summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL56
-rw-r--r--LICENSE118
-rw-r--r--README93
-rw-r--r--SUPPORT18
-rw-r--r--c/ACKNOWLEDGEMENTS88
-rw-r--r--c/PROBLEMS66
-rw-r--r--c/README45
-rw-r--r--c/README.DOS72
-rw-r--r--c/REQUIRES13
-rw-r--r--c/TESTED56
-rw-r--r--c/UPDATE_HELP52
-rw-r--r--c/build-tools/README32
-rw-r--r--c/build-tools/cklength.c364
-rw-r--r--c/build-tools/eolstrip.c351
-rw-r--r--c/build-tools/os/msdos/README12
-rw-r--r--c/build-tools/os/msdos/cklength.uue286
-rw-r--r--c/build-tools/os/msdos/fixtimer.c111
-rw-r--r--c/build-tools/os/msdos/fixtimer.uue162
-rw-r--r--c/build-tools/os/msdos/ifc.c331
-rw-r--r--c/build-tools/os/msdos/ifc_exe.uue163
-rw-r--r--c/build-tools/packhex.c513
-rw-r--r--c/build-tools/scripts/README32
-rw-r--r--c/build-tools/src/cklength.c364
-rw-r--r--c/build-tools/src/eolstrip.c351
-rw-r--r--c/build-tools/src/packhex.c513
-rw-r--r--c/build-tools/src/unhex.c721
-rw-r--r--c/build-tools/unhex.c721
-rw-r--r--c/src/README27
-rw-r--r--c/src/exec/libcsupport/include/clockdrv.h51
-rw-r--r--c/src/exec/libcsupport/include/console.h69
-rw-r--r--c/src/exec/libcsupport/include/iosupp.h44
-rw-r--r--c/src/exec/libcsupport/include/ringbuf.h53
-rw-r--r--c/src/exec/libcsupport/include/rtems/assoc.h42
-rw-r--r--c/src/exec/libcsupport/include/rtems/error.h33
-rw-r--r--c/src/exec/libcsupport/include/rtems/libcsupport.h42
-rw-r--r--c/src/exec/libcsupport/include/rtems/libio.h98
-rw-r--r--c/src/exec/libcsupport/include/spurious.h38
-rw-r--r--c/src/exec/libcsupport/include/sys/utsname.h49
-rw-r--r--c/src/exec/libcsupport/include/timerdrv.h40
-rw-r--r--c/src/exec/libcsupport/include/vmeintr.h58
-rw-r--r--c/src/exec/libcsupport/src/README37
-rw-r--r--c/src/exec/libcsupport/src/__brk.c44
-rw-r--r--c/src/exec/libcsupport/src/__gettod.c103
-rw-r--r--c/src/exec/libcsupport/src/__times.c65
-rw-r--r--c/src/exec/libcsupport/src/assoc.c260
-rw-r--r--c/src/exec/libcsupport/src/error.c209
-rw-r--r--c/src/exec/libcsupport/src/hosterr.c43
-rw-r--r--c/src/exec/libcsupport/src/libio.c442
-rw-r--r--c/src/exec/libcsupport/src/malloc.c366
-rw-r--r--c/src/exec/libcsupport/src/newlibc.c336
-rw-r--r--c/src/exec/libcsupport/src/no_libc.c45
-rw-r--r--c/src/exec/libcsupport/src/unixlibc.c11
-rw-r--r--c/src/exec/libcsupport/src/utsname.c61
-rw-r--r--c/src/exec/posix/base/aio.h137
-rw-r--r--c/src/exec/posix/base/devctl.h30
-rw-r--r--c/src/exec/posix/base/intr.h72
-rw-r--r--c/src/exec/posix/base/limits.h154
-rw-r--r--c/src/exec/posix/base/mqueue.h145
-rw-r--r--c/src/exec/posix/base/pthread.h502
-rw-r--r--c/src/exec/posix/base/sched.h88
-rw-r--r--c/src/exec/posix/base/semaphore.h108
-rw-r--r--c/src/exec/posix/base/unistd.h85
-rw-r--r--c/src/exec/posix/headers/cancel.h16
-rw-r--r--c/src/exec/posix/headers/cond.h123
-rw-r--r--c/src/exec/posix/headers/condmp.h162
-rw-r--r--c/src/exec/posix/headers/intr.h153
-rw-r--r--c/src/exec/posix/headers/key.h136
-rw-r--r--c/src/exec/posix/headers/mqueue.h186
-rw-r--r--c/src/exec/posix/headers/mqueuemp.h161
-rw-r--r--c/src/exec/posix/headers/mutex.h117
-rw-r--r--c/src/exec/posix/headers/mutexmp.h161
-rw-r--r--c/src/exec/posix/headers/priority.h34
-rw-r--r--c/src/exec/posix/headers/pthread.h113
-rw-r--r--c/src/exec/posix/headers/pthreadmp.h161
-rw-r--r--c/src/exec/posix/headers/semaphore.h135
-rw-r--r--c/src/exec/posix/headers/semaphoremp.h161
-rw-r--r--c/src/exec/posix/headers/threadsup.h30
-rw-r--r--c/src/exec/posix/headers/time.h14
-rw-r--r--c/src/exec/posix/include/aio.h137
-rw-r--r--c/src/exec/posix/include/devctl.h30
-rw-r--r--c/src/exec/posix/include/intr.h72
-rw-r--r--c/src/exec/posix/include/limits.h154
-rw-r--r--c/src/exec/posix/include/mqueue.h145
-rw-r--r--c/src/exec/posix/include/pthread.h502
-rw-r--r--c/src/exec/posix/include/rtems/posix/cancel.h16
-rw-r--r--c/src/exec/posix/include/rtems/posix/cond.h123
-rw-r--r--c/src/exec/posix/include/rtems/posix/condmp.h162
-rw-r--r--c/src/exec/posix/include/rtems/posix/intr.h153
-rw-r--r--c/src/exec/posix/include/rtems/posix/key.h136
-rw-r--r--c/src/exec/posix/include/rtems/posix/mqueue.h186
-rw-r--r--c/src/exec/posix/include/rtems/posix/mqueuemp.h161
-rw-r--r--c/src/exec/posix/include/rtems/posix/mutex.h117
-rw-r--r--c/src/exec/posix/include/rtems/posix/mutexmp.h161
-rw-r--r--c/src/exec/posix/include/rtems/posix/priority.h34
-rw-r--r--c/src/exec/posix/include/rtems/posix/pthread.h113
-rw-r--r--c/src/exec/posix/include/rtems/posix/pthreadmp.h161
-rw-r--r--c/src/exec/posix/include/rtems/posix/semaphore.h135
-rw-r--r--c/src/exec/posix/include/rtems/posix/semaphoremp.h161
-rw-r--r--c/src/exec/posix/include/rtems/posix/threadsup.h30
-rw-r--r--c/src/exec/posix/include/rtems/posix/time.h14
-rw-r--r--c/src/exec/posix/include/sched.h88
-rw-r--r--c/src/exec/posix/include/semaphore.h108
-rw-r--r--c/src/exec/posix/include/sys/utsname.h49
-rw-r--r--c/src/exec/posix/include/unistd.h85
-rw-r--r--c/src/exec/posix/inline/cond.inl76
-rw-r--r--c/src/exec/posix/inline/intr.inl72
-rw-r--r--c/src/exec/posix/inline/key.inl70
-rw-r--r--c/src/exec/posix/inline/mqueue.inl83
-rw-r--r--c/src/exec/posix/inline/mutex.inl88
-rw-r--r--c/src/exec/posix/inline/priority.inl29
-rw-r--r--c/src/exec/posix/inline/pthread.inl71
-rw-r--r--c/src/exec/posix/inline/rtems/posix/cond.inl76
-rw-r--r--c/src/exec/posix/inline/rtems/posix/intr.inl72
-rw-r--r--c/src/exec/posix/inline/rtems/posix/key.inl70
-rw-r--r--c/src/exec/posix/inline/rtems/posix/mqueue.inl83
-rw-r--r--c/src/exec/posix/inline/rtems/posix/mutex.inl88
-rw-r--r--c/src/exec/posix/inline/rtems/posix/priority.inl29
-rw-r--r--c/src/exec/posix/inline/rtems/posix/pthread.inl71
-rw-r--r--c/src/exec/posix/inline/rtems/posix/semaphore.inl71
-rw-r--r--c/src/exec/posix/inline/semaphore.inl71
-rw-r--r--c/src/exec/posix/src/aio.c113
-rw-r--r--c/src/exec/posix/src/cancel.c227
-rw-r--r--c/src/exec/posix/src/cond.c400
-rw-r--r--c/src/exec/posix/src/devctl.c25
-rw-r--r--c/src/exec/posix/src/intr.c338
-rw-r--r--c/src/exec/posix/src/key.c260
-rw-r--r--c/src/exec/posix/src/mqueue.c715
-rw-r--r--c/src/exec/posix/src/mutex.c570
-rw-r--r--c/src/exec/posix/src/psignal.c258
-rw-r--r--c/src/exec/posix/src/pthread.c553
-rw-r--r--c/src/exec/posix/src/sched.c127
-rw-r--r--c/src/exec/posix/src/semaphore.c576
-rw-r--r--c/src/exec/posix/src/time.c193
-rw-r--r--c/src/exec/posix/src/types.c168
-rw-r--r--c/src/exec/posix/src/unistd.c21
-rw-r--r--c/src/exec/posix/src/utsname.c61
-rw-r--r--c/src/exec/posix/sys/utsname.h49
-rw-r--r--c/src/exec/rtems/headers/asr.h112
-rw-r--r--c/src/exec/rtems/headers/attr.h84
-rw-r--r--c/src/exec/rtems/headers/clock.h103
-rw-r--r--c/src/exec/rtems/headers/dpmem.h157
-rw-r--r--c/src/exec/rtems/headers/event.h174
-rw-r--r--c/src/exec/rtems/headers/eventmp.h147
-rw-r--r--c/src/exec/rtems/headers/eventset.h89
-rw-r--r--c/src/exec/rtems/headers/intr.h160
-rw-r--r--c/src/exec/rtems/headers/message.h317
-rw-r--r--c/src/exec/rtems/headers/modes.h89
-rw-r--r--c/src/exec/rtems/headers/mp.h53
-rw-r--r--c/src/exec/rtems/headers/msgmp.h175
-rw-r--r--c/src/exec/rtems/headers/options.h53
-rw-r--r--c/src/exec/rtems/headers/part.h168
-rw-r--r--c/src/exec/rtems/headers/partmp.h161
-rw-r--r--c/src/exec/rtems/headers/ratemon.h185
-rw-r--r--c/src/exec/rtems/headers/region.h234
-rw-r--r--c/src/exec/rtems/headers/regionmp.h166
-rw-r--r--c/src/exec/rtems/headers/rtems.h121
-rw-r--r--c/src/exec/rtems/headers/rtemsapi.h34
-rw-r--r--c/src/exec/rtems/headers/sem.h248
-rw-r--r--c/src/exec/rtems/headers/semmp.h163
-rw-r--r--c/src/exec/rtems/headers/signal.h83
-rw-r--r--c/src/exec/rtems/headers/signalmp.h147
-rw-r--r--c/src/exec/rtems/headers/status.h82
-rw-r--r--c/src/exec/rtems/headers/support.h97
-rw-r--r--c/src/exec/rtems/headers/taskmp.h167
-rw-r--r--c/src/exec/rtems/headers/tasks.h419
-rw-r--r--c/src/exec/rtems/headers/timer.h207
-rw-r--r--c/src/exec/rtems/headers/types.h96
-rw-r--r--c/src/exec/rtems/include/rtems.h121
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/asr.h112
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/attr.h84
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/clock.h103
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/dpmem.h157
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/event.h174
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/eventmp.h147
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/eventset.h89
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/intr.h160
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/message.h317
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/modes.h89
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/mp.h53
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/msgmp.h175
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/options.h53
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/part.h168
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/partmp.h161
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/ratemon.h185
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/region.h234
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/regionmp.h166
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/rtemsapi.h34
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/sem.h248
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/semmp.h163
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/signal.h83
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/signalmp.h147
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/status.h82
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/support.h97
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/taskmp.h167
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/tasks.h419
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/timer.h207
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/types.h96
-rw-r--r--c/src/exec/rtems/inline/asr.inl128
-rw-r--r--c/src/exec/rtems/inline/attr.inl159
-rw-r--r--c/src/exec/rtems/inline/dpmem.inl95
-rw-r--r--c/src/exec/rtems/inline/event.inl21
-rw-r--r--c/src/exec/rtems/inline/eventset.inl91
-rw-r--r--c/src/exec/rtems/inline/message.inl83
-rw-r--r--c/src/exec/rtems/inline/modes.inl152
-rw-r--r--c/src/exec/rtems/inline/options.inl55
-rw-r--r--c/src/exec/rtems/inline/part.inl199
-rw-r--r--c/src/exec/rtems/inline/ratemon.inl143
-rw-r--r--c/src/exec/rtems/inline/region.inl127
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/asr.inl128
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/attr.inl159
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/dpmem.inl95
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/event.inl21
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/eventset.inl91
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/message.inl83
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/modes.inl152
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/options.inl55
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/part.inl199
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/ratemon.inl143
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/region.inl127
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/sem.inl93
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/status.inl56
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/support.inl61
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/tasks.inl90
-rw-r--r--c/src/exec/rtems/inline/rtems/rtems/timer.inl142
-rw-r--r--c/src/exec/rtems/inline/sem.inl93
-rw-r--r--c/src/exec/rtems/inline/status.inl56
-rw-r--r--c/src/exec/rtems/inline/support.inl61
-rw-r--r--c/src/exec/rtems/inline/tasks.inl90
-rw-r--r--c/src/exec/rtems/inline/timer.inl142
-rw-r--r--c/src/exec/rtems/macros/asr.inl90
-rw-r--r--c/src/exec/rtems/macros/attr.inl91
-rw-r--r--c/src/exec/rtems/macros/dpmem.inl59
-rw-r--r--c/src/exec/rtems/macros/event.inl21
-rw-r--r--c/src/exec/rtems/macros/eventset.inl53
-rw-r--r--c/src/exec/rtems/macros/message.inl49
-rw-r--r--c/src/exec/rtems/macros/modes.inl92
-rw-r--r--c/src/exec/rtems/macros/options.inl39
-rw-r--r--c/src/exec/rtems/macros/part.inl117
-rw-r--r--c/src/exec/rtems/macros/ratemon.inl85
-rw-r--r--c/src/exec/rtems/macros/region.inl75
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/asr.inl90
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/attr.inl91
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/dpmem.inl59
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/event.inl21
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/eventset.inl53
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/message.inl49
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/modes.inl92
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/options.inl39
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/part.inl117
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/ratemon.inl85
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/region.inl75
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/sem.inl58
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/status.inl39
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/support.inl44
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/tasks.inl58
-rw-r--r--c/src/exec/rtems/macros/rtems/rtems/timer.inl85
-rw-r--r--c/src/exec/rtems/macros/sem.inl58
-rw-r--r--c/src/exec/rtems/macros/status.inl39
-rw-r--r--c/src/exec/rtems/macros/support.inl44
-rw-r--r--c/src/exec/rtems/macros/tasks.inl58
-rw-r--r--c/src/exec/rtems/macros/timer.inl85
-rw-r--r--c/src/exec/rtems/optman/no-dpmem.c98
-rw-r--r--c/src/exec/rtems/optman/no-event.c56
-rw-r--r--c/src/exec/rtems/optman/no-mp.c201
-rw-r--r--c/src/exec/rtems/optman/no-msg.c192
-rw-r--r--c/src/exec/rtems/optman/no-part.c97
-rw-r--r--c/src/exec/rtems/optman/no-region.c114
-rw-r--r--c/src/exec/rtems/optman/no-rtmon.c117
-rw-r--r--c/src/exec/rtems/optman/no-sem.c114
-rw-r--r--c/src/exec/rtems/optman/no-signal.c56
-rw-r--r--c/src/exec/rtems/optman/no-timer.c123
-rw-r--r--c/src/exec/rtems/src/clock.c151
-rw-r--r--c/src/exec/rtems/src/dpmem.c281
-rw-r--r--c/src/exec/rtems/src/event.c383
-rw-r--r--c/src/exec/rtems/src/eventmp.c190
-rw-r--r--c/src/exec/rtems/src/intr.c65
-rw-r--r--c/src/exec/rtems/src/mp.c42
-rw-r--r--c/src/exec/rtems/src/msg.c714
-rw-r--r--c/src/exec/rtems/src/msgmp.c454
-rw-r--r--c/src/exec/rtems/src/part.c341
-rw-r--r--c/src/exec/rtems/src/partmp.c302
-rw-r--r--c/src/exec/rtems/src/ratemon.c385
-rw-r--r--c/src/exec/rtems/src/region.c486
-rw-r--r--c/src/exec/rtems/src/regionmp.c310
-rw-r--r--c/src/exec/rtems/src/rtclock.c151
-rw-r--r--c/src/exec/rtems/src/rtemstimer.c349
-rw-r--r--c/src/exec/rtems/src/sem.c570
-rw-r--r--c/src/exec/rtems/src/semmp.c308
-rw-r--r--c/src/exec/rtems/src/signal.c149
-rw-r--r--c/src/exec/rtems/src/signalmp.c189
-rw-r--r--c/src/exec/rtems/src/taskmp.c340
-rw-r--r--c/src/exec/rtems/src/tasks.c1098
-rw-r--r--c/src/exec/rtems/src/timer.c349
-rw-r--r--c/src/exec/sapi/headers/confdefs.h377
-rw-r--r--c/src/exec/sapi/headers/config.h94
-rw-r--r--c/src/exec/sapi/headers/directives.h120
-rw-r--r--c/src/exec/sapi/headers/extension.h136
-rw-r--r--c/src/exec/sapi/headers/fatal.h49
-rw-r--r--c/src/exec/sapi/headers/init.h110
-rw-r--r--c/src/exec/sapi/headers/io.h244
-rw-r--r--c/src/exec/sapi/headers/mptables.h29
-rw-r--r--c/src/exec/sapi/headers/sptables.h162
-rw-r--r--c/src/exec/sapi/include/confdefs.h377
-rw-r--r--c/src/exec/sapi/include/rtems/config.h94
-rw-r--r--c/src/exec/sapi/include/rtems/directives.h120
-rw-r--r--c/src/exec/sapi/include/rtems/extension.h136
-rw-r--r--c/src/exec/sapi/include/rtems/fatal.h49
-rw-r--r--c/src/exec/sapi/include/rtems/init.h110
-rw-r--r--c/src/exec/sapi/include/rtems/io.h244
-rw-r--r--c/src/exec/sapi/include/rtems/mptables.h29
-rw-r--r--c/src/exec/sapi/include/rtems/sptables.h162
-rw-r--r--c/src/exec/sapi/inline/extension.inl91
-rw-r--r--c/src/exec/sapi/inline/rtems/extension.inl91
-rw-r--r--c/src/exec/sapi/macros/extension.inl58
-rw-r--r--c/src/exec/sapi/macros/rtems/extension.inl58
-rw-r--r--c/src/exec/sapi/optman/no-ext.c67
-rw-r--r--c/src/exec/sapi/optman/no-io.c145
-rw-r--r--c/src/exec/sapi/src/debug.c62
-rw-r--r--c/src/exec/sapi/src/exinit.c285
-rw-r--r--c/src/exec/sapi/src/extension.c165
-rw-r--r--c/src/exec/sapi/src/fatal.c38
-rw-r--r--c/src/exec/sapi/src/io.c345
-rw-r--r--c/src/exec/sapi/src/rtemsapi.c89
-rw-r--r--c/src/exec/score/cpu/hppa1.1/cpu.c189
-rw-r--r--c/src/exec/score/cpu/hppa1.1/cpu.h599
-rw-r--r--c/src/exec/score/cpu/hppa1.1/cpu_asm.h73
-rw-r--r--c/src/exec/score/cpu/hppa1.1/cpu_asm.s702
-rw-r--r--c/src/exec/score/cpu/hppa1.1/hppa.h719
-rw-r--r--c/src/exec/score/cpu/hppa1.1/hppatypes.h46
-rw-r--r--c/src/exec/score/cpu/hppa1.1/rtems.s53
-rw-r--r--c/src/exec/score/cpu/i386/asm.h140
-rw-r--r--c/src/exec/score/cpu/i386/cpu.c177
-rw-r--r--c/src/exec/score/cpu/i386/cpu.h390
-rw-r--r--c/src/exec/score/cpu/i386/cpu_asm.s660
-rw-r--r--c/src/exec/score/cpu/i386/i386.h496
-rw-r--r--c/src/exec/score/cpu/i386/i386types.h58
-rw-r--r--c/src/exec/score/cpu/i386/rtems.s31
-rw-r--r--c/src/exec/score/cpu/i960/asm.h107
-rw-r--r--c/src/exec/score/cpu/i960/cpu.c155
-rw-r--r--c/src/exec/score/cpu/i960/cpu.h447
-rw-r--r--c/src/exec/score/cpu/i960/cpu_asm.s199
-rw-r--r--c/src/exec/score/cpu/i960/i960.h287
-rw-r--r--c/src/exec/score/cpu/i960/i960types.h58
-rw-r--r--c/src/exec/score/cpu/i960/rtems.s25
-rw-r--r--c/src/exec/score/cpu/m68k/asm.h129
-rw-r--r--c/src/exec/score/cpu/m68k/cpu.c144
-rw-r--r--c/src/exec/score/cpu/m68k/cpu.h484
-rw-r--r--c/src/exec/score/cpu/m68k/cpu_asm.s243
-rw-r--r--c/src/exec/score/cpu/m68k/m68302.h608
-rw-r--r--c/src/exec/score/cpu/m68k/m68360.h880
-rw-r--r--c/src/exec/score/cpu/m68k/m68k.h325
-rw-r--r--c/src/exec/score/cpu/m68k/m68ktypes.h58
-rw-r--r--c/src/exec/score/cpu/m68k/qsm.h209
-rw-r--r--c/src/exec/score/cpu/m68k/rtems.s46
-rw-r--r--c/src/exec/score/cpu/m68k/sim.h328
-rw-r--r--c/src/exec/score/cpu/no_cpu/asm.h98
-rw-r--r--c/src/exec/score/cpu/no_cpu/cpu.c160
-rw-r--r--c/src/exec/score/cpu/no_cpu/cpu.h853
-rw-r--r--c/src/exec/score/cpu/no_cpu/cpu_asm.c165
-rw-r--r--c/src/exec/score/cpu/no_cpu/cpu_asm.h70
-rw-r--r--c/src/exec/score/cpu/no_cpu/no_cpu.h78
-rw-r--r--c/src/exec/score/cpu/no_cpu/no_cputypes.h57
-rw-r--r--c/src/exec/score/cpu/no_cpu/rtems.c45
-rw-r--r--c/src/exec/score/cpu/powerpc/README71
-rw-r--r--c/src/exec/score/cpu/powerpc/TODO7
-rw-r--r--c/src/exec/score/cpu/powerpc/cpu.c264
-rw-r--r--c/src/exec/score/cpu/powerpc/cpu.h1017
-rw-r--r--c/src/exec/score/cpu/powerpc/cpu_asm.s749
-rw-r--r--c/src/exec/score/cpu/powerpc/irq_stub.s228
-rw-r--r--c/src/exec/score/cpu/powerpc/ppc.h318
-rw-r--r--c/src/exec/score/cpu/powerpc/ppctypes.h74
-rw-r--r--c/src/exec/score/cpu/powerpc/rtems.s132
-rw-r--r--c/src/exec/score/cpu/sparc/README110
-rw-r--r--c/src/exec/score/cpu/sparc/asm.h111
-rw-r--r--c/src/exec/score/cpu/sparc/cpu.c404
-rw-r--r--c/src/exec/score/cpu/sparc/cpu.h991
-rw-r--r--c/src/exec/score/cpu/sparc/cpu_asm.s707
-rw-r--r--c/src/exec/score/cpu/sparc/erc32.h518
-rw-r--r--c/src/exec/score/cpu/sparc/rtems.s58
-rw-r--r--c/src/exec/score/cpu/sparc/sparc.h275
-rw-r--r--c/src/exec/score/cpu/sparc/sparctypes.h64
-rw-r--r--c/src/exec/score/cpu/unix/cpu.c969
-rw-r--r--c/src/exec/score/cpu/unix/cpu.h1024
-rw-r--r--c/src/exec/score/cpu/unix/unix.h89
-rw-r--r--c/src/exec/score/cpu/unix/unixtypes.h72
-rw-r--r--c/src/exec/score/headers/address.h31
-rw-r--r--c/src/exec/score/headers/apiext.h102
-rw-r--r--c/src/exec/score/headers/bitfield.h98
-rw-r--r--c/src/exec/score/headers/chain.h168
-rw-r--r--c/src/exec/score/headers/context.h134
-rw-r--r--c/src/exec/score/headers/copyrt.h42
-rw-r--r--c/src/exec/score/headers/coremsg.h274
-rw-r--r--c/src/exec/score/headers/coremutex.h171
-rw-r--r--c/src/exec/score/headers/coresem.h156
-rw-r--r--c/src/exec/score/headers/debug.h98
-rw-r--r--c/src/exec/score/headers/heap.h226
-rw-r--r--c/src/exec/score/headers/interr.h94
-rw-r--r--c/src/exec/score/headers/isr.h224
-rw-r--r--c/src/exec/score/headers/mpci.h411
-rw-r--r--c/src/exec/score/headers/mppkt.h100
-rw-r--r--c/src/exec/score/headers/object.h397
-rw-r--r--c/src/exec/score/headers/objectmp.h152
-rw-r--r--c/src/exec/score/headers/priority.h96
-rw-r--r--c/src/exec/score/headers/stack.h50
-rw-r--r--c/src/exec/score/headers/states.h78
-rw-r--r--c/src/exec/score/headers/sysstate.h66
-rw-r--r--c/src/exec/score/headers/system.h134
-rw-r--r--c/src/exec/score/headers/thread.h585
-rw-r--r--c/src/exec/score/headers/threadmp.h89
-rw-r--r--c/src/exec/score/headers/threadq.h301
-rw-r--r--c/src/exec/score/headers/tod.h260
-rw-r--r--c/src/exec/score/headers/tqdata.h91
-rw-r--r--c/src/exec/score/headers/userext.h213
-rw-r--r--c/src/exec/score/headers/watchdog.h185
-rw-r--r--c/src/exec/score/headers/wkspace.h71
-rw-r--r--c/src/exec/score/include/rtems/debug.h98
-rw-r--r--c/src/exec/score/include/rtems/score/address.h31
-rw-r--r--c/src/exec/score/include/rtems/score/apiext.h102
-rw-r--r--c/src/exec/score/include/rtems/score/bitfield.h98
-rw-r--r--c/src/exec/score/include/rtems/score/chain.h168
-rw-r--r--c/src/exec/score/include/rtems/score/context.h134
-rw-r--r--c/src/exec/score/include/rtems/score/copyrt.h42
-rw-r--r--c/src/exec/score/include/rtems/score/coremsg.h274
-rw-r--r--c/src/exec/score/include/rtems/score/coremutex.h171
-rw-r--r--c/src/exec/score/include/rtems/score/coresem.h156
-rw-r--r--c/src/exec/score/include/rtems/score/heap.h226
-rw-r--r--c/src/exec/score/include/rtems/score/interr.h94
-rw-r--r--c/src/exec/score/include/rtems/score/isr.h224
-rw-r--r--c/src/exec/score/include/rtems/score/mpci.h411
-rw-r--r--c/src/exec/score/include/rtems/score/mppkt.h100
-rw-r--r--c/src/exec/score/include/rtems/score/object.h397
-rw-r--r--c/src/exec/score/include/rtems/score/objectmp.h152
-rw-r--r--c/src/exec/score/include/rtems/score/priority.h96
-rw-r--r--c/src/exec/score/include/rtems/score/stack.h50
-rw-r--r--c/src/exec/score/include/rtems/score/states.h78
-rw-r--r--c/src/exec/score/include/rtems/score/sysstate.h66
-rw-r--r--c/src/exec/score/include/rtems/score/thread.h585
-rw-r--r--c/src/exec/score/include/rtems/score/threadmp.h89
-rw-r--r--c/src/exec/score/include/rtems/score/threadq.h301
-rw-r--r--c/src/exec/score/include/rtems/score/tod.h260
-rw-r--r--c/src/exec/score/include/rtems/score/tqdata.h91
-rw-r--r--c/src/exec/score/include/rtems/score/userext.h213
-rw-r--r--c/src/exec/score/include/rtems/score/watchdog.h185
-rw-r--r--c/src/exec/score/include/rtems/score/wkspace.h71
-rw-r--r--c/src/exec/score/include/rtems/system.h134
-rw-r--r--c/src/exec/score/inline/address.inl120
-rw-r--r--c/src/exec/score/inline/chain.inl390
-rw-r--r--c/src/exec/score/inline/coremsg.inl260
-rw-r--r--c/src/exec/score/inline/coremutex.inl124
-rw-r--r--c/src/exec/score/inline/coresem.inl54
-rw-r--r--c/src/exec/score/inline/heap.inl274
-rw-r--r--c/src/exec/score/inline/isr.inl73
-rw-r--r--c/src/exec/score/inline/mppkt.inl58
-rw-r--r--c/src/exec/score/inline/object.inl244
-rw-r--r--c/src/exec/score/inline/objectmp.inl73
-rw-r--r--c/src/exec/score/inline/priority.inl247
-rw-r--r--c/src/exec/score/inline/rtems/score/address.inl120
-rw-r--r--c/src/exec/score/inline/rtems/score/chain.inl390
-rw-r--r--c/src/exec/score/inline/rtems/score/coremsg.inl260
-rw-r--r--c/src/exec/score/inline/rtems/score/coremutex.inl124
-rw-r--r--c/src/exec/score/inline/rtems/score/coresem.inl54
-rw-r--r--c/src/exec/score/inline/rtems/score/heap.inl274
-rw-r--r--c/src/exec/score/inline/rtems/score/isr.inl73
-rw-r--r--c/src/exec/score/inline/rtems/score/mppkt.inl58
-rw-r--r--c/src/exec/score/inline/rtems/score/object.inl244
-rw-r--r--c/src/exec/score/inline/rtems/score/objectmp.inl73
-rw-r--r--c/src/exec/score/inline/rtems/score/priority.inl247
-rw-r--r--c/src/exec/score/inline/rtems/score/stack.inl81
-rw-r--r--c/src/exec/score/inline/rtems/score/states.inl384
-rw-r--r--c/src/exec/score/inline/rtems/score/sysstate.inl154
-rw-r--r--c/src/exec/score/inline/rtems/score/thread.inl404
-rw-r--r--c/src/exec/score/inline/rtems/score/threadmp.inl61
-rw-r--r--c/src/exec/score/inline/rtems/score/tod.inl82
-rw-r--r--c/src/exec/score/inline/rtems/score/tqdata.inl89
-rw-r--r--c/src/exec/score/inline/rtems/score/userext.inl121
-rw-r--r--c/src/exec/score/inline/rtems/score/watchdog.inl324
-rw-r--r--c/src/exec/score/inline/rtems/score/wkspace.inl57
-rw-r--r--c/src/exec/score/inline/stack.inl81
-rw-r--r--c/src/exec/score/inline/states.inl384
-rw-r--r--c/src/exec/score/inline/sysstate.inl154
-rw-r--r--c/src/exec/score/inline/thread.inl404
-rw-r--r--c/src/exec/score/inline/threadmp.inl61
-rw-r--r--c/src/exec/score/inline/tod.inl82
-rw-r--r--c/src/exec/score/inline/tqdata.inl89
-rw-r--r--c/src/exec/score/inline/userext.inl121
-rw-r--r--c/src/exec/score/inline/watchdog.inl324
-rw-r--r--c/src/exec/score/inline/wkspace.inl57
-rw-r--r--c/src/exec/score/macros/README18
-rw-r--r--c/src/exec/score/macros/address.inl68
-rw-r--r--c/src/exec/score/macros/chain.inl200
-rw-r--r--c/src/exec/score/macros/coremsg.inl143
-rw-r--r--c/src/exec/score/macros/coremutex.inl77
-rw-r--r--c/src/exec/score/macros/coresem.inl40
-rw-r--r--c/src/exec/score/macros/heap.inl150
-rw-r--r--c/src/exec/score/macros/isr.inl48
-rw-r--r--c/src/exec/score/macros/mppkt.inl41
-rw-r--r--c/src/exec/score/macros/object.inl148
-rw-r--r--c/src/exec/score/macros/objectmp.inl50
-rw-r--r--c/src/exec/score/macros/priority.inl170
-rw-r--r--c/src/exec/score/macros/rtems/score/README18
-rw-r--r--c/src/exec/score/macros/rtems/score/address.inl68
-rw-r--r--c/src/exec/score/macros/rtems/score/chain.inl200
-rw-r--r--c/src/exec/score/macros/rtems/score/coremsg.inl143
-rw-r--r--c/src/exec/score/macros/rtems/score/coremutex.inl77
-rw-r--r--c/src/exec/score/macros/rtems/score/coresem.inl40
-rw-r--r--c/src/exec/score/macros/rtems/score/heap.inl150
-rw-r--r--c/src/exec/score/macros/rtems/score/isr.inl48
-rw-r--r--c/src/exec/score/macros/rtems/score/mppkt.inl41
-rw-r--r--c/src/exec/score/macros/rtems/score/object.inl148
-rw-r--r--c/src/exec/score/macros/rtems/score/objectmp.inl50
-rw-r--r--c/src/exec/score/macros/rtems/score/priority.inl170
-rw-r--r--c/src/exec/score/macros/rtems/score/stack.inl50
-rw-r--r--c/src/exec/score/macros/rtems/score/states.inl210
-rw-r--r--c/src/exec/score/macros/rtems/score/sysstate.inl90
-rw-r--r--c/src/exec/score/macros/rtems/score/thread.inl217
-rw-r--r--c/src/exec/score/macros/rtems/score/threadmp.inl50
-rw-r--r--c/src/exec/score/macros/rtems/score/tod.inl58
-rw-r--r--c/src/exec/score/macros/rtems/score/tqdata.inl59
-rw-r--r--c/src/exec/score/macros/rtems/score/userext.inl126
-rw-r--r--c/src/exec/score/macros/rtems/score/watchdog.inl172
-rw-r--r--c/src/exec/score/macros/rtems/score/wkspace.inl39
-rw-r--r--c/src/exec/score/macros/stack.inl50
-rw-r--r--c/src/exec/score/macros/states.inl210
-rw-r--r--c/src/exec/score/macros/sysstate.inl90
-rw-r--r--c/src/exec/score/macros/thread.inl217
-rw-r--r--c/src/exec/score/macros/threadmp.inl50
-rw-r--r--c/src/exec/score/macros/tod.inl58
-rw-r--r--c/src/exec/score/macros/tqdata.inl59
-rw-r--r--c/src/exec/score/macros/userext.inl126
-rw-r--r--c/src/exec/score/macros/watchdog.inl172
-rw-r--r--c/src/exec/score/macros/wkspace.inl39
-rw-r--r--c/src/exec/score/src/apiext.c105
-rw-r--r--c/src/exec/score/src/chain.c202
-rw-r--r--c/src/exec/score/src/coremsg.c432
-rw-r--r--c/src/exec/score/src/coremutex.c269
-rw-r--r--c/src/exec/score/src/coresem.c184
-rw-r--r--c/src/exec/score/src/coretod.c235
-rw-r--r--c/src/exec/score/src/heap.c537
-rw-r--r--c/src/exec/score/src/interr.c61
-rw-r--r--c/src/exec/score/src/isr.c60
-rw-r--r--c/src/exec/score/src/mpci.c524
-rw-r--r--c/src/exec/score/src/object.c512
-rw-r--r--c/src/exec/score/src/objectmp.c275
-rw-r--r--c/src/exec/score/src/thread.c1257
-rw-r--r--c/src/exec/score/src/threadmp.c164
-rw-r--r--c/src/exec/score/src/threadq.c967
-rw-r--r--c/src/exec/score/src/tod.c235
-rw-r--r--c/src/exec/score/src/userext.c204
-rw-r--r--c/src/exec/score/src/watchdog.c267
-rw-r--r--c/src/exec/score/src/wkspace.c88
-rw-r--r--c/src/exec/score/tools/hppa1.1/genoffsets.c346
-rw-r--r--c/src/exec/score/tools/unix/gensize.c116
-rw-r--r--c/src/lib/include/clockdrv.h51
-rw-r--r--c/src/lib/include/console.h69
-rw-r--r--c/src/lib/include/iosupp.h44
-rw-r--r--c/src/lib/include/ringbuf.h53
-rw-r--r--c/src/lib/include/rtems/assoc.h42
-rw-r--r--c/src/lib/include/rtems/error.h33
-rw-r--r--c/src/lib/include/rtems/libcsupport.h42
-rw-r--r--c/src/lib/include/rtems/libio.h98
-rw-r--r--c/src/lib/include/spurious.h38
-rw-r--r--c/src/lib/include/sys/utsname.h49
-rw-r--r--c/src/lib/include/timerdrv.h40
-rw-r--r--c/src/lib/include/vmeintr.h58
-rw-r--r--c/src/lib/libbsp/README46
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h121
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/include/ttydrv.h54
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/README9
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/addrconv.c30
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c89
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c51
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/lock.c75
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/mpisr.c27
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/startup/bspclean.c36
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c439
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/startup/setvec.c66
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/times7
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/tools/print_dump.c332
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/tty/tty.c254
-rw-r--r--c/src/lib/libbsp/i386/force386/clock/ckinit.c135
-rw-r--r--c/src/lib/libbsp/i386/force386/console/console.c286
-rw-r--r--c/src/lib/libbsp/i386/force386/include/bsp.h176
-rw-r--r--c/src/lib/libbsp/i386/force386/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/i386/force386/shmsupp/addrconv.c32
-rw-r--r--c/src/lib/libbsp/i386/force386/shmsupp/getcfg.c73
-rw-r--r--c/src/lib/libbsp/i386/force386/shmsupp/lock.c83
-rw-r--r--c/src/lib/libbsp/i386/force386/shmsupp/mpisr.c31
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/bspstart.c225
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/exit.c29
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/ldsegs.s86
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/linkcmds44
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/setvec.c59
-rw-r--r--c/src/lib/libbsp/i386/force386/timer/timer.c96
-rw-r--r--c/src/lib/libbsp/i386/force386/timer/timerisr.s34
-rw-r--r--c/src/lib/libbsp/i386/force386/times191
-rw-r--r--c/src/lib/libbsp/i386/go32/clock/ckinit.c199
-rw-r--r--c/src/lib/libbsp/i386/go32/clock/rtc.c212
-rw-r--r--c/src/lib/libbsp/i386/go32/console/console.c257
-rw-r--r--c/src/lib/libbsp/i386/go32/console/inch.c162
-rw-r--r--c/src/lib/libbsp/i386/go32/console/outch.c150
-rw-r--r--c/src/lib/libbsp/i386/go32/include/bsp.h172
-rw-r--r--c/src/lib/libbsp/i386/go32/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/i386/go32/startup/bspstart.c234
-rw-r--r--c/src/lib/libbsp/i386/go32/startup/exit.c30
-rw-r--r--c/src/lib/libbsp/i386/go32/startup/setvec.c46
-rw-r--r--c/src/lib/libbsp/i386/go32/timer/timer.c144
-rw-r--r--c/src/lib/libbsp/i386/go32/timer/timerisr.s41
-rw-r--r--c/src/lib/libbsp/i386/go32/times_i486dx191
-rw-r--r--c/src/lib/libbsp/i386/go32/times_p5196
-rw-r--r--c/src/lib/libbsp/i960/cvme961/clock/ckinit.c141
-rw-r--r--c/src/lib/libbsp/i960/cvme961/console/console.c212
-rw-r--r--c/src/lib/libbsp/i960/cvme961/include/bsp.h149
-rw-r--r--c/src/lib/libbsp/i960/cvme961/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/i960/cvme961/shmsupp/addrconv.c37
-rw-r--r--c/src/lib/libbsp/i960/cvme961/shmsupp/getcfg.c98
-rw-r--r--c/src/lib/libbsp/i960/cvme961/shmsupp/lock.c76
-rw-r--r--c/src/lib/libbsp/i960/cvme961/shmsupp/mpisr.c70
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/bspclean.c32
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/bspstart.c245
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/exit.c38
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/linkcmds48
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/setvec.c145
-rw-r--r--c/src/lib/libbsp/i960/cvme961/timer/timer.c107
-rw-r--r--c/src/lib/libbsp/i960/cvme961/timer/timerisr.s59
-rw-r--r--c/src/lib/libbsp/i960/cvme961/times191
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c162
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/console/console.c249
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/include/bsp.h190
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/spurious/spinit.c46
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c252
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/startup/linkcmds48
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/startup/vmeintr.c60
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/timer/timer.c105
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/timer/timerisr.s38
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/times195
-rw-r--r--c/src/lib/libbsp/m68k/efi332/README42
-rw-r--r--c/src/lib/libbsp/m68k/efi332/clock/ckinit.c137
-rw-r--r--c/src/lib/libbsp/m68k/efi332/console/console.c390
-rw-r--r--c/src/lib/libbsp/m68k/efi332/include/bsp.h147
-rw-r--r--c/src/lib/libbsp/m68k/efi332/include/coverhd.h106
-rw-r--r--c/src/lib/libbsp/m68k/efi332/include/efi332.h46
-rw-r--r--c/src/lib/libbsp/m68k/efi332/spurious/spinit.c85
-rw-r--r--c/src/lib/libbsp/m68k/efi332/startup/bspclean.c28
-rw-r--r--c/src/lib/libbsp/m68k/efi332/startup/bspstart.c222
-rw-r--r--c/src/lib/libbsp/m68k/efi332/startup/linkcmds100
-rw-r--r--c/src/lib/libbsp/m68k/efi332/timer/timer.c84
-rw-r--r--c/src/lib/libbsp/m68k/efi332/times193
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/README48
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/clock/ckinit.c157
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/console/console.c363
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/16550.h120
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/DP8570A.h285
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/bsp.h153
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/coverhd.h106
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/efi68k.h21
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/spurious/spinit.c85
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/bspclean.c28
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c232
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/efi68k_tcp.c248
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/efi68k_wd.c55
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/linkcmds108
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/m68k-stub.c782
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/setvec.c45
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/timer/timer.c141
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/times193
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/README154
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c162
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/console/console.c304
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/include/bsp.h125
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/include/coverhd.h115
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/start/start302.s267
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/start302/start302.s267
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/startup/bspclean.c26
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c251
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/startup/linkcmds46
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/timer/timer.c130
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/timer/timerisr.s28
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/times193
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/README267
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/clock/ckinit.c149
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/console/console.c311
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/include/bsp.h134
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/include/coverhd.h76
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/start/start360.s405
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/start360/start360.s405
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/bspclean.c27
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c247
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/init68360.c190
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/linkcmds105
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom111
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/timer/timer.c95
-rw-r--r--c/src/lib/libbsp/m68k/idp/README35
-rw-r--r--c/src/lib/libbsp/m68k/idp/clock/ckinit.c199
-rw-r--r--c/src/lib/libbsp/m68k/idp/console/console.c284
-rw-r--r--c/src/lib/libbsp/m68k/idp/console/duart.c174
-rw-r--r--c/src/lib/libbsp/m68k/idp/console/leds.c82
-rw-r--r--c/src/lib/libbsp/m68k/idp/console/mc68ec.c21
-rw-r--r--c/src/lib/libbsp/m68k/idp/include/README13
-rw-r--r--c/src/lib/libbsp/m68k/idp/include/bsp.h97
-rw-r--r--c/src/lib/libbsp/m68k/idp/include/coverhd.h106
-rw-r--r--c/src/lib/libbsp/m68k/idp/include/leds.h27
-rw-r--r--c/src/lib/libbsp/m68k/idp/startup/bspstart.c256
-rw-r--r--c/src/lib/libbsp/m68k/idp/startup/linkcmds46
-rw-r--r--c/src/lib/libbsp/m68k/idp/timer/timer.c120
-rw-r--r--c/src/lib/libbsp/m68k/idp/timer/timerisr.s38
-rw-r--r--c/src/lib/libbsp/m68k/idp/times193
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c173
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/console/console.c224
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/include/bsp.h162
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/shmsupp/addrconv.c32
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/shmsupp/getcfg.c85
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/shmsupp/lock.c75
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/shmsupp/mpisr.c42
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c46
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c239
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/startup/linkcmds48
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/timer/timer.c107
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/timer/timerisr.s39
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/times191
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/README151
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c146
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/console/console.c256
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/include/bsp.h300
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/include/page_table.h45
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c55
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c256
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/linkcmds50
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/page_table.c201
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/timer/timer.c93
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s47
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/times193
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/tools/sload.c511
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/README69
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c191
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/console/console.c223
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h105
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/include/coverhd.h115
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/addrconv.c31
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/getcfg.c77
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/lock.c86
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/mpisr.c47
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c26
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c255
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/linkcmds46
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c34
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c44
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/timer/timer.c105
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/timer/timerisr.c37
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/times194
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/README50
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s251
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s289
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/include/bsp.h154
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/include/coverhd.h135
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/bspclean.c44
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c276
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/linkcmds77
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/setvec.c58
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/times197
-rw-r--r--c/src/lib/libbsp/shmdr/README9
-rw-r--r--c/src/lib/libbsp/shmdr/addlq.c43
-rw-r--r--c/src/lib/libbsp/shmdr/cnvpkt.c42
-rw-r--r--c/src/lib/libbsp/shmdr/dump.c49
-rw-r--r--c/src/lib/libbsp/shmdr/fatal.c39
-rw-r--r--c/src/lib/libbsp/shmdr/getlq.c48
-rw-r--r--c/src/lib/libbsp/shmdr/getpkt.c36
-rw-r--r--c/src/lib/libbsp/shmdr/init.c254
-rw-r--r--c/src/lib/libbsp/shmdr/initlq.c35
-rw-r--r--c/src/lib/libbsp/shmdr/intr.c58
-rw-r--r--c/src/lib/libbsp/shmdr/mpci.h59
-rw-r--r--c/src/lib/libbsp/shmdr/mpisr.c23
-rw-r--r--c/src/lib/libbsp/shmdr/poll.c53
-rw-r--r--c/src/lib/libbsp/shmdr/receive.c44
-rw-r--r--c/src/lib/libbsp/shmdr/retpkt.c32
-rw-r--r--c/src/lib/libbsp/shmdr/send.c61
-rw-r--r--c/src/lib/libbsp/shmdr/setckvec.c34
-rw-r--r--c/src/lib/libbsp/shmdr/shm.h534
-rw-r--r--c/src/lib/libbsp/shmdr/shm_driver.h534
-rw-r--r--c/src/lib/libbsp/unix/posix/README18
-rw-r--r--c/src/lib/libbsp/unix/posix/clock/clock.c112
-rw-r--r--c/src/lib/libbsp/unix/posix/console/console.c102
-rw-r--r--c/src/lib/libbsp/unix/posix/include/bsp.h106
-rw-r--r--c/src/lib/libbsp/unix/posix/include/coverhd.h111
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/README9
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/addrconv.c30
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c75
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/intr.c34
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/lock.c72
-rw-r--r--c/src/lib/libbsp/unix/posix/shmsupp/mpisr.c32
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/bspclean.c41
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/bspstart.c368
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/exit.c27
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/no-ctor.c16
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc116
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/setvec.c47
-rw-r--r--c/src/lib/libbsp/unix/posix/timer/timer.c74
-rw-r--r--c/src/lib/libbsp/unix/posix/times10
-rw-r--r--c/src/lib/libc/README37
-rw-r--r--c/src/lib/libc/__brk.c44
-rw-r--r--c/src/lib/libc/__gettod.c103
-rw-r--r--c/src/lib/libc/__times.c65
-rw-r--r--c/src/lib/libc/assoc.c260
-rw-r--r--c/src/lib/libc/assoc.h42
-rw-r--r--c/src/lib/libc/error.c209
-rw-r--r--c/src/lib/libc/error.h33
-rw-r--r--c/src/lib/libc/hosterr.c43
-rw-r--r--c/src/lib/libc/internal.h41
-rw-r--r--c/src/lib/libc/libcsupport.h42
-rw-r--r--c/src/lib/libc/libio.c442
-rw-r--r--c/src/lib/libc/libio.h98
-rw-r--r--c/src/lib/libc/malloc.c366
-rw-r--r--c/src/lib/libc/newlibc.c336
-rw-r--r--c/src/lib/libc/no_libc.c45
-rw-r--r--c/src/lib/libc/support.c52
-rw-r--r--c/src/lib/libc/syscalls.c62
-rw-r--r--c/src/lib/libc/unixlibc.c11
-rw-r--r--c/src/lib/libc/utsname.c61
-rw-r--r--c/src/lib/libcpu/README14
-rw-r--r--c/src/lib/libcpu/hppa1.1/clock/clock.c267
-rw-r--r--c/src/lib/libcpu/hppa1.1/runway/runway.h37
-rw-r--r--c/src/lib/libcpu/hppa1.1/semaphore/semaphore.c308
-rw-r--r--c/src/lib/libcpu/hppa1.1/semaphore/semaphore.h84
-rw-r--r--c/src/lib/libcpu/hppa1.1/timer/timer.c62
-rw-r--r--c/src/lib/libcpu/powerpc/README13
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/README22
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/clock/clock.c265
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/console/console.c387
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/timer/timer.c98
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/vectors/README25
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/vectors/align_h.s433
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.s282
-rw-r--r--c/src/lib/libcpu/sparc/include/erc32.h518
-rw-r--r--c/src/lib/libcpu/sparc/reg_win/window.s257
-rw-r--r--c/src/lib/libmisc/README16
-rw-r--r--c/src/lib/libmisc/assoc/assoc.c260
-rw-r--r--c/src/lib/libmisc/assoc/assoc.h42
-rw-r--r--c/src/lib/libmisc/error/error.c209
-rw-r--r--c/src/lib/libmisc/error/error.h33
-rw-r--r--c/src/lib/libmisc/monitor/README97
-rw-r--r--c/src/lib/libmisc/monitor/mon-command.c187
-rw-r--r--c/src/lib/libmisc/monitor/mon-config.c130
-rw-r--r--c/src/lib/libmisc/monitor/mon-dname.c112
-rw-r--r--c/src/lib/libmisc/monitor/mon-driver.c136
-rw-r--r--c/src/lib/libmisc/monitor/mon-extension.c98
-rw-r--r--c/src/lib/libmisc/monitor/mon-itask.c115
-rw-r--r--c/src/lib/libmisc/monitor/mon-manager.c50
-rw-r--r--c/src/lib/libmisc/monitor/mon-monitor.c517
-rw-r--r--c/src/lib/libmisc/monitor/mon-mpci.c159
-rw-r--r--c/src/lib/libmisc/monitor/mon-object.c374
-rw-r--r--c/src/lib/libmisc/monitor/mon-prmisc.c254
-rw-r--r--c/src/lib/libmisc/monitor/mon-queue.c64
-rw-r--r--c/src/lib/libmisc/monitor/mon-server.c302
-rw-r--r--c/src/lib/libmisc/monitor/mon-symbols.c481
-rw-r--r--c/src/lib/libmisc/monitor/mon-task.c92
-rw-r--r--c/src/lib/libmisc/monitor/monitor.h443
-rw-r--r--c/src/lib/libmisc/monitor/symbols.h64
-rw-r--r--c/src/lib/libmisc/stackchk/README41
-rw-r--r--c/src/lib/libmisc/stackchk/check.c512
-rw-r--r--c/src/lib/libmisc/stackchk/internal.h96
-rw-r--r--c/src/lib/libmisc/stackchk/stackchk.h41
-rw-r--r--c/src/lib/start/README10
-rw-r--r--c/src/lib/start/i960/start.s106
-rw-r--r--c/src/lib/start/m68k/start.s167
-rw-r--r--c/src/libchip/shmdr/README9
-rw-r--r--c/src/libchip/shmdr/addlq.c43
-rw-r--r--c/src/libchip/shmdr/cnvpkt.c42
-rw-r--r--c/src/libchip/shmdr/dump.c49
-rw-r--r--c/src/libchip/shmdr/fatal.c39
-rw-r--r--c/src/libchip/shmdr/getlq.c48
-rw-r--r--c/src/libchip/shmdr/getpkt.c36
-rw-r--r--c/src/libchip/shmdr/init.c254
-rw-r--r--c/src/libchip/shmdr/initlq.c35
-rw-r--r--c/src/libchip/shmdr/intr.c58
-rw-r--r--c/src/libchip/shmdr/mpci.h59
-rw-r--r--c/src/libchip/shmdr/mpisr.c23
-rw-r--r--c/src/libchip/shmdr/poll.c53
-rw-r--r--c/src/libchip/shmdr/receive.c44
-rw-r--r--c/src/libchip/shmdr/retpkt.c32
-rw-r--r--c/src/libchip/shmdr/send.c61
-rw-r--r--c/src/libchip/shmdr/setckvec.c34
-rw-r--r--c/src/libchip/shmdr/shm_driver.h534
-rw-r--r--c/src/libmisc/README16
-rw-r--r--c/src/libmisc/assoc/assoc.c260
-rw-r--r--c/src/libmisc/assoc/assoc.h42
-rw-r--r--c/src/libmisc/error/error.c209
-rw-r--r--c/src/libmisc/error/error.h33
-rw-r--r--c/src/libmisc/monitor/README97
-rw-r--r--c/src/libmisc/monitor/mon-command.c187
-rw-r--r--c/src/libmisc/monitor/mon-config.c130
-rw-r--r--c/src/libmisc/monitor/mon-dname.c112
-rw-r--r--c/src/libmisc/monitor/mon-driver.c136
-rw-r--r--c/src/libmisc/monitor/mon-extension.c98
-rw-r--r--c/src/libmisc/monitor/mon-itask.c115
-rw-r--r--c/src/libmisc/monitor/mon-manager.c50
-rw-r--r--c/src/libmisc/monitor/mon-monitor.c517
-rw-r--r--c/src/libmisc/monitor/mon-mpci.c159
-rw-r--r--c/src/libmisc/monitor/mon-object.c374
-rw-r--r--c/src/libmisc/monitor/mon-prmisc.c254
-rw-r--r--c/src/libmisc/monitor/mon-queue.c64
-rw-r--r--c/src/libmisc/monitor/mon-server.c302
-rw-r--r--c/src/libmisc/monitor/mon-symbols.c481
-rw-r--r--c/src/libmisc/monitor/mon-task.c92
-rw-r--r--c/src/libmisc/monitor/monitor.h443
-rw-r--r--c/src/libmisc/monitor/symbols.h64
-rw-r--r--c/src/libmisc/stackchk/README41
-rw-r--r--c/src/libmisc/stackchk/check.c512
-rw-r--r--c/src/libmisc/stackchk/internal.h96
-rw-r--r--c/src/libmisc/stackchk/stackchk.h41
-rw-r--r--c/src/optman/rtems/no-dpmem.c98
-rw-r--r--c/src/optman/rtems/no-event.c56
-rw-r--r--c/src/optman/rtems/no-mp.c201
-rw-r--r--c/src/optman/rtems/no-msg.c192
-rw-r--r--c/src/optman/rtems/no-part.c97
-rw-r--r--c/src/optman/rtems/no-region.c114
-rw-r--r--c/src/optman/rtems/no-rtmon.c117
-rw-r--r--c/src/optman/rtems/no-sem.c114
-rw-r--r--c/src/optman/rtems/no-signal.c56
-rw-r--r--c/src/optman/rtems/no-timer.c123
-rw-r--r--c/src/optman/sapi/no-ext.c67
-rw-r--r--c/src/optman/sapi/no-io.c145
-rw-r--r--c/src/tests/README44
-rw-r--r--c/src/tests/libtests/README10
-rw-r--r--c/src/tests/libtests/stackchk/blow.c45
-rw-r--r--c/src/tests/libtests/stackchk/init.c86
-rw-r--r--c/src/tests/libtests/stackchk/stackchk.scn9
-rw-r--r--c/src/tests/libtests/stackchk/system.h49
-rw-r--r--c/src/tests/libtests/stackchk/task1.c44
-rw-r--r--c/src/tests/mptests/README10
-rw-r--r--c/src/tests/mptests/mp01/init.c96
-rw-r--r--c/src/tests/mptests/mp01/node1/mp01.doc53
-rw-r--r--c/src/tests/mptests/mp01/node1/mp01.scn15
-rw-r--r--c/src/tests/mptests/mp01/node2/mp01.doc13
-rw-r--r--c/src/tests/mptests/mp01/node2/mp01.scn15
-rw-r--r--c/src/tests/mptests/mp01/system.h45
-rw-r--r--c/src/tests/mptests/mp01/task1.c84
-rw-r--r--c/src/tests/mptests/mp02/init.c60
-rw-r--r--c/src/tests/mptests/mp02/node1/mp02.doc47
-rw-r--r--c/src/tests/mptests/mp02/node1/mp02.scn14
-rw-r--r--c/src/tests/mptests/mp02/node2/mp02.doc13
-rw-r--r--c/src/tests/mptests/mp02/node2/mp02.scn14
-rw-r--r--c/src/tests/mptests/mp02/system.h43
-rw-r--r--c/src/tests/mptests/mp02/task1.c118
-rw-r--r--c/src/tests/mptests/mp03/delay.c31
-rw-r--r--c/src/tests/mptests/mp03/init.c65
-rw-r--r--c/src/tests/mptests/mp03/node1/mp03.doc45
-rw-r--r--c/src/tests/mptests/mp03/node1/mp03.scn24
-rw-r--r--c/src/tests/mptests/mp03/node2/mp03.doc13
-rw-r--r--c/src/tests/mptests/mp03/node2/mp03.scn24
-rw-r--r--c/src/tests/mptests/mp03/system.h56
-rw-r--r--c/src/tests/mptests/mp03/task1.c155
-rw-r--r--c/src/tests/mptests/mp04/init.c60
-rw-r--r--c/src/tests/mptests/mp04/node1/mp04.doc41
-rw-r--r--c/src/tests/mptests/mp04/node1/mp04.scn8
-rw-r--r--c/src/tests/mptests/mp04/node2/mp04.doc13
-rw-r--r--c/src/tests/mptests/mp04/node2/mp04.scn8
-rw-r--r--c/src/tests/mptests/mp04/system.h45
-rw-r--r--c/src/tests/mptests/mp04/task1.c83
-rw-r--r--c/src/tests/mptests/mp05/asr.c37
-rw-r--r--c/src/tests/mptests/mp05/init.c65
-rw-r--r--c/src/tests/mptests/mp05/node1/mp05.doc45
-rw-r--r--c/src/tests/mptests/mp05/node1/mp05.scn11
-rw-r--r--c/src/tests/mptests/mp05/node2/mp05.doc13
-rw-r--r--c/src/tests/mptests/mp05/node2/mp05.scn10
-rw-r--r--c/src/tests/mptests/mp05/system.h59
-rw-r--r--c/src/tests/mptests/mp05/task1.c106
-rw-r--r--c/src/tests/mptests/mp06/init.c65
-rw-r--r--c/src/tests/mptests/mp06/node1/mp06.doc45
-rw-r--r--c/src/tests/mptests/mp06/node1/mp06.scn11
-rw-r--r--c/src/tests/mptests/mp06/node2/mp06.doc13
-rw-r--r--c/src/tests/mptests/mp06/node2/mp06.scn12
-rw-r--r--c/src/tests/mptests/mp06/system.h50
-rw-r--r--c/src/tests/mptests/mp06/task1.c176
-rw-r--r--c/src/tests/mptests/mp07/init.c65
-rw-r--r--c/src/tests/mptests/mp07/node1/mp07.doc46
-rw-r--r--c/src/tests/mptests/mp07/node1/mp07.scn10
-rw-r--r--c/src/tests/mptests/mp07/node2/mp07.doc13
-rw-r--r--c/src/tests/mptests/mp07/node2/mp07.scn9
-rw-r--r--c/src/tests/mptests/mp07/system.h50
-rw-r--r--c/src/tests/mptests/mp07/task1.c95
-rw-r--r--c/src/tests/mptests/mp08/init.c74
-rw-r--r--c/src/tests/mptests/mp08/node1/mp08.doc52
-rw-r--r--c/src/tests/mptests/mp08/node1/mp08.scn11
-rw-r--r--c/src/tests/mptests/mp08/node2/mp08.doc13
-rw-r--r--c/src/tests/mptests/mp08/node2/mp08.scn12
-rw-r--r--c/src/tests/mptests/mp08/system.h49
-rw-r--r--c/src/tests/mptests/mp08/task1.c89
-rw-r--r--c/src/tests/mptests/mp09/init.c74
-rw-r--r--c/src/tests/mptests/mp09/node1/mp09.doc50
-rw-r--r--c/src/tests/mptests/mp09/node1/mp09.scn22
-rw-r--r--c/src/tests/mptests/mp09/node2/mp09.doc13
-rw-r--r--c/src/tests/mptests/mp09/node2/mp09.scn27
-rw-r--r--c/src/tests/mptests/mp09/recvmsg.c47
-rw-r--r--c/src/tests/mptests/mp09/sendmsg.c60
-rw-r--r--c/src/tests/mptests/mp09/system.h58
-rw-r--r--c/src/tests/mptests/mp09/task1.c109
-rw-r--r--c/src/tests/mptests/mp10/init.c143
-rw-r--r--c/src/tests/mptests/mp10/node1/mp10.doc46
-rw-r--r--c/src/tests/mptests/mp10/node1/mp10.scn4
-rw-r--r--c/src/tests/mptests/mp10/node2/mp10.doc13
-rw-r--r--c/src/tests/mptests/mp10/node2/mp10.scn19
-rw-r--r--c/src/tests/mptests/mp10/system.h62
-rw-r--r--c/src/tests/mptests/mp10/task1.c52
-rw-r--r--c/src/tests/mptests/mp10/task2.c47
-rw-r--r--c/src/tests/mptests/mp10/task3.c50
-rw-r--r--c/src/tests/mptests/mp11/init.c105
-rw-r--r--c/src/tests/mptests/mp11/node1/mp11.doc42
-rw-r--r--c/src/tests/mptests/mp11/node1/mp11.scn10
-rw-r--r--c/src/tests/mptests/mp11/node2/mp11.doc13
-rw-r--r--c/src/tests/mptests/mp11/node2/mp11.scn2
-rw-r--r--c/src/tests/mptests/mp11/system.h54
-rw-r--r--c/src/tests/mptests/mp12/init.c113
-rw-r--r--c/src/tests/mptests/mp12/node1/mp12.doc52
-rw-r--r--c/src/tests/mptests/mp12/node1/mp12.scn6
-rw-r--r--c/src/tests/mptests/mp12/node2/mp12.doc13
-rw-r--r--c/src/tests/mptests/mp12/node2/mp12.scn10
-rw-r--r--c/src/tests/mptests/mp12/system.h53
-rw-r--r--c/src/tests/mptests/mp13/init.c115
-rw-r--r--c/src/tests/mptests/mp13/node1/mp13.doc48
-rw-r--r--c/src/tests/mptests/mp13/node1/mp13.scn14
-rw-r--r--c/src/tests/mptests/mp13/node2/mp13.doc13
-rw-r--r--c/src/tests/mptests/mp13/node2/mp13.scn16
-rw-r--r--c/src/tests/mptests/mp13/system.h58
-rw-r--r--c/src/tests/mptests/mp13/task1.c73
-rw-r--r--c/src/tests/mptests/mp13/task2.c106
-rw-r--r--c/src/tests/mptests/mp14/delay.c34
-rw-r--r--c/src/tests/mptests/mp14/evtask1.c87
-rw-r--r--c/src/tests/mptests/mp14/evtmtask.c65
-rw-r--r--c/src/tests/mptests/mp14/exit.c33
-rw-r--r--c/src/tests/mptests/mp14/init.c191
-rw-r--r--c/src/tests/mptests/mp14/msgtask1.c107
-rw-r--r--c/src/tests/mptests/mp14/node1/mp14.doc50
-rw-r--r--c/src/tests/mptests/mp14/node1/mp14.scn41
-rw-r--r--c/src/tests/mptests/mp14/node2/mp14.doc13
-rw-r--r--c/src/tests/mptests/mp14/node2/mp14.scn38
-rw-r--r--c/src/tests/mptests/mp14/pttask1.c71
-rw-r--r--c/src/tests/mptests/mp14/smtask1.c73
-rw-r--r--c/src/tests/mptests/mp14/system.h115
-rw-r--r--c/src/tests/samples/README73
-rw-r--r--c/src/tests/samples/base_mp/apptask.c37
-rw-r--r--c/src/tests/samples/base_mp/init.c46
-rw-r--r--c/src/tests/samples/base_mp/node1/base_mp.doc13
-rw-r--r--c/src/tests/samples/base_mp/node1/base_mp.scn5
-rw-r--r--c/src/tests/samples/base_mp/node2/base_mp.doc13
-rw-r--r--c/src/tests/samples/base_mp/node2/base_mp.scn5
-rw-r--r--c/src/tests/samples/base_mp/system.h46
-rw-r--r--c/src/tests/samples/base_sp/apptask.c38
-rw-r--r--c/src/tests/samples/base_sp/base_sp.doc13
-rw-r--r--c/src/tests/samples/base_sp/base_sp.scn5
-rw-r--r--c/src/tests/samples/base_sp/init.c48
-rw-r--r--c/src/tests/samples/base_sp/system.h42
-rw-r--r--c/src/tests/samples/cdtest/cdtest.scn31
-rw-r--r--c/src/tests/samples/cdtest/init.c26
-rw-r--r--c/src/tests/samples/cdtest/main.cc145
-rw-r--r--c/src/tests/samples/cdtest/system.h41
-rw-r--r--c/src/tests/samples/hello/hello.doc13
-rw-r--r--c/src/tests/samples/hello/hello.scn3
-rw-r--r--c/src/tests/samples/hello/init.c36
-rw-r--r--c/src/tests/samples/hello/system.h35
-rw-r--r--c/src/tests/samples/paranoia/init.c39
-rw-r--r--c/src/tests/samples/paranoia/paranoia.c2300
-rw-r--r--c/src/tests/samples/paranoia/paranoia.doc13
-rw-r--r--c/src/tests/samples/paranoia/system.h40
-rw-r--r--c/src/tests/samples/ticker/init.c61
-rw-r--r--c/src/tests/samples/ticker/system.h43
-rw-r--r--c/src/tests/samples/ticker/tasks.c44
-rw-r--r--c/src/tests/samples/ticker/ticker.doc13
-rw-r--r--c/src/tests/samples/ticker/ticker.scn16
-rw-r--r--c/src/tests/sptests/README9
-rw-r--r--c/src/tests/sptests/sp01/init.c86
-rw-r--r--c/src/tests/sptests/sp01/sp01.doc43
-rw-r--r--c/src/tests/sptests/sp01/sp01.scn18
-rw-r--r--c/src/tests/sptests/sp01/system.h43
-rw-r--r--c/src/tests/sptests/sp01/task1.c50
-rw-r--r--c/src/tests/sptests/sp02/init.c152
-rw-r--r--c/src/tests/sptests/sp02/preempt.c32
-rw-r--r--c/src/tests/sptests/sp02/sp02.doc37
-rw-r--r--c/src/tests/sptests/sp02/sp02.scn15
-rw-r--r--c/src/tests/sptests/sp02/system.h58
-rw-r--r--c/src/tests/sptests/sp02/task1.c66
-rw-r--r--c/src/tests/sptests/sp02/task2.c34
-rw-r--r--c/src/tests/sptests/sp02/task3.c37
-rw-r--r--c/src/tests/sptests/sp03/init.c67
-rw-r--r--c/src/tests/sptests/sp03/sp03.doc24
-rw-r--r--c/src/tests/sptests/sp03/sp03.scn26
-rw-r--r--c/src/tests/sptests/sp03/system.h47
-rw-r--r--c/src/tests/sptests/sp03/task1.c59
-rw-r--r--c/src/tests/sptests/sp03/task2.c46
-rw-r--r--c/src/tests/sptests/sp04/init.c110
-rw-r--r--c/src/tests/sptests/sp04/sp04.doc38
-rw-r--r--c/src/tests/sptests/sp04/sp04.scn24
-rw-r--r--c/src/tests/sptests/sp04/system.h65
-rw-r--r--c/src/tests/sptests/sp04/task1.c103
-rw-r--r--c/src/tests/sptests/sp04/task2.c29
-rw-r--r--c/src/tests/sptests/sp04/task3.c29
-rw-r--r--c/src/tests/sptests/sp04/tswitch.c59
-rw-r--r--c/src/tests/sptests/sp05/init.c81
-rw-r--r--c/src/tests/sptests/sp05/sp05.doc26
-rw-r--r--c/src/tests/sptests/sp05/sp05.scn47
-rw-r--r--c/src/tests/sptests/sp05/system.h53
-rw-r--r--c/src/tests/sptests/sp05/task1.c78
-rw-r--r--c/src/tests/sptests/sp05/task2.c39
-rw-r--r--c/src/tests/sptests/sp05/task3.c39
-rw-r--r--c/src/tests/sptests/sp06/init.c87
-rw-r--r--c/src/tests/sptests/sp06/sp06.doc26
-rw-r--r--c/src/tests/sptests/sp06/sp06.scn40
-rw-r--r--c/src/tests/sptests/sp06/system.h56
-rw-r--r--c/src/tests/sptests/sp06/task1.c61
-rw-r--r--c/src/tests/sptests/sp06/task2.c40
-rw-r--r--c/src/tests/sptests/sp06/task3.c32
-rw-r--r--c/src/tests/sptests/sp07/init.c128
-rw-r--r--c/src/tests/sptests/sp07/sp07.doc37
-rw-r--r--c/src/tests/sptests/sp07/sp07.scn33
-rw-r--r--c/src/tests/sptests/sp07/system.h85
-rw-r--r--c/src/tests/sptests/sp07/task1.c85
-rw-r--r--c/src/tests/sptests/sp07/task2.c78
-rw-r--r--c/src/tests/sptests/sp07/task3.c34
-rw-r--r--c/src/tests/sptests/sp07/task4.c30
-rw-r--r--c/src/tests/sptests/sp07/taskexit.c33
-rw-r--r--c/src/tests/sptests/sp07/tcreate.c35
-rw-r--r--c/src/tests/sptests/sp07/tdelete.c37
-rw-r--r--c/src/tests/sptests/sp07/trestart.c34
-rw-r--r--c/src/tests/sptests/sp07/tstart.c34
-rw-r--r--c/src/tests/sptests/sp08/init.c53
-rw-r--r--c/src/tests/sptests/sp08/sp08.doc26
-rw-r--r--c/src/tests/sptests/sp08/sp08.scn22
-rw-r--r--c/src/tests/sptests/sp08/system.h48
-rw-r--r--c/src/tests/sptests/sp08/task1.c256
-rw-r--r--c/src/tests/sptests/sp09/delay.c28
-rw-r--r--c/src/tests/sptests/sp09/init.c120
-rw-r--r--c/src/tests/sptests/sp09/isr.c27
-rw-r--r--c/src/tests/sptests/sp09/screen01.c168
-rw-r--r--c/src/tests/sptests/sp09/screen02.c192
-rw-r--r--c/src/tests/sptests/sp09/screen03.c217
-rw-r--r--c/src/tests/sptests/sp09/screen04.c85
-rw-r--r--c/src/tests/sptests/sp09/screen05.c164
-rw-r--r--c/src/tests/sptests/sp09/screen06.c125
-rw-r--r--c/src/tests/sptests/sp09/screen07.c192
-rw-r--r--c/src/tests/sptests/sp09/screen08.c128
-rw-r--r--c/src/tests/sptests/sp09/screen09.c144
-rw-r--r--c/src/tests/sptests/sp09/screen10.c164
-rw-r--r--c/src/tests/sptests/sp09/screen11.c250
-rw-r--r--c/src/tests/sptests/sp09/screen12.c337
-rw-r--r--c/src/tests/sptests/sp09/screen13.c114
-rw-r--r--c/src/tests/sptests/sp09/screen14.c154
-rw-r--r--c/src/tests/sptests/sp09/sp09.doc36
-rw-r--r--c/src/tests/sptests/sp09/sp09.scn249
-rw-r--r--c/src/tests/sptests/sp09/system.h139
-rw-r--r--c/src/tests/sptests/sp09/task1.c70
-rw-r--r--c/src/tests/sptests/sp09/task2.c48
-rw-r--r--c/src/tests/sptests/sp09/task3.c53
-rw-r--r--c/src/tests/sptests/sp09/task4.c50
-rw-r--r--c/src/tests/sptests/sp11/init.c92
-rw-r--r--c/src/tests/sptests/sp11/sp11.doc26
-rw-r--r--c/src/tests/sptests/sp11/sp11.scn74
-rw-r--r--c/src/tests/sptests/sp11/system.h88
-rw-r--r--c/src/tests/sptests/sp11/task1.c410
-rw-r--r--c/src/tests/sptests/sp11/task2.c126
-rw-r--r--c/src/tests/sptests/sp11/timer.c97
-rw-r--r--c/src/tests/sptests/sp12/init.c179
-rw-r--r--c/src/tests/sptests/sp12/pridrv.c131
-rw-r--r--c/src/tests/sptests/sp12/pritask.c91
-rw-r--r--c/src/tests/sptests/sp12/sp12.doc27
-rw-r--r--c/src/tests/sptests/sp12/sp12.scn78
-rw-r--r--c/src/tests/sptests/sp12/system.h80
-rw-r--r--c/src/tests/sptests/sp12/task1.c153
-rw-r--r--c/src/tests/sptests/sp12/task2.c65
-rw-r--r--c/src/tests/sptests/sp12/task3.c50
-rw-r--r--c/src/tests/sptests/sp12/task4.c37
-rw-r--r--c/src/tests/sptests/sp12/task5.c55
-rw-r--r--c/src/tests/sptests/sp13/fillbuff.c31
-rw-r--r--c/src/tests/sptests/sp13/init.c112
-rw-r--r--c/src/tests/sptests/sp13/putbuff.c29
-rw-r--r--c/src/tests/sptests/sp13/sp13.doc25
-rw-r--r--c/src/tests/sptests/sp13/sp13.scn72
-rw-r--r--c/src/tests/sptests/sp13/system.h66
-rw-r--r--c/src/tests/sptests/sp13/task1.c344
-rw-r--r--c/src/tests/sptests/sp13/task2.c139
-rw-r--r--c/src/tests/sptests/sp13/task3.c78
-rw-r--r--c/src/tests/sptests/sp14/asr.c47
-rw-r--r--c/src/tests/sptests/sp14/init.c72
-rw-r--r--c/src/tests/sptests/sp14/sp14.doc24
-rw-r--r--c/src/tests/sptests/sp14/sp14.scn33
-rw-r--r--c/src/tests/sptests/sp14/system.h76
-rw-r--r--c/src/tests/sptests/sp14/task1.c116
-rw-r--r--c/src/tests/sptests/sp14/task2.c48
-rw-r--r--c/src/tests/sptests/sp15/init.c78
-rw-r--r--c/src/tests/sptests/sp15/sp15.doc24
-rw-r--r--c/src/tests/sptests/sp15/sp15.scn16
-rw-r--r--c/src/tests/sptests/sp15/system.h58
-rw-r--r--c/src/tests/sptests/sp15/task1.c129
-rw-r--r--c/src/tests/sptests/sp16/init.c128
-rw-r--r--c/src/tests/sptests/sp16/sp16.doc24
-rw-r--r--c/src/tests/sptests/sp16/sp16.scn58
-rw-r--r--c/src/tests/sptests/sp16/system.h83
-rw-r--r--c/src/tests/sptests/sp16/task1.c282
-rw-r--r--c/src/tests/sptests/sp16/task2.c86
-rw-r--r--c/src/tests/sptests/sp16/task3.c57
-rw-r--r--c/src/tests/sptests/sp16/task4.c60
-rw-r--r--c/src/tests/sptests/sp16/task5.c73
-rw-r--r--c/src/tests/sptests/sp17/asr.c32
-rw-r--r--c/src/tests/sptests/sp17/init.c69
-rw-r--r--c/src/tests/sptests/sp17/sp17.doc35
-rw-r--r--c/src/tests/sptests/sp17/sp17.scn8
-rw-r--r--c/src/tests/sptests/sp17/system.h56
-rw-r--r--c/src/tests/sptests/sp17/task1.c48
-rw-r--r--c/src/tests/sptests/sp17/task2.c45
-rw-r--r--c/src/tests/sptests/sp19/first.c66
-rw-r--r--c/src/tests/sptests/sp19/fptask.c98
-rw-r--r--c/src/tests/sptests/sp19/fptest.h165
-rw-r--r--c/src/tests/sptests/sp19/init.c150
-rw-r--r--c/src/tests/sptests/sp19/inttest.h149
-rw-r--r--c/src/tests/sptests/sp19/sp19.doc23
-rw-r--r--c/src/tests/sptests/sp19/sp19.scn55
-rw-r--r--c/src/tests/sptests/sp19/system.h55
-rw-r--r--c/src/tests/sptests/sp19/task1.c59
-rw-r--r--c/src/tests/sptests/sp20/getall.c43
-rw-r--r--c/src/tests/sptests/sp20/init.c68
-rw-r--r--c/src/tests/sptests/sp20/sp20.doc24
-rw-r--r--c/src/tests/sptests/sp20/sp20.scn27
-rw-r--r--c/src/tests/sptests/sp20/system.h59
-rw-r--r--c/src/tests/sptests/sp20/task1.c116
-rw-r--r--c/src/tests/sptests/sp21/init.c53
-rw-r--r--c/src/tests/sptests/sp21/sp21.doc28
-rw-r--r--c/src/tests/sptests/sp21/sp21.scn19
-rw-r--r--c/src/tests/sptests/sp21/system.h44
-rw-r--r--c/src/tests/sptests/sp21/task1.c105
-rw-r--r--c/src/tests/sptests/sp22/delay.c32
-rw-r--r--c/src/tests/sptests/sp22/init.c66
-rw-r--r--c/src/tests/sptests/sp22/prtime.c32
-rw-r--r--c/src/tests/sptests/sp22/sp22.doc20
-rw-r--r--c/src/tests/sptests/sp22/sp22.scn29
-rw-r--r--c/src/tests/sptests/sp22/system.h55
-rw-r--r--c/src/tests/sptests/sp22/task1.c164
-rw-r--r--c/src/tests/sptests/sp23/init.c69
-rw-r--r--c/src/tests/sptests/sp23/sp23.doc26
-rw-r--r--c/src/tests/sptests/sp23/sp23.scn9
-rw-r--r--c/src/tests/sptests/sp23/system.h54
-rw-r--r--c/src/tests/sptests/sp23/task1.c96
-rw-r--r--c/src/tests/sptests/sp24/init.c76
-rw-r--r--c/src/tests/sptests/sp24/resume.c34
-rw-r--r--c/src/tests/sptests/sp24/sp24.doc51
-rw-r--r--c/src/tests/sptests/sp24/sp24.scn16
-rw-r--r--c/src/tests/sptests/sp24/system.h53
-rw-r--r--c/src/tests/sptests/sp24/task1.c58
-rw-r--r--c/src/tests/sptests/sp25/init.c66
-rw-r--r--c/src/tests/sptests/sp25/sp25.doc32
-rw-r--r--c/src/tests/sptests/sp25/sp25.scn29
-rw-r--r--c/src/tests/sptests/sp25/system.h54
-rw-r--r--c/src/tests/sptests/sp25/task1.c241
-rw-r--r--c/src/tests/sptests/spfatal/fatal.c135
-rw-r--r--c/src/tests/sptests/spfatal/init.c51
-rw-r--r--c/src/tests/sptests/spfatal/puterr.c68
-rw-r--r--c/src/tests/sptests/spfatal/spfatal.doc28
-rw-r--r--c/src/tests/sptests/spfatal/spfatal.scn8
-rw-r--r--c/src/tests/sptests/spfatal/system.h79
-rw-r--r--c/src/tests/sptests/spfatal/task1.c29
-rw-r--r--c/src/tests/sptests/spsize/getint.c32
-rw-r--r--c/src/tests/sptests/spsize/init.c60
-rw-r--r--c/src/tests/sptests/spsize/size.c648
-rw-r--r--c/src/tests/sptests/spsize/system.h45
-rw-r--r--c/src/tests/support/include/tmacros.h127
-rw-r--r--c/src/tests/support/stubdr/close.c34
-rw-r--r--c/src/tests/support/stubdr/cntrl.c34
-rw-r--r--c/src/tests/support/stubdr/init.c37
-rw-r--r--c/src/tests/support/stubdr/open.c34
-rw-r--r--c/src/tests/support/stubdr/read.c34
-rw-r--r--c/src/tests/support/stubdr/stubdrv.h69
-rw-r--r--c/src/tests/support/stubdr/write.c34
-rw-r--r--c/src/tests/tmtests/README21
-rw-r--r--c/src/tests/tmtests/include/timesys.h58
-rw-r--r--c/src/tests/tmtests/tm01/system.h41
-rw-r--r--c/src/tests/tmtests/tm01/task1.c189
-rw-r--r--c/src/tests/tmtests/tm01/tm01.doc13
-rw-r--r--c/src/tests/tmtests/tm02/system.h42
-rw-r--r--c/src/tests/tmtests/tm02/task1.c158
-rw-r--r--c/src/tests/tmtests/tm02/tm02.doc13
-rw-r--r--c/src/tests/tmtests/tm03/system.h42
-rw-r--r--c/src/tests/tmtests/tm03/task1.c151
-rw-r--r--c/src/tests/tmtests/tm03/tm03.doc13
-rw-r--r--c/src/tests/tmtests/tm04/system.h41
-rw-r--r--c/src/tests/tmtests/tm04/task1.c388
-rw-r--r--c/src/tests/tmtests/tm04/tm04.doc13
-rw-r--r--c/src/tests/tmtests/tm05/system.h42
-rw-r--r--c/src/tests/tmtests/tm05/task1.c132
-rw-r--r--c/src/tests/tmtests/tm05/tm05.doc13
-rw-r--r--c/src/tests/tmtests/tm06/system.h42
-rw-r--r--c/src/tests/tmtests/tm06/task1.c162
-rw-r--r--c/src/tests/tmtests/tm06/tm06.doc13
-rw-r--r--c/src/tests/tmtests/tm07/system.h42
-rw-r--r--c/src/tests/tmtests/tm07/task1.c120
-rw-r--r--c/src/tests/tmtests/tm07/tm07.doc13
-rw-r--r--c/src/tests/tmtests/tm08/system.h42
-rw-r--r--c/src/tests/tmtests/tm08/task1.c255
-rw-r--r--c/src/tests/tmtests/tm08/tm08.doc13
-rw-r--r--c/src/tests/tmtests/tm09/system.h40
-rw-r--r--c/src/tests/tmtests/tm09/task1.c226
-rw-r--r--c/src/tests/tmtests/tm09/tm09.doc13
-rw-r--r--c/src/tests/tmtests/tm10/system.h41
-rw-r--r--c/src/tests/tmtests/tm10/task1.c165
-rw-r--r--c/src/tests/tmtests/tm10/tm10.doc13
-rw-r--r--c/src/tests/tmtests/tm11/system.h41
-rw-r--r--c/src/tests/tmtests/tm11/task1.c155
-rw-r--r--c/src/tests/tmtests/tm11/tm11.doc13
-rw-r--r--c/src/tests/tmtests/tm12/system.h41
-rw-r--r--c/src/tests/tmtests/tm12/task1.c146
-rw-r--r--c/src/tests/tmtests/tm12/tm12.doc13
-rw-r--r--c/src/tests/tmtests/tm13/system.h41
-rw-r--r--c/src/tests/tmtests/tm13/task1.c154
-rw-r--r--c/src/tests/tmtests/tm13/tm13.doc13
-rw-r--r--c/src/tests/tmtests/tm14/system.h41
-rw-r--r--c/src/tests/tmtests/tm14/task1.c146
-rw-r--r--c/src/tests/tmtests/tm14/tm14.doc13
-rw-r--r--c/src/tests/tmtests/tm15/system.h41
-rw-r--r--c/src/tests/tmtests/tm15/task1.c222
-rw-r--r--c/src/tests/tmtests/tm15/tm15.doc13
-rw-r--r--c/src/tests/tmtests/tm16/system.h41
-rw-r--r--c/src/tests/tmtests/tm16/task1.c148
-rw-r--r--c/src/tests/tmtests/tm16/tm16.doc13
-rw-r--r--c/src/tests/tmtests/tm17/system.h41
-rw-r--r--c/src/tests/tmtests/tm17/task1.c127
-rw-r--r--c/src/tests/tmtests/tm17/tm17.doc13
-rw-r--r--c/src/tests/tmtests/tm18/system.h41
-rw-r--r--c/src/tests/tmtests/tm18/task1.c112
-rw-r--r--c/src/tests/tmtests/tm18/tm18.doc13
-rw-r--r--c/src/tests/tmtests/tm19/system.h41
-rw-r--r--c/src/tests/tmtests/tm19/task1.c208
-rw-r--r--c/src/tests/tmtests/tm19/tm19.doc13
-rw-r--r--c/src/tests/tmtests/tm20/system.h42
-rw-r--r--c/src/tests/tmtests/tm20/task1.c466
-rw-r--r--c/src/tests/tmtests/tm20/tm20.doc13
-rw-r--r--c/src/tests/tmtests/tm21/system.h48
-rw-r--r--c/src/tests/tmtests/tm21/task1.c236
-rw-r--r--c/src/tests/tmtests/tm21/tm21.doc13
-rw-r--r--c/src/tests/tmtests/tm22/system.h41
-rw-r--r--c/src/tests/tmtests/tm22/task1.c200
-rw-r--r--c/src/tests/tmtests/tm22/tm22.doc13
-rw-r--r--c/src/tests/tmtests/tm23/system.h41
-rw-r--r--c/src/tests/tmtests/tm23/task1.c302
-rw-r--r--c/src/tests/tmtests/tm23/tm23.doc13
-rw-r--r--c/src/tests/tmtests/tm24/system.h40
-rw-r--r--c/src/tests/tmtests/tm24/task1.c124
-rw-r--r--c/src/tests/tmtests/tm24/tm24.doc13
-rw-r--r--c/src/tests/tmtests/tm25/system.h41
-rw-r--r--c/src/tests/tmtests/tm25/task1.c109
-rw-r--r--c/src/tests/tmtests/tm25/tm25.doc13
-rw-r--r--c/src/tests/tmtests/tm26/fptest.h165
-rw-r--r--c/src/tests/tmtests/tm26/system.h41
-rw-r--r--c/src/tests/tmtests/tm26/task1.c550
-rw-r--r--c/src/tests/tmtests/tm26/tm26.doc13
-rw-r--r--c/src/tests/tmtests/tm27/system.h40
-rw-r--r--c/src/tests/tmtests/tm27/task1.c272
-rw-r--r--c/src/tests/tmtests/tm27/tm27.doc13
-rw-r--r--c/src/tests/tmtests/tm28/system.h41
-rw-r--r--c/src/tests/tmtests/tm28/task1.c134
-rw-r--r--c/src/tests/tmtests/tm28/tm28.doc13
-rw-r--r--c/src/tests/tmtests/tm29/system.h41
-rw-r--r--c/src/tests/tmtests/tm29/task1.c207
-rw-r--r--c/src/tests/tmtests/tm29/tm29.doc13
-rw-r--r--c/src/tests/tmtests/tmck/system.h40
-rw-r--r--c/src/tests/tmtests/tmck/task1.c180
-rw-r--r--c/src/tests/tmtests/tmck/tmck.doc20
-rw-r--r--c/src/tests/tmtests/tmoverhd/dumrtems.h255
-rw-r--r--c/src/tests/tmtests/tmoverhd/empty.c41
-rw-r--r--c/src/tests/tmtests/tmoverhd/system.h58
-rw-r--r--c/src/tests/tmtests/tmoverhd/testtask.c1279
-rw-r--r--c/src/tests/tmtests/tmoverhd/tmoverhd.doc13
-rw-r--r--c/src/tests/tools/generic/difftest110
-rw-r--r--c/src/tests/tools/generic/sorttimes192
-rw-r--r--c/update-tools/310_to_320_list543
-rw-r--r--c/update-tools/README7
-rw-r--r--cpukit/libcsupport/include/clockdrv.h51
-rw-r--r--cpukit/libcsupport/include/console.h69
-rw-r--r--cpukit/libcsupport/include/iosupp.h44
-rw-r--r--cpukit/libcsupport/include/ringbuf.h53
-rw-r--r--cpukit/libcsupport/include/rtems/assoc.h42
-rw-r--r--cpukit/libcsupport/include/rtems/error.h33
-rw-r--r--cpukit/libcsupport/include/rtems/libcsupport.h42
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h98
-rw-r--r--cpukit/libcsupport/include/spurious.h38
-rw-r--r--cpukit/libcsupport/include/sys/utsname.h49
-rw-r--r--cpukit/libcsupport/include/timerdrv.h40
-rw-r--r--cpukit/libcsupport/include/vmeintr.h58
-rw-r--r--cpukit/libcsupport/src/README37
-rw-r--r--cpukit/libcsupport/src/__brk.c44
-rw-r--r--cpukit/libcsupport/src/__gettod.c103
-rw-r--r--cpukit/libcsupport/src/__times.c65
-rw-r--r--cpukit/libcsupport/src/assoc.c260
-rw-r--r--cpukit/libcsupport/src/error.c209
-rw-r--r--cpukit/libcsupport/src/hosterr.c43
-rw-r--r--cpukit/libcsupport/src/libio.c442
-rw-r--r--cpukit/libcsupport/src/malloc.c366
-rw-r--r--cpukit/libcsupport/src/newlibc.c336
-rw-r--r--cpukit/libcsupport/src/no_libc.c45
-rw-r--r--cpukit/libcsupport/src/unixlibc.c11
-rw-r--r--cpukit/libcsupport/src/utsname.c61
-rw-r--r--cpukit/libmisc/README16
-rw-r--r--cpukit/libmisc/monitor/README97
-rw-r--r--cpukit/libmisc/monitor/mon-command.c187
-rw-r--r--cpukit/libmisc/monitor/mon-config.c130
-rw-r--r--cpukit/libmisc/monitor/mon-dname.c112
-rw-r--r--cpukit/libmisc/monitor/mon-driver.c136
-rw-r--r--cpukit/libmisc/monitor/mon-extension.c98
-rw-r--r--cpukit/libmisc/monitor/mon-itask.c115
-rw-r--r--cpukit/libmisc/monitor/mon-manager.c50
-rw-r--r--cpukit/libmisc/monitor/mon-monitor.c517
-rw-r--r--cpukit/libmisc/monitor/mon-mpci.c159
-rw-r--r--cpukit/libmisc/monitor/mon-object.c374
-rw-r--r--cpukit/libmisc/monitor/mon-prmisc.c254
-rw-r--r--cpukit/libmisc/monitor/mon-queue.c64
-rw-r--r--cpukit/libmisc/monitor/mon-server.c302
-rw-r--r--cpukit/libmisc/monitor/mon-symbols.c481
-rw-r--r--cpukit/libmisc/monitor/mon-task.c92
-rw-r--r--cpukit/libmisc/monitor/monitor.h443
-rw-r--r--cpukit/libmisc/monitor/symbols.h64
-rw-r--r--cpukit/libmisc/stackchk/README41
-rw-r--r--cpukit/libmisc/stackchk/check.c512
-rw-r--r--cpukit/libmisc/stackchk/internal.h96
-rw-r--r--cpukit/libmisc/stackchk/stackchk.h41
-rw-r--r--cpukit/posix/include/aio.h137
-rw-r--r--cpukit/posix/include/devctl.h30
-rw-r--r--cpukit/posix/include/intr.h72
-rw-r--r--cpukit/posix/include/mqueue.h145
-rw-r--r--cpukit/posix/include/rtems/posix/cancel.h16
-rw-r--r--cpukit/posix/include/rtems/posix/cond.h123
-rw-r--r--cpukit/posix/include/rtems/posix/condmp.h162
-rw-r--r--cpukit/posix/include/rtems/posix/intr.h153
-rw-r--r--cpukit/posix/include/rtems/posix/key.h136
-rw-r--r--cpukit/posix/include/rtems/posix/mqueue.h186
-rw-r--r--cpukit/posix/include/rtems/posix/mqueuemp.h161
-rw-r--r--cpukit/posix/include/rtems/posix/mutex.h117
-rw-r--r--cpukit/posix/include/rtems/posix/mutexmp.h161
-rw-r--r--cpukit/posix/include/rtems/posix/priority.h34
-rw-r--r--cpukit/posix/include/rtems/posix/pthread.h113
-rw-r--r--cpukit/posix/include/rtems/posix/pthreadmp.h161
-rw-r--r--cpukit/posix/include/rtems/posix/semaphore.h135
-rw-r--r--cpukit/posix/include/rtems/posix/semaphoremp.h161
-rw-r--r--cpukit/posix/include/rtems/posix/threadsup.h30
-rw-r--r--cpukit/posix/include/rtems/posix/time.h14
-rw-r--r--cpukit/posix/include/sched.h88
-rw-r--r--cpukit/posix/include/semaphore.h108
-rw-r--r--cpukit/posix/inline/rtems/posix/cond.inl76
-rw-r--r--cpukit/posix/inline/rtems/posix/intr.inl72
-rw-r--r--cpukit/posix/inline/rtems/posix/key.inl70
-rw-r--r--cpukit/posix/inline/rtems/posix/mqueue.inl83
-rw-r--r--cpukit/posix/inline/rtems/posix/mutex.inl88
-rw-r--r--cpukit/posix/inline/rtems/posix/priority.inl29
-rw-r--r--cpukit/posix/inline/rtems/posix/pthread.inl71
-rw-r--r--cpukit/posix/inline/rtems/posix/semaphore.inl71
-rw-r--r--cpukit/posix/src/aio.c113
-rw-r--r--cpukit/posix/src/cancel.c227
-rw-r--r--cpukit/posix/src/cond.c400
-rw-r--r--cpukit/posix/src/devctl.c25
-rw-r--r--cpukit/posix/src/intr.c338
-rw-r--r--cpukit/posix/src/key.c260
-rw-r--r--cpukit/posix/src/mqueue.c715
-rw-r--r--cpukit/posix/src/mutex.c570
-rw-r--r--cpukit/posix/src/psignal.c258
-rw-r--r--cpukit/posix/src/pthread.c553
-rw-r--r--cpukit/posix/src/sched.c127
-rw-r--r--cpukit/posix/src/semaphore.c576
-rw-r--r--cpukit/posix/src/time.c193
-rw-r--r--cpukit/posix/src/types.c168
-rw-r--r--cpukit/rtems/include/rtems.h121
-rw-r--r--cpukit/rtems/include/rtems/rtems/asr.h112
-rw-r--r--cpukit/rtems/include/rtems/rtems/attr.h84
-rw-r--r--cpukit/rtems/include/rtems/rtems/clock.h103
-rw-r--r--cpukit/rtems/include/rtems/rtems/dpmem.h157
-rw-r--r--cpukit/rtems/include/rtems/rtems/event.h174
-rw-r--r--cpukit/rtems/include/rtems/rtems/eventmp.h147
-rw-r--r--cpukit/rtems/include/rtems/rtems/eventset.h89
-rw-r--r--cpukit/rtems/include/rtems/rtems/intr.h160
-rw-r--r--cpukit/rtems/include/rtems/rtems/message.h317
-rw-r--r--cpukit/rtems/include/rtems/rtems/modes.h89
-rw-r--r--cpukit/rtems/include/rtems/rtems/mp.h53
-rw-r--r--cpukit/rtems/include/rtems/rtems/msgmp.h175
-rw-r--r--cpukit/rtems/include/rtems/rtems/options.h53
-rw-r--r--cpukit/rtems/include/rtems/rtems/part.h168
-rw-r--r--cpukit/rtems/include/rtems/rtems/partmp.h161
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h185
-rw-r--r--cpukit/rtems/include/rtems/rtems/region.h234
-rw-r--r--cpukit/rtems/include/rtems/rtems/regionmp.h166
-rw-r--r--cpukit/rtems/include/rtems/rtems/rtemsapi.h34
-rw-r--r--cpukit/rtems/include/rtems/rtems/sem.h248
-rw-r--r--cpukit/rtems/include/rtems/rtems/semmp.h163
-rw-r--r--cpukit/rtems/include/rtems/rtems/signal.h83
-rw-r--r--cpukit/rtems/include/rtems/rtems/signalmp.h147
-rw-r--r--cpukit/rtems/include/rtems/rtems/status.h82
-rw-r--r--cpukit/rtems/include/rtems/rtems/support.h97
-rw-r--r--cpukit/rtems/include/rtems/rtems/taskmp.h167
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasks.h419
-rw-r--r--cpukit/rtems/include/rtems/rtems/timer.h207
-rw-r--r--cpukit/rtems/include/rtems/rtems/types.h96
-rw-r--r--cpukit/rtems/inline/rtems/rtems/asr.inl128
-rw-r--r--cpukit/rtems/inline/rtems/rtems/attr.inl159
-rw-r--r--cpukit/rtems/inline/rtems/rtems/dpmem.inl95
-rw-r--r--cpukit/rtems/inline/rtems/rtems/event.inl21
-rw-r--r--cpukit/rtems/inline/rtems/rtems/eventset.inl91
-rw-r--r--cpukit/rtems/inline/rtems/rtems/message.inl83
-rw-r--r--cpukit/rtems/inline/rtems/rtems/modes.inl152
-rw-r--r--cpukit/rtems/inline/rtems/rtems/options.inl55
-rw-r--r--cpukit/rtems/inline/rtems/rtems/part.inl199
-rw-r--r--cpukit/rtems/inline/rtems/rtems/ratemon.inl143
-rw-r--r--cpukit/rtems/inline/rtems/rtems/region.inl127
-rw-r--r--cpukit/rtems/inline/rtems/rtems/sem.inl93
-rw-r--r--cpukit/rtems/inline/rtems/rtems/status.inl56
-rw-r--r--cpukit/rtems/inline/rtems/rtems/support.inl61
-rw-r--r--cpukit/rtems/inline/rtems/rtems/tasks.inl90
-rw-r--r--cpukit/rtems/inline/rtems/rtems/timer.inl142
-rw-r--r--cpukit/rtems/macros/rtems/rtems/asr.inl90
-rw-r--r--cpukit/rtems/macros/rtems/rtems/attr.inl91
-rw-r--r--cpukit/rtems/macros/rtems/rtems/dpmem.inl59
-rw-r--r--cpukit/rtems/macros/rtems/rtems/event.inl21
-rw-r--r--cpukit/rtems/macros/rtems/rtems/eventset.inl53
-rw-r--r--cpukit/rtems/macros/rtems/rtems/message.inl49
-rw-r--r--cpukit/rtems/macros/rtems/rtems/modes.inl92
-rw-r--r--cpukit/rtems/macros/rtems/rtems/options.inl39
-rw-r--r--cpukit/rtems/macros/rtems/rtems/part.inl117
-rw-r--r--cpukit/rtems/macros/rtems/rtems/ratemon.inl85
-rw-r--r--cpukit/rtems/macros/rtems/rtems/region.inl75
-rw-r--r--cpukit/rtems/macros/rtems/rtems/sem.inl58
-rw-r--r--cpukit/rtems/macros/rtems/rtems/status.inl39
-rw-r--r--cpukit/rtems/macros/rtems/rtems/support.inl44
-rw-r--r--cpukit/rtems/macros/rtems/rtems/tasks.inl58
-rw-r--r--cpukit/rtems/macros/rtems/rtems/timer.inl85
-rw-r--r--cpukit/rtems/src/dpmem.c281
-rw-r--r--cpukit/rtems/src/event.c383
-rw-r--r--cpukit/rtems/src/eventmp.c190
-rw-r--r--cpukit/rtems/src/intr.c65
-rw-r--r--cpukit/rtems/src/mp.c42
-rw-r--r--cpukit/rtems/src/msg.c714
-rw-r--r--cpukit/rtems/src/msgmp.c454
-rw-r--r--cpukit/rtems/src/part.c341
-rw-r--r--cpukit/rtems/src/partmp.c302
-rw-r--r--cpukit/rtems/src/ratemon.c385
-rw-r--r--cpukit/rtems/src/region.c486
-rw-r--r--cpukit/rtems/src/regionmp.c310
-rw-r--r--cpukit/rtems/src/rtclock.c151
-rw-r--r--cpukit/rtems/src/rtemstimer.c349
-rw-r--r--cpukit/rtems/src/sem.c570
-rw-r--r--cpukit/rtems/src/semmp.c308
-rw-r--r--cpukit/rtems/src/signal.c149
-rw-r--r--cpukit/rtems/src/signalmp.c189
-rw-r--r--cpukit/rtems/src/taskmp.c340
-rw-r--r--cpukit/rtems/src/tasks.c1098
-rw-r--r--cpukit/sapi/include/confdefs.h377
-rw-r--r--cpukit/sapi/include/rtems/config.h94
-rw-r--r--cpukit/sapi/include/rtems/extension.h136
-rw-r--r--cpukit/sapi/include/rtems/fatal.h49
-rw-r--r--cpukit/sapi/include/rtems/init.h110
-rw-r--r--cpukit/sapi/include/rtems/io.h244
-rw-r--r--cpukit/sapi/include/rtems/mptables.h29
-rw-r--r--cpukit/sapi/inline/rtems/extension.inl91
-rw-r--r--cpukit/sapi/macros/rtems/extension.inl58
-rw-r--r--cpukit/sapi/src/debug.c62
-rw-r--r--cpukit/sapi/src/exinit.c285
-rw-r--r--cpukit/sapi/src/extension.c165
-rw-r--r--cpukit/sapi/src/fatal.c38
-rw-r--r--cpukit/sapi/src/io.c345
-rw-r--r--cpukit/sapi/src/rtemsapi.c89
-rw-r--r--cpukit/score/cpu/hppa1.1/cpu.c189
-rw-r--r--cpukit/score/cpu/i386/asm.h140
-rw-r--r--cpukit/score/cpu/i386/cpu.c177
-rw-r--r--cpukit/score/cpu/i386/rtems/asm.h140
-rw-r--r--cpukit/score/cpu/i960/asm.h107
-rw-r--r--cpukit/score/cpu/i960/cpu.c155
-rw-r--r--cpukit/score/cpu/m68k/asm.h129
-rw-r--r--cpukit/score/cpu/m68k/cpu.c144
-rw-r--r--cpukit/score/cpu/m68k/m68302.h608
-rw-r--r--cpukit/score/cpu/m68k/m68360.h880
-rw-r--r--cpukit/score/cpu/m68k/qsm.h209
-rw-r--r--cpukit/score/cpu/m68k/rtems/asm.h129
-rw-r--r--cpukit/score/cpu/m68k/rtems/m68k/m68302.h608
-rw-r--r--cpukit/score/cpu/m68k/rtems/m68k/m68360.h880
-rw-r--r--cpukit/score/cpu/m68k/rtems/m68k/qsm.h209
-rw-r--r--cpukit/score/cpu/m68k/rtems/m68k/sim.h328
-rw-r--r--cpukit/score/cpu/m68k/sim.h328
-rw-r--r--cpukit/score/cpu/no_cpu/asm.h98
-rw-r--r--cpukit/score/cpu/no_cpu/cpu.c160
-rw-r--r--cpukit/score/cpu/no_cpu/cpu_asm.c165
-rw-r--r--cpukit/score/cpu/no_cpu/rtems/asm.h98
-rw-r--r--cpukit/score/cpu/sparc/README110
-rw-r--r--cpukit/score/cpu/sparc/asm.h111
-rw-r--r--cpukit/score/cpu/sparc/cpu.c404
-rw-r--r--cpukit/score/cpu/sparc/rtems/asm.h111
-rw-r--r--cpukit/score/cpu/unix/cpu.c969
-rw-r--r--cpukit/score/include/rtems/debug.h98
-rw-r--r--cpukit/score/include/rtems/score/address.h31
-rw-r--r--cpukit/score/include/rtems/score/apiext.h102
-rw-r--r--cpukit/score/include/rtems/score/bitfield.h98
-rw-r--r--cpukit/score/include/rtems/score/chain.h168
-rw-r--r--cpukit/score/include/rtems/score/context.h134
-rw-r--r--cpukit/score/include/rtems/score/copyrt.h42
-rw-r--r--cpukit/score/include/rtems/score/coremsg.h274
-rw-r--r--cpukit/score/include/rtems/score/coremutex.h171
-rw-r--r--cpukit/score/include/rtems/score/coresem.h156
-rw-r--r--cpukit/score/include/rtems/score/heap.h226
-rw-r--r--cpukit/score/include/rtems/score/interr.h94
-rw-r--r--cpukit/score/include/rtems/score/isr.h224
-rw-r--r--cpukit/score/include/rtems/score/mpci.h411
-rw-r--r--cpukit/score/include/rtems/score/mppkt.h100
-rw-r--r--cpukit/score/include/rtems/score/object.h397
-rw-r--r--cpukit/score/include/rtems/score/objectmp.h152
-rw-r--r--cpukit/score/include/rtems/score/priority.h96
-rw-r--r--cpukit/score/include/rtems/score/stack.h50
-rw-r--r--cpukit/score/include/rtems/score/states.h78
-rw-r--r--cpukit/score/include/rtems/score/sysstate.h66
-rw-r--r--cpukit/score/include/rtems/score/thread.h585
-rw-r--r--cpukit/score/include/rtems/score/threadmp.h89
-rw-r--r--cpukit/score/include/rtems/score/threadq.h301
-rw-r--r--cpukit/score/include/rtems/score/tod.h260
-rw-r--r--cpukit/score/include/rtems/score/tqdata.h91
-rw-r--r--cpukit/score/include/rtems/score/userext.h213
-rw-r--r--cpukit/score/include/rtems/score/watchdog.h185
-rw-r--r--cpukit/score/include/rtems/score/wkspace.h71
-rw-r--r--cpukit/score/include/rtems/system.h134
-rw-r--r--cpukit/score/inline/rtems/score/address.inl120
-rw-r--r--cpukit/score/inline/rtems/score/chain.inl390
-rw-r--r--cpukit/score/inline/rtems/score/coremsg.inl260
-rw-r--r--cpukit/score/inline/rtems/score/coremutex.inl124
-rw-r--r--cpukit/score/inline/rtems/score/coresem.inl54
-rw-r--r--cpukit/score/inline/rtems/score/heap.inl274
-rw-r--r--cpukit/score/inline/rtems/score/isr.inl73
-rw-r--r--cpukit/score/inline/rtems/score/mppkt.inl58
-rw-r--r--cpukit/score/inline/rtems/score/object.inl244
-rw-r--r--cpukit/score/inline/rtems/score/objectmp.inl73
-rw-r--r--cpukit/score/inline/rtems/score/priority.inl247
-rw-r--r--cpukit/score/inline/rtems/score/stack.inl81
-rw-r--r--cpukit/score/inline/rtems/score/states.inl384
-rw-r--r--cpukit/score/inline/rtems/score/sysstate.inl154
-rw-r--r--cpukit/score/inline/rtems/score/thread.inl404
-rw-r--r--cpukit/score/inline/rtems/score/threadmp.inl61
-rw-r--r--cpukit/score/inline/rtems/score/tod.inl82
-rw-r--r--cpukit/score/inline/rtems/score/tqdata.inl89
-rw-r--r--cpukit/score/inline/rtems/score/userext.inl121
-rw-r--r--cpukit/score/inline/rtems/score/watchdog.inl324
-rw-r--r--cpukit/score/inline/rtems/score/wkspace.inl57
-rw-r--r--cpukit/score/macros/README18
-rw-r--r--cpukit/score/macros/rtems/score/README18
-rw-r--r--cpukit/score/macros/rtems/score/address.inl68
-rw-r--r--cpukit/score/macros/rtems/score/chain.inl200
-rw-r--r--cpukit/score/macros/rtems/score/coremsg.inl143
-rw-r--r--cpukit/score/macros/rtems/score/coremutex.inl77
-rw-r--r--cpukit/score/macros/rtems/score/coresem.inl40
-rw-r--r--cpukit/score/macros/rtems/score/heap.inl150
-rw-r--r--cpukit/score/macros/rtems/score/isr.inl48
-rw-r--r--cpukit/score/macros/rtems/score/mppkt.inl41
-rw-r--r--cpukit/score/macros/rtems/score/object.inl148
-rw-r--r--cpukit/score/macros/rtems/score/objectmp.inl50
-rw-r--r--cpukit/score/macros/rtems/score/priority.inl170
-rw-r--r--cpukit/score/macros/rtems/score/stack.inl50
-rw-r--r--cpukit/score/macros/rtems/score/states.inl210
-rw-r--r--cpukit/score/macros/rtems/score/sysstate.inl90
-rw-r--r--cpukit/score/macros/rtems/score/thread.inl217
-rw-r--r--cpukit/score/macros/rtems/score/threadmp.inl50
-rw-r--r--cpukit/score/macros/rtems/score/tod.inl58
-rw-r--r--cpukit/score/macros/rtems/score/tqdata.inl59
-rw-r--r--cpukit/score/macros/rtems/score/userext.inl126
-rw-r--r--cpukit/score/macros/rtems/score/watchdog.inl172
-rw-r--r--cpukit/score/macros/rtems/score/wkspace.inl39
-rw-r--r--cpukit/score/src/apiext.c105
-rw-r--r--cpukit/score/src/chain.c202
-rw-r--r--cpukit/score/src/coremsg.c432
-rw-r--r--cpukit/score/src/coremutex.c269
-rw-r--r--cpukit/score/src/coresem.c184
-rw-r--r--cpukit/score/src/coretod.c235
-rw-r--r--cpukit/score/src/heap.c537
-rw-r--r--cpukit/score/src/interr.c61
-rw-r--r--cpukit/score/src/isr.c60
-rw-r--r--cpukit/score/src/mpci.c524
-rw-r--r--cpukit/score/src/object.c512
-rw-r--r--cpukit/score/src/objectmp.c275
-rw-r--r--cpukit/score/src/thread.c1257
-rw-r--r--cpukit/score/src/threadmp.c164
-rw-r--r--cpukit/score/src/threadq.c967
-rw-r--r--cpukit/score/src/userext.c204
-rw-r--r--cpukit/score/src/watchdog.c267
-rw-r--r--cpukit/score/src/wkspace.c88
-rw-r--r--testsuites/README44
-rw-r--r--testsuites/libtests/README10
-rw-r--r--testsuites/libtests/stackchk/blow.c45
-rw-r--r--testsuites/libtests/stackchk/init.c86
-rw-r--r--testsuites/libtests/stackchk/stackchk.scn9
-rw-r--r--testsuites/libtests/stackchk/system.h49
-rw-r--r--testsuites/libtests/stackchk/task1.c44
-rw-r--r--testsuites/mptests/README10
-rw-r--r--testsuites/mptests/mp01/init.c96
-rw-r--r--testsuites/mptests/mp01/node1/mp01.doc53
-rw-r--r--testsuites/mptests/mp01/node1/mp01.scn15
-rw-r--r--testsuites/mptests/mp01/node2/mp01.doc13
-rw-r--r--testsuites/mptests/mp01/node2/mp01.scn15
-rw-r--r--testsuites/mptests/mp01/system.h45
-rw-r--r--testsuites/mptests/mp01/task1.c84
-rw-r--r--testsuites/mptests/mp02/init.c60
-rw-r--r--testsuites/mptests/mp02/node1/mp02.doc47
-rw-r--r--testsuites/mptests/mp02/node1/mp02.scn14
-rw-r--r--testsuites/mptests/mp02/node2/mp02.doc13
-rw-r--r--testsuites/mptests/mp02/node2/mp02.scn14
-rw-r--r--testsuites/mptests/mp02/system.h43
-rw-r--r--testsuites/mptests/mp02/task1.c118
-rw-r--r--testsuites/mptests/mp03/delay.c31
-rw-r--r--testsuites/mptests/mp03/init.c65
-rw-r--r--testsuites/mptests/mp03/node1/mp03.doc45
-rw-r--r--testsuites/mptests/mp03/node1/mp03.scn24
-rw-r--r--testsuites/mptests/mp03/node2/mp03.doc13
-rw-r--r--testsuites/mptests/mp03/node2/mp03.scn24
-rw-r--r--testsuites/mptests/mp03/system.h56
-rw-r--r--testsuites/mptests/mp03/task1.c155
-rw-r--r--testsuites/mptests/mp04/init.c60
-rw-r--r--testsuites/mptests/mp04/node1/mp04.doc41
-rw-r--r--testsuites/mptests/mp04/node1/mp04.scn8
-rw-r--r--testsuites/mptests/mp04/node2/mp04.doc13
-rw-r--r--testsuites/mptests/mp04/node2/mp04.scn8
-rw-r--r--testsuites/mptests/mp04/system.h45
-rw-r--r--testsuites/mptests/mp04/task1.c83
-rw-r--r--testsuites/mptests/mp05/asr.c37
-rw-r--r--testsuites/mptests/mp05/init.c65
-rw-r--r--testsuites/mptests/mp05/node1/mp05.doc45
-rw-r--r--testsuites/mptests/mp05/node1/mp05.scn11
-rw-r--r--testsuites/mptests/mp05/node2/mp05.doc13
-rw-r--r--testsuites/mptests/mp05/node2/mp05.scn10
-rw-r--r--testsuites/mptests/mp05/system.h59
-rw-r--r--testsuites/mptests/mp05/task1.c106
-rw-r--r--testsuites/mptests/mp06/init.c65
-rw-r--r--testsuites/mptests/mp06/node1/mp06.doc45
-rw-r--r--testsuites/mptests/mp06/node1/mp06.scn11
-rw-r--r--testsuites/mptests/mp06/node2/mp06.doc13
-rw-r--r--testsuites/mptests/mp06/node2/mp06.scn12
-rw-r--r--testsuites/mptests/mp06/system.h50
-rw-r--r--testsuites/mptests/mp06/task1.c176
-rw-r--r--testsuites/mptests/mp07/init.c65
-rw-r--r--testsuites/mptests/mp07/node1/mp07.doc46
-rw-r--r--testsuites/mptests/mp07/node1/mp07.scn10
-rw-r--r--testsuites/mptests/mp07/node2/mp07.doc13
-rw-r--r--testsuites/mptests/mp07/node2/mp07.scn9
-rw-r--r--testsuites/mptests/mp07/system.h50
-rw-r--r--testsuites/mptests/mp07/task1.c95
-rw-r--r--testsuites/mptests/mp08/init.c74
-rw-r--r--testsuites/mptests/mp08/node1/mp08.doc52
-rw-r--r--testsuites/mptests/mp08/node1/mp08.scn11
-rw-r--r--testsuites/mptests/mp08/node2/mp08.doc13
-rw-r--r--testsuites/mptests/mp08/node2/mp08.scn12
-rw-r--r--testsuites/mptests/mp08/system.h49
-rw-r--r--testsuites/mptests/mp08/task1.c89
-rw-r--r--testsuites/mptests/mp09/init.c74
-rw-r--r--testsuites/mptests/mp09/node1/mp09.doc50
-rw-r--r--testsuites/mptests/mp09/node1/mp09.scn22
-rw-r--r--testsuites/mptests/mp09/node2/mp09.doc13
-rw-r--r--testsuites/mptests/mp09/node2/mp09.scn27
-rw-r--r--testsuites/mptests/mp09/recvmsg.c47
-rw-r--r--testsuites/mptests/mp09/sendmsg.c60
-rw-r--r--testsuites/mptests/mp09/system.h58
-rw-r--r--testsuites/mptests/mp09/task1.c109
-rw-r--r--testsuites/mptests/mp10/init.c143
-rw-r--r--testsuites/mptests/mp10/node1/mp10.doc46
-rw-r--r--testsuites/mptests/mp10/node1/mp10.scn4
-rw-r--r--testsuites/mptests/mp10/node2/mp10.doc13
-rw-r--r--testsuites/mptests/mp10/node2/mp10.scn19
-rw-r--r--testsuites/mptests/mp10/system.h62
-rw-r--r--testsuites/mptests/mp10/task1.c52
-rw-r--r--testsuites/mptests/mp10/task2.c47
-rw-r--r--testsuites/mptests/mp10/task3.c50
-rw-r--r--testsuites/mptests/mp11/init.c105
-rw-r--r--testsuites/mptests/mp11/node1/mp11.doc42
-rw-r--r--testsuites/mptests/mp11/node1/mp11.scn10
-rw-r--r--testsuites/mptests/mp11/node2/mp11.doc13
-rw-r--r--testsuites/mptests/mp11/node2/mp11.scn2
-rw-r--r--testsuites/mptests/mp11/system.h54
-rw-r--r--testsuites/mptests/mp12/init.c113
-rw-r--r--testsuites/mptests/mp12/node1/mp12.doc52
-rw-r--r--testsuites/mptests/mp12/node1/mp12.scn6
-rw-r--r--testsuites/mptests/mp12/node2/mp12.doc13
-rw-r--r--testsuites/mptests/mp12/node2/mp12.scn10
-rw-r--r--testsuites/mptests/mp12/system.h53
-rw-r--r--testsuites/mptests/mp13/init.c115
-rw-r--r--testsuites/mptests/mp13/node1/mp13.doc48
-rw-r--r--testsuites/mptests/mp13/node1/mp13.scn14
-rw-r--r--testsuites/mptests/mp13/node2/mp13.doc13
-rw-r--r--testsuites/mptests/mp13/node2/mp13.scn16
-rw-r--r--testsuites/mptests/mp13/system.h58
-rw-r--r--testsuites/mptests/mp13/task1.c73
-rw-r--r--testsuites/mptests/mp13/task2.c106
-rw-r--r--testsuites/mptests/mp14/delay.c34
-rw-r--r--testsuites/mptests/mp14/evtask1.c87
-rw-r--r--testsuites/mptests/mp14/evtmtask.c65
-rw-r--r--testsuites/mptests/mp14/exit.c33
-rw-r--r--testsuites/mptests/mp14/init.c191
-rw-r--r--testsuites/mptests/mp14/msgtask1.c107
-rw-r--r--testsuites/mptests/mp14/node1/mp14.doc50
-rw-r--r--testsuites/mptests/mp14/node1/mp14.scn41
-rw-r--r--testsuites/mptests/mp14/node2/mp14.doc13
-rw-r--r--testsuites/mptests/mp14/node2/mp14.scn38
-rw-r--r--testsuites/mptests/mp14/pttask1.c71
-rw-r--r--testsuites/mptests/mp14/smtask1.c73
-rw-r--r--testsuites/mptests/mp14/system.h115
-rw-r--r--testsuites/samples/README73
-rw-r--r--testsuites/samples/base_mp/apptask.c37
-rw-r--r--testsuites/samples/base_mp/init.c46
-rw-r--r--testsuites/samples/base_mp/node1/base_mp.doc13
-rw-r--r--testsuites/samples/base_mp/node1/base_mp.scn5
-rw-r--r--testsuites/samples/base_mp/node2/base_mp.doc13
-rw-r--r--testsuites/samples/base_mp/node2/base_mp.scn5
-rw-r--r--testsuites/samples/base_mp/system.h46
-rw-r--r--testsuites/samples/base_sp/apptask.c38
-rw-r--r--testsuites/samples/base_sp/base_sp.doc13
-rw-r--r--testsuites/samples/base_sp/base_sp.scn5
-rw-r--r--testsuites/samples/base_sp/init.c48
-rw-r--r--testsuites/samples/base_sp/system.h42
-rw-r--r--testsuites/samples/cdtest/cdtest.scn31
-rw-r--r--testsuites/samples/cdtest/init.c26
-rw-r--r--testsuites/samples/cdtest/main.cc145
-rw-r--r--testsuites/samples/cdtest/system.h41
-rw-r--r--testsuites/samples/hello/hello.doc13
-rw-r--r--testsuites/samples/hello/hello.scn3
-rw-r--r--testsuites/samples/hello/init.c36
-rw-r--r--testsuites/samples/hello/system.h35
-rw-r--r--testsuites/samples/paranoia/init.c39
-rw-r--r--testsuites/samples/paranoia/paranoia.c2300
-rw-r--r--testsuites/samples/paranoia/paranoia.doc13
-rw-r--r--testsuites/samples/paranoia/system.h40
-rw-r--r--testsuites/samples/ticker/init.c61
-rw-r--r--testsuites/samples/ticker/system.h43
-rw-r--r--testsuites/samples/ticker/tasks.c44
-rw-r--r--testsuites/samples/ticker/ticker.doc13
-rw-r--r--testsuites/samples/ticker/ticker.scn16
-rw-r--r--testsuites/sptests/README9
-rw-r--r--testsuites/sptests/sp01/init.c86
-rw-r--r--testsuites/sptests/sp01/sp01.doc43
-rw-r--r--testsuites/sptests/sp01/sp01.scn18
-rw-r--r--testsuites/sptests/sp01/system.h43
-rw-r--r--testsuites/sptests/sp01/task1.c50
-rw-r--r--testsuites/sptests/sp02/init.c152
-rw-r--r--testsuites/sptests/sp02/preempt.c32
-rw-r--r--testsuites/sptests/sp02/sp02.doc37
-rw-r--r--testsuites/sptests/sp02/sp02.scn15
-rw-r--r--testsuites/sptests/sp02/system.h58
-rw-r--r--testsuites/sptests/sp02/task1.c66
-rw-r--r--testsuites/sptests/sp02/task2.c34
-rw-r--r--testsuites/sptests/sp02/task3.c37
-rw-r--r--testsuites/sptests/sp03/init.c67
-rw-r--r--testsuites/sptests/sp03/sp03.doc24
-rw-r--r--testsuites/sptests/sp03/sp03.scn26
-rw-r--r--testsuites/sptests/sp03/system.h47
-rw-r--r--testsuites/sptests/sp03/task1.c59
-rw-r--r--testsuites/sptests/sp03/task2.c46
-rw-r--r--testsuites/sptests/sp04/init.c110
-rw-r--r--testsuites/sptests/sp04/sp04.doc38
-rw-r--r--testsuites/sptests/sp04/sp04.scn24
-rw-r--r--testsuites/sptests/sp04/system.h65
-rw-r--r--testsuites/sptests/sp04/task1.c103
-rw-r--r--testsuites/sptests/sp04/task2.c29
-rw-r--r--testsuites/sptests/sp04/task3.c29
-rw-r--r--testsuites/sptests/sp04/tswitch.c59
-rw-r--r--testsuites/sptests/sp05/init.c81
-rw-r--r--testsuites/sptests/sp05/sp05.doc26
-rw-r--r--testsuites/sptests/sp05/sp05.scn47
-rw-r--r--testsuites/sptests/sp05/system.h53
-rw-r--r--testsuites/sptests/sp05/task1.c78
-rw-r--r--testsuites/sptests/sp05/task2.c39
-rw-r--r--testsuites/sptests/sp05/task3.c39
-rw-r--r--testsuites/sptests/sp06/init.c87
-rw-r--r--testsuites/sptests/sp06/sp06.doc26
-rw-r--r--testsuites/sptests/sp06/sp06.scn40
-rw-r--r--testsuites/sptests/sp06/system.h56
-rw-r--r--testsuites/sptests/sp06/task1.c61
-rw-r--r--testsuites/sptests/sp06/task2.c40
-rw-r--r--testsuites/sptests/sp06/task3.c32
-rw-r--r--testsuites/sptests/sp07/init.c128
-rw-r--r--testsuites/sptests/sp07/sp07.doc37
-rw-r--r--testsuites/sptests/sp07/sp07.scn33
-rw-r--r--testsuites/sptests/sp07/system.h85
-rw-r--r--testsuites/sptests/sp07/task1.c85
-rw-r--r--testsuites/sptests/sp07/task2.c78
-rw-r--r--testsuites/sptests/sp07/task3.c34
-rw-r--r--testsuites/sptests/sp07/task4.c30
-rw-r--r--testsuites/sptests/sp07/taskexit.c33
-rw-r--r--testsuites/sptests/sp07/tcreate.c35
-rw-r--r--testsuites/sptests/sp07/tdelete.c37
-rw-r--r--testsuites/sptests/sp07/trestart.c34
-rw-r--r--testsuites/sptests/sp07/tstart.c34
-rw-r--r--testsuites/sptests/sp08/init.c53
-rw-r--r--testsuites/sptests/sp08/sp08.doc26
-rw-r--r--testsuites/sptests/sp08/sp08.scn22
-rw-r--r--testsuites/sptests/sp08/system.h48
-rw-r--r--testsuites/sptests/sp08/task1.c256
-rw-r--r--testsuites/sptests/sp09/delay.c28
-rw-r--r--testsuites/sptests/sp09/init.c120
-rw-r--r--testsuites/sptests/sp09/isr.c27
-rw-r--r--testsuites/sptests/sp09/screen01.c168
-rw-r--r--testsuites/sptests/sp09/screen02.c192
-rw-r--r--testsuites/sptests/sp09/screen03.c217
-rw-r--r--testsuites/sptests/sp09/screen04.c85
-rw-r--r--testsuites/sptests/sp09/screen05.c164
-rw-r--r--testsuites/sptests/sp09/screen06.c125
-rw-r--r--testsuites/sptests/sp09/screen07.c192
-rw-r--r--testsuites/sptests/sp09/screen08.c128
-rw-r--r--testsuites/sptests/sp09/screen09.c144
-rw-r--r--testsuites/sptests/sp09/screen10.c164
-rw-r--r--testsuites/sptests/sp09/screen11.c250
-rw-r--r--testsuites/sptests/sp09/screen12.c337
-rw-r--r--testsuites/sptests/sp09/screen13.c114
-rw-r--r--testsuites/sptests/sp09/screen14.c154
-rw-r--r--testsuites/sptests/sp09/sp09.doc36
-rw-r--r--testsuites/sptests/sp09/sp09.scn249
-rw-r--r--testsuites/sptests/sp09/system.h139
-rw-r--r--testsuites/sptests/sp09/task1.c70
-rw-r--r--testsuites/sptests/sp09/task2.c48
-rw-r--r--testsuites/sptests/sp09/task3.c53
-rw-r--r--testsuites/sptests/sp09/task4.c50
-rw-r--r--testsuites/sptests/sp11/init.c92
-rw-r--r--testsuites/sptests/sp11/sp11.doc26
-rw-r--r--testsuites/sptests/sp11/sp11.scn74
-rw-r--r--testsuites/sptests/sp11/system.h88
-rw-r--r--testsuites/sptests/sp11/task1.c410
-rw-r--r--testsuites/sptests/sp11/task2.c126
-rw-r--r--testsuites/sptests/sp11/timer.c97
-rw-r--r--testsuites/sptests/sp12/init.c179
-rw-r--r--testsuites/sptests/sp12/pridrv.c131
-rw-r--r--testsuites/sptests/sp12/pritask.c91
-rw-r--r--testsuites/sptests/sp12/sp12.doc27
-rw-r--r--testsuites/sptests/sp12/sp12.scn78
-rw-r--r--testsuites/sptests/sp12/system.h80
-rw-r--r--testsuites/sptests/sp12/task1.c153
-rw-r--r--testsuites/sptests/sp12/task2.c65
-rw-r--r--testsuites/sptests/sp12/task3.c50
-rw-r--r--testsuites/sptests/sp12/task4.c37
-rw-r--r--testsuites/sptests/sp12/task5.c55
-rw-r--r--testsuites/sptests/sp13/fillbuff.c31
-rw-r--r--testsuites/sptests/sp13/init.c112
-rw-r--r--testsuites/sptests/sp13/putbuff.c29
-rw-r--r--testsuites/sptests/sp13/sp13.doc25
-rw-r--r--testsuites/sptests/sp13/sp13.scn72
-rw-r--r--testsuites/sptests/sp13/system.h66
-rw-r--r--testsuites/sptests/sp13/task1.c344
-rw-r--r--testsuites/sptests/sp13/task2.c139
-rw-r--r--testsuites/sptests/sp13/task3.c78
-rw-r--r--testsuites/sptests/sp14/asr.c47
-rw-r--r--testsuites/sptests/sp14/init.c72
-rw-r--r--testsuites/sptests/sp14/sp14.doc24
-rw-r--r--testsuites/sptests/sp14/sp14.scn33
-rw-r--r--testsuites/sptests/sp14/system.h76
-rw-r--r--testsuites/sptests/sp14/task1.c116
-rw-r--r--testsuites/sptests/sp14/task2.c48
-rw-r--r--testsuites/sptests/sp15/init.c78
-rw-r--r--testsuites/sptests/sp15/sp15.doc24
-rw-r--r--testsuites/sptests/sp15/sp15.scn16
-rw-r--r--testsuites/sptests/sp15/system.h58
-rw-r--r--testsuites/sptests/sp15/task1.c129
-rw-r--r--testsuites/sptests/sp16/init.c128
-rw-r--r--testsuites/sptests/sp16/sp16.doc24
-rw-r--r--testsuites/sptests/sp16/sp16.scn58
-rw-r--r--testsuites/sptests/sp16/system.h83
-rw-r--r--testsuites/sptests/sp16/task1.c282
-rw-r--r--testsuites/sptests/sp16/task2.c86
-rw-r--r--testsuites/sptests/sp16/task3.c57
-rw-r--r--testsuites/sptests/sp16/task4.c60
-rw-r--r--testsuites/sptests/sp16/task5.c73
-rw-r--r--testsuites/sptests/sp17/asr.c32
-rw-r--r--testsuites/sptests/sp17/init.c69
-rw-r--r--testsuites/sptests/sp17/sp17.doc35
-rw-r--r--testsuites/sptests/sp17/sp17.scn8
-rw-r--r--testsuites/sptests/sp17/system.h56
-rw-r--r--testsuites/sptests/sp17/task1.c48
-rw-r--r--testsuites/sptests/sp17/task2.c45
-rw-r--r--testsuites/sptests/sp19/first.c66
-rw-r--r--testsuites/sptests/sp19/fptask.c98
-rw-r--r--testsuites/sptests/sp19/fptest.h165
-rw-r--r--testsuites/sptests/sp19/init.c150
-rw-r--r--testsuites/sptests/sp19/inttest.h149
-rw-r--r--testsuites/sptests/sp19/sp19.doc23
-rw-r--r--testsuites/sptests/sp19/sp19.scn55
-rw-r--r--testsuites/sptests/sp19/system.h55
-rw-r--r--testsuites/sptests/sp19/task1.c59
-rw-r--r--testsuites/sptests/sp20/getall.c43
-rw-r--r--testsuites/sptests/sp20/init.c68
-rw-r--r--testsuites/sptests/sp20/sp20.doc24
-rw-r--r--testsuites/sptests/sp20/sp20.scn27
-rw-r--r--testsuites/sptests/sp20/system.h59
-rw-r--r--testsuites/sptests/sp20/task1.c116
-rw-r--r--testsuites/sptests/sp21/init.c53
-rw-r--r--testsuites/sptests/sp21/sp21.doc28
-rw-r--r--testsuites/sptests/sp21/sp21.scn19
-rw-r--r--testsuites/sptests/sp21/system.h44
-rw-r--r--testsuites/sptests/sp21/task1.c105
-rw-r--r--testsuites/sptests/sp22/delay.c32
-rw-r--r--testsuites/sptests/sp22/init.c66
-rw-r--r--testsuites/sptests/sp22/prtime.c32
-rw-r--r--testsuites/sptests/sp22/sp22.doc20
-rw-r--r--testsuites/sptests/sp22/sp22.scn29
-rw-r--r--testsuites/sptests/sp22/system.h55
-rw-r--r--testsuites/sptests/sp22/task1.c164
-rw-r--r--testsuites/sptests/sp23/init.c69
-rw-r--r--testsuites/sptests/sp23/sp23.doc26
-rw-r--r--testsuites/sptests/sp23/sp23.scn9
-rw-r--r--testsuites/sptests/sp23/system.h54
-rw-r--r--testsuites/sptests/sp23/task1.c96
-rw-r--r--testsuites/sptests/sp24/init.c76
-rw-r--r--testsuites/sptests/sp24/resume.c34
-rw-r--r--testsuites/sptests/sp24/sp24.doc51
-rw-r--r--testsuites/sptests/sp24/sp24.scn16
-rw-r--r--testsuites/sptests/sp24/system.h53
-rw-r--r--testsuites/sptests/sp24/task1.c58
-rw-r--r--testsuites/sptests/sp25/init.c66
-rw-r--r--testsuites/sptests/sp25/sp25.doc32
-rw-r--r--testsuites/sptests/sp25/sp25.scn29
-rw-r--r--testsuites/sptests/sp25/system.h54
-rw-r--r--testsuites/sptests/sp25/task1.c241
-rw-r--r--testsuites/sptests/spfatal/fatal.c135
-rw-r--r--testsuites/sptests/spfatal/init.c51
-rw-r--r--testsuites/sptests/spfatal/puterr.c68
-rw-r--r--testsuites/sptests/spfatal/spfatal.doc28
-rw-r--r--testsuites/sptests/spfatal/spfatal.scn8
-rw-r--r--testsuites/sptests/spfatal/system.h79
-rw-r--r--testsuites/sptests/spfatal/task1.c29
-rw-r--r--testsuites/sptests/spsize/getint.c32
-rw-r--r--testsuites/sptests/spsize/init.c60
-rw-r--r--testsuites/sptests/spsize/size.c648
-rw-r--r--testsuites/sptests/spsize/system.h45
-rw-r--r--testsuites/support/include/tmacros.h127
-rw-r--r--testsuites/tmtests/README21
-rw-r--r--testsuites/tmtests/include/timesys.h58
-rw-r--r--testsuites/tmtests/tm01/system.h41
-rw-r--r--testsuites/tmtests/tm01/task1.c189
-rw-r--r--testsuites/tmtests/tm01/tm01.doc13
-rw-r--r--testsuites/tmtests/tm02/system.h42
-rw-r--r--testsuites/tmtests/tm02/task1.c158
-rw-r--r--testsuites/tmtests/tm02/tm02.doc13
-rw-r--r--testsuites/tmtests/tm03/system.h42
-rw-r--r--testsuites/tmtests/tm03/task1.c151
-rw-r--r--testsuites/tmtests/tm03/tm03.doc13
-rw-r--r--testsuites/tmtests/tm04/system.h41
-rw-r--r--testsuites/tmtests/tm04/task1.c388
-rw-r--r--testsuites/tmtests/tm04/tm04.doc13
-rw-r--r--testsuites/tmtests/tm05/system.h42
-rw-r--r--testsuites/tmtests/tm05/task1.c132
-rw-r--r--testsuites/tmtests/tm05/tm05.doc13
-rw-r--r--testsuites/tmtests/tm06/system.h42
-rw-r--r--testsuites/tmtests/tm06/task1.c162
-rw-r--r--testsuites/tmtests/tm06/tm06.doc13
-rw-r--r--testsuites/tmtests/tm07/system.h42
-rw-r--r--testsuites/tmtests/tm07/task1.c120
-rw-r--r--testsuites/tmtests/tm07/tm07.doc13
-rw-r--r--testsuites/tmtests/tm08/system.h42
-rw-r--r--testsuites/tmtests/tm08/task1.c255
-rw-r--r--testsuites/tmtests/tm08/tm08.doc13
-rw-r--r--testsuites/tmtests/tm09/system.h40
-rw-r--r--testsuites/tmtests/tm09/task1.c226
-rw-r--r--testsuites/tmtests/tm09/tm09.doc13
-rw-r--r--testsuites/tmtests/tm10/system.h41
-rw-r--r--testsuites/tmtests/tm10/task1.c165
-rw-r--r--testsuites/tmtests/tm10/tm10.doc13
-rw-r--r--testsuites/tmtests/tm11/system.h41
-rw-r--r--testsuites/tmtests/tm11/task1.c155
-rw-r--r--testsuites/tmtests/tm11/tm11.doc13
-rw-r--r--testsuites/tmtests/tm12/system.h41
-rw-r--r--testsuites/tmtests/tm12/task1.c146
-rw-r--r--testsuites/tmtests/tm12/tm12.doc13
-rw-r--r--testsuites/tmtests/tm13/system.h41
-rw-r--r--testsuites/tmtests/tm13/task1.c154
-rw-r--r--testsuites/tmtests/tm13/tm13.doc13
-rw-r--r--testsuites/tmtests/tm14/system.h41
-rw-r--r--testsuites/tmtests/tm14/task1.c146
-rw-r--r--testsuites/tmtests/tm14/tm14.doc13
-rw-r--r--testsuites/tmtests/tm15/system.h41
-rw-r--r--testsuites/tmtests/tm15/task1.c222
-rw-r--r--testsuites/tmtests/tm15/tm15.doc13
-rw-r--r--testsuites/tmtests/tm16/system.h41
-rw-r--r--testsuites/tmtests/tm16/task1.c148
-rw-r--r--testsuites/tmtests/tm16/tm16.doc13
-rw-r--r--testsuites/tmtests/tm17/system.h41
-rw-r--r--testsuites/tmtests/tm17/task1.c127
-rw-r--r--testsuites/tmtests/tm17/tm17.doc13
-rw-r--r--testsuites/tmtests/tm18/system.h41
-rw-r--r--testsuites/tmtests/tm18/task1.c112
-rw-r--r--testsuites/tmtests/tm18/tm18.doc13
-rw-r--r--testsuites/tmtests/tm19/system.h41
-rw-r--r--testsuites/tmtests/tm19/task1.c208
-rw-r--r--testsuites/tmtests/tm19/tm19.doc13
-rw-r--r--testsuites/tmtests/tm20/system.h42
-rw-r--r--testsuites/tmtests/tm20/task1.c466
-rw-r--r--testsuites/tmtests/tm20/tm20.doc13
-rw-r--r--testsuites/tmtests/tm21/system.h48
-rw-r--r--testsuites/tmtests/tm21/task1.c236
-rw-r--r--testsuites/tmtests/tm21/tm21.doc13
-rw-r--r--testsuites/tmtests/tm22/system.h41
-rw-r--r--testsuites/tmtests/tm22/task1.c200
-rw-r--r--testsuites/tmtests/tm22/tm22.doc13
-rw-r--r--testsuites/tmtests/tm23/system.h41
-rw-r--r--testsuites/tmtests/tm23/task1.c302
-rw-r--r--testsuites/tmtests/tm23/tm23.doc13
-rw-r--r--testsuites/tmtests/tm24/system.h40
-rw-r--r--testsuites/tmtests/tm24/task1.c124
-rw-r--r--testsuites/tmtests/tm24/tm24.doc13
-rw-r--r--testsuites/tmtests/tm25/system.h41
-rw-r--r--testsuites/tmtests/tm25/task1.c109
-rw-r--r--testsuites/tmtests/tm25/tm25.doc13
-rw-r--r--testsuites/tmtests/tm26/fptest.h165
-rw-r--r--testsuites/tmtests/tm26/system.h41
-rw-r--r--testsuites/tmtests/tm26/task1.c550
-rw-r--r--testsuites/tmtests/tm26/tm26.doc13
-rw-r--r--testsuites/tmtests/tm27/system.h40
-rw-r--r--testsuites/tmtests/tm27/task1.c272
-rw-r--r--testsuites/tmtests/tm27/tm27.doc13
-rw-r--r--testsuites/tmtests/tm28/system.h41
-rw-r--r--testsuites/tmtests/tm28/task1.c134
-rw-r--r--testsuites/tmtests/tm28/tm28.doc13
-rw-r--r--testsuites/tmtests/tm29/system.h41
-rw-r--r--testsuites/tmtests/tm29/task1.c207
-rw-r--r--testsuites/tmtests/tm29/tm29.doc13
-rw-r--r--testsuites/tmtests/tmck/system.h40
-rw-r--r--testsuites/tmtests/tmck/task1.c180
-rw-r--r--testsuites/tmtests/tmck/tmck.doc20
-rw-r--r--testsuites/tmtests/tmoverhd/dumrtems.h255
-rw-r--r--testsuites/tmtests/tmoverhd/empty.c41
-rw-r--r--testsuites/tmtests/tmoverhd/system.h58
-rw-r--r--testsuites/tmtests/tmoverhd/testtask.c1279
-rw-r--r--testsuites/tmtests/tmoverhd/tmoverhd.doc13
-rw-r--r--tools/build/README32
-rw-r--r--tools/build/cklength.c364
-rw-r--r--tools/build/eolstrip.c351
-rw-r--r--tools/build/os/msdos/README12
-rw-r--r--tools/build/os/msdos/cklength.uue286
-rw-r--r--tools/build/os/msdos/fixtimer.c111
-rw-r--r--tools/build/os/msdos/fixtimer.uue162
-rw-r--r--tools/build/os/msdos/ifc.c331
-rw-r--r--tools/build/os/msdos/ifc_exe.uue163
-rw-r--r--tools/build/packhex.c513
-rw-r--r--tools/build/scripts/README32
-rw-r--r--tools/build/src/cklength.c364
-rw-r--r--tools/build/src/eolstrip.c351
-rw-r--r--tools/build/src/packhex.c513
-rw-r--r--tools/build/src/unhex.c721
-rw-r--r--tools/build/unhex.c721
-rw-r--r--tools/cpu/hppa1.1/genoffsets.c346
-rw-r--r--tools/cpu/unix/gensize.c116
-rw-r--r--tools/update/310_to_320_list543
-rw-r--r--tools/update/README7
2140 files changed, 275899 insertions, 0 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000000..2dcc27f9c5
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,56 @@
+#
+# $Id$
+#
+
+NOTE: The string <release> should be replaced with
+ the appropriate release number of RTEMS.
+
+This file only discusses the installation of .tgz files.
+For more detailed information on the installation of RTEMS,
+refer to the Release Notes manual in the file
+/pub/rtems/releases/<release>/doc/c_or_ada/relnotes.tgz on
+lancelot.gcs.redstone.army.mil.
+
+UNCOMPRESSING .tgz FILES
+===========================
+Many of the files found in this directory and its subdirectories
+are gzip'ed, tar archive files. These files have the ".tgz"
+extension. They were compressed with gzip version 1.2.4.
+
+Use a command sequence similar to the following to uncompress each
+file:
+
+ gzcat FILE.tgz | tar xvof -
+
+where FILE.tgz is the file to be installed. This procedure will
+extract the files in the archive into the current directory.
+All of the .tgz files associated with this release RTEMS will
+place their contents in a subdirectory rtems-<release> in the current
+directory.
+
+If you are unsure of what is in an RTEMS archive file, then use
+the following command sequence to get a listing of the contents:
+
+ gzcat FILE.tgz | tar tvf -
+
+NOTES:
+
+(1) The "-o" option to tar is included on the tar command line
+ so that the user extracting the tar archive will own the extracted
+ files.
+
+(2) gzcat is sometimes installed as zcat. Be warned that on many
+ (most) UNIX machines, zcat is associated with compress (.Z files).
+
+(3) If you do not have gzip 1.2.4, it is available from numerous sites
+ including this one. Other sites include prep.ai.mit.edu and
+ gatekeeper.dec.com.
+
+(4) The GNU archive files included in this distribution are packaged
+ exactly like they are on official GNU ftp sites. When extracting
+ GNU archives, they will not extract under a rtems-<version>
+ directory. They will extract themselves under a directory which
+ is the name and version of the tool in question. For example,
+ gcc-2.5.8.tgz will extract its contents into the subdirectory
+ gcc-2.5.8.
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..cfedde3c5f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,118 @@
+#
+# $Id$
+#
+ LICENSE INFORMATION
+
+For the purposes of this document the Real Time Executive for
+Missile Systems (RTEMS) is defined to include all source code,
+documentation, shell utilities developed by On-Line Applications
+Research Corporation (OAR) under contract of the U.S. Army
+Missile Command. OAR obtained the copyright for RTEMS and
+subsequently assigned ownership of said copyright to the
+U.S. Government. As part of this transfer, OAR waived all
+claims of ownership for RTEMS. Since OAR no longer makes claims
+of ownership of RTEMS, OAR in no event shall be held liable
+for damages including any general, special, incidental or
+consequential damages arising out of the use or inability
+to use the RTEMS software or documentation or of the support
+services provided (including but not limited to loss of data or
+data being rendered inaccurate or losses sustained by you or
+third parties or a failure of the program to operate with any
+other programs), even if advised of the possibility of such damages.
+
+Simply stated any file containing the U.S. Government
+copyright notice or relocatables derived from one or more of
+these files are covered by this agreement.
+
+RTEMS may be reproduced by or for the U.S. Government pursuant
+to the copyright license under the clause at DFARS 252.227-7013.
+The following notice must appear in all copies of RTEMS and its
+derivatives:
+
+ COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ On-Line Applications Research Corporation (OAR).
+ All rights assigned to U.S. Government, 1994.
+
+ This material may be reproduced by or for the U.S. Government
+ pursuant to the copyright license under the clause at DFARS
+ 252.227-7013. This notice must appear in all copies of this
+ material and its derivatives.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code and documentation must retain the
+ above copyright notice, this list of conditions and the following
+ disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ Redistributions in binary form must contain or make available the
+ RTEMS source code.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed for the U.S. Government
+ by On-Line Applications Research Corp.
+
+ 4. Neither the name of the author nor the U.S. Government may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+
+RTEMS is provided "AS IS" without warranty of any kind, either
+expressed or implied, including, but not limited to, the implied
+warranties of merchantability, title and fitness for a
+particular purpose. The U.S. Government does not warrant that
+the RTEMS software or documentation will satisfy your requirements
+or that the software and documentation are without defect or error
+or that the operation of the software will be uninterrupted.
+
+The U.S. Government shall in no event shall be held liable for
+damages including any general, special, incidental or consequential
+damages arising out of the use or inability to use the RTEMS software
+or documentation or of the support services provided (including
+but not limited to loss of data or data being rendered
+inaccurate or losses sustained by you or third parties or a
+failure of the program to operate with any other programs), even
+if the U.S. Government has been advised of the possibility of such damages.
+
+The U.S. Government reserves the right to revise this material
+and to make changes from time to time in the content hereof without
+obligation to notify anyone or any organization of such revision
+or changes.
+
+OAR remains the sole organization authorized by contract to
+distribute or provide support and training for the Real-Time
+Executive for Multiprocessor Systems (RTEMS).
+
+In order to promote future research activities within the U.S.
+Government, we request that potential users of RTEMS notify us
+as to the systems that RTEMS is being utilized. This will allow
+us to publicize our Dual-Use / Reuse capabilities in support of
+the current administration's goals. This can be accomplished by
+calling the RTEMS phone numbers published in the documentation
+or by electronic mail to "rtems@redstone.army.mil". Your
+cooperation is greatly appreciated. Again, thank you for using
+RTEMS.
+
+RTEMS
+U.S. ARMY Missile Command
+ATTN: AMSMI-RD-GC-S
+Redstone Arsenal, AL 35898-5254
+Voice: (205) 842-6906
+FAX: (205) 842-6917
+EMAIL: rtems@redstone.army.mil
+
+
+On-Line Applications Research Corporation.
+2227 Drake Avenue SW
+Suite 10-F
+Huntsville, AL 35805
+(205) 883-0131
+
+
+
+
diff --git a/README b/README
new file mode 100644
index 0000000000..02931b8bcb
--- /dev/null
+++ b/README
@@ -0,0 +1,93 @@
+#
+# $Id$
+#
+
+Directory Overview
+==================
+
+This is the top level of the RTEMS directory structure. The following
+is a description of the files and directories in this directory:
+
+ INSTALL
+ Rudimentary installation instructions. For more detailed
+ information please see the Release Notes. The Postscript
+ version of this manual can be found in the file
+ c_or_ada/doc/relnotes.tgz.
+
+ LICENSE
+ Required legalese.
+
+ README
+ This file.
+
+ c
+ This directory contains the source code for the C
+ implementation of RTEMS as well as the test suites, sample
+ applications, Board Support Packages, Device Drivers, and
+ support libraries.
+
+ doc
+ This directory contains the PDL for the RTEMS executive.
+
+Ada versus C
+============
+
+There are two implementations of RTEMS in this source tree --
+in Ada and in C. These two implementations are functionally
+and structurally equivalent. The C implementation follows
+the packaging conventions and hiearchical nature of the Ada
+implementation. In addition, a style has been followed which
+allows one to easily find the corresponding Ada and C
+implementations.
+
+File names in C and code placement was carefully designed to insure
+a close mapping to the Ada implementation. The following file name
+extensions are used:
+
+ .adb - Ada body
+ .ads - Ada specification
+ .adp - Ada body requiring preprocessing
+ .inc - include file for .adp files
+
+ .c - C body (non-inlined routines)
+ .inl - C body (inlined routines)
+ .h - C specification
+
+In the executive source, XYZ.c and XYZ.inl correspond directly to a
+single XYZ.adb or XYZ.adp file. A .h file corresponds directly to
+the .ads file. There are only a handful of .inc files in the
+Ada source and these are used to insure that the desired simple
+inline textual expansion is performed. This avoids scoping and
+calling convention side-effects in carefully constructed tests
+which usually test context switch behavior.
+
+In addition, in Ada code and data name references are always fully
+qualified as PACKAGE.NAME. In C, this convention is followed
+by having the package name as part of the name itself and using a
+capital letter to indicate the presence of a "." level. So we have
+PACKAGE.NAME in Ada and _Package_Name in C. The leading "_" in C
+is used to avoid naming conflicts between RTEMS and user variables.
+By using these conventions, one can easily compare the C and Ada
+implementations.
+
+The most noticeable difference between the C and Ada83 code is
+the inability to easily obtain a "typed pointer" in Ada83.
+Using the "&" operator in C yields a pointer with a specific type.
+The 'Address attribute is the closest feature in Ada83. This
+returns a System.Address and this must be coerced via Unchecked_Conversion
+into an access type of the desired type. It is easy to view
+System.Address as similar to a "void *" in C, but this is not the case.
+A "void *" can be assigned to any other pointer type without an
+explicit conversion.
+
+The solution adopted to this problem was to provide two routines for
+each access type in the Ada implementation -- one to convert from
+System.Address to the access type and another to go the opposite
+direction. This results in code which accomplishes the same thing
+as the corresponding C but it is easier to get lost in the clutter
+of the apparent subprogram invocations than the "less bulky"
+C equivalent.
+
+A related difference is the types which are only in Ada which are used
+for pointers to arrays. These types do not exist and are not needed
+in the C implementation.
diff --git a/SUPPORT b/SUPPORT
new file mode 100644
index 0000000000..6d64a4d0e3
--- /dev/null
+++ b/SUPPORT
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+For support and training contact:
+
+On-Line Applications Research
+2227 Drake Avenue SW Suite 10-F
+Huntsville AL 35805
+(205) 883-0131
+
+OAR offers support and classes for RTEMS as well as custom
+development services such as ports to new processors and
+the development of custom board support packages and device
+drivers.
+
+OAR developed RTEMS under contract to the U.S. Army Missile Command.
+
diff --git a/c/ACKNOWLEDGEMENTS b/c/ACKNOWLEDGEMENTS
new file mode 100644
index 0000000000..06a4b1545e
--- /dev/null
+++ b/c/ACKNOWLEDGEMENTS
@@ -0,0 +1,88 @@
+#
+# $Id$
+#
+
+RTEMS was developed by On-Line Applications Research (OAR) under
+contract to the U.S. Army Missile Command. Other than the
+contributions listed in this document, all code and documentation
+was developed by OAR for the Army.
+
+The RTEMS project would like to thank those who have made
+contributions to the project. Together we make RTEMS a
+much better product.
+
+The following persons/organizations have made contributions:
+
++ Dr. Mikhail (Misha) Savitski (mms@eiscathq.irf.se) of the EISCAT Scientific
+ Association submitted the BSP and other miscellaneous support for the
+ Motorola MVME162 (M68040LC CPU) VMEbus single board computer.
+
++ Division Inc. of Chapel Hill, NC for sponsoring On-Line Applications
+ Research to port RTEMS to the Hewlett-Packard PA-RISC architecture (V1.1)
+ and the addition of HP-UX as a development host. Tony Bennett
+ (tbennett@divnc.com) was assisted in this effort by Joel Sherrill
+ (jsherril@redstone.army.mil). Tony also deserves a big pat on the
+ back for contributing significantly to the overall organization
+ of the development environment and directory structure. RTEMS
+ is much easier to build because of Tony.
+
++ Greg Allen of Division Inc. of Chapel Hill, NC for
+ porting RTEMS to HP-UX. This port treats a UNIX computer as simply
+ another RTEMS target processor. This port can be used to develop
+ and test code which will ultimately run on the embedded platform.
+
++ Doug McBride (mcbride@rodin.colorado.edu) of the Colorado Space Grant
+ College at the University of Colorado at Boulder submitted the BSP
+ for the Motorola IDP board (M68EC040 CPU) single board computer. The
+ BSP leverages heavily off of the existing RTEMS BSP framework, the
+ examples in the back of the IDP user's manual, and the libgloss example
+ support for the IDP board from the newlib/libgloss distribution.
+
++ David Glessner (dwg@glenqcy.glenayre.com) of Glenayre Electronics
+ submitted the support for the Motorola MC68302 CPU. This included
+ the "gen68302" BSP which uses the on-chip peripherals on the MC68302
+ as well as the modifications to the m68k dependent executive code to
+ support m68k family members based on the mc68000 core.
+
++ Bryce Cogswell (cogswell@cs.uoregon.edu) submitted the support for MS-DOS
+ as a development environment as well as djgpp/go32 as a target environment.
+
++ Andy Bray (andy@i-cubed.demon.co.uk) of I-CUBED Ltd. in Cambridge U.K.
+ for porting RTEMS to the PowerPC. This effort included support for the
+ IBM 403 as well as the Motorola 601, 603, and 604 variants. A special
+ thanks to Dom Latter (dom@i-cubed.demon.co.uk) for being an RTEMS
+ evangelist and promoting the use of RTEMS both at I-CUBED Ltd. as well
+ as within the Internet community as a whole.
+
++ John S. Gwynne (jsg@coulomb.eng.ohio-state.edu) of Ohio State University
+ submitted the support for the Motorola MC68332 CPU as well as completing
+ the support for CPUs based on the MC68000 core. This included the "efi68k"
+ and "efi332" BSPs as well as completing the modifications to the m68k
+ dependent executive code to support m68k family members based on the
+ MC68000 core. "efi68k" and "efi332" are single board computers designed
+ primarily for automotive electronic fuel injection (EFI) control, but can
+ be considered general purpose controllers when used without the EFI
+ companion board(s). See the README in each BSP for more information.
+
++ The European Space Agency for sponsoring On-Line Applications Research
+ to port RTEMS to the SPARC V7 architecture for use with their ERC32
+ radiation-hardened CPU. Jiri Gaisler (jgais@wd.estec.esa.nl) deserves
+ special thanks for championing this port within the ESA was well as
+ for developing and supporting the SPARC Instruction Simulator used to
+ develop and test this port.
+
++ Eric Norum (eric@skatter.usask.ca) of the Saskatchewan Accelerator
+ Laboratory submitted the support for the Motorola MC68360 CPU
+ including the `gen68360' BSP.
+
+Finally, the RTEMS project would like to thank those who have contributed
+to the other free software efforts which RTEMS utilizes. The primary RTEMS
+development environment is from the Free Software Foundation (the GNU
+project). The "newlib" C library was put together by Cygnus and is
+a collaboration of the efforts of numerous individuals and organizations.
+
+We would like to see your name here. BSPs and ports are always welcome.
+Useful libraries which support RTEMS applications are also an important
+part of providing a strong foundation for the development of real-time
+embedded applications and are welcome as submission.
+
diff --git a/c/PROBLEMS b/c/PROBLEMS
new file mode 100644
index 0000000000..affbfa6778
--- /dev/null
+++ b/c/PROBLEMS
@@ -0,0 +1,66 @@
+#
+# $Id$
+#
+
+This is the list of outstanding problems in this release.
+
++ The POSIX threads and real time extensions code in this tree does
+ not work yet and is intentionally not in the normal build path.
+
++ The test spfatal is out of date and as a result will NOT execute
+ correctly. The addition of POSIX and consequent ongoing initialization
+ reorganization makes it pointless to fix this until the POSIX support
+ is completely in place.
+
++ The m68000 support is nearly complete now. The missing piece
+ inside the executive proper is support for the software interrupt
+ stack. Also, the m68k family has become quite large and an
+ understanding of the compatibility of the peripherals on the various
+ members of the 683xx family would allow someone to designate some
+ of the drivers submitted for the gen683xx BSPs as useful on other
+ members.
+
++ The only i960 family member tested is the CA. No support for the
+ floating point support found in other family members is present.
+ This also implies that RTEMS may "think" of something as generic
+ across the i960 family when in fact it is specific to the CA.
+ To make matters worse, the i960 target board owned by the RTEMS Project
+ is now broken and as a result even the i960CA is a "compile only" port.
+
++ Some of the BSPs still define RAM_START and RAM_END in the bsp.h file.
+ It is better to define these in the linkcmds file. It is also nice
+ to use the linkcmds file to place overlays for on-board hardware.
+
++ The __read() system call in all of the BSPs using single
+ character input/output needs to be smarter. The following
+ issues need to be addressed:
+
+ + echoing of characters on input
+ + CR/NL echoing
+ + backspaces
+ + tabs
+
++ UNIX port notes:
+
+ + sometimes a stray SIGALRM is reported as spfatal completes.
+
+ + There are conflicts between the names of native library routines
+ which MUST be used and those in the POSIX support. This must
+ be addressed.
+
++ Some of the tests may execute correctly and not produce the exact
+ ordering of lines in the screen file. This appears to be a combination
+ of a number of factors including buffering, processor speed, IO
+ device overhead, and clock interrupt rate.
+
++ The compiler configuration files (c/make/gcc-XYZ.cfg) are largely
+ the same when the different targets have the same CPU. It would
+ be desirable to have a gcc-CPU.cfg or gcc-CPU_MODEL.cfg (e.g.
+ gcc-m68k.cfg or gcc-m68020.cfg) and have the file gcc-TARGET.cfg
+ include this and possibly override default settings.
+
++ The clock device drivers should really avoid doing the division
+ by 1000 in the clock tick ISR to convert microseconds into
+ milliseconds. This only applies to clock drivers which generate
+ an ISR each millisecond and only call rtems_clock_tick every
+ so many ISRs.
diff --git a/c/README b/c/README
new file mode 100644
index 0000000000..99eac9de18
--- /dev/null
+++ b/c/README
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+
+This is the top level of the RTEMS directory structure. The following
+is a description of the files and directories in this directory:
+
+ LICENSE
+ Required legalese.
+
+ Makefile
+ The top-level Make command file used to build the C implementation
+ of RTEMS. [RTEMS assumes the use of GNU make.]
+
+ Modules
+ Example Modules command files used to configure the user's environment
+ for RTEMS. These require the Modules system administration package
+ available from numerous ftp sites.
+
+ README
+ This file.
+
+ REQUIRES
+ A list of the other tools which are assumed to be installed
+ before RTEMS is built.
+
+ SUPPORT
+ Information on third-party support for RTEMS.
+
+ build-tools
+ This directory contains the source for various utilities
+ needed to build RTEMS.
+
+ make
+ Make command files "included" from those in the source distribution.
+ [RTEMS assumes the use of GNU make.]
+
+ patches
+ This directory contains patches for this release of RTEMS.
+
+ src
+ This directory contains the source code for the C
+ implementation of RTEMS as well as the test suites, sample
+ applications, Board Support Packages, Device Drivers, and
+ support libraries.
diff --git a/c/README.DOS b/c/README.DOS
new file mode 100644
index 0000000000..5219479910
--- /dev/null
+++ b/c/README.DOS
@@ -0,0 +1,72 @@
+#
+# $Id$
+#
+
+tools
+-----
+The RTEMS build procedure was designed with the capabilitiies of a
+typical UNIX computer in mind. Making this procedure work under MS-DOS
+is not that difficult but requires that MS-DOS versions of a number
+of UNIX utilities be acquired and installed. For time being, the
+best advice which can be offered is:
+
+ "This is a nasty question, since when I first set up the DOS machine
+ (long before I acquired RTEMS) I ftp'd a bunch of different tool
+ sets (all from SimTel), and then picked individual tools from each
+ set that worked best for me. The djgpp tools are probably a good
+ starting point, especially to get a working sed. Next the gnu tools
+ in SimTel/msdos/gnuish, and then others. Sorry I can't give you more
+ specific names. The only real requirement for the tools is that
+ they *must* accept redirection of command line arguments from a file
+ using the '@' notation (i.e., "mkdir @/tmp/args" reads the argument
+ list from file /tmp/args)."
+
+There is a special version (source and executable) of GNU make 3.71 for
+MS-DOS which minimizes the amount of memory used by recursive makes
+available on lancelot.gcs.redstone.army.mil in the file:
+
+/pub/msdos/gmake371.tgz
+
+Many of the RTEMS specific utilities used in the build and installation
+are UNIX shell scripts. On a UNIX host, these are normally interpreted
+by the Bourne Again Shell (BASH) or the Korn Shell (ksh). Most of these
+scripts can be successfully executed with the following shell from the
+MS-DOS archives from Simtel.
+
+SimTel/msdos/sysutil/ms_sh23b.zip
+
+Please be sure to use the 16-bit version. The Simtel archives are
+available from ftp.cdrom.com as well as a number of mirror sites.
+
+go32
+----
+go32 dumps the stack when a program seg-faults, and if this happens while
+on an alternate stack an infinite loop can ensue. Setting the environment
+variable GO32="core /tmp/core" will prevent more than 20 lines or
+so of stack information from being dumped after a crash, and the output
+will go to a file rather than the screen.
+
+The go32 debuggers get confused by the relocated stacks used by tasks,
+and tend to crash when variables are inspected.
+
+djgcc include files
+-------------------
+In general, we use RTEMS include files because these contain the proper
+declarations for the libc, and in particular, the stdio functions.
+When calling go32-specific functions it is necessary to include some
+djgpp include files, as well. Unfortunately, there are some disagreements
+between RTEMS and djgpp as to how certain functions and types are
+declared. In these cases, the RTEMS source have been modified to
+special-case the differences.
+
+other
+-----
+* Pressing F12 will immediately abort the program.
+See lib/libbsp/i386/go32/console/inch.c.
+
+* lib/libbsp/i386/go32/timer uses the on-board timer chip by default,
+which has a resolution of about 1 microsecond. However, if executing
+on a Pentium processor you can use the on-chip 64-bit cycle counter,
+which counts at whatever clock rate your processor runs at. To enable
+this, set RTEMS_CPU_MODEL=pentium in make/custom/go32.cfg.
+
diff --git a/c/REQUIRES b/c/REQUIRES
new file mode 100644
index 0000000000..196cf5b070
--- /dev/null
+++ b/c/REQUIRES
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+
+1. The installation procedure assumes that "gcc" is installed
+ and is in your path for the installation of local tools.
+
+2. gcc 2.6.3 with crossgcc patches (ftp.cygnus.com:/pub/embedded)
+
+3. binutils 2.5.2
+
+4. newlib with RTEMS configurations.
+
diff --git a/c/TESTED b/c/TESTED
new file mode 100644
index 0000000000..e1d98b322c
--- /dev/null
+++ b/c/TESTED
@@ -0,0 +1,56 @@
+#
+# $Id$
+#
+
+The RTEMS Project does not have all of the development computers or
+target boards included in the RTEMS distribution. Many of the BSPs
+are user supplied and we try to insure that they compile before each
+full release. This file describes the range of configurations the
+RTEMS project can internally test.
+
+Host Development Systems
+========================
+
+All RTEMS development is done on a Sun SPARCStation running Solaris 2.3 and
+all other host systems are not tested internally.
+
+Target Systems
+==============
+
+The following table describes the testability of each BSP by the RTEMS project:
+
+ CPU CPU
+ FAMILY MODEL TARGET STATUS
+ ====== ========= =================== =================
+ m68k m68000 efi68k (note 1)
+ m68k m68020 Motorola MVME136 TESTED INTERNALLY
+ m68k m68lc040 Motorola MVME162 (note 1)
+ m68k m68ec040 Motorola IDP (note 1)
+ m68k m68020 DY-4 DMV152 (note 1)
+ m68k m68302 generic 68302 (note 1)
+ m68k m68332 efi332 (note 1)
+ i386 i386_fp Force CPU-386 TESTED INTERNALLY
+ i386 i486 DJGPP/PC-AT TESTED INTERNALLY
+ i386 pentium DJGPP/PC-AT TESTED INTERNALLY
+ i960 i960ca Cyclone CVME961 (note 4)
+ hppa hppa7100 simhppa (note 2)
+ ppc 403 Papyrus (note 2)
+ UNIX NA Solaris 2 (SPARC) TESTED INTERNALLY (inlines)
+ UNIX NA Solaris 2 (SPARC) TESTED INTERNALLY (macros)
+ UNIX NA Linux (i386) (note 5)
+ UNIX NA HPUX (PA-RISC) (note 2)
+ no_cpu NA no_bsp (note 3)
+
+
+(1) Target board is not owned by RTEMS Project. The target is known
+ to compile and link with all appropriate tests successfully.
+ If the target does not support multiprocessor configurations, then
+ "ALL TESTS" does not include the multiprocessor tests.
+
+(2) RTEMS Project cannot internally compile or test this target.
+
+(3) Target is not intended to be executed. It is only an example.
+
+(4) The RTEMS Project owns this board but it is broken at the moment.
+
+(5) The RTEMS Project owns a Linux host but does not regularly test this BSP.
diff --git a/c/UPDATE_HELP b/c/UPDATE_HELP
new file mode 100644
index 0000000000..520d99aafc
--- /dev/null
+++ b/c/UPDATE_HELP
@@ -0,0 +1,52 @@
+#
+# $Id$
+#
+
+Between RTEMS 3.1.0 and 3.2.0, every RTEMS defined symbol made visible
+was renamed. This document describes the change and the tools provided
+to assist you in updating your RTEMS 3.1.0 application.
+
+[NOTE: This change was not included in snapshots prior to 3.1.15.]
+
+DESCRIPTION OF NAME CHANGES:
+============================
+
+The primary change was the addition of the prefix "rtems_" or "RTEMS_" to
+EVERY user visible RTEMS provided constant and routine. The primary
+factor in the decision to make such a sweeping change was conflicts
+between the the RTEMS and POSIX API's.
+
+
+TO UPDATE YOUR APPLICATION:
+===========================
+
+The update script requires that Perl be installed on your computer.
+It has only been tested with Perl 5.x.
+
+After RTEMS has been built, in the directory "$r/<BSP>/update_tools", will
+be a set of tools to aid in making the application source changes necessary
+to address (hopefully) all of the name changes in the RTEMS API between
+releases 3.1.0 and 3.2.0.
+
+The update shell script is the only executable which is invoked by the
+user directly. The word-replace Perl script is invoked by the update
+shell script.
+
+WARNING: These tools modify the files IN PLACE!!! Backup your
+ source before using these tools.
+
+To udpate your application, change directories to the top of your application
+source tree and execute the update script. It should be something similar
+to the following:
+
+cd MY_APP
+$r/<BSP>/update-tools/update
+
+The update script will ask if you have backed up your source code before
+beginning the update process. While operating on files, it will print
+the name of each file and a dot for each change made to the source file.
+
+NOTE: These scripts do not attempt to address changes in calling
+ sequences. After the script has run, you will need to update
+ calls to rtems_clock_get(), rtems_timer_fire_after(), and
+ rtems_timer_fire_when() by hand.
diff --git a/c/build-tools/README b/c/build-tools/README
new file mode 100644
index 0000000000..0436fc958d
--- /dev/null
+++ b/c/build-tools/README
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+Misc. support tools for RTEMS workspaces.
+More will be added later as they are converted from Teamware
+to CVS.
+
+install-if-change
+ Smart install script that also can append suffixes as it
+ installs (suffixes used for debug and profile variants).
+ Requires bash or ksh.
+
+rcs-clean
+ deletes all files from the current directory that can be
+ re-created from RCS. Careful to not delete locked files.
+ May be used by 'gmake clobber'
+
+lock-directory
+unlock-directory
+ traverse a directory structure making it unwritable.
+ Useful to keep people from accidentally overwriting
+ "released" trees if they get confused about which
+ module they have loaded.
+
+rtems-glom
+ glom together all the rtems libraries in order to simplify
+ the link line used by applications.
+ Produces rtems.rel.
+ Not used by the RTEMS src tree at all.
+ Strictly optional.
+
diff --git a/c/build-tools/cklength.c b/c/build-tools/cklength.c
new file mode 100644
index 0000000000..6059cacb1f
--- /dev/null
+++ b/c/build-tools/cklength.c
@@ -0,0 +1,364 @@
+/*
+ * cklength - check the length of lines in a file
+ *
+ * This program check to see if the files passed to it on the command line
+ * contain a line which exceeds the maximum allowable length. The default
+ * maximum line length is 80.
+ *
+ * usage: cklength [ -v ] [ arg ... ] files...
+ * -l length -- maximum line length
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "l:nNv"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -l length -- maximum line length\n\
+ -n -- report line numbers for offending lines\n\
+ -N -- report line numbers and length for offending lines\n\
+ -v -- verbose\n\
+\n\
+Print the name of files which have at least 1 line which exceeds the\n\
+maximum line length. The default maximum line length is 80.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 512
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int report_line_numbers = FALSE; /* report line numbers of offenders */
+int report_line_length = FALSE; /* report line length of offenders */
+
+int line_length = 80; /* maximum allowable line length */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 'l': /* line length */
+ line_length = atoi( optarg );
+ if ( line_length < 0 || line_length > BUFFER_SIZE )
+ error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
+ break;
+
+ case 'n': /* toggle report_line_numbers */
+ report_line_numbers = ! report_line_numbers;
+ break;
+
+ case 'N': /* toggle both reports */
+ report_line_numbers = ! report_line_numbers;
+ report_line_length = ! report_line_length;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int line_number;
+ int length;
+ int count;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ count = 0;
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( length <= line_length )
+ continue;
+
+ if ( count == 0 ) {
+ fprintf( stderr, "%s\n", arg );
+ if ( !report_line_numbers )
+ break;
+ }
+
+ if ( verbose )
+ fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
+
+ if ( report_line_numbers ) {
+ if ( report_line_length )
+ fprintf( stderr, "%d: %d\n" , line_number, length );
+ else
+ fprintf( stderr, "%d\n" , line_number );
+ }
+
+ count++;
+
+ }
+
+ fclose( in );
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/c/build-tools/eolstrip.c b/c/build-tools/eolstrip.c
new file mode 100644
index 0000000000..b4e0d5d165
--- /dev/null
+++ b/c/build-tools/eolstrip.c
@@ -0,0 +1,351 @@
+/*
+ * eolstrip - strip white space from end of lines
+ *
+ * This program strips the white space from the end of every line in the
+ * specified program.
+ *
+ * usage: eolstrip [ -v ] [ arg ... ] files...
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "vt"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -v -- verbose\n\
+ -t -- test only .. DO NOT OVERWRITE FILE!!!\n\
+\n\
+Strip the white space from the end of every line on the list of files.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 2048
+#define MAX_PATH 2048
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int test_only = FALSE; /* test only */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 't': /* toggle test only mode */
+ test_only = ! test_only;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ FILE *out = (FILE *) 0;
+ char outname[ MAX_PATH ];
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int length;
+ int line_number;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ if ( !test_only ) {
+ sprintf( outname, "%s.eoltmp", arg );
+
+ out = fopen( outname, "w" );
+ if (!out)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+ }
+
+ if ( verbose )
+ fprintf( stderr, "Processing %s\n", arg );
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( buffer[ length ] != '\n' )
+ error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
+
+ while ( isspace( buffer[ length ] ) )
+ buffer[ length-- ] = '\0';
+
+ if ( test_only ) {
+ fprintf( stderr, "%s\n", arg );
+ break;
+ }
+
+ fprintf( out, "%s\n", buffer );
+ }
+
+ fclose( in );
+ if ( !test_only ) {
+ fclose( out );
+ rename( outname, arg );
+ }
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/c/build-tools/os/msdos/README b/c/build-tools/os/msdos/README
new file mode 100644
index 0000000000..af3b0dfb31
--- /dev/null
+++ b/c/build-tools/os/msdos/README
@@ -0,0 +1,12 @@
+#
+# $Id$
+#
+
+ifc is an MS-DOS executable which is equivalent to the program
+install-if-change. It was compiled using Borland C 2.00.
+
+cklength is a precompiled version of the program cklength.c from
+the main source tree.
+
+fixtimer is a program to restore the clock if the program does not
+exit cleanly.
diff --git a/c/build-tools/os/msdos/cklength.uue b/c/build-tools/os/msdos/cklength.uue
new file mode 100644
index 0000000000..fd8052cd9a
--- /dev/null
+++ b/c/build-tools/os/msdos/cklength.uue
@@ -0,0 +1,286 @@
+#
+# $Id$
+#
+begin 664 cklength
+M?T5,1@$" 0 " ( ! $,% #0 "T8 T "
+M!0 H !H %P 8 T $ - "@ H 4 P
+M -0 !$ ! ! ! 7
+M2P %TL % $ $ !=, (73 &\ %? < 0
+M @ %U A=0 (@ !P O=7-R+VQI8B]L9"YS
+M;RXQ $, !6 20 #P
+M #@ $4 /0 !P !# &@
+M A 30 #\ *0 $X !" D
+M $@ W $8 )@ "
+M ! %( 4P Z *@ 00
+M $H 'P $L !5 3P L .P %0 H
+M-@ #$ P 40
+M
+M
+M G
+M '0 C ; N
+M "( -0 E #D R - !X
+M "T ,P !$ *P
+M ^ "\ 3 % !'
+M 0#4 , $ $ Z # "
+M ! U0 P P 0BT , 0 $*W #
+M % !"S P !@ 0P4 , < $32
+M # ( !$^ P "0 1/L , H $3
+M] # + !% P # A=, , T
+M (74 # . "%]@ P #P ACP , !
+M (9" # 1 P $@ ,
+M !, # 4 P %0
+M , !8 # 7 P &
+M , !D ! (8. 2 " !$_0 $0 "P !8
+M 0P4 =!( < = (8U 2 (@ "&$0 $@
+M "< 1/L !$ H U (8O 2 / "&0@ $$0
+M$0 $4 AB8 !( !. (9# 01 1 5P "',@
+M$0#_\0 %P 1+ 2!( < !B $2> $@2 ' 9P !$8@
+M "H$@ !P &\ AD8 !0"$ !$ !T (73 1 /_Q B@ "
+M&*0 $@ ) A@( !( "7 (8% 2
+MG !$T@ $@ " *( ACT !!$ ! "J (9$ 01 1
+M M "&E@ )@$0 $0 , AB !( #' (8\ 01
+M 0 S0 "%U $0#_\0 -8 0[H !0!( < #> (9&
+M 4 1 1 Y "&E@ )@$0 $0 /$ AC@ !( #W (8
+M+ 2 _P "&" $@ 04 AD, !"$ !$ $-
+M (<N 01 1 !$P "&+ $@ 1H 1 H !8!( <
+M $@ (8_ 01 0 !,P "'+P $$0 $0 3H AC( !(
+M $_ (<P 01 1 !1@ "&&@ $@ 4P AS$
+M!!$ !$ %3 (8^ 01 0 !9P "&0@ $0#_\0 6X A?8
+M !$ __$ &( (87 2 !C@ "&1 $$0 $0 9<
+M 1,( /!( < &I $3\ 1 * !M@ !%TL $0#_\0
+M ;T 10 !!$ P '* $2, $@2 ' !SP "&(P $@
+M =8 0R( !( < 'H $3^ 1 + !]0 !#10 '4
+M$@ !P ?H AD !!$ ! (& (8= 2 "#0 !$^
+M $@ "0 A, AA0 !( 9V5T;W!T %]?1%1/4E],25-47U\
+M7W-T87)T ')E860 871O:0!?7T-43U)?3$E35%]? '-T<G1O; !P<F]G;F%M
+M90!V9G!R:6YT9@!?96YV:7)O;@!?96YD %=R:71E %)E860 9V5T<&%R;0!?
+M:6]B %]'3$]"04Q?3T9&4T547U1!0DQ%7P!A8F]R= !A=&5X:70 97AI= !?
+M:6YI= !V97)B;W-E %]S>7-?;F5R<@!S>7-?97)R;&ES= !F8VQO<V4 55-!
+M1T4 7T193D%-24, <')O8V5S<P!?7VEO8@!?<WES7V5R<FQI<W0 =W)I=&4
+M<W1R<F-H<@!?97AI= !E;G9I<F]N &5R<FYO '-T<F-H<@!E<G)O<@!R97!O
+M<G1?;&EN95]L96YG=&@ ;W!T:6YD &]P96X ;W!T87)G &9G971S &]P=&5R
+M<@!R97!O<G1?;&EN95]N=6UB97)S %]E9&%T80!?4%)/0T5$55)%7TQ)3DM!
+M1T5?5$%"3$5? &9O<&5N '-Y<U]N97)R %]?9&]?9VQO8F%L7V1T;W)S %]?
+M0U1/4E]%3D1?7P!?971E>'0 7VQI8E]V97)S:6]N $]P96X 9F9L=7-H %]?
+M9&]?9VQO8F%L7V-T;W)S %]?1%1/4E]%3D1?7P!M86EN &QI;F5?;&5N9W1H
+M '-T<FQE;@!?9FEN:0!F<')I;G1F &QI8F,N<V\N,0 AD, C$P
+M AS$ !#$P AS !!$P AR\ _$P AD8 U
+M$P " AD0 !($P AI8 P$P A@( K%0 A@4
+M L%0 A@@ Y%0 A@L X%0 A@X :%0
+M AA$ >%0 AA0 !5%0 AA< !'%0 AAH !"%0
+M AAT !3%0 AB Q%0 AB, !.%0 AB8 B
+M%0 ABD J%0 ABP \%0 AB\ @%0 AC(
+M ! %0 AC4 =%0 AC@ W%0 "\$" X .@0*(#H$2<
+M(Z @@) 0* 20$ !0 !"]@$ 1 !$D!(CX$ 0O(! 0 !P $
+M "0$ 0DA $94L( *4 J $E 1 "A< (:6$N$,U"+ $ "D! 0 !"
+MYP$ ! $+H 0 ('#X @! $0 1-0"(^R HK__$H #9(2(^S0 F $
+M@*(@ * F4$" E@)@!)(0( "2 F $T ) "X"B( 2O__]E *@ 9*2@ "
+M@ ,$0 1!$ $2B$B/LH2I@ M $ !&?P@ 0 *"$/_PRO__]T 0 $1$
+M $1 $+!D!(C"(''X B!Z G>._F*@0 !BB$" L! @ - &0 ! $+!DA @
+M+Q, (: HB $H !- B80@0@ $T 9 - "80B0 B !T")A"!$ (;0 B$(
+MT"9 !$ (? (B#$(0 AB< (8E "&%0 19 0 !22$ 90 !"KI02H:"
+MHC__ H ,X"B(&PB@ 1$0 AQ2 F HB!N@*(@/P* "J HB!. H '- $
+M(/@0O__P%0 10* !. HB!V H 'M $H/00O__J%0 14 0IO0 B# E!
+M"!$ (: HJ( "+__XM0B(0 3 !%$0@ $ (N2$F&H$+__W14 $70!"#X
+M@* ")!@/_\0O__7T"0@^("@ B08#__T"0@^- $X/R H (D& __Q"__\_0
+M).#\@* ")!@/_\0O__+T"2@]!"__\FB$" !@*1@ "* L1 "'%0 AA$
+M (:0$B$X$P 19(28<A $)VU *@\$ 0F60$" !DA "- "(+R1*B "T 9
+M"("B( "@ 1(0 A] "8+R1*B "0 #] &0 B HC__(H K 0/__0!""\
+MD (@ = D(+R1*B "T 9 "("B( 2O__SDA $(''X B!Z G>.]F) 0 !@3
+M !%0 !"6I(28="JD@ $H !Z80( 1& $P 19(28=A !%E! &* 0
+M( &H![WX)0 ABT (:0$ 4DA B $ 0DV4$ 5@*(@ * #4! 0 !"
+M2Y 0 !2B C__$0 AM "(0" I$ (!( *X"DX 2@ +$0 AA, $60%*$X
+MDA)A^$ 0C64$ 8T 6@^("B( "@ B$0 AM "(/2 HB H !Q, $60
+M%*$XDA)B )00 !! $(HE@>]^- %H/B HB H $A$ (;0 B#\@*(@ *
+M D3 !%D!2A.)(28AB4$ 00 !"&Y80 !$0@ (I@3@ 1, $60%*$XDA)B
+M($ 0A24$ 0I@3@ 1"__\B@!" !0 !"&Y 0 !6P$" @<?@"('H "=X[^0
+M\B>@2/0GH$SV)Z!0^">@5/HGH%@1 "&0 !"$I 2(2@1' LBX "!$0 "
+MC@ ( H !*('H$P1 "'\@(@N. 'H$@5 "&-0 AI 6H3@3 !%DA)B*$
+M0?/4 J$(D!:A.)(0 !! $(!E! $8"F8 "@ :$0 A@2 !*0$B$X$0
+MAM "(1" ID (-H #!$ (85 "&E!*B6)<N8 *0%J$X$P 19(28C! $'=
+MU + "A" X1 "&D!(A.!, $62$F(X0 !!UI00 !D0@ '$0 AI 2(3@3
+M !%0 !!T)(28E 1 "&0 !!W) 2(3@1# @(X " * !41" @(X " *
+M R IF H !1$ $41 !%$( Y(2(EB2$B)P?___M) 0( ! $&MD!
+M&9 0( 3 !%?___KI(28GA $'+ 0 (''X B!Z G>._F* 0 !@1 !%
+MD!(BD$ 0<;23 @*(@ !* F0$ 0$0@ !, $62$F*@?___G)00 ! 0
+M@ :L! &9(0( ! $&\E! @ + 0 B I@ 9!H !("F !H$@ 1 0 ("F
+M0!H2@ ($0@ !, $62$F*XE! $'___XF6$ :,( !Q, $62$F+0E!
+M&Y80 !E___^"F! &H''X B!Z G>._F* 0 !B0$ 0DA &4 0:*4$ :
+ML! "("F/_\2@ ($1@ !, $62$F+PE! $)80 !E___]PF! &H''X B!
+MZ G>._F* 0 !B0$ 0DA &4 09.4$ :L! "("F/_\2@ ($1@ !,
+M $62$F,0E! $)80 !E___]>F! &H''X B!Z G>._F* 0 !B0$ 0DA
+M&4 0824$ :L! "("F/_\2@ ($1@ !, $62$F,PE! $)80 !E___],
+MF! &H''X B!Z G>._F!$ $32 B/X@*)@ * F@$B/XT 0 )_" "@
+M!" $T 0 ("B( 2O__[ 0 (''X B!Z G>._F)WCOZ"!Z G>._F!$
+M $34 B/L@**__Q* V2$B/LT )@!("B( "@ )E! @ )8"8 22$" D@)@
+M!- "0 N HB $K___90"H &2DH H #!$ $01 !$HA(C[*$J8 +0! 1
+MG\( $ "@A#_\,K___= $ !$1 !$0 !!$) 2(PB!Q^ (@>@ (''X B!
+MZ G>._H(''X B!Z _____P #_____ ! '5S
+M86=E.B @8VML96YG=&@@(%L@+78@72!;(&%R9R N+BX@72!F:6QE<RXN+B *
+M(" @(" @(" @(" @+6P@;&5N9W1H(" @+2T@;6%X:6UU;2!L:6YE(&QE;F=T
+M: H@(" @(" @(" @(" M;B @(" @(" @(" M+2!R97!O<G0@;&EN92!N=6UB
+M97)S(&9O<B!O9F9E;F1I;F<@;&EN97,*(" @(" @(" @(" @+4X@(" @(" @
+M(" @+2T@<F5P;W)T(&QI;F4@;G5M8F5R<R!A;F0@;&5N9W1H(&9O<B!O9F9E
+M;F1I;F<@;&EN97,*(" @(" @(" @(" @+78@(" @(" @(" @+2T@=F5R8F]S
+M90H*4')I;G0@=&AE(&YA;64@;V8@9FEL97,@=VAI8V@@:&%V92!A="!L96%S
+M=" Q(&QI;F4@=VAI8V@@97AC965D<R!T:&4*;6%X:6UU;2!L:6YE(&QE;F=T
+M:"X@(%1H92!D969A=6QT(&UA>&EM=6T@;&EN92!L96YG=&@@:7,@.# N"@
+M &PZ;DYV *"5D*2!I<R!I;&QE9V%L(&QI;F4@;&5N9W1H"@ E<P
+M '( 56YA8FQE('1O(&]P96X@9FEL92 H)7,I"@ E
+M<PH %1/3R!,3TY'.B5D.B E<PH "5D.B E9 H )60*
+M E<SH@ " H)7,I"@ ("AU;FMN;W=N(&5R<FYO/25D*0H "@
+M !F871A;"!E<G)O<BP@97AI=&EN9P !E>&ET:6YG &9A=&%L(&5R
+M<F]R+"!A8F]R=&EN9P # Q,C,T-38W.#DM G)7,G(&ES(&YO="!A
+M(&YU;6)E<@ E<R!C86X@;VYL>2!B92 E;&0 E<R!M=7-T(&)E
+M(&)E='=E96X@)6QD(&%N9" E;&0 &]P96XH)R5S)RP@,'@E>"P@,"5O*2!F
+M86EL960 <F5A9"@E9"P@,'@E>"P@)60I(&9A:6QE9 !W<FET
+M92@E9"P@,'@E>"P@)60I(&9A:6QE9 (74 $ (; # !$T@
+M - $3X 0 0#H !0 !"+0 * ")0 8 0-4 "P
+M ! 5 , A?8 @ .0 4 !P !< 0LP
+M!P !"MP ( !. D ,
+M # P,+__\P$ #
+M \,+__\ $ # !(,+__[0$ # !4,+__Z@$ # !@,+__YP$
+M # !L,+__Y $ # !X,+__X0$ # "$,+__W@$ # "0,+__
+MVP$ # "<,+__V $ # "H,+__U0$ # "T,+__T@$ # #
+M,+__SP$ # #,,+__S $ # #8,+__R0$ # #D,+__Q@$ #
+M #P,+__PP$ # #\,+__P $ # $(,+__O0$ ! $4"
+M % $
+M 0 __$ $ U # ! ! .@ P @ 0-4
+M , , $(M # $ !"MP P !0
+M 0LP , 8 $,% # ' !$T@ P "
+M 1/@ , D $3[ # * !$_0 P
+M"P 10 , P (73 # - "%U
+M P #@ A?8 , \ (8\ # 0 "&0@
+M P $0 , !( # 3
+M P % , !4 # 6
+M P %P , !@ # 9
+M #P ! #_\0 !8 0 __$ B $
+M /_Q +0 !$U @ " $, 0R( < !2 (8\
+M ! 0 8 ! #_\0 &L 0T4 < !Z
+M $ /_Q A ! #_\0 (\ 1-$ ( < "E
+M $31 ' M "&00 0 $ ,( 0 __$
+M #) (8. 2 T !$_0 $0 "P -X 0P4 =!(
+M < #E (8U 2 Z@ "&$0 $@ .\ 1/L
+M !$ H #] (8O 2 !! "&0@ $$0 $0 0T AB8
+M !( $6 (9# 01 1 !'P "',@ $0#_\0 20
+M 1+ 2!( < $J $2> $@2 ' !+P !$8@ "H$@ !P
+M 3< AD8 !0"$ !$ $\ (73 1 /_Q !4@ "&*0 $@
+M 5@ A@( !( %? (8% 2 !9 !$T@
+M$@ " 6H ACT !!$ ! %R (9$ 01 1 !? "&E@
+M )@$0 $0 8@ AB !( &/ (8\ 01 0 !E0 "
+M%U $0#_\0 9X 0[H !0!( < &F (9& 4 1 1 !
+MK "&E@ )@$0 $0 ;D AC@ !( &_ (8+ 2
+M !QP "&" $@ <T AD, !"$ !$ '5 (<N 01
+M 1 !VP "&+ $@ >( 1 H !8!( < 'H (8_
+M 01 0 !^P "'+P $$0 $0 @( AC( !( (' (<
+MP 01 1 "#@ "&&@ $@ A0 AS$ !!$ !$ (;
+M (8^ 01 0 "+P "&0@ $0#_\0 C8 A?8 !$ __$
+M )0 (87 2 "5@ "&1 $$0 $0 E\ 1,( /!(
+M < )Q $3\ 1 * "?@ !%TL $0#_\0 H4 10
+M!!$ P *2 $2, $@2 ' "EP "&(P $@ IX 0R(
+M !( < *P $3^ 1 + "O0 !#10 '4$@ !P L(
+M AD !!$ ! +. (8= 2 "U0 !$^ $@ "0
+M ML AA0 !( 9V\S,B]C:VQE;F=T: !C<G1I+G, =F%L=65S+5AA
+M+F, 8W)T<W1U9F8N8P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@ 9V-C,E]C;VUP
+M:6QE9"X 9F]R8V5?=&]?9&%T80!C:VQE;F=T:"YC &=C8S)?8V]M<&EL960N
+M &QI8F=C8S(N8P!C<G1S='5F9BYC %]?9&]?9VQO8F%L7V-T;W)S7V%U> !G
+M8V,R7V-O;7!I;&5D+@!F;W)C95]T;U]D871A &-R=&XN<P!G971O<'0 7U]$
+M5$]27TQ)4U1?7P!?<W1A<G0 <F5A9 !A=&]I %]?0U1/4E],25-47U\ <W1R
+M=&]L '!R;V=N86UE '9F<')I;G1F %]E;G9I<F]N %]E;F0 5W)I=&4 4F5A
+M9 !G971P87)M %]I;V( 7T=,3T)!3%]/1D93151?5$%"3$5? &%B;W)T &%T
+M97AI= !E>&ET %]I;FET '9E<F)O<V4 7W-Y<U]N97)R '-Y<U]E<G)L:7-T
+M &9C;&]S90!54T%'10!?1%E.04U)0P!P<F]C97-S %]?:6]B %]S>7-?97)R
+M;&ES= !W<FET90!S=')R8VAR %]E>&ET &5N=FER;VX 97)R;F\ <W1R8VAR
+M &5R<F]R ')E<&]R=%]L:6YE7VQE;F=T: !O<'1I;F0 ;W!E;@!O<'1A<F<
+M9F=E=', ;W!T97)R ')E<&]R=%]L:6YE7VYU;6)E<G, 7V5D871A %]04D]#
+M14154D5?3$E.2T%'15]404),15\ 9F]P96X <WES7VYE<G( 7U]D;U]G;&]B
+M86Q?9'1O<G, 7U]#5$]27T5.1%]? %]E=&5X= !?;&EB7W9E<G-I;VX 3W!E
+M;@!F9FQU<V@ 7U]D;U]G;&]B86Q?8W1O<G, 7U]$5$]27T5.1%]? &UA:6X
+M;&EN95]L96YG=&@ <W1R;&5N %]F:6YI &9P<FEN=&8 $ %
+MFP UD "]D # %$X ((X
+M $8\ ! *",I4W5N3U,@-2XS($=E;F5R:6,@4V5P=&5M
+M8F5R(#$Y.3, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,*
+M $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@
+M4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A
+M8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N
+M,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C,
+M;&0Z("A31U4I(%-U;D]3+T5,1B H3$LM,2XS*0 0 "D 8?
+M"V0 1,( (60 1,( +3P /(
+M 7H <( EX L(
+M SH !$H !5H !=(
+M !EH !LX !SX !
+MX8 !]( "#( ".8
+M "5( "<( "D8 "G8
+M "R( #&8 $GH %+(
+M & %.8 ) %0X -< %3H #0 %
+M6H #4 %9( #8 %;X #< %>8 #@
+M %A( #D %CX #H %FH $8 %IX
+M %T( &T %]( "X &"20 !\L 1,( "YI;G1E
+M<G +FAA<V@ +F1Y;G-Y;0 N9'EN<W1R "YR96QA+F)S<P N<F5L82YP;'0
+M+G1E>'0 +FEN:70 +F9I;FD +F-T;W)S "YD=&]R<P N<F]D871A "YG;W0
+M+F1Y;F%M:6, +G!L= N9&%T80 N8G-S "YS>6UT86( +G-T<G1A8@ N<W1A
+M8BYI;F1E> N8V]M;65N= N<W1A8@ N<VAS=')T86( +G-T86(N:6YD97AS
+M='( +G-T86)S='( '9A;'5E<RU882YC "\Q,#DS+V]N,3 Y,U]W<R]U<W(O
+M<W)C+VQI8B]L:6)C+P!P;W)T+V=E;B]V86QU97,M6&$N8P %AT(#L@5CTR
+M+C +VYE="]M;W)G86YA+W5S<C$O<G1E;7,M,RXU+C P+V,O8G5I;&0M=&]O
+M;',O<W)C "]U<W(O8V-S+VQI8B]V86QU97,M6&$N;P ;&EB9V-C,BYC "]U
+M<W(T+T=.050O9V-C+3(N-BXS+P N+VQI8F=C8S(N8P!G8V,R7V-O;7!I;&5D
+M+@!I;G0Z=#$]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T-SL 8VAA<CIT,CUR
+M,CLP.S$R-SL ;&]N9R!I;G0Z=#,]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T
+M-SL =6YS:6=N960@:6YT.G0T/7(Q.S [+3$[ &QO;F<@=6YS:6=N960@:6YT
+M.G0U/7(Q.S [+3$[ &QO;F<@;&]N9R!I;G0Z=#8]<C$[,#$P,# P,# P,# P
+M,# P,# P,# P,# [,#<W-S<W-S<W-S<W-S<W-S<W-S<W-SL ;&]N9R!L;VYG
+M('5N<VEG;F5D(&EN=#IT-SUR,3LP,# P,# P,# P,# P.S Q-S<W-S<W-S<W
+M-S<W-S<W-S<W-S<W.P!S:&]R="!I;G0Z=#@]<C$[+3,R-S8X.S,R-S8W.P!S
+M:&]R="!U;G-I9VYE9"!I;G0Z=#D]<C$[,#LV-34S-3L <VEG;F5D(&-H87(Z
+M=#$P/7(Q.RTQ,C@[,3(W.P!U;G-I9VYE9"!C:&%R.G0Q,3UR,3LP.S(U-3L
+M9FQO870Z=#$R/7(Q.S0[,#L 9&]U8FQE.G0Q,SUR,3LX.S [ &QO;F<@9&]U
+M8FQE.G0Q-#UR,3LX.S [ &-O;7!L97@@:6YT.G0Q-3US.')E86PZ,2PP+#,R
+M.VEM86<Z,2PS,BPS,CL[ &-O;7!L97@@9FQO870Z=#$V/7(Q-CLT.S [ &-O
+M;7!L97@@9&]U8FQE.G0Q-SUR,3<[.#LP.P!C;VUP;&5X(&QO;F<@9&]U8FQE
+M.G0Q.#UR,3@[.#LP.P!V;VED.G0Q.3TQ.0!A<F-H7W1Y<&4Z5#(P/65!4D-(
+M7S,R0DE4.C L05)#2%\V-$))5#HQ+#L <F5G7V-L87-S.E0R,3UE3D]?4D5'
+M4SHP+$=%3D5204Q?4D5'4SHQ+$907U)%1U,Z,BQ!3$Q?4D5'4SHS+$Q)35]2
+M14=?0TQ!4U-%4SHT+#L ;6%C:&EN95]M;V1E.E0R,CUE5D])1&UO9&4Z,"Q1
+M26UO9&4Z,2Q(26UO9&4Z,BQ04TEM;V1E.C,L4TEM;V1E.C0L4$1);6]D93HU
+M+$1);6]D93HV+%1);6]D93HW+$]);6]D93HX+%%&;6]D93HY+$A&;6]D93HQ
+M,"Q4449M;V1E.C$Q+%-&;6]D93HQ,BQ$1FUO9&4Z,3,L6$9M;V1E.C$T+%1&
+M;6]D93HQ-2Q30VUO9&4Z,38L1$-M;V1E.C$W+%A#;6]D93HQ."Q40VUO9&4Z
+M,3DL0U%);6]D93HR,"Q#2$EM;V1E.C(Q+$-326UO9&4Z,C(L0T1);6]D93HR
+M,RQ#5$EM;V1E.C(T+$-/26UO9&4Z,C4L0DQ+;6]D93HR-BQ#0VUO9&4Z,C<L
+M0T-8;6]D93HR."Q#0U].3T]6;6]D93HR.2Q#0UA?3D]/5FUO9&4Z,S L0T-&
+M4&UO9&4Z,S$L0T-&4$5M;V1E.C,R+$U!6%]-04-(24Y%7TU/1$4Z,S,L.P!M
+M;V1E7V-L87-S.E0R,SUE34]$15]204Y$3TTZ,"Q-3T1%7TE.5#HQ+$U/1$5?
+M1DQ/050Z,BQ-3T1%7U!!4E1)04Q?24Y4.C,L34]$15]#0SHT+$U/1$5?0T]-
+M4$Q%6%])3E0Z-2Q-3T1%7T-/35!,15A?1DQ/050Z-BQ-05A?34]$15]#3$%3
+M4SHW+#L <'1R9&EF9E]T.G0Q '-I>F5?=#IT- !W8VAA<E]T.G0S %51271Y
+M<&4Z=#$Q %-)='EP93IT,0!54TET>7!E.G0T $1)='EP93IT-@!51$ET>7!E
+M.G0W %-&='EP93IT,3( 1$9T>7!E.G0Q,P!W;W)D7W1Y<&4Z=#$ 1$ES=')U
+M8W0Z5#(T/7,X:&EG:#HQ+# L,S([;&]W.C$L,S(L,S([.P!$275N:6]N.G0R
+M-3UU.',Z,C0L,"PV-#ML;#HV+# L-C0[.P!F=6YC7W!T<CIT,C8]*C(W/68Q
+M.0!?7V1O7V=L;V)A;%]D=&]R<SI&,3D
+M $ ! @ ! -0 #4 $0
+M 0 ) !0 ( 0#H Z FP #
+M 0 $ #P L " $#5 U0 5@ ! !H $
+M $ !< # @ !"+0 BT ")0 0
+M ? ! ( 0K< *W %0 # $0 0 , *0
+M 0 " $+, "S #D P \ $ # #, !
+M!@ !#!0 P4 '- ! Y 0 8 1-(
+M 32 )@ 0 /P $ & $3X $^
+M , $ $4 ! !@ !$^P !/L "
+M ! !, 0 8 1/T 3] @
+M 0 4P $ " $4 % -+ (
+M %L ! P "%TP !=, ! ! 0
+M !@ !@ , A=0 74 (@ $ 0 ( :0
+M $ ' (7V %]@ $8 $ # &X !
+M P "&/ !CP % ! !T " , AD(
+M 9" \ @ >0 ( &0@
+M 90 $P "D $ $ ($ # !]8 "XP
+M 0 ") 0 B/ $@
+M 0 , E0 $ (H0 $; !
+M )X ! ".@ !^ ! P
+M "D P EF ,8 $ K@
+M , )EX "; ! +T #
+= ";Y &'P 0 !
+
+end
diff --git a/c/build-tools/os/msdos/fixtimer.c b/c/build-tools/os/msdos/fixtimer.c
new file mode 100644
index 0000000000..3b71032550
--- /dev/null
+++ b/c/build-tools/os/msdos/fixtimer.c
@@ -0,0 +1,111 @@
+/*
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <dos.h>
+
+#define IO_RTC 0x70 /* RTC */
+
+#define RTC_SEC 0x00 /* seconds */
+#define RTC_MIN 0x02 /* minutes */
+#define RTC_HRS 0x04 /* hours */
+#define RTC_WDAY 0x06 /* week day */
+#define RTC_DAY 0x07 /* day of month */
+#define RTC_MONTH 0x08 /* month of year */
+#define RTC_YEAR 0x09 /* month of year */
+#define RTC_STATUSA 0x0a /* status register A */
+#define RTCSA_TUP 0x80 /* time update, don't look now */
+
+#define RTC_STATUSB 0x0b /* status register B */
+
+#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
+#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
+
+
+
+/* convert 2 digit BCD number */
+static int bcd( unsigned int i )
+{
+ return ((i/16)*10 + (i%16));
+}
+
+static unsigned int rtcin( unsigned int what )
+{
+ outportb( IO_RTC, what );
+ return inportb( IO_RTC+1 );
+}
+
+
+void fix_date( void )
+{
+ int s;
+ struct date date;
+ struct time time;
+
+ /* initialize brain-dead battery powered clock */
+ outportb( IO_RTC, RTC_STATUSA );
+ outportb( IO_RTC+1, 0x26 );
+ outportb( IO_RTC, RTC_STATUSB );
+ outportb( IO_RTC+1, 2 );
+
+ outportb( IO_RTC, RTC_DIAG );
+ s = inportb( IO_RTC+1 );
+ if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
+
+ /* check for presence of clock */
+ s = rtcin(RTC_STATUSA);
+ if ( s == 0xff || s == 0 ) {
+ printf( "Real-time clock not found\n" );
+ return;
+ }
+
+ /* ready for a read? */
+ while ((s & RTCSA_TUP) == RTCSA_TUP)
+ s = rtcin(RTC_STATUSA);
+
+ date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
+ if ( date.da_year < 1970) date.da_year += 100;
+ date.da_year -= 1980;
+ date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
+ date.da_day = bcd(rtcin(RTC_DAY)); /* day */
+
+ (void)bcd(rtcin(RTC_WDAY)); /* weekday */
+
+ time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
+ time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
+ time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
+ time.ti_hund = 0;
+
+ setdate( & date );
+ settime( & time );
+}
+
+
+
+
+void fix_timer( void )
+{
+#define PIT_PORT 0x40
+#define TIMER_CNTR0 (PIT_PORT + 0) /* timer 0 counter port */
+#define TIMER_MODE (PIT_PORT + 3) /* timer mode port */
+#define TIMER_SEL0 0x00 /* select counter 0 */
+#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
+#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
+
+ /* set timer 0 to generate interrupts every period */
+ outportb( TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT );
+ outportb( TIMER_CNTR0, 0 ); /* counter low */
+ outportb( TIMER_CNTR0, 0 ); /* counter high */
+}
+
+int main(void)
+{
+ /* Make timer count at correct pace */
+ fix_timer();
+
+ /* Fix the date */
+ fix_date();
+
+ return 0;
+}
diff --git a/c/build-tools/os/msdos/fixtimer.uue b/c/build-tools/os/msdos/fixtimer.uue
new file mode 100644
index 0000000000..bc4b10fc72
--- /dev/null
+++ b/c/build-tools/os/msdos/fixtimer.uue
@@ -0,0 +1,162 @@
+#
+# $Id$
+#
+begin 664 fixtimer.exe
+M35IF 0X 0 @ T __^; 8 (@ $ ^R!R:@$
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M "Z3 $NB1;X ;0PS2&++@( BQXL ([:HY( C :0
+M (D>C ")+JP QP:6 /__Z#0!Q#Z* (O'B]BY_W\F@3TX-W49)HM5 H#Z/740
+M@.;?_P:6 (#^674$_P:6 /*NXV%#)C@%==: S8#WV8D.B@"Y 0#3XX/#"(/C
+M^(D>C@",VBOJBSY\ H'_ )S![\ HD^? *!Q^P$<B@#/GH"<B*Q!-/O1SOO
+M<AF#/GP" '0'@SYZ @!U#K\ $#OO=P>+_>L#Z2$!B]\#VHD>I ")'J@ H9
+M*]B.P+1*5\TA7]/G^H[2B^?[,\ NC@;X ;^F!+GL!"O/\ZH._Q:8!.BU NB=
+M [0 S1J)%I@ B0Z: /\6G 3_-H@ _S:& /\VA #H%P)0Z%H"+HX>^ 'H? .
+M_Q::!#/ B_"Y+P"0_ ($@-0 1N+X+3<-D'0*N1D D+HO .B+ (OLM$R*1@+-
+M(;D. )"Z2 #IAP >N US2&)'G0 C 9V +@$-<TAB1YX (P&>@"X!37-(8D>
+M? ",!GX N 8US2&)'H C :" +@ )8S*CMJZ6 '-(1_#'K@ )<46= #-(1\>
+MN 0EQ19X ,TA'QZX!27%%GP S2$?'K@&)<46@ #-(1_#QP:6 R\.T0+L"
+M ,TAP[D> )"Z5@ NCA[X >CI_[@# %#H*?\ %6+[(M&!+$$T^BZ"@#WXHM6
+M!('B#P #PNL 7<-5B^R*1@3F<.1QM #K %W#58OL@^P(5K *YG"P)N9QL OF
+M<+ "YG&P#N9PY'&T (OP"_9T#[BR 5!6N)0!4.B<"8/$!K@* %#HM?]9B_"!
+M_O\ = 0+]G4+N/P!4.A^"5GIJ0#K"K@* %#HE/]9B_"+QB6 #V '3LN D
+M4.B _UE0Z%__605L!XE&^(%^^+('?02#1OAD@6[XO >X" !0Z%W_65#H//]9
+MB$;[N < 4.A-_UE0Z"S_68A&^K@& %#H/?]94.@<_UFX! !0Z##_65#H#_]9
+MB$;]N ( 4.@@_UE0Z/_^68A&_#/ 4.@1_UE0Z/#^68A&_\9&_@"-1OA0Z'H1
+M68U&_%#HA1%97HOE7<.P-.9#L #F0+ YD##Z/#_Z.S^,\#K ,-5B^Q6BW8$
+M"_9\%(/^6'8#OE< B388 HJ$&@*8ENL-]]Z#_B-WZL<&& +__XO&HY0 N/__
+MZP!>7<(" ,-5B^SK"HL>?@+1X_^7I@2A?@+_#GX""\!UZ_\6= +_%G8"_Q9X
+M O]V!.AZ_5E=PP "Z/!JH#+HP>K /\C@:0 +Z #+D)JQ C,6'UI.+
+M-HH @\8"N0$ @#Z2 -R$8X&C "+_K%_,L#RKN-V@/%_@^P"N $ \,#P27^
+M_XO\*_AR8(OGC,".V(S0CL!12?.D,L"JCMV'\H?9B\.+T$/H&0!W!W) Z!(
+M=_D\('0(/ UT!#P)=>@RP.OD"\!T!T*J"L!U 4.&X#+ ^>,5K$DL(G0/!"(\
+M7'4'@#PB=0*L20OVP^E^_5D#RBZ.'JP#B1Z$ $,#VXOTB^PKZW+FB^6)+H8
+MXPZ)=@"#Q0(VK K X/IT\#/ B48 +O\FJ@.+#HH 4>A' 5F+^ O ="0>'@>.
+M'HP ,_;\\Z0?B_@&_S:. .@I 8/$ HO8!Z.( O =0/I$?TSP+G__XD_@\,"
+M\JXF. 5U](D'PU6+[(,^?@(@=06X 0#K%8M&!(L>?@+1XXF'I@3_!GX",\#K
+M %W#58OL5E>+?@2+10:CZ 0[QW4(QP;H! ZQ"+=02+'N@$B7<$H>@$B40&
+M7UY=PU6+[%97BWX$BT8&*06+-0/WBT8&0(D$B7P"H>8$.\=U!HDVY@3K"(O^
+M WX&B74"B\8%! #K %]>7<-5B^Q6BT8$,](E__^!X@ 4E#H] !968OP@_[_
+M=00SP.L8H>8$B40"BT8$0(D$B3;F!*'F! 4$ .L 7EW#58OL5HM&!#/2)?__
+M@>( %)0Z+< 65F+\(/^_W4$,\#K%8DVZ@2)-N8$BT8$0(D$B\8%! #K %Y=
+MPU6+[%97BWX$"_]U!#/ ZUJ+QP4+ "7X_XOX@S[J! !U!U?HH?]9ZT*+-N@$
+MB\8+P'0QBP2+UX/"*#O"<@E75N@-_UE9ZR2+!#O'<@Y6Z-'^6?\$B\8%! #K
+M$(MT!CLVZ 1USU?H(O]9ZP!?7EW#58OLBT8$B]2!Z@ !.\)S!Z.> #/ ZPO'
+M!I0 " "X___K %W#58OLBT8$BU8& P:> (/2 (O(@<$ 8/2 O2=0H[S',&
+MAP:> .L+QP:4 @ N/__ZP!=PU6+[/]V!.B?_UGK %W#58OLBT8$F5)0Z++_
+MB^7K %W#58OL@^P"5E>+7@2+-XO&B4;^BUX$]T<"0 !T!(O&ZQ^+7@2+?PKK
+M"XO?1X _"G4#_T;^B\9."\!U[HM&_NL 7UZ+Y5W" @!5B^Q6BW8$5NA3!%D+
+MP'0%N/__ZTR#?@H!=1"#/ !^"U;HE?^9*48&&58(@60"7_['! BT0(B40*
+M_W8*_W8(_W8&BD0$F%#HW *#Q B#^O]U"CW__W4%N/__ZP(SP.L 7EW#58OL
+M@^P$5HMV!%;H[ -9"\!T"+K__[C__^L_N $ 4#/ 4%"*1 284.B8 H/$"(E6
+M_HE&_(,\ 'X9BU;^BT;\4E!6Z!#_F8O8B\I86BO#&]'K!HM6_HM&_.L 7HOE
+M7<-5B^RX $2+7@3-(;@ '($T>+1T.L 7<-5B^Q65XM^"HMV!(M$#CO&=0R#
+M?@@"?P:!__]_=@:X___IJ@"#/NH# '4/N) ".\9U",<&Z@,! .L4@S[H P!U
+M#;B CO&=0;'!N@# 0"#/ !T#[@! % SP%!05NC&_H/$"/=$ @0 = ?_= CH
+M"PQ9@60"\__'1 8 (O&!04 B40(B40*@WX( G0_"_]V.\<&= +$"(-^!@!U
+M&%?H6?U9B48&"\!T!X%, @0 ZP6X___K&XM&!HE$"HE$"(E\!H-^" %U!8%,
+M @@ ,\#K %]>7<-65[\$ +Z NL0]T0" P!T!5;HG )93X/&$ O_=>Q?7L-5
+MB^R![(H 5E>+1@A /0( <P4SP.GV (M>!-'C]X? P" =!+_=@C_=@;_=@3H
+MXP"#Q ;IUP"+7@31XX&GP /__8M&!HF&?/^+1@B)AGC_C;9^_^MM_XYX_XN>
+M?/__AGS_B@>(AGO_/ IU!,8$#4:*AGO_B 1&C89^_XO6*]"!^H ?#Z-AG[_
+MB_XK^%>-AG[_4/]V!.A[ (/$!HF&=O\[QW0;@[YV_P!S!;C__^L-BT8(*X9X
+M_P.&=O\KQ^M/C;9^_X.^>/\ = /IB?^-AG[_B_XK^(O'"\!V+E>-AG[_4/]V
+M!.@M (/$!HF&=O\[QW07@[YV_P!S!;C__^L)BT8( X9V_RO'ZP6+1@CK %]>
+MB^5=PU6+[(M>!-'C]X? P (=!"X @!0,\!04/]V!.@H (OEM$"+7@2+3@B+
+M5@;-(7(/4(M>!-'C@8_ P 06.L&4.@%^>L 7<-5B^R+7@31XX&GP /__;1"
+MBD8*BUX$BTX(BU8&S2%R NL'4.C;^)GK %W#58OL@^PB5E<&BWX*'@>+7@B#
+M^R1W6(#[ G)3BT8,BTX."\E]$8!^!@!T"\8%+4?WV??8@]D C7;>XP^1*]+W
+M\Y'W\X@41N,)Z_$KTO?SB!1&"\!U]8U.WO?9 \[\3HH$+ IS! 0ZZP,"1@2J
+MXN^P *H'BT8*ZP!?7HOE7<(, %6+[(-^" IU!HM&!)GK!8M&!#/24E#_=@;_
+M=@BP 5"P85#H7/_K %W#58OL_W8&_W8$_W8(_W8*L !0L&%0Z$#_ZP!=PU6+
+M[/]V!O]V!/]V"/]V"H-^"@IU!;@! .L",\!0L&%0Z!G_ZP!=P[KL ^L#NO$#
+MN04 D+1 NP( S2&Y)P"0NO8#M$#-(>EM]E6+[%97BW8$BT0..\9T!;C__^MF
+M@SP ?"WW1 (( '4,BT0*B]:#P@4[PG46QP0 (M$"HO6@\(%.\)U!HM$"(E$
+M"C/ ZS2+? 8#/$<I/%>+1 B)1 I0BD0$F%#H$OV#Q 8[QW01]T0" )U"H%,
+M A N/__ZP0SP.L 7UY=PU6+[+AK#5"XD )0_W8$C48&4.A, NL 7<-5B^R+
+M7@;_#_]V!HI&!)A0Z 8 B^7K %W#58OL@^P"5HMV!HI&!(A&__\$?3:*1O__
+M1 J+7 J(1__W1 (( '0;@'[_"G0&@'[_#74/5N@9_UD+P'0&N/__Z>D BD;_
+MM #IX0#_#/=$ I =0?W1 (" '4+@4P"$ "X___IQ@"!3 ( 8-\!@!T)H,\
+M '015NC7_ED+P'0&N/__Z:< ZPJX__^+5 8KPHD$Z7W_Z94 @S[J P!U.;B0
+M CO&=3**1 284.@)^UD+P'4%@60"__VX )0]T0" )T!;@" .L",\!0,\!0
+M5NC]^H/$".F/_X!^_PIU'_=$ D =1BX 0!0N!X$4(I$!)A0Z.#\@\0&/0$
+M=1BX 0!0C48$4(I$!)A0Z,C\@\0&/0$ =!'W1 ( G4*@4P"$ "X___K!XI&
+M_[0 ZP!>B^5=PU6+[%:+=@2XD )05NC!_EE9ZP!>7<-5B^R#[ )65XMV!(M^
+M!D?W1 (( '0CZP+K $^+QPO =!56BUX(_T8(B@>84.B+_EE9/?__=>+I=0#W
+M1 ) '0W@WP& '0QBT0&.\=S*H,\ '0-5NBT_5D+P'0$,\#K4T]7_W8(BD0$
+MF%#H(?R#Q :)1OXK?O[K-^L"ZP!/B\<+P'0L_P1]%8M>"/]&"(H'_T0*BUP*
+MB$?_M #K#E:+7@C_1@C_-^CZ_5E9/?__=<N+Q^L 7UZ+Y5W"!@#_)IX$58OL
+MBU8$N00/NR<$_(K&TNC7JHK&(L77JHK"TNC7JHK"(L77JNL 7<(" %6+[('L
+ME@!65\=&J@ QD:M4.LX5[G__S+ \J[WT4E?PX@%1_Y.K7XB4U%2!HU&KBOX
+MC4:N4%?_=@C_5@K&1JU0 7ZJC7ZN!UI96\,&_(U^KHF^;/^+OFS_BW8&K K
+M=!$\)700B 5'_DZM?^_HN?_KZNEU!(FV>/^L/"5TYXF^;/\SR8F.=O^)CFK_
+MB(YU_\>&</___\>&<O___^L!K#+DB]"+V(#K((#[8'-'BI\W!(O#/1< =@/I
+M'02+V-'C+O^G& ]C#TL/I ]7#\D/TP\5$!\0+Q"*#V00/Q!#$$<0Z1";$3P1
+M7!'_$BP3+!,L$W8/@ _IX0. _0!W^(..:O\!ZYN _0!W[(..:O\"ZX^ _0!W
+MX("^=?\K= 2(EG7_Z7S_@Z9J_]^U!>ER_X..:O\@M07I:/^ _0!W1/>&:O\"
+M '4A@XYJ_PBU >E1_^F( XM^!(L%@T8$ H#] G,)B89P_[4#Z3?_@/T$=>&)
+MAG+__L7I*?^ _01ST[4$Z1__DBPPF(#] G<;M0*'AG#_"\!\TM'@B]#1X-'@
+M \(!AG#_Z?O^@/T$=:6'AG+_"\!\M-'@B]#1X-'@ \(!AG+_Z=W^@XYJ_Q"U
+M!>G3_H&.:O\ 8.F:O_OM07IP_Z#IFK_[X&.:O^ +4%Z;/^MPCK"K<*ZPNW
+M$+/I MK&AG7_ ,:&;_\ B)9N_XM^!(L%,]+K$;<*QH9O_P&(EF[_BWX$BP69
+M1T>)=@;WAFK_$ !T!(L51T>)?@2-OGO_"\!U,PO2=2^#OG+_ '4MB[YL_XN.
+M</_C&X/Y_W06BX9J_R4( '0$LC#K K(@BL+HMOWB^>GI_8..:O\$4E!7BL>8
+M4(J&;_]04^B0^18'BY9R_PO2?P/I% 'I(0&(EF[_B78&C;YZ_XM>!/\W0T.)
+M7@3WAFK_( !T#_\W0T.)7@06!^@7_; ZJA8'Z _]Q@4 QH9O_P"#IFK_^XV.
+M>O\K^8?/BY9R_SO1?P*+T>F^ (EV!HB6;O^+?@2+!8-&! (6!XV^>_\RY(D%
+MN0$ Z=@ B78&B)9N_XM^!/>&:O\@ '4,BSV#1@0"'@<+_^L*Q#V#1@0$C, +
+MQW4%'@>_( 3HVOP[CG+_=@2+CG+_Z9D B78&B)9N_XM^!(N.<O\+R7T#N08
+M5U&-GGO_4U*X 0 CAFK_4(N&:O^I@ !T"K@" ,=&_@0 ZQ>I %T"K@( ,=&
+M_@H ZPC'1OX( +@& %#H-_R+1OX!1@06!XV^>__WAFK_" !T$XN6</\+TGX+
+MZ%O\*]%^!(F6=O^*AG7_"L!T%": /2UT#H.N=O\!@Y9V_P!/)H@%Z#3\B_>+
+MOFS_BYYP_[@% ".&:O\]!0!U%HJF;O^ _&]U$(.^=O\ ?P;'AG;_ 0#K'Y"
+M_'AT!8#\6'44@XYJ_T!+2X.N=O\"?0;'AG;_ #CG;_]X9J_P( =0SK!K @
+MZ.'[2SO9?_;WAFK_0 !T#+ PZ,_[BH9N_^C(^XN6=O\+TGXG*\HKVB:*!#PM
+M= @\('0$/"MU!R:LZ*C[24N'RN,'L##HG?OB^8?*XQ$KV2:LB 5'_DZM?P/H
+MD/OB\0O;?@F+R[ @Z'O[XOGIKON)=@:+?@3WAFK_( !U"HL]@T8$ AX'ZP;$
+M/8-&! 2X4 J1JT#1JHFB07I??N+MGC_B[YL_[ EZ#S[K K =?B ?JU0?0/H
+M-OL'BT:JZP!?7HOE7<(( %6+[%97BW8$@S[H! !T'(L>Z 2+?P:+'N@$B7<&
+MB74$B7P&H>@$B40$ZPJ)-N@$B70$B70&7UY=PU6+[(/L E97BW8&BWX$BP0!
+M!:'F!#O&=0:)/N8$ZPV+! /&B4;^BU[^B7\"5NA-\5E?7HOE7<-6H>H$.P;F
+M!'42_S;J!.C:\EDSP*/F!*/J!.L[BQ[F!(MW O<$ 0!U(E;H&?%9.S;J!'4*
+M,\"CY@2CZ@3K!HM$ J/F!%;HH_)9ZPS_-N8$Z)GR68DVY@1>PU6+[(/L E97
+MBW8$_PR+! /&B4;^BWP"]P4! '44.S;J!'0.BP0!!8M>_HE_ HOWZP56Z +_
+M68M>_O<' 0!U"?]V_E;H*O]965]>B^5=PU6+[%:+=@0+]G4"ZQ>+Q@7\_XOP
+M.S;F!'4%Z#S_ZP56Z(__65Y=PU6+[%:T*XMV!(L,BU0"S2%>7<-5B^Q6M"V+
+M=@2+#(M4 LTA7EW# !4=7)B;RU#("T@0V]P>7)I9VAT("AC
+M*2 Q.3@X($)O<FQA;F0@26YT;"X 3G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-
+M"D1I=FED92!E<G)O<@T*06)N;W)M86P@<')O9W)A;2!T97)M:6YA=&EO;@T*
+M .P$[ 3L
+M!
+M
+M
+M
+M
+M 4E1#($))3U,@9&EA9VYO<W1I8R!E<G)O<B E
+M8@H $ AC;&]C:U]B871T97)Y!U)/35]C:W-U;09C;VYF:6=?=6YI= 5M96UO
+M<GE?<VEZ901F:7AE9%]D:7-K VEN=F%L:61?=&EM90!296%L+71I;64@8VQO
+M8VL@;F]T(&9O=6YD"@ $P("! 4&" @(%!4%$_\6!1$"____________
+M_____P4%_____________________P__(P+_#_____\3__\" @4/ O___Q/_
+M_________R/_____(_\3_P!Z WH#>@, 0 D" ( "
+M * @$ "0 @ @(" H ( $," P
+M + " !" @0 # @ #_ T ( _P
+M . " /\ #P @ #_ , _P
+M ! # /\ @ P #_ , ,
+M_P $ # /\ !0 P #_ 8 ,
+M _P ' # /\ " P #_
+MD , _P * # /\ "P P$@ B "( 2@ J#_
+M______________________________________\ <')I;G0@<V-A;F8@
+M.B!F;&]A=&EN9R!P;VEN="!F;W)M871S(&YO="!L:6YK960-"@ - "AN=6QL
+M*0 P,3(S-#4V-S@Y04)#1$5& !04 105%!04% ( % ,$% D%!04%!04%!044
+M%!04%!04%!04% \7#P@4%!0'%!84%!04%!04%!0-%!04%!04%!04%! *#P\/
+G" H4% 84$@L.%!01% P4% T4%!04%!04 -(!T@'9 50+60M9"UD+
+
+end
diff --git a/c/build-tools/os/msdos/ifc.c b/c/build-tools/os/msdos/ifc.c
new file mode 100644
index 0000000000..091e2dd0ef
--- /dev/null
+++ b/c/build-tools/os/msdos/ifc.c
@@ -0,0 +1,331 @@
+/*
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <process.h>
+
+#include <io.h>
+
+void * xmalloc( int size )
+{
+ void * p = (void *)malloc( size );
+ if ( !p ) {
+ fprintf( stderr, "out of memory\n" );
+ exit( 1 );
+ }
+ return p;
+}
+void * xrealloc( void * old, int size )
+{
+ void * p = (void *)realloc( old, size );
+ if ( !p ) {
+ fprintf( stderr, "out of memory\n" );
+ exit( 1 );
+ }
+ return p;
+}
+
+char ** argv_fix( int * argc, char ** argv )
+{
+ char ** new = NULL;
+ int max = 20;
+ int cnt = 0;
+ int j;
+
+ for ( j = 1; argv[j]; ++j )
+ if ( argv[j][0] == '@' && access(argv[j]+1,0)==0 )
+ break;
+ if ( argv[j] == NULL )
+ return argv;
+
+ new = (char **)xmalloc( max * sizeof *new );
+ new[cnt++] = *argv++;
+ for ( ; *argv; ++argv ) {
+ if ( cnt >= max )
+ new = (char **)realloc( new, (max*=2) * sizeof *new );
+
+ if ( argv[0][0] != '@' || access(argv[0]+1,0) ) {
+ new[cnt++] = *argv;
+ } else {
+ char line[ 1000 ];
+ FILE * f = fopen( argv[0]+1, "r" );
+ if ( !f ) {
+ perror( argv[0]+1 );
+ exit( 2 );
+ }
+ while ( fgets( line, sizeof line, f ) ) {
+ int len = strlen( line );
+ /* delete trailing newlines */
+ while ( line[len-1] == '\n' || line[len-1] == '\r' )
+ line[--len] = '\0';
+ if ( cnt >= max )
+ new = (char **)xrealloc( new, (max*=2) * sizeof *new );
+ new[cnt] = (char *)xmalloc( len+1 );
+ strcpy( new[cnt], line );
+ ++cnt;
+ }
+ fclose( f );
+ }
+ }
+ if ( cnt >= max )
+ new = (char **)xrealloc( new, (max+1) * sizeof *new );
+ new[cnt] = NULL;
+ *argc = cnt;
+ return new;
+}
+
+
+const char * USAGE =
+"usage: $progname [ -cNvmV ] file [ file ... ] dest-directory-or-file\n"
+" -v -- verbose\n"
+" -V suffix -- suffix to append to targets (before any . suffix)\n"
+" eg: -V _g would change 'foo' to 'foo_g' and\n"
+" 'libfoo.a' to 'libfoo_g.a'\n"
+" -m mode -- mode for new file(s)\n"
+" -c -- copy instead of move (always on)\n"
+" -N -- copy only if source is newer than target\n"
+;
+
+void fatal( char * msg )
+{
+ if ( msg )
+ fprintf( stderr, "%s\n", msg );
+ fprintf( stderr, "%s", USAGE );
+ exit( 1 );
+}
+
+char * basename( char * f )
+{
+ char * b = strrchr( f, '/' );
+ if ( b ) ++b;
+ else b = f;
+ return b;
+}
+
+#include <sys/stat.h>
+int is_dir( char * path )
+{
+ struct stat buf;
+ if ( stat( path, &buf ) )
+ return 0;
+ return buf.st_mode & S_IFDIR;
+}
+int is_file( char * path )
+{
+ struct stat buf;
+ if ( stat( path, &buf ) )
+ return 0;
+ return buf.st_mode & S_IFREG;
+}
+int newer( char * p1, char * p2 )
+{
+ struct stat buf1;
+ struct stat buf2;
+ if ( stat( p1, &buf1 ) )
+ return 0;
+ if ( stat( p2, &buf2 ) )
+ return 0;
+ return buf1.st_mtime > buf2.st_mtime;
+}
+
+int filecopy( char * d, char * s, int preserve_time )
+{
+#if 0
+ int status;
+ char * argv[ 5 ];
+ argv[0] = "cp";
+ argv[1] = "-p";
+ argv[2] = s;
+ argv[3] = d;
+ argv[4] = NULL;
+ status = spawnvp( P_WAIT, argv[0], argv );
+ if ( status )
+ perror( "cp" );
+ return status;
+#else
+ FILE * fs;
+ FILE * fd;
+ char buffer[ 8192 ];
+ int n;
+ struct ftime When;
+ struct stat Stat;
+
+ fs = fopen( s, "rb" );
+ if ( fs == NULL ) {
+ perror( s );
+ return 1;
+ }
+ fd = fopen( d, "wb" );
+ if ( fd == NULL ) {
+ perror( d );
+ fclose( fs );
+ return 2;
+ }
+
+ if ( preserve_time )
+ if ( getftime( fileno(fs), &When ) ) {
+ perror( s );
+ preserve_time = 0;
+ }
+
+ do {
+ n = fread( buffer, 1, sizeof buffer, fs );
+ if ( n > 0 )
+ if ( fwrite( buffer, 1, n, fd ) < 0 ) {
+ perror( d );
+ return 3;
+ }
+ } while ( n > 0 );
+
+ fclose( fs );
+
+ /* Fix time stamp */
+ if ( preserve_time )
+ if ( setftime( fileno(fd), &When ) ) {
+ perror( s );
+ preserve_time = 0;
+ }
+ fclose( fd );
+
+ /* Fix access rights */
+ if ( stat( s, &Stat ) )
+ perror( s );
+ else if ( chmod( d, Stat.st_mode ) )
+ perror( d );
+
+ return 0;
+#endif
+}
+
+
+
+
+
+int main( int argc, char * argv[] )
+{
+ char * progname;
+ int verbose = 0;
+ int only_if_newer= 0;
+ char * suffix = NULL;
+ char * mode = NULL;
+ char * dest;
+ char ** pp;
+
+ argv = argv_fix( &argc, argv );
+
+ progname = basename( *argv++ );
+
+ /* process the options */
+ while ( argv[0] && argv[0][0] == '-' ) {
+ switch ( argv[0][1] ) {
+ case 'N':
+ ++argv;
+ only_if_newer = 1;
+ break;
+ case 'c':
+ ++argv;
+ /* We always copy, regardless */
+ break;
+ case 'v':
+ ++argv;
+ verbose = 1;
+ break;
+ case 'V':
+ ++argv;
+ suffix = *argv;
+ ++argv;
+ break;
+ case 'm':
+ ++argv;
+ mode = *argv;
+ ++argv;
+ break;
+ default:
+ fatal( NULL );
+ }
+ }
+
+ /* Separate source file(s) from dest directory or file */
+#if 0
+ if ( !argv[0] || !argv[1] )
+ fatal( "missing files or invalid destination" );
+#else
+ /* We used to require at least one file; not any more */
+ if ( !argv[0] )
+ fatal( "missing files or invalid destination" );
+ if ( !argv[1] )
+ return 0;
+#endif
+ for ( pp = argv; *pp; ++pp )
+ continue;
+ --pp;
+ dest = *pp;
+ *pp = NULL;
+
+ /* Process the arguments */
+ for (; *argv; ++argv ) {
+ char * f = *argv;
+ char * leaf = basename( f );
+ char target[ 128 ];
+
+ strcpy( target, dest );
+
+ if ( is_dir( target ) ) {
+ strcat( target, "/" );
+ /* if we were given a suffix, then add it as appropriate */
+ if ( suffix ) {
+ char * dot = strchr( leaf, '.' );
+ if ( dot ) {
+ strncat( target, leaf, dot-leaf );
+ strcat( target, suffix );
+ strcat( target, dot );
+ if ( verbose )
+ printf( "%s: %s will be installed as %s",
+ progname, f, strrchr(target,'/')+1 );
+ } else {
+ strcat( target, leaf );
+ strcat( target, suffix );
+ }
+ } else {
+ strcat( target, leaf );
+ }
+ }
+
+ if ( access( f, 0 ) ) {
+ char buf[200];
+ sprintf( buf, "cannot read %s", f );
+ fatal( buf );
+ }
+
+ if ( only_if_newer && is_file( target ) && !newer( f, target ) ) {
+ if ( verbose )
+ printf( "'%s' not newer than '%s'\n", f, target );
+ continue;
+ }
+
+ if ( verbose )
+ printf( "rm -f %s\n", target );
+ if ( chmod( target, 0777 ) )
+ if ( verbose )
+ perror( target );
+ if ( unlink( target ) )
+ if ( verbose )
+ perror( target );
+ if ( verbose )
+ printf( "cp -p %s %s\n", f, target );
+ if ( filecopy( target, f, 1 ) )
+ return 1;
+ if ( mode ) {
+ char buf[ 255 ];
+ sprintf( buf, "chmod %s %s\n", mode, target );
+ if ( verbose )
+ printf( "%s\n", buf );
+ system( buf );
+ }
+ }
+
+ return 0;
+}
+
diff --git a/c/build-tools/os/msdos/ifc_exe.uue b/c/build-tools/os/msdos/ifc_exe.uue
new file mode 100644
index 0000000000..cd9f52b8f0
--- /dev/null
+++ b/c/build-tools/os/msdos/ifc_exe.uue
@@ -0,0 +1,163 @@
+#
+# $Id$
+#
+
+begin 664 ifc.exe
+M(VEN8VQU9&4@/'-T9&EO+F@^#0HC:6YC;'5D92 \<W1R:6YG+F@^#0HC:6YC
+M;'5D92 \<')O8V5S<RYH/@T*#0HC:6YC;'5D92 \:6\N:#X-"@T*=F]I9" J
+M('AM86QL;V,H(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
+M("HI;6%L;&]C*"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)9G!R:6YT
+M9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H(#$@*3L-
+M"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0IV;VED("H@>')E86QL;V,H('9O
+M:60@*B!O;&0L(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
+M("HI<F5A;&QO8R@@;VQD+"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)
+M9G!R:6YT9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H
+M(#$@*3L-"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0H-"F-H87(@*BH@87)G
+M=E]F:7@H(&EN=" J(&%R9V,L(&-H87(@*BH@87)G=B I#0I[#0H@(" @8VAA
+M<B J*B!N97<@/2!.54Q,.PT*(" @(&EN=" @(" @;6%X(#T@,C [#0H@(" @
+M:6YT"2 @("!C;G0@/2 P.PT*(" @(&EN= D@(" @:CL-"@T*(" @(&9O<B H
+M(&H@/2 Q.R!A<F=V6VI=.R K*VH@*0T*"6EF("@@87)G=EMJ75LP72 ]/2 G
+M0"<@)B8@86-C97-S*&%R9W9;:ETK,2PP*3T]," I#0H)(" @(&)R96%K.PT*
+M(" @(&EF("@@87)G=EMJ72 ]/2!.54Q,("D-"@ER971U<FX@87)G=CL-"@T*
+M(" @(&YE=R ]("AC:&%R("HJ*7AM86QL;V,H(&UA>" J('-I>F5O9B J;F5W
+M("D[#0H@(" @;F5W6V-N="LK72 ]("IA<F=V*RL[#0H@(" @9F]R("@@.R J
+M87)G=CL@*RMA<F=V("D@('L-"@EI9B H(&-N=" ^/2!M87@@*0T*"2 @("!N
+M97<@/2 H8VAA<B J*BER96%L;&]C*"!N97<L("AM87@J/3(I("H@<VEZ96]F
+M("IN97<@*3L-"@D@(" @#0H):68@*"!A<F=V6S!=6S!=("$]("= )R!\?"!A
+M8V-E<W,H87)G=ELP72LQ+# I("D@('L-"@D@(" @;F5W6V-N="LK72 ]("IA
+M<F=V.PT*"7T@96QS92![#0H)(" @(&-H87(@;&EN95L@,3 P,"!=.PT*"2 @
+M("!&24Q%("H@9B ](&9O<&5N*"!A<F=V6S!=*S$L(")R(B I.PT*"2 @("!I
+M9B H("%F("D@('L-"@D)<&5R<F]R*"!A<F=V6S!=*S$@*3L-"@D)97AI="@@
+M,B I.PT*"2 @("!]#0H)(" @('=H:6QE("@@9F=E=',H(&QI;F4L('-I>F5O
+M9B!L:6YE+"!F("D@*2 @>PT*"0EI;G0@;&5N(#T@<W1R;&5N*"!L:6YE("D[
+M#0H)"2\J(&1E;&5T92!T<F%I;&EN9R!N97=L:6YE<R J+PT*"0EW:&EL92 H
+M(&QI;F5;;&5N+3%=(#T]("=<;B<@?'P@;&EN95ML96XM,5T@/3T@)UQR)R I
+M#0H)"2 @("!L:6YE6RTM;&5N72 ]("=<,"<[#0H)"6EF("@@8VYT(#X](&UA
+M>" I#0H)"2 @("!N97<@/2 H8VAA<B J*BEX<F5A;&QO8R@@;F5W+" H;6%X
+M*CTR*2 J('-I>F5O9B J;F5W("D[#0H)"6YE=UMC;G1=(#T@*&-H87(@*BEX
+M;6%L;&]C*"!L96XK,2 I.PT*"0ES=')C<'DH(&YE=UMC;G1=+"!L:6YE("D[
+M#0H)"2LK8VYT.PT*"2 @("!]#0H)(" @(&9C;&]S92@@9B I.PT*"7T)#0H@
+M(" @?0T*(" @(&EF("@@8VYT(#X](&UA>" I#0H);F5W(#T@*&-H87(@*BHI
+M>')E86QL;V,H(&YE=RP@*&UA>"LQ*2 J('-I>F5O9B J;F5W("D[#0H@(" @
+M;F5W6V-N=%T@/2!.54Q,.PT*(" @("IA<F=C(#T@8VYT.PT*(" @(')E='5R
+M;B!N97<[#0I]#0H-"@T*8V]N<W0@8VAA<B J(%5304=%(#T@#0HB=7-A9V4Z
+M("1P<F]G;F%M92!;("UC3G9M5B!=(&9I;&4@6R!F:6QE("XN+B!=(&1E<W0M
+M9&ER96-T;W)Y+6]R+69I;&5<;B(-"B(@(" @(" @("UV(" @(" @(" @("TM
+M('9E<F)O<V5<;B(-"B(@(" @(" @("U6('-U9F9I>" @("TM('-U9F9I>"!T
+M;R!A<'!E;F0@=&\@=&%R9V5T<R H8F5F;W)E(&%N>2 N('-U9F9I>"E<;B(-
+M"B(@(" @(" @(" @(" @(" @(" @(" @("!E9SH@+58@7V<@=V]U;&0@8VAA
+M;F=E("=F;V\G('1O("=F;V]?9R<@86YD7&XB#0HB(" @(" @(" @(" @(" @
+M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" G;&EB9F]O+F$G('1O
+M("=L:6)F;V]?9RYA)UQN(@T*(B @(" @(" @+6T@;6]D92 @(" @+2T@;6]D
+M92!F;W(@;F5W(&9I;&4H<RE<;B(-"B(@(" @(" @("UC(" @(" @(" @("TM
+M(&-O<'D@:6YS=&5A9"!O9B!M;W9E("AA;'=A>7,@;VXI7&XB#0HB(" @(" @
+M(" M3B @(" @(" @(" M+2!C;W!Y(&]N;'D@:68@<V]U<F-E(&ES(&YE=V5R
+M('1H86X@=&%R9V5T7&XB#0H[#0H-"G9O:60@9F%T86PH(&-H87(@*B!M<V<@
+M*0T*>PT*(" @(&EF("@@;7-G("D-"@EF<')I;G1F*"!S=&1E<G(L("(E<UQN
+M(BP@;7-G("D[#0H@(" @9G!R:6YT9B@@<W1D97)R+" B)7,B+"!54T%'12 I
+M.PT*(" @(&5X:70H(#$@*3L-"GT-"@T*8VAA<B J(&)A<V5N86UE*"!C:&%R
+M("H@9B I#0I[#0H@(" @8VAA<B J(&(@/2!S=')R8VAR*"!F+" G+R<@*3L-
+M"B @("!I9B H(&(@*0DK*V([#0H@(" @96QS90EB(#T@9CL-"B @("!R971U
+M<FX@8CL-"GT-"@T*(VEN8VQU9&4@/'-Y<R]S=&%T+F@^#0II;G0@:7-?9&ER
+M*"!C:&%R("H@<&%T:" I#0I[#0H@(" @<W1R=6-T('-T870@8G5F.PT*(" @
+M(&EF("@@<W1A="@@<&%T:"P@)F)U9B I("D-"@ER971U<FX@,#L-"B @("!R
+M971U<FX@8G5F+G-T7VUO9&4@)B!37TE&1$E2.PT*?0T*:6YT(&ES7V9I;&4H
+M(&-H87(@*B!P871H("D-"GL-"B @("!S=')U8W0@<W1A="!B=68[#0H@(" @
+M:68@*"!S=&%T*"!P871H+" F8G5F("D@*0T*"7)E='5R;B P.PT*(" @(')E
+M='5R;B!B=68N<W1?;6]D92 F(%-?249214<[#0I]#0II;G0@;F5W97(H(&-H
+M87(@*B!P,2P@8VAA<B J(' R("D-"GL-"B @("!S=')U8W0@<W1A="!B=68Q
+M.PT*(" @('-T<G5C="!S=&%T(&)U9C([#0H@(" @:68@*"!S=&%T*"!P,2P@
+M)F)U9C$@*2 I#0H)<F5T=7)N(# [#0H@(" @:68@*"!S=&%T*"!P,BP@)F)U
+M9C(@*2 I#0H)<F5T=7)N(# [#0H@(" @<F5T=7)N(&)U9C$N<W1?;71I;64@
+M/B!B=68R+G-T7VUT:6UE.PT*?0T*#0II;G0@9FEL96-O<'DH(&-H87(@*B!D
+M+"!C:&%R("H@<RP@:6YT('!R97-E<G9E7W1I;64@*0T*>PT*(VEF(# -"B @
+M("!I;G0)"7-T871U<SL-"B @("!C:&%R(" @(" @*B!A<F=V6R U(%T[#0H@
+M(" @87)G=ELP72 ](")C<"([#0H@(" @87)G=ELQ72 ]("(M<"([#0H@(" @
+M87)G=ELR72 ](',[#0H@(" @87)G=ELS72 ](&0[#0H@(" @87)G=ELT72 ]
+M($Y53$P[#0H@(" @<W1A='5S(#T@<W!A=VYV<"@@4%]704E4+"!A<F=V6S!=
+M+"!A<F=V("D[#0H@(" @:68@*"!S=&%T=7,@*0T*"7!E<G)O<B@@(F-P(B I
+M.PT*(" @(')E='5R;B!S=&%T=7,[#0HC96QS90T*(" @($9)3$4@(" @(" J
+M(&9S.PT*(" @($9)3$4@(" @(" J(&9D.PT*(" @(&-H87()8G5F9F5R6R X
+M,3DR(%T[#0H@(" @:6YT"0EN.PT*(" @('-T<G5C="!F=&EM90E7:&5N.PT*
+M(" @('-T<G5C="!S=&%T"0E3=&%T.PT*#0H@(" @9G,@/2!F;W!E;B@@<RP@
+M(G)B(B I.PT*(" @(&EF("@@9G,@/3T@3E5,3" I("![#0H)<&5R<F]R*"!S
+M("D[#0H)<F5T=7)N(#$[#0H@(" @?0T*(" @(&9D(#T@9F]P96XH(&0L(")W
+M8B(@*3L-"B @("!I9B H(&9D(#T]($Y53$P@*2 @>PT*"7!E<G)O<B@@9" I
+M.PT*"69C;&]S92@@9G,@*3L-"@ER971U<FX@,CL-"B @("!]#0H-"B @("!I
+M9B H('!R97-E<G9E7W1I;64@*0T*"6EF("@@9V5T9G1I;64H(&9I;&5N;RAF
+M<RDL("97:&5N("D@*2 @>PT*"2 @("!P97)R;W(H(',@*3L-"@D@(" @<')E
+M<V5R=F5?=&EM92 ](# [#0H)?0T*#0H@(" @9&\@>PT*"6X@/2!F<F5A9"@@
+M8G5F9F5R+" Q+"!S:7IE;V8@8G5F9F5R+"!F<R I.PT*"6EF("@@;B ^(# @
+M*0T*"2 @("!I9B H(&9W<FET92@@8G5F9F5R+" Q+"!N+"!F9" I(#P@," I
+M("![#0H)"7!E<G)O<B@@9" I.PT*"0ER971U<FX@,SL-"@D@(" @?0T*(" @
+M('T@=VAI;&4@*"!N(#X@," I.R @(" -"@T*(" @(&9C;&]S92@@9G,@*3L-
+M"@T*(" @("\J($9I>"!T:6UE('-T86UP("HO#0H@(" @:68@*"!P<F5S97)V
+M95]T:6UE("D-"@EI9B H('-E=&9T:6UE*"!F:6QE;F\H9F0I+" F5VAE;B I
+M("D@('L-"@D@(" @<&5R<F]R*"!S("D[#0H)(" @('!R97-E<G9E7W1I;64@
+M/2 P.PT*"7T-"B @("!F8VQO<V4H(&9D("D[#0H-"B @(" O*B!&:7@@86-C
+M97-S(')I9VAT<R J+PT*(" @(&EF("@@<W1A="@@<RP@)E-T870@*2 I#0H)
+M<&5R<F]R*"!S("D[#0H@(" @96QS92!I9B H(&-H;6]D*"!D+"!3=&%T+G-T
+M7VUO9&4@*2 I#0H)<&5R<F]R*"!D("D[#0H-"B @("!R971U<FX@,#L-"B-E
+M;F1I9@T*?0T*#0H-"@T*#0H-"FEN="!M86EN*"!I;G0@87)G8RP@8VAA<B J
+M(&%R9W9;72 I#0I[#0H@(" @8VAA<B J"7!R;V=N86UE.PT*(" @(&EN= D)
+M=F5R8F]S92 ](# [#0H@(" @:6YT"0EO;FQY7VEF7VYE=V5R/2 P.PT*(" @
+M(&-H87(@*@ES=69F:7@@(#T@3E5,3#L-"B @("!C:&%R("H);6]D90D]($Y5
+M3$P[#0H@(" @8VAA<B J( ED97-T.PT*(" @(&-H87(@*BH)<' [#0H-"B @
+M("!A<F=V(#T@87)G=E]F:7@H("9A<F=C+"!A<F=V("D[#0H-"B @("!P<F]G
+M;F%M92 ](&)A<V5N86UE*" J87)G=BLK("D[#0H-"B @(" O*B!P<F]C97-S
+M('1H92!O<'1I;VYS("HO#0H@(" @=VAI;&4@*"!A<F=V6S!=(" F)B @87)G
+M=ELP75LP72 ]/2 G+2<@*2 @>PT*"7-W:71C:" H(&%R9W9;,%U;,5T@*2 @
+M>PT*"2 @("!C87-E("=.)SH-"@D@(" @(" @("LK87)G=CL-"@D);VYL>5]I
+M9E]N97=E<B ](#$[#0H)"6)R96%K.PT*"2 @("!C87-E("=C)SH-"@D@(" @
+M(" @("LK87)G=CL-"@D)+RH@5V4@86QW87ES(&-O<'DL(')E9V%R9&QE<W,@
+M*B\-"@D)8G)E86L[#0H)(" @(&-A<V4@)W8G.@T*"0DK*V%R9W8[#0H)"79E
+M<F)O<V4@/2 Q.PT*"0EB<F5A:SL-"@D@(" @8V%S92 G5B<Z#0H)"2LK87)G
+M=CL-"@D)<W5F9FEX(#T@*F%R9W8[#0H)"2LK87)G=CL-"@D)8G)E86L[#0H)
+M(" @(&-A<V4@)VTG.@T*"0DK*V%R9W8[#0H)"6UO9&4@/2 J87)G=CL-"@D)
+M*RMA<F=V.PT*"0EB<F5A:SL-"@D@(" @9&5F875L=#H-"@D)9F%T86PH($Y5
+M3$P@*3L-"@E]#0H@(" @?0T*#0H@(" @+RH@4V5P87)A=&4@<V]U<F-E(&9I
+M;&4H<RD@9G)O;2!D97-T(&1I<F5C=&]R>2!O<B!F:6QE("HO#0HC:68@, T*
+M(" @(&EF("@@(6%R9W9;,%T@?'P@(6%R9W9;,5T@*0T*"69A=&%L*" B;6ES
+M<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*(V5L<V4-
+M"B @(" O*B!792!U<V5D('1O(')E<75I<F4@870@;&5A<W0@;VYE(&9I;&4[
+M(&YO="!A;GD@;6]R92 J+PT*(" @(&EF("@@(6%R9W9;,%T@*0T*"69A=&%L
+M*" B;6ES<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*
+M(" @(&EF("@@(6%R9W9;,5T@*0T*"7)E='5R;B P.PT*(V5N9&EF#0H@(" @
+M9F]R("@@<' @/2!A<F=V.R J<' [("LK<' @*0T*"6-O;G1I;G5E.PT*(" @
+M("TM<' [#0H@(" @9&5S=" ]("IP<#L-"B @(" J<' @/2!.54Q,.PT*#0H@
+M(" @+RH@4')O8V5S<R!T:&4@87)G=6UE;G1S("HO#0H@(" @9F]R("@[("IA
+M<F=V.R K*V%R9W8@*2 @>PT*"6-H87(@*B!F(#T@*F%R9W8[#0H)8VAA<B J
+M(&QE868@/2!B87-E;F%M92@@9B I.PT*"6-H87(@=&%R9V5T6R Q,C@@73L-
+M"@T*"7-T<F-P>2@@=&%R9V5T+"!D97-T("D[#0H-"@EI9B H(&ES7V1I<B@@
+M=&%R9V5T("D@*2 @>PT*"2 @("!S=')C870H('1A<F=E="P@(B\B("D[#0H)
+M(" @("\J(&EF('=E('=E<F4@9VEV96X@82!S=69F:7@L('1H96X@861D(&ET
+M(&%S(&%P<')O<')I871E("HO#0H)(" @(&EF("@@<W5F9FEX("D@('L-"@D)
+M8VAA<B J(&1O=" ]('-T<F-H<B@@;&5A9BP@)RXG("D[#0H)"6EF("@@9&]T
+M("D@('L-"@D)(" @('-T<FYC870H('1A<F=E="P@;&5A9BP@9&]T+6QE868@
+M*3L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!S=69F:7@@*3L-"@D)(" @('-T
+M<F-A="@@=&%R9V5T+"!D;W0@*3L-"@D)(" @(&EF("@@=F5R8F]S92 I#0H)
+M"0EP<FEN=&8H("(E<SH@)7,@=VEL;"!B92!I;G-T86QL960@87,@)7,B+ T*
+M"0D)(" @(" @('!R;V=N86UE+"!F+"!S=')R8VAR*'1A<F=E="PG+R<I*S$@
+M*3L-"@D)?2!E;'-E('L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!L96%F("D[
+M#0H)"2 @("!S=')C870H('1A<F=E="P@<W5F9FEX("D[#0H)"7T-"@D@(" @
+M?2!E;'-E('L-"@D)<W1R8V%T*"!T87)G970L(&QE868@*3L-"@D@(" @?0T*
+M"7T-"@T*"6EF("@@86-C97-S*"!F+" P("D@*2 @>PT*"2 @("!C:&%R(&)U
+M9ELR,#!=.PT*"2 @("!S<')I;G1F*"!B=68L(")C86YN;W0@<F5A9" E<R(L
+M(&8@*3L-"@D@(" @9F%T86PH(&)U9B I.PT*"7T-"@T*"6EF("@@;VYL>5]I
+M9E]N97=E<B F)B!I<U]F:6QE*"!T87)G970@*2 F)B A;F5W97(H(&8L('1A
+M<F=E=" I("D@('L-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<')I;G1F*" B
+M)R5S)R!N;W0@;F5W97(@=&AA;B G)7,G7&XB+"!F+"!T87)G970@*3L-"@D@
+M(" @8V]N=&EN=64[#0H)?0T*#0H):68@*"!V97)B;W-E("D-"@D@(" @<')I
+M;G1F*" B<FT@+68@)7-<;B(L('1A<F=E=" I.PT*"6EF("@@8VAM;V0H('1A
+M<F=E="P@,#<W-R I("D-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<&5R<F]R
+M*"!T87)G970@*3L-"@EI9B H('5N;&EN:R@@=&%R9V5T("D@*0T*"2 @("!I
+M9B H('9E<F)O<V4@*0T*"0EP97)R;W(H('1A<F=E=" I.PT*"6EF("@@=F5R
+M8F]S92 I#0H)(" @('!R:6YT9B@@(F-P("UP("5S("5S7&XB+"!F+"!T87)G
+M970@*3L-"@EI9B H(&9I;&5C;W!Y*"!T87)G970L(&8L(#$@*2 I#0H)(" @
+M(')E='5R;B Q.PT*"6EF("@@;6]D92 I("![#0H)(" @(&-H87(@8G5F6R R
+M-34@73L-"@D@(" @<W!R:6YT9B@@8G5F+" B8VAM;V0@)7,@)7-<;B(L(&UO
+M9&4L('1A<F=E=" I.PT*"2 @("!I9B H('9E<F)O<V4@*0T*"0EP<FEN=&8H
+M("(E<UQN(BP@8G5F("D[#0H)(" @('-Y<W1E;2@@8G5F("D[#0H)?0T*(" @
+:('T-"@T*(" @(')E='5R;B P.PT*?0T*#0IE
+
+end
diff --git a/c/build-tools/packhex.c b/c/build-tools/packhex.c
new file mode 100644
index 0000000000..ddd010c4a9
--- /dev/null
+++ b/c/build-tools/packhex.c
@@ -0,0 +1,513 @@
+
+/***** P A C K H E X . C ************************************************
+ *
+ * Packhex is a hex-file compaction utility. It attempts to concatenate
+ * hex records to produce more size-efficient packaging.
+ *
+ * Limitations: Input files must be correctly formatted. This utility
+ * is not robust enough to detect hex-record formatting
+ * errors.
+ *
+ * Published: 5/93 Embedded Systems magazine
+ *
+ * Compiler: Microsoft C 6.0
+ * cl /F 1000 packhex.c
+ *
+ *
+ * $Id$
+ *
+ **************************************************************************/
+
+
+/* #define SMALLER_RECORDS */
+#ifdef SMALLER_RECORDS
+#define MAX_LEN_S1_RECS 128
+#define MAX_LEN_S2_RECS 128
+#define MAX_LEN_S3_RECS 128
+#else
+#define MAX_LEN_S1_RECS 252
+#define MAX_LEN_S2_RECS 251
+#define MAX_LEN_S3_RECS 250
+#endif
+
+
+/*--------------------------------- includes ---------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__unix__) && !defined(EXIT_FAILURE)
+#define EXIT_FAILURE -1
+#define EXIT_SUCCESS 0
+#endif
+
+/*--------------------------------- defines ----------------------------------*/
+
+#define YES 1
+#define MAX_LINE_SIZE 600
+#define EOS '\0'
+
+
+/*---------------------------------- macros ----------------------------------*/
+
+/* Convert ASCII hexadecimal digit to value. */
+
+#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
+
+
+/*--------------------------------- typedefs ---------------------------------*/
+
+typedef unsigned char Boolean;
+typedef unsigned char Uchar;
+typedef unsigned int Uint;
+typedef unsigned long Ulong;
+
+typedef struct /* Functions and constant returning Hex-record vital stats. */
+{
+ Boolean ( *is_data_record )( char * );
+ Ulong ( *get_address )( char * );
+ Uint ( *get_data_count )( char * );
+ const Uint max_data_count;
+ char *( *get_data_start )( char * );
+ void ( *put_data_record )( Uint, Ulong, char * );
+} Rec_vitals;
+
+
+/*--------------------------- function prototypes ----------------------------*/
+
+Rec_vitals * identify_first_data_record( char * );
+Ulong get_ndigit_hex( char *, int );
+
+
+/*----------------------------- Intel Hex format -----------------------------*/
+
+/*
+ * Intel Hex data-record layout
+ *
+ * :aabbbbccd...dee
+ *
+ * : - header character
+ * aa - record data byte count, a 2-digit hex value
+ * bbbb - record address, a 4-digit hex value
+ * cc - record type, a 2-digit hex value:
+ * "00" is a data record
+ * "01" is an end-of-data record
+ * "02" is an extended-address record
+ * "03" is a start record
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 2's complement
+ * [ (sum of bytes: aabbbbccd...d) modulo 256 ]
+ */
+
+
+Boolean is_intel_data_rec( char * rec_str )
+{
+ return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
+}
+
+Uint get_intel_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
+}
+
+Ulong get_intel_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 3, 4 ) );
+}
+
+char * get_intel_rec_data_start( char * rec_str )
+{
+ return( rec_str + 9 );
+}
+
+void put_intel_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ ":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
+ );
+}
+
+
+Rec_vitals intel_hex =
+{
+ is_intel_data_rec,
+ get_intel_rec_address,
+ get_intel_rec_data_count,
+ 255, /* Maximum data bytes in a record. */
+ get_intel_rec_data_start,
+ put_intel_data_rec
+};
+
+
+/*------------------------- Motorola S1-record format ------------------------*/
+
+/*
+ * Motorola S-record data-record layout
+ *
+ * Sabbc...cd...dee
+ *
+ * S - header character
+ * a - record type, a 1-digit value:
+ * "0" is a header record
+ * "1" is a 2-byte-address data record
+ * "2" is a 3-byte-address data record
+ * "3" is a 4-byte-address data record
+ * "7" is a 4-byte-address end-of-data record
+ * "8" is a 3-byte-address end-of-data record
+ * "9" is a 2-byte-address end-of-data record
+ * bb - record length in bytes, a 2-digit hex value
+ * (record length doesn't count the header/type
+ * chars and checksum byte)
+ * c...c - record address, a 4-, 6-, or 8-digit value,
+ * depending on record type
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 1's complement
+ * [ (sum of all bytes: bbc..cd...d) modulo 256 ]
+ */
+
+#define S1_COUNT_OFFSET 3
+
+
+Boolean is_moto_s1_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
+}
+
+Uint get_moto_s1_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
+}
+
+Ulong get_moto_s1_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 4 ) );
+}
+
+char * get_moto_s1_rec_data_start( char * rec_str )
+{
+ return( rec_str + 8 );
+}
+
+void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S1_COUNT_OFFSET + count +
+ ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S1%02X%04lX%s%02X\n",
+ count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s1_rec =
+{
+ is_moto_s1_data_rec,
+ get_moto_s1_rec_address,
+ get_moto_s1_rec_data_count,
+ MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
+ get_moto_s1_rec_data_start,
+ put_moto_s1_data_rec
+};
+
+
+/*------------------------- Motorola S2-record format ------------------------*/
+
+#define S2_COUNT_OFFSET 4
+
+Boolean is_moto_s2_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
+}
+
+Uint get_moto_s2_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
+}
+
+Ulong get_moto_s2_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 6 ) );
+}
+
+char * get_moto_s2_rec_data_start( char * rec_str )
+{
+ return( rec_str + 10 );
+}
+
+void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S2%02X%06lX%s%02X\n",
+ count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s2_rec =
+{
+ is_moto_s2_data_rec,
+ get_moto_s2_rec_address,
+ get_moto_s2_rec_data_count,
+ MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
+ get_moto_s2_rec_data_start,
+ put_moto_s2_data_rec
+};
+
+
+/*------------------------- Motorola S3-record format ------------------------*/
+
+#define S3_COUNT_OFFSET 5
+
+Boolean is_moto_s3_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
+}
+
+Uint get_moto_s3_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
+}
+
+Ulong get_moto_s3_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 8 ) );
+}
+
+char * get_moto_s3_rec_data_start( char * rec_str )
+{
+ return( rec_str + 12 );
+}
+
+void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
+ ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S3%02X%08lX%s%02X\n",
+ count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s3_rec =
+{
+ is_moto_s3_data_rec,
+ get_moto_s3_rec_address,
+ get_moto_s3_rec_data_count,
+ MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
+ get_moto_s3_rec_data_start,
+ put_moto_s3_data_rec
+};
+
+
+/*-------------------- Put your favorite hex format here ---------------------*/
+
+/*
+ * * * * The following is a template for an additional hex format: * * *
+ *
+ *
+ * Boolean is_X_data_rec( char * rec_str ) {}
+ *
+ * Uint get_X_rec_data_count( char * rec_str ) {}
+ *
+ * Ulong get_X_rec_address( char * rec_str ) {}
+ *
+ * char * get_X_rec_data_start( char * rec_str ) {}
+ *
+ * void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
+ *
+ * Rec_vitals X_rec =
+ * {
+ * is_X_data_rec,
+ * get_X_rec_address,
+ * get_X_rec_data_count,
+ * MAXIMUM DATA BYTES IN A RECORD,
+ * get_X_rec_data_start,
+ * put_X_data_rec
+ * };
+ *
+ */
+
+/*----------------------------------------------------------------------------*/
+
+
+/*
+ * Put address of additional Rec_vitals structures
+ * in this array, before the NULL entry.
+ */
+
+Rec_vitals *formats[] =
+{
+ &intel_hex,
+ &motorola_s1_rec,
+ &motorola_s2_rec,
+ &motorola_s3_rec,
+ ( Rec_vitals * ) NULL
+};
+
+
+/**** main *****************************************************************
+*
+*
+* Expects: Nothing (no command-line parameters).
+*
+* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
+*
+* Reads hex records on the standard input and attempts to
+* splice adjacent data fields together. Results appear on
+* the standard output.
+*
+*******************************************************************************/
+
+void main( void )
+{
+
+ char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
+ char *in_dptr, *out_dptr;
+ int d_total, d_count, d_excess, n;
+ Ulong in_rec_addr, out_rec_addr = 0;
+ Rec_vitals *rptr;
+
+
+ /* Sift through file until first hex record is identified. */
+ if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
+ {
+ fputs( "No hex records found.\n", stderr );
+ exit( EXIT_FAILURE );
+ }
+
+
+ /* Attempt data-record splicing until end-of-file is reached. */
+ d_total = 0;
+ do
+ {
+ if ( rptr->is_data_record( inbuff ) == YES )
+ { /* Input record is a data record. */
+ d_count = rptr->get_data_count( inbuff );
+ in_rec_addr = rptr->get_address( inbuff );
+ in_dptr = rptr->get_data_start( inbuff );
+
+ if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
+ { /* Begin a new output record. */
+ if ( d_total != 0 )
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ out_dptr = outbuff;
+ n = d_total = d_count;
+ out_rec_addr = in_rec_addr;
+ }
+ else if
+ ( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
+ { /* Output a maximum-length record, then start a new record. */
+ strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
+ rptr->put_data_record(
+ rptr->max_data_count, out_rec_addr, outbuff
+ );
+ in_dptr += 2 * ( d_count - d_excess );
+ out_dptr = outbuff;
+ n = d_total = d_excess;
+ out_rec_addr += rptr->max_data_count;
+ }
+ else
+ { /* Append input record's data field with accumulated data. */
+ out_dptr = outbuff + ( 2 * d_total );
+ d_total += n = d_count;
+ }
+ strncpy( out_dptr, in_dptr, 2 * n );
+ out_dptr[ 2 * n ] = EOS;
+ }
+ else
+ { /* Not a data record;
+ * flush accumulated data then echo non-data record.
+ */
+ if ( d_total != 0 )
+ {
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ d_total = 0;
+ }
+ puts( inbuff );
+ }
+ } while ( gets( inbuff ) != NULL );
+
+
+ exit( EXIT_SUCCESS );
+
+}
+
+
+/**** identify_first_data_record *******************************************
+*
+* Expects: Pointer to hex-record line buffer.
+*
+* Returns: Pointer to hex-record structure (NULL if no match found).
+*
+* Reads the standard input, line by line, searching for a valid
+* record header character. If a valid header is found, a pointer
+* to the hex-record's type structure is returned, otherwise NULL.
+*
+* The input-stream pointer is left pointing to the first valid hex record.
+*
+*******************************************************************************/
+
+Rec_vitals * identify_first_data_record( char * buff_ptr )
+{
+ Rec_vitals ** ptr;
+
+ while ( gets( buff_ptr ) != NULL )
+ {
+ for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
+ if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
+ return( *ptr ); /* Successful return. */
+
+ puts( buff_ptr ); /* Echo non-hex-record line. */
+ }
+
+ return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
+}
+
+
+/**** get_ndigit_hex *******************************************************
+*
+* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
+*
+* Returns: Value of hexadecimal string as an unsigned long.
+*
+*******************************************************************************/
+
+Ulong get_ndigit_hex( char * cptr, int digits )
+{
+ Ulong value;
+
+ for ( value = 0 ; --digits >= 0 ; cptr++ )
+ value = ( value * 16L ) + HEX_DIGIT( *cptr );
+
+ return( value );
+}
diff --git a/c/build-tools/scripts/README b/c/build-tools/scripts/README
new file mode 100644
index 0000000000..0436fc958d
--- /dev/null
+++ b/c/build-tools/scripts/README
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+Misc. support tools for RTEMS workspaces.
+More will be added later as they are converted from Teamware
+to CVS.
+
+install-if-change
+ Smart install script that also can append suffixes as it
+ installs (suffixes used for debug and profile variants).
+ Requires bash or ksh.
+
+rcs-clean
+ deletes all files from the current directory that can be
+ re-created from RCS. Careful to not delete locked files.
+ May be used by 'gmake clobber'
+
+lock-directory
+unlock-directory
+ traverse a directory structure making it unwritable.
+ Useful to keep people from accidentally overwriting
+ "released" trees if they get confused about which
+ module they have loaded.
+
+rtems-glom
+ glom together all the rtems libraries in order to simplify
+ the link line used by applications.
+ Produces rtems.rel.
+ Not used by the RTEMS src tree at all.
+ Strictly optional.
+
diff --git a/c/build-tools/src/cklength.c b/c/build-tools/src/cklength.c
new file mode 100644
index 0000000000..6059cacb1f
--- /dev/null
+++ b/c/build-tools/src/cklength.c
@@ -0,0 +1,364 @@
+/*
+ * cklength - check the length of lines in a file
+ *
+ * This program check to see if the files passed to it on the command line
+ * contain a line which exceeds the maximum allowable length. The default
+ * maximum line length is 80.
+ *
+ * usage: cklength [ -v ] [ arg ... ] files...
+ * -l length -- maximum line length
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "l:nNv"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -l length -- maximum line length\n\
+ -n -- report line numbers for offending lines\n\
+ -N -- report line numbers and length for offending lines\n\
+ -v -- verbose\n\
+\n\
+Print the name of files which have at least 1 line which exceeds the\n\
+maximum line length. The default maximum line length is 80.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 512
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int report_line_numbers = FALSE; /* report line numbers of offenders */
+int report_line_length = FALSE; /* report line length of offenders */
+
+int line_length = 80; /* maximum allowable line length */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 'l': /* line length */
+ line_length = atoi( optarg );
+ if ( line_length < 0 || line_length > BUFFER_SIZE )
+ error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
+ break;
+
+ case 'n': /* toggle report_line_numbers */
+ report_line_numbers = ! report_line_numbers;
+ break;
+
+ case 'N': /* toggle both reports */
+ report_line_numbers = ! report_line_numbers;
+ report_line_length = ! report_line_length;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int line_number;
+ int length;
+ int count;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ count = 0;
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( length <= line_length )
+ continue;
+
+ if ( count == 0 ) {
+ fprintf( stderr, "%s\n", arg );
+ if ( !report_line_numbers )
+ break;
+ }
+
+ if ( verbose )
+ fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
+
+ if ( report_line_numbers ) {
+ if ( report_line_length )
+ fprintf( stderr, "%d: %d\n" , line_number, length );
+ else
+ fprintf( stderr, "%d\n" , line_number );
+ }
+
+ count++;
+
+ }
+
+ fclose( in );
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/c/build-tools/src/eolstrip.c b/c/build-tools/src/eolstrip.c
new file mode 100644
index 0000000000..b4e0d5d165
--- /dev/null
+++ b/c/build-tools/src/eolstrip.c
@@ -0,0 +1,351 @@
+/*
+ * eolstrip - strip white space from end of lines
+ *
+ * This program strips the white space from the end of every line in the
+ * specified program.
+ *
+ * usage: eolstrip [ -v ] [ arg ... ] files...
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "vt"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -v -- verbose\n\
+ -t -- test only .. DO NOT OVERWRITE FILE!!!\n\
+\n\
+Strip the white space from the end of every line on the list of files.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 2048
+#define MAX_PATH 2048
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int test_only = FALSE; /* test only */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 't': /* toggle test only mode */
+ test_only = ! test_only;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ FILE *out = (FILE *) 0;
+ char outname[ MAX_PATH ];
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int length;
+ int line_number;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ if ( !test_only ) {
+ sprintf( outname, "%s.eoltmp", arg );
+
+ out = fopen( outname, "w" );
+ if (!out)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+ }
+
+ if ( verbose )
+ fprintf( stderr, "Processing %s\n", arg );
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( buffer[ length ] != '\n' )
+ error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
+
+ while ( isspace( buffer[ length ] ) )
+ buffer[ length-- ] = '\0';
+
+ if ( test_only ) {
+ fprintf( stderr, "%s\n", arg );
+ break;
+ }
+
+ fprintf( out, "%s\n", buffer );
+ }
+
+ fclose( in );
+ if ( !test_only ) {
+ fclose( out );
+ rename( outname, arg );
+ }
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/c/build-tools/src/packhex.c b/c/build-tools/src/packhex.c
new file mode 100644
index 0000000000..ddd010c4a9
--- /dev/null
+++ b/c/build-tools/src/packhex.c
@@ -0,0 +1,513 @@
+
+/***** P A C K H E X . C ************************************************
+ *
+ * Packhex is a hex-file compaction utility. It attempts to concatenate
+ * hex records to produce more size-efficient packaging.
+ *
+ * Limitations: Input files must be correctly formatted. This utility
+ * is not robust enough to detect hex-record formatting
+ * errors.
+ *
+ * Published: 5/93 Embedded Systems magazine
+ *
+ * Compiler: Microsoft C 6.0
+ * cl /F 1000 packhex.c
+ *
+ *
+ * $Id$
+ *
+ **************************************************************************/
+
+
+/* #define SMALLER_RECORDS */
+#ifdef SMALLER_RECORDS
+#define MAX_LEN_S1_RECS 128
+#define MAX_LEN_S2_RECS 128
+#define MAX_LEN_S3_RECS 128
+#else
+#define MAX_LEN_S1_RECS 252
+#define MAX_LEN_S2_RECS 251
+#define MAX_LEN_S3_RECS 250
+#endif
+
+
+/*--------------------------------- includes ---------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__unix__) && !defined(EXIT_FAILURE)
+#define EXIT_FAILURE -1
+#define EXIT_SUCCESS 0
+#endif
+
+/*--------------------------------- defines ----------------------------------*/
+
+#define YES 1
+#define MAX_LINE_SIZE 600
+#define EOS '\0'
+
+
+/*---------------------------------- macros ----------------------------------*/
+
+/* Convert ASCII hexadecimal digit to value. */
+
+#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
+
+
+/*--------------------------------- typedefs ---------------------------------*/
+
+typedef unsigned char Boolean;
+typedef unsigned char Uchar;
+typedef unsigned int Uint;
+typedef unsigned long Ulong;
+
+typedef struct /* Functions and constant returning Hex-record vital stats. */
+{
+ Boolean ( *is_data_record )( char * );
+ Ulong ( *get_address )( char * );
+ Uint ( *get_data_count )( char * );
+ const Uint max_data_count;
+ char *( *get_data_start )( char * );
+ void ( *put_data_record )( Uint, Ulong, char * );
+} Rec_vitals;
+
+
+/*--------------------------- function prototypes ----------------------------*/
+
+Rec_vitals * identify_first_data_record( char * );
+Ulong get_ndigit_hex( char *, int );
+
+
+/*----------------------------- Intel Hex format -----------------------------*/
+
+/*
+ * Intel Hex data-record layout
+ *
+ * :aabbbbccd...dee
+ *
+ * : - header character
+ * aa - record data byte count, a 2-digit hex value
+ * bbbb - record address, a 4-digit hex value
+ * cc - record type, a 2-digit hex value:
+ * "00" is a data record
+ * "01" is an end-of-data record
+ * "02" is an extended-address record
+ * "03" is a start record
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 2's complement
+ * [ (sum of bytes: aabbbbccd...d) modulo 256 ]
+ */
+
+
+Boolean is_intel_data_rec( char * rec_str )
+{
+ return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
+}
+
+Uint get_intel_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
+}
+
+Ulong get_intel_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 3, 4 ) );
+}
+
+char * get_intel_rec_data_start( char * rec_str )
+{
+ return( rec_str + 9 );
+}
+
+void put_intel_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ ":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
+ );
+}
+
+
+Rec_vitals intel_hex =
+{
+ is_intel_data_rec,
+ get_intel_rec_address,
+ get_intel_rec_data_count,
+ 255, /* Maximum data bytes in a record. */
+ get_intel_rec_data_start,
+ put_intel_data_rec
+};
+
+
+/*------------------------- Motorola S1-record format ------------------------*/
+
+/*
+ * Motorola S-record data-record layout
+ *
+ * Sabbc...cd...dee
+ *
+ * S - header character
+ * a - record type, a 1-digit value:
+ * "0" is a header record
+ * "1" is a 2-byte-address data record
+ * "2" is a 3-byte-address data record
+ * "3" is a 4-byte-address data record
+ * "7" is a 4-byte-address end-of-data record
+ * "8" is a 3-byte-address end-of-data record
+ * "9" is a 2-byte-address end-of-data record
+ * bb - record length in bytes, a 2-digit hex value
+ * (record length doesn't count the header/type
+ * chars and checksum byte)
+ * c...c - record address, a 4-, 6-, or 8-digit value,
+ * depending on record type
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 1's complement
+ * [ (sum of all bytes: bbc..cd...d) modulo 256 ]
+ */
+
+#define S1_COUNT_OFFSET 3
+
+
+Boolean is_moto_s1_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
+}
+
+Uint get_moto_s1_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
+}
+
+Ulong get_moto_s1_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 4 ) );
+}
+
+char * get_moto_s1_rec_data_start( char * rec_str )
+{
+ return( rec_str + 8 );
+}
+
+void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S1_COUNT_OFFSET + count +
+ ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S1%02X%04lX%s%02X\n",
+ count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s1_rec =
+{
+ is_moto_s1_data_rec,
+ get_moto_s1_rec_address,
+ get_moto_s1_rec_data_count,
+ MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
+ get_moto_s1_rec_data_start,
+ put_moto_s1_data_rec
+};
+
+
+/*------------------------- Motorola S2-record format ------------------------*/
+
+#define S2_COUNT_OFFSET 4
+
+Boolean is_moto_s2_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
+}
+
+Uint get_moto_s2_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
+}
+
+Ulong get_moto_s2_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 6 ) );
+}
+
+char * get_moto_s2_rec_data_start( char * rec_str )
+{
+ return( rec_str + 10 );
+}
+
+void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S2%02X%06lX%s%02X\n",
+ count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s2_rec =
+{
+ is_moto_s2_data_rec,
+ get_moto_s2_rec_address,
+ get_moto_s2_rec_data_count,
+ MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
+ get_moto_s2_rec_data_start,
+ put_moto_s2_data_rec
+};
+
+
+/*------------------------- Motorola S3-record format ------------------------*/
+
+#define S3_COUNT_OFFSET 5
+
+Boolean is_moto_s3_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
+}
+
+Uint get_moto_s3_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
+}
+
+Ulong get_moto_s3_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 8 ) );
+}
+
+char * get_moto_s3_rec_data_start( char * rec_str )
+{
+ return( rec_str + 12 );
+}
+
+void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
+ ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S3%02X%08lX%s%02X\n",
+ count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s3_rec =
+{
+ is_moto_s3_data_rec,
+ get_moto_s3_rec_address,
+ get_moto_s3_rec_data_count,
+ MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
+ get_moto_s3_rec_data_start,
+ put_moto_s3_data_rec
+};
+
+
+/*-------------------- Put your favorite hex format here ---------------------*/
+
+/*
+ * * * * The following is a template for an additional hex format: * * *
+ *
+ *
+ * Boolean is_X_data_rec( char * rec_str ) {}
+ *
+ * Uint get_X_rec_data_count( char * rec_str ) {}
+ *
+ * Ulong get_X_rec_address( char * rec_str ) {}
+ *
+ * char * get_X_rec_data_start( char * rec_str ) {}
+ *
+ * void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
+ *
+ * Rec_vitals X_rec =
+ * {
+ * is_X_data_rec,
+ * get_X_rec_address,
+ * get_X_rec_data_count,
+ * MAXIMUM DATA BYTES IN A RECORD,
+ * get_X_rec_data_start,
+ * put_X_data_rec
+ * };
+ *
+ */
+
+/*----------------------------------------------------------------------------*/
+
+
+/*
+ * Put address of additional Rec_vitals structures
+ * in this array, before the NULL entry.
+ */
+
+Rec_vitals *formats[] =
+{
+ &intel_hex,
+ &motorola_s1_rec,
+ &motorola_s2_rec,
+ &motorola_s3_rec,
+ ( Rec_vitals * ) NULL
+};
+
+
+/**** main *****************************************************************
+*
+*
+* Expects: Nothing (no command-line parameters).
+*
+* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
+*
+* Reads hex records on the standard input and attempts to
+* splice adjacent data fields together. Results appear on
+* the standard output.
+*
+*******************************************************************************/
+
+void main( void )
+{
+
+ char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
+ char *in_dptr, *out_dptr;
+ int d_total, d_count, d_excess, n;
+ Ulong in_rec_addr, out_rec_addr = 0;
+ Rec_vitals *rptr;
+
+
+ /* Sift through file until first hex record is identified. */
+ if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
+ {
+ fputs( "No hex records found.\n", stderr );
+ exit( EXIT_FAILURE );
+ }
+
+
+ /* Attempt data-record splicing until end-of-file is reached. */
+ d_total = 0;
+ do
+ {
+ if ( rptr->is_data_record( inbuff ) == YES )
+ { /* Input record is a data record. */
+ d_count = rptr->get_data_count( inbuff );
+ in_rec_addr = rptr->get_address( inbuff );
+ in_dptr = rptr->get_data_start( inbuff );
+
+ if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
+ { /* Begin a new output record. */
+ if ( d_total != 0 )
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ out_dptr = outbuff;
+ n = d_total = d_count;
+ out_rec_addr = in_rec_addr;
+ }
+ else if
+ ( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
+ { /* Output a maximum-length record, then start a new record. */
+ strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
+ rptr->put_data_record(
+ rptr->max_data_count, out_rec_addr, outbuff
+ );
+ in_dptr += 2 * ( d_count - d_excess );
+ out_dptr = outbuff;
+ n = d_total = d_excess;
+ out_rec_addr += rptr->max_data_count;
+ }
+ else
+ { /* Append input record's data field with accumulated data. */
+ out_dptr = outbuff + ( 2 * d_total );
+ d_total += n = d_count;
+ }
+ strncpy( out_dptr, in_dptr, 2 * n );
+ out_dptr[ 2 * n ] = EOS;
+ }
+ else
+ { /* Not a data record;
+ * flush accumulated data then echo non-data record.
+ */
+ if ( d_total != 0 )
+ {
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ d_total = 0;
+ }
+ puts( inbuff );
+ }
+ } while ( gets( inbuff ) != NULL );
+
+
+ exit( EXIT_SUCCESS );
+
+}
+
+
+/**** identify_first_data_record *******************************************
+*
+* Expects: Pointer to hex-record line buffer.
+*
+* Returns: Pointer to hex-record structure (NULL if no match found).
+*
+* Reads the standard input, line by line, searching for a valid
+* record header character. If a valid header is found, a pointer
+* to the hex-record's type structure is returned, otherwise NULL.
+*
+* The input-stream pointer is left pointing to the first valid hex record.
+*
+*******************************************************************************/
+
+Rec_vitals * identify_first_data_record( char * buff_ptr )
+{
+ Rec_vitals ** ptr;
+
+ while ( gets( buff_ptr ) != NULL )
+ {
+ for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
+ if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
+ return( *ptr ); /* Successful return. */
+
+ puts( buff_ptr ); /* Echo non-hex-record line. */
+ }
+
+ return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
+}
+
+
+/**** get_ndigit_hex *******************************************************
+*
+* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
+*
+* Returns: Value of hexadecimal string as an unsigned long.
+*
+*******************************************************************************/
+
+Ulong get_ndigit_hex( char * cptr, int digits )
+{
+ Ulong value;
+
+ for ( value = 0 ; --digits >= 0 ; cptr++ )
+ value = ( value * 16L ) + HEX_DIGIT( *cptr );
+
+ return( value );
+}
diff --git a/c/build-tools/src/unhex.c b/c/build-tools/src/unhex.c
new file mode 100644
index 0000000000..ba099c4772
--- /dev/null
+++ b/c/build-tools/src/unhex.c
@@ -0,0 +1,721 @@
+/*
+ * unhex
+ * convert a hex file to binary equivalent. If more than one file name
+ * is given, then the output will be logically concatenated together.
+ * stdin and stdout are defaults. Verbose will enable checksum output.
+ *
+ * Supported input formats are Intel hex, Motorola S records, and TI 'B'
+ * records.
+ *
+ * Intel hex input format is
+ * Byte
+ * 1 Colon :
+ * 2..3 Record length, eg: "20"
+ * 4..7 load address nibbles
+ * 8..9 record type: "00" (data) or "02" base addr
+ * 10..x data bytes in ascii-hex
+ * x+1..x+2 cksum (2's compl of (len+addr+data))
+ * x+3 \n -- newline
+ *
+ * $Id$
+ */
+
+char *USAGE = "\
+usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
+ -v -- verbose\n\
+ -a base -- 1st byte of output corresponds to this address\n\
+ -l -- linear, just writes data out\n\
+ -o file -- output file; must not be input file\n\
+ -F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
+ up to \"k_bits\" * 1024 bits\n\
+";
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define OK 0
+#define FAILURE (-1)
+#define Failed(x) ((x) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+typedef char bool;
+#define STREQ(a,b) (strcmp(a,b) == 0)
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * Pick out designated bytes
+ */
+
+#define B0(x) ((x) & 0xff)
+#define B1(x) B0((x) >> 8)
+#define B2(x) B0((x) >> 16)
+#define B3(x) B0((x) >> 24)
+
+typedef struct buffer_rec {
+ u32 dl_destaddr;
+ u32 dl_jumpaddr;
+ int dl_count;
+ u8 dl_buf[512];
+} buffer_rec;
+
+/*
+ * vars controlled by command line options
+ */
+
+bool verbose = FALSE; /* be verbose */
+bool linear = FALSE; /* just write out linear data */
+char *outfilename = "-"; /* default output is stdout */
+u32 base = 0L; /* base address */
+u32 FFfill = 0L; /* how far to fill w 0xFF's */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind;
+extern int errno;
+
+char *progname; /* for error() */
+
+void error(int errn, ...);
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtoul(p, (char **) NULL, 0)
+
+int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+void write_record(buffer_rec *tb, FILE *fp);
+int getnibble(char **p);
+int getbyte(char **p);
+long getNbytes(char **p, int n);
+void badformat(char *s, char *fname, char *msg);
+
+#define get1bytes(p) ((int) getbyte(p))
+#define get2bytes(p) ((int) getNbytes(p, 2))
+#define get3bytes(p) getNbytes(p, 3)
+#define get4bytes(p) getNbytes(p, 4)
+
+char *BADADDR = "Invalid record address";
+char *BADLEN = "Invalid record length";
+char *BADBASE = "Bad base or starting address";
+char *BADFMT = "Unrecognized record type";
+char *BADDATA = "Invalid data byte";
+char *BADCSUM = "Invalid checksum";
+char *MISCSUM = "Checksum mismatch";
+char *BADTYPE = "Unrecognized record type";
+char *MISTYPE = "Incompatible record types";
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ register int c;
+ bool showusage = FALSE; /* usage error? */
+ int rc = 0;
+ FILE *outfp, *infp;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ progname = argv[0];
+ while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
+ switch (c)
+ {
+ case 'a': /* base address */
+ base = stol(optarg);
+ break;
+
+ case 'l': /* linear output */
+ linear = TRUE;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case 'o': /* output file */
+ outfilename = optarg;
+ break;
+
+ case 'F': /* 0xFF fill amount (bytes) */
+ FFfill = stol(optarg) * 1024L / 8L;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ if (linear && (base != 0))
+ {
+ error(0, "-l and -a may not be specified in combination");
+ exit(1);
+ }
+
+ if (STREQ(outfilename, "-"))
+ {
+ outfp = stdout;
+ outfilename = "stdout";
+ }
+ else
+ if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for output", outfilename);
+ exit(1);
+ }
+
+ /*
+ * Now process the input files (or stdin, if none specified)
+ */
+
+ if (argv[optind] == (char *) NULL) /* just stdin */
+ exit(unhex(stdin, "stdin", outfp, outfilename));
+ else
+ for (; (optarg = argv[optind]); optind++)
+ {
+ if (STREQ(optarg, "-"))
+ rc += unhex(stdin, "stdin", outfp, outfilename);
+ else
+ {
+ if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for input", optarg);
+ exit(1);
+ }
+ rc += unhex(infp, optarg, outfp, outfilename);
+ }
+ }
+
+ return(rc);
+}
+
+u16 filesum;
+
+int
+unhex(FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ int c;
+
+ filesum = 0;
+
+ /*
+ * Make sure holes will be filled with 0xFF's if requested. We
+ * do this the easy way by just filling the file with FF's before
+ * getting started. To do it more optimally would be quite a bit
+ * more difficult since the user can skip around as much as he/she
+ * likes in the input hex file addressing.
+ *
+ * We'll clean this up later (after this program has run) with
+ * 'stripffs'
+ */
+
+ if (FFfill)
+ {
+ (void) fseek(ofp, 0, 0);
+ for (c = FFfill; c > 0; c--)
+ (void) fputc(0xFF, ofp);
+ }
+
+ /*
+ * Read the first char from file and determine record types
+ */
+
+ if ((c = getc(ifp)) != EOF)
+ {
+ ungetc(c, ifp);
+ switch(c)
+ {
+ case 'S':
+ convert_S_records(ifp, inm, ofp, onm);
+ break;
+
+ case ':':
+ convert_Intel_records(ifp, inm, ofp, onm);
+ break;
+
+ case '9':
+ case 'B':
+ convert_TI_records(ifp, inm, ofp, onm);
+ break;
+
+ default:
+ {
+ char tmp[2];
+ tmp[0] = c; tmp[1] = 0;
+ badformat(tmp, inm, BADFMT);
+ }
+ }
+ }
+
+ if (verbose)
+ fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
+
+ return 0;
+}
+
+int
+convert_Intel_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int rectype; /* record type */
+ int len; /* data length of current line */
+ u32 addr;
+ u32 base_address = 0;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != ':')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+
+ if ((addr = get2bytes(&p)) == -1L) /* record addr */
+ badformat(buff, inm, BADADDR);
+
+ rectype = getbyte(&p);
+
+ cksum = len + B0(addr) + B1(addr) + rectype;
+
+ switch (rectype)
+ {
+ case 0x00: /* normal data record */
+ tb.dl_destaddr = base_address + addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x01: /* execution start address */
+ base_address = addr;
+ endrecord = TRUE;
+ break;
+
+ case 0x02: /* new base */
+ if ((base_address = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADBASE);
+ cksum += B0(base_address) + B1(base_address);
+ base_address <<= 4;
+ break;
+
+ case 0x03: /* seg/off execution start address */
+ {
+ u32 seg, off;
+
+ seg = get2bytes(&p);
+ off = get2bytes(&p);
+ if ((seg == -1L) || (off == -1L))
+ badformat(buff, inm, BADADDR);
+
+ cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
+
+ tb.dl_jumpaddr = (seg << 4) + off;
+ break;
+ }
+
+ default:
+ error(0, "unknown Intel-hex record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (-cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_S_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int len; /* data length of current line */
+ int rectype; /* record type */
+ u32 addr;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != 'S')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((rectype = getnibble(&p)) == -1) /* record type */
+ badformat(buff, inm, BADTYPE);
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+ cksum = len;
+
+ switch (rectype)
+ {
+ case 0x00: /* comment field, ignored */
+ goto write_it;
+
+ case 0x01: /* data record, 16 bit addr */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 3;
+ goto doit;
+
+ case 0x02: /* ... 24 bit addr */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 4;
+ goto doit;
+
+ case 0x03: /* ... 32 bit addr */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 5;
+ doit:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+
+ tb.dl_destaddr = addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x07: /* 32 bit end record */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x08: /* 24 bit end record */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x09: /* 16 bit end record */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+
+end_rec:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+ tb.dl_jumpaddr = addr;
+ break;
+
+ default:
+ error(0, "unknown Motorola-S record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ break;
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (~cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+write_it:
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_TI_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ int c;
+ bool endrecord = FALSE;
+ bool eol;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ p = &buff[0];
+ eol = FALSE;
+ while ( ! eol && ! endrecord)
+ {
+ switch (*p++)
+ {
+ case '9':
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ tb.dl_destaddr = get2bytes(&p);
+ break;
+
+ case 'B':
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ break;
+
+ case 'F':
+ eol = TRUE;
+ break;
+
+ case ':':
+ endrecord = TRUE;
+ break;
+
+ default:
+ badformat(p, inm, BADFMT);
+ }
+ }
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+void
+write_record(buffer_rec *tb,
+ FILE *fp)
+{
+ if ( ! linear)
+ {
+ if (tb->dl_destaddr < base)
+ error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
+ tb->dl_destaddr, base);
+ (void) fseek(fp, tb->dl_destaddr - base, 0);
+ }
+
+ (void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
+ tb->dl_destaddr += tb->dl_count;
+ tb->dl_count = 0;
+}
+
+int
+getnibble(char **p)
+{
+ register int val;
+
+ **p = toupper(**p);
+ switch (**p)
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ val = **p - '0';
+ break;
+
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ val = 10 + (**p - 'A');
+ break;
+
+ default:
+ return(-1);
+ }
+ *p += 1;
+
+ return(val & 0x0f);
+}
+
+int
+getbyte(char **p)
+{
+ int n0, n1;
+
+ if ((n0 = getnibble(p)) == -1)
+ return(-1);
+ if ((n1 = getnibble(p)) == -1)
+ return(-1);
+
+ return(((n0 << 4) + n1) & 0xff);
+}
+
+long
+getNbytes(char **p,
+ int n)
+{
+ int t;
+ u32 val = 0;
+
+ while (n--)
+ {
+ if ((t = getbyte(p)) == -1)
+ return(-1L);
+ val <<= 8;
+ val += t;
+ }
+
+ return(val);
+}
+
+void
+badformat(char *s,
+ char *fname,
+ char *msg)
+{
+ if (s[strlen(s)-1] == '\n') /* get rid of newline */
+ s[strlen(s)-1] = '\0';
+ error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
+ exit(1);
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_EXIT bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
diff --git a/c/build-tools/unhex.c b/c/build-tools/unhex.c
new file mode 100644
index 0000000000..ba099c4772
--- /dev/null
+++ b/c/build-tools/unhex.c
@@ -0,0 +1,721 @@
+/*
+ * unhex
+ * convert a hex file to binary equivalent. If more than one file name
+ * is given, then the output will be logically concatenated together.
+ * stdin and stdout are defaults. Verbose will enable checksum output.
+ *
+ * Supported input formats are Intel hex, Motorola S records, and TI 'B'
+ * records.
+ *
+ * Intel hex input format is
+ * Byte
+ * 1 Colon :
+ * 2..3 Record length, eg: "20"
+ * 4..7 load address nibbles
+ * 8..9 record type: "00" (data) or "02" base addr
+ * 10..x data bytes in ascii-hex
+ * x+1..x+2 cksum (2's compl of (len+addr+data))
+ * x+3 \n -- newline
+ *
+ * $Id$
+ */
+
+char *USAGE = "\
+usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
+ -v -- verbose\n\
+ -a base -- 1st byte of output corresponds to this address\n\
+ -l -- linear, just writes data out\n\
+ -o file -- output file; must not be input file\n\
+ -F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
+ up to \"k_bits\" * 1024 bits\n\
+";
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define OK 0
+#define FAILURE (-1)
+#define Failed(x) ((x) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+typedef char bool;
+#define STREQ(a,b) (strcmp(a,b) == 0)
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * Pick out designated bytes
+ */
+
+#define B0(x) ((x) & 0xff)
+#define B1(x) B0((x) >> 8)
+#define B2(x) B0((x) >> 16)
+#define B3(x) B0((x) >> 24)
+
+typedef struct buffer_rec {
+ u32 dl_destaddr;
+ u32 dl_jumpaddr;
+ int dl_count;
+ u8 dl_buf[512];
+} buffer_rec;
+
+/*
+ * vars controlled by command line options
+ */
+
+bool verbose = FALSE; /* be verbose */
+bool linear = FALSE; /* just write out linear data */
+char *outfilename = "-"; /* default output is stdout */
+u32 base = 0L; /* base address */
+u32 FFfill = 0L; /* how far to fill w 0xFF's */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind;
+extern int errno;
+
+char *progname; /* for error() */
+
+void error(int errn, ...);
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtoul(p, (char **) NULL, 0)
+
+int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+void write_record(buffer_rec *tb, FILE *fp);
+int getnibble(char **p);
+int getbyte(char **p);
+long getNbytes(char **p, int n);
+void badformat(char *s, char *fname, char *msg);
+
+#define get1bytes(p) ((int) getbyte(p))
+#define get2bytes(p) ((int) getNbytes(p, 2))
+#define get3bytes(p) getNbytes(p, 3)
+#define get4bytes(p) getNbytes(p, 4)
+
+char *BADADDR = "Invalid record address";
+char *BADLEN = "Invalid record length";
+char *BADBASE = "Bad base or starting address";
+char *BADFMT = "Unrecognized record type";
+char *BADDATA = "Invalid data byte";
+char *BADCSUM = "Invalid checksum";
+char *MISCSUM = "Checksum mismatch";
+char *BADTYPE = "Unrecognized record type";
+char *MISTYPE = "Incompatible record types";
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ register int c;
+ bool showusage = FALSE; /* usage error? */
+ int rc = 0;
+ FILE *outfp, *infp;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ progname = argv[0];
+ while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
+ switch (c)
+ {
+ case 'a': /* base address */
+ base = stol(optarg);
+ break;
+
+ case 'l': /* linear output */
+ linear = TRUE;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case 'o': /* output file */
+ outfilename = optarg;
+ break;
+
+ case 'F': /* 0xFF fill amount (bytes) */
+ FFfill = stol(optarg) * 1024L / 8L;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ if (linear && (base != 0))
+ {
+ error(0, "-l and -a may not be specified in combination");
+ exit(1);
+ }
+
+ if (STREQ(outfilename, "-"))
+ {
+ outfp = stdout;
+ outfilename = "stdout";
+ }
+ else
+ if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for output", outfilename);
+ exit(1);
+ }
+
+ /*
+ * Now process the input files (or stdin, if none specified)
+ */
+
+ if (argv[optind] == (char *) NULL) /* just stdin */
+ exit(unhex(stdin, "stdin", outfp, outfilename));
+ else
+ for (; (optarg = argv[optind]); optind++)
+ {
+ if (STREQ(optarg, "-"))
+ rc += unhex(stdin, "stdin", outfp, outfilename);
+ else
+ {
+ if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for input", optarg);
+ exit(1);
+ }
+ rc += unhex(infp, optarg, outfp, outfilename);
+ }
+ }
+
+ return(rc);
+}
+
+u16 filesum;
+
+int
+unhex(FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ int c;
+
+ filesum = 0;
+
+ /*
+ * Make sure holes will be filled with 0xFF's if requested. We
+ * do this the easy way by just filling the file with FF's before
+ * getting started. To do it more optimally would be quite a bit
+ * more difficult since the user can skip around as much as he/she
+ * likes in the input hex file addressing.
+ *
+ * We'll clean this up later (after this program has run) with
+ * 'stripffs'
+ */
+
+ if (FFfill)
+ {
+ (void) fseek(ofp, 0, 0);
+ for (c = FFfill; c > 0; c--)
+ (void) fputc(0xFF, ofp);
+ }
+
+ /*
+ * Read the first char from file and determine record types
+ */
+
+ if ((c = getc(ifp)) != EOF)
+ {
+ ungetc(c, ifp);
+ switch(c)
+ {
+ case 'S':
+ convert_S_records(ifp, inm, ofp, onm);
+ break;
+
+ case ':':
+ convert_Intel_records(ifp, inm, ofp, onm);
+ break;
+
+ case '9':
+ case 'B':
+ convert_TI_records(ifp, inm, ofp, onm);
+ break;
+
+ default:
+ {
+ char tmp[2];
+ tmp[0] = c; tmp[1] = 0;
+ badformat(tmp, inm, BADFMT);
+ }
+ }
+ }
+
+ if (verbose)
+ fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
+
+ return 0;
+}
+
+int
+convert_Intel_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int rectype; /* record type */
+ int len; /* data length of current line */
+ u32 addr;
+ u32 base_address = 0;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != ':')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+
+ if ((addr = get2bytes(&p)) == -1L) /* record addr */
+ badformat(buff, inm, BADADDR);
+
+ rectype = getbyte(&p);
+
+ cksum = len + B0(addr) + B1(addr) + rectype;
+
+ switch (rectype)
+ {
+ case 0x00: /* normal data record */
+ tb.dl_destaddr = base_address + addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x01: /* execution start address */
+ base_address = addr;
+ endrecord = TRUE;
+ break;
+
+ case 0x02: /* new base */
+ if ((base_address = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADBASE);
+ cksum += B0(base_address) + B1(base_address);
+ base_address <<= 4;
+ break;
+
+ case 0x03: /* seg/off execution start address */
+ {
+ u32 seg, off;
+
+ seg = get2bytes(&p);
+ off = get2bytes(&p);
+ if ((seg == -1L) || (off == -1L))
+ badformat(buff, inm, BADADDR);
+
+ cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
+
+ tb.dl_jumpaddr = (seg << 4) + off;
+ break;
+ }
+
+ default:
+ error(0, "unknown Intel-hex record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (-cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_S_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int len; /* data length of current line */
+ int rectype; /* record type */
+ u32 addr;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != 'S')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((rectype = getnibble(&p)) == -1) /* record type */
+ badformat(buff, inm, BADTYPE);
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+ cksum = len;
+
+ switch (rectype)
+ {
+ case 0x00: /* comment field, ignored */
+ goto write_it;
+
+ case 0x01: /* data record, 16 bit addr */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 3;
+ goto doit;
+
+ case 0x02: /* ... 24 bit addr */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 4;
+ goto doit;
+
+ case 0x03: /* ... 32 bit addr */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 5;
+ doit:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+
+ tb.dl_destaddr = addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x07: /* 32 bit end record */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x08: /* 24 bit end record */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x09: /* 16 bit end record */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+
+end_rec:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+ tb.dl_jumpaddr = addr;
+ break;
+
+ default:
+ error(0, "unknown Motorola-S record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ break;
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (~cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+write_it:
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_TI_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ int c;
+ bool endrecord = FALSE;
+ bool eol;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ p = &buff[0];
+ eol = FALSE;
+ while ( ! eol && ! endrecord)
+ {
+ switch (*p++)
+ {
+ case '9':
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ tb.dl_destaddr = get2bytes(&p);
+ break;
+
+ case 'B':
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ break;
+
+ case 'F':
+ eol = TRUE;
+ break;
+
+ case ':':
+ endrecord = TRUE;
+ break;
+
+ default:
+ badformat(p, inm, BADFMT);
+ }
+ }
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+void
+write_record(buffer_rec *tb,
+ FILE *fp)
+{
+ if ( ! linear)
+ {
+ if (tb->dl_destaddr < base)
+ error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
+ tb->dl_destaddr, base);
+ (void) fseek(fp, tb->dl_destaddr - base, 0);
+ }
+
+ (void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
+ tb->dl_destaddr += tb->dl_count;
+ tb->dl_count = 0;
+}
+
+int
+getnibble(char **p)
+{
+ register int val;
+
+ **p = toupper(**p);
+ switch (**p)
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ val = **p - '0';
+ break;
+
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ val = 10 + (**p - 'A');
+ break;
+
+ default:
+ return(-1);
+ }
+ *p += 1;
+
+ return(val & 0x0f);
+}
+
+int
+getbyte(char **p)
+{
+ int n0, n1;
+
+ if ((n0 = getnibble(p)) == -1)
+ return(-1);
+ if ((n1 = getnibble(p)) == -1)
+ return(-1);
+
+ return(((n0 << 4) + n1) & 0xff);
+}
+
+long
+getNbytes(char **p,
+ int n)
+{
+ int t;
+ u32 val = 0;
+
+ while (n--)
+ {
+ if ((t = getbyte(p)) == -1)
+ return(-1L);
+ val <<= 8;
+ val += t;
+ }
+
+ return(val);
+}
+
+void
+badformat(char *s,
+ char *fname,
+ char *msg)
+{
+ if (s[strlen(s)-1] == '\n') /* get rid of newline */
+ s[strlen(s)-1] = '\0';
+ error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
+ exit(1);
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_EXIT bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
diff --git a/c/src/README b/c/src/README
new file mode 100644
index 0000000000..3e242504dc
--- /dev/null
+++ b/c/src/README
@@ -0,0 +1,27 @@
+#
+# $Id$
+#
+
+This is the top level directory of the C RTEMS environment. The
+following is a description of the contents of each file and
+subdirectory directly in this directory:
+
+ tests
+
+ This directory contains the RTEMS Test Suites. Currently
+ this includes the following suites:
+
+ + Single Processor Test Suite
+ + Multiprocessor Test Suite
+ + Timing Test Suite
+ + Sample Application Suite
+
+ lib
+
+ This directory contains src for RTEMS libraries:
+ libc, board support (including drivers) and libcpu.
+
+ exec
+
+ This directory contains the source code for the RTEMS executive.
+
diff --git a/c/src/exec/libcsupport/include/clockdrv.h b/c/src/exec/libcsupport/include/clockdrv.h
new file mode 100644
index 0000000000..258c590e0d
--- /dev/null
+++ b/c/src/exec/libcsupport/include/clockdrv.h
@@ -0,0 +1,51 @@
+/* clock.h
+ *
+ * This file describes the Clock Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CLOCK_DRIVER_h
+#define __CLOCK_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* variables */
+
+extern volatile rtems_unsigned32 Clock_driver_ticks;
+extern rtems_device_major_number rtems_clock_major;
+extern rtems_device_minor_number rtems_clock_minor;
+
+/* default clock driver entry */
+
+#define CLOCK_DRIVER_TABLE_ENTRY \
+ { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/console.h b/c/src/exec/libcsupport/include/console.h
new file mode 100644
index 0000000000..02196de7a9
--- /dev/null
+++ b/c/src/exec/libcsupport/include/console.h
@@ -0,0 +1,69 @@
+/* console.h
+ *
+ * This file describes the Console Device Driver for all boards.
+ * This driver provides support for the standard C Library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef _CONSOLE_DRIVER_h
+#define _CONSOLE_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CONSOLE_DRIVER_TABLE_ENTRY \
+ { console_initialize, console_open, console_close, \
+ console_read, console_write, console_control }
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/iosupp.h b/c/src/exec/libcsupport/include/iosupp.h
new file mode 100644
index 0000000000..5f4a83b8ca
--- /dev/null
+++ b/c/src/exec/libcsupport/include/iosupp.h
@@ -0,0 +1,44 @@
+/* iosupp.h
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __IOSUPP_h
+#define __IOSUPP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* character constants */
+
+#define BS 0x08 /* backspace */
+#define LF 0x0a /* line feed */
+#define CR 0x0d /* carriage return */
+#define XON 0x11 /* control-Q */
+#define XOFF 0x13 /* control-S */
+
+/* structures */
+
+#ifdef IOSUPP_INIT
+#define IOSUPP_EXTERN
+#else
+#undef IOSUPP_EXTERN
+#define IOSUPP_EXTERN extern
+#endif
+
+/* functions */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/exec/libcsupport/include/ringbuf.h b/c/src/exec/libcsupport/include/ringbuf.h
new file mode 100644
index 0000000000..8c80aaf9c8
--- /dev/null
+++ b/c/src/exec/libcsupport/include/ringbuf.h
@@ -0,0 +1,53 @@
+/*
+ * ringbuf.h
+ *
+ * This file provides simple ring buffer functionality.
+ *
+ * $Id$
+ */
+
+#ifndef __RINGBUF_H__
+#define __RINGBUF_H__
+
+#ifndef RINGBUF_QUEUE_LENGTH
+#define RINGBUF_QUEUE_LENGTH 128
+#endif
+
+typedef struct {
+ char buffer[RINGBUF_QUEUE_LENGTH];
+ volatile int head;
+ volatile int tail;
+} Ring_buffer_t;
+
+#define Ring_buffer_Initialize( _buffer ) \
+ do { \
+ (_buffer)->head = (_buffer)->tail = 0; \
+ } while ( 0 )
+
+#define Ring_buffer_Is_empty( _buffer ) \
+ ( (_buffer)->head == (_buffer)->tail )
+
+#define Ring_buffer_Is_full( _buffer ) \
+ ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
+
+#define Ring_buffer_Add_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
+ (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#define Ring_buffer_Remove_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
+ (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#endif
diff --git a/c/src/exec/libcsupport/include/rtems/assoc.h b/c/src/exec/libcsupport/include/rtems/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/c/src/exec/libcsupport/include/rtems/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/c/src/exec/libcsupport/include/rtems/error.h b/c/src/exec/libcsupport/include/rtems/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/c/src/exec/libcsupport/include/rtems/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/rtems/libcsupport.h b/c/src/exec/libcsupport/include/rtems/libcsupport.h
new file mode 100644
index 0000000000..f43cd189e1
--- /dev/null
+++ b/c/src/exec/libcsupport/include/rtems/libcsupport.h
@@ -0,0 +1,42 @@
+/* libcsupport.h
+ *
+ * This include file contains the information regarding the
+ * RTEMS specific support for the standard C library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __LIBC_SUPPORT_h
+#define __LIBC_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+);
+
+extern void malloc_dump(void);
+extern void libc_init(int reentrant);
+extern int host_errno(void);
+extern void fix_syscall_errno(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/rtems/libio.h b/c/src/exec/libcsupport/include/rtems/libio.h
new file mode 100644
index 0000000000..07d72620b1
--- /dev/null
+++ b/c/src/exec/libcsupport/include/rtems/libio.h
@@ -0,0 +1,98 @@
+/*
+ * General purpose communication channel for RTEMS to allow UNIX/POSIX
+ * system call behavior on top of RTEMS IO devices.
+ *
+ * TODO
+ * stat(2)
+ * unlink(2)
+ * rename(2)
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_LIBIO_H
+#define _RTEMS_LIBIO_H
+
+typedef unsigned32 rtems_libio_offset_t;
+
+/*
+ * An open file data structure, indexed by 'fd'
+ * TODO:
+ * should really have a separate per/file data structure that this
+ * points to (eg: size, offset, driver, pathname should be in that)
+ */
+
+typedef struct {
+ rtems_driver_name_t *driver;
+ rtems_libio_offset_t size; /* size of file */
+ rtems_libio_offset_t offset; /* current offset into the file */
+ unsigned32 flags;
+ char *pathname; /* opened pathname */
+ Objects_Id sem;
+ unsigned32 data0; /* private to "driver" */
+ unsigned32 data1; /* ... */
+} rtems_libio_t;
+
+
+/*
+ * param block for read/write
+ * Note: it must include 'offset' instead of using iop's offset since
+ * we can have multiple outstanding i/o's on a device.
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ rtems_libio_offset_t offset;
+ unsigned8 *buffer;
+ unsigned32 count;
+ unsigned32 flags;
+ unsigned32 bytes_moved;
+} rtems_libio_rw_args_t;
+
+/*
+ * param block for open/close
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 flags;
+ unsigned32 mode;
+} rtems_libio_open_close_args_t;
+
+/*
+ * param block for ioctl
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 command;
+ void *buffer;
+ unsigned32 ioctl_return;
+} rtems_libio_ioctl_args_t;
+
+
+/*
+ * Values for 'flag'
+ */
+
+#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
+#define LIBIO_FLAGS_READ 0x0002 /* reading */
+#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
+#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
+#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
+#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
+#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
+
+#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
+
+void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
+void rtems_libio_init(void);
+
+int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
+int __close(int fd);
+int __read(int fd, void *buffer, unsigned32 count);
+int __write(int fd, const void *buffer, unsigned32 count);
+int __ioctl(int fd, unsigned32 command, void *buffer);
+int __lseek(int fd, rtems_libio_offset_t offset, int whence);
+
+#endif /* _RTEMS_LIBIO_H */
diff --git a/c/src/exec/libcsupport/include/spurious.h b/c/src/exec/libcsupport/include/spurious.h
new file mode 100644
index 0000000000..428e826164
--- /dev/null
+++ b/c/src/exec/libcsupport/include/spurious.h
@@ -0,0 +1,38 @@
+/* spurious.h
+ *
+ * This file describes the Spurious Interrupt Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SPURIOUS_h
+#define __SPURIOUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SPURIOUS_DRIVER_TABLE_ENTRY \
+ { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL }
+
+rtems_device_driver Spurious_Initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/sys/utsname.h b/c/src/exec/libcsupport/include/sys/utsname.h
new file mode 100644
index 0000000000..ca15230d40
--- /dev/null
+++ b/c/src/exec/libcsupport/include/sys/utsname.h
@@ -0,0 +1,49 @@
+/* sys/utsname.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SYS_UTSNAME_h
+#define __POSIX_SYS_UTSNAME_h
+
+#include <sys/times.h>
+#include <sys/types.h>
+
+/*
+ * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
+ *
+ * NOTE: The lengths of the strings in this structure are
+ * just long enough to reliably contain the RTEMS information.
+ * For example, the fields are not long enough to support
+ * Internet hostnames.
+ */
+
+struct utsname {
+ char sysname[ 32 ]; /* Name of this implementation of the operating system */
+ char nodename[ 32 ]; /* Name of this node within an implementation */
+ /* specified communication network */
+ char release[ 32 ]; /* Current release level of this implementation */
+ char version[ 32 ]; /* Current version level of this release */
+ char machine[ 32 ]; /* Name of the hardware type on which the system */
+ /* is running */
+};
+
+/*
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+);
+
+/*
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+);
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/libcsupport/include/timerdrv.h b/c/src/exec/libcsupport/include/timerdrv.h
new file mode 100644
index 0000000000..d091b62410
--- /dev/null
+++ b/c/src/exec/libcsupport/include/timerdrv.h
@@ -0,0 +1,40 @@
+/* timerdrv.h
+ *
+ * This file describes the Timer Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_DRIVER_h
+#define __TIMER_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* functions */
+
+void Timer_initialize( void );
+
+rtems_unsigned32 Read_timer( void );
+
+rtems_status_code Empty_function( void );
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/libcsupport/include/vmeintr.h b/c/src/exec/libcsupport/include/vmeintr.h
new file mode 100644
index 0000000000..6148114ce8
--- /dev/null
+++ b/c/src/exec/libcsupport/include/vmeintr.h
@@ -0,0 +1,58 @@
+/*
+ * vmeintr.h
+ *
+ * This file is the specification for the VMEbus interface library
+ * which should be provided by all BSPs for VMEbus Single Board
+ * Computers but currently only a few do so.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __VME_INTERRUPT_h
+#define __VME_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the mask which is used to determine which
+ * interrupt levels are affected by a call to this package.
+ * The LSB corresponds to VME interrupt 0 and the MSB
+ * to VME interrupt 7.
+ *
+ */
+
+typedef rtems_unsigned8 VME_interrupt_Mask;
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Disable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Enable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of include file */
diff --git a/c/src/exec/libcsupport/src/README b/c/src/exec/libcsupport/src/README
new file mode 100644
index 0000000000..ee7a90501e
--- /dev/null
+++ b/c/src/exec/libcsupport/src/README
@@ -0,0 +1,37 @@
+--
+-- $Id$
+--
+
+Overview of newlib support (newlib is from CYGNUS)
+ Each task can have its own libc state including:
+ open stdio files
+ strtok
+ multi precision arithmetic state
+ etc.
+
+ This is implemented by a reentrancy data structure for each task.
+
+ When a task is "started" (in RTEMS sense) the reentrancy structure
+ is allocated. Its address is stored in notepad[NOTEPAD_LAST].
+
+ When task is switched to, the value of global variable _impure_ptr
+ is changed to the value of the new tasks reentrancy structure.
+
+ When a task is deleted
+ atexit() processing (for that task) happens
+ task's stdio buffers are flushed
+
+ When exit(3) is called
+ calling task's atexit processing done
+ global libc state atexit processing done
+ (this will include any atexit routines installed by drivers)
+ executive is shutdown
+ causes a context switch back to bsp land
+
+
+NOTE:
+ libc extension are installed by bsp_libc_init()
+ iff we are using clock interrupts.
+ This hack is necessary to allow the tmtests to avoid
+ timing the extensions.
+
diff --git a/c/src/exec/libcsupport/src/__brk.c b/c/src/exec/libcsupport/src/__brk.c
new file mode 100644
index 0000000000..5f256cb072
--- /dev/null
+++ b/c/src/exec/libcsupport/src/__brk.c
@@ -0,0 +1,44 @@
+#if !defined(RTEMS_UNIX)
+
+/*
+ * RTEMS "Broken" __brk/__sbrk Implementation
+ *
+ * NOTE: sbrk is BSP provided.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <signal.h>
+#include <errno.h>
+#include <sys/types.h>
+#ifdef RTEMS_NEWLIB
+#include <reent.h>
+#endif
+#include <unistd.h>
+
+/* we use RTEMS for memory management. We don't need sbrk */
+
+void * __sbrk(int incr)
+{
+ errno = EINVAL;
+ return (void *)0;
+}
+
+int __brk( const void *endds )
+{
+ errno = EINVAL;
+ return -1;
+}
+
+#endif
diff --git a/c/src/exec/libcsupport/src/__gettod.c b/c/src/exec/libcsupport/src/__gettod.c
new file mode 100644
index 0000000000..6c9350d41c
--- /dev/null
+++ b/c/src/exec/libcsupport/src/__gettod.c
@@ -0,0 +1,103 @@
+#if !defined(RTEMS_UNIX)
+/*
+ * RTEMS gettimeofday Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <time.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <assert.h>
+
+/*
+ * NOTE: The solaris gettimeofday does not have a second parameter.
+ */
+
+int gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ rtems_status_code status;
+ rtems_clock_time_value time;
+
+ if ( !tp ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ tp->tv_sec = time.seconds;
+ tp->tv_usec = time.microseconds;
+
+ /*
+ * newlib does not have timezone and daylight savings time
+ * yet. When it does this needs to be fixed.
+ */
+
+#if 0
+ if ( tzp ) {
+ tzp->tz_minuteswest = 0; /* at UTC */
+ tzp->tz_dsttime = 0; /* no daylight savings */
+ tzp->minuteswest = timezone / 60; /* from seconds to minutes */
+ tzp->dsttime = daylight;
+ }
+#endif
+ return 0;
+}
+
+#if defined(RTEMS_NEWLIB)
+
+#if 0
+/*
+ * "Reentrant" version
+ */
+
+int _gettimeofday_r(
+ struct _reent *ignored_reentrancy_stuff,
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+#endif
+
+/*
+ * "System call" version
+ */
+
+int _gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+
+#endif /* defined(RTEMS_NEWLIB) */
+
+#endif
diff --git a/c/src/exec/libcsupport/src/__times.c b/c/src/exec/libcsupport/src/__times.c
new file mode 100644
index 0000000000..12fd9241fe
--- /dev/null
+++ b/c/src/exec/libcsupport/src/__times.c
@@ -0,0 +1,65 @@
+/*
+ * RTEMS _times Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <sys/times.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <assert.h>
+
+clock_t _times(
+ struct tms *ptms
+)
+{
+ rtems_status_code status;
+ rtems_interval ticks_since_boot;
+
+ if ( !ptms ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get(
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ &ticks_since_boot
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ /*
+ * RTEMS has no notion of system versus user time and does
+ * not (as of 3.2.0) keep track of CPU usage on a per task basis.
+ */
+
+ ptms->tms_utime = ticks_since_boot;
+ ptms->tms_stime = 0;
+ ptms->tms_cutime = 0;
+ ptms->tms_cstime = 0;
+
+ return 0;
+}
+
+clock_t times(
+ struct tms *ptms
+)
+{
+ return _times( ptms );
+}
+
diff --git a/c/src/exec/libcsupport/src/assoc.c b/c/src/exec/libcsupport/src/assoc.c
new file mode 100644
index 0000000000..74387a8c5b
--- /dev/null
+++ b/c/src/exec/libcsupport/src/assoc.c
@@ -0,0 +1,260 @@
+/*
+ * assoc.c
+ * rtems assoc routines
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "assoc.h"
+
+#include <stdio.h> /* sprintf */
+#include <string.h> /* strcat, strcmp */
+
+#define STREQ(a,b) (strcmp((a), (b)) == 0)
+#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (strcmp(ap->name, name) == 0)
+ return ap;
+
+ return default_ap;
+}
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->local_value == local_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->remote_value == remote_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+/*
+ * Get values
+ */
+
+unsigned32
+rtems_assoc_remote_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_remote_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+/*
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+
+const char *
+rtems_assoc_name_bad(
+ unsigned32 bad_value
+)
+{
+#ifdef RTEMS_DEBUG
+ static char bad_buffer[32];
+
+ sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
+#else
+ static char bad_buffer[32] = "<assoc.c: BAD NAME>";
+#endif
+ return bad_buffer;
+}
+
+
+const char *
+rtems_assoc_name_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(local_value);
+}
+
+const char *
+rtems_assoc_name_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(remote_value);
+}
+
+/*
+ * Bitfield functions assume just 1 bit set in each of remote and local
+ * entries; they do not check for this.
+ */
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ unsigned32 b;
+ unsigned32 remote_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & local_value)
+ remote_value |= rtems_assoc_remote_by_local(ap, b);
+
+ return remote_value;
+}
+
+
+unsigned32 rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ unsigned32 b;
+ unsigned32 local_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & remote_value)
+ local_value |= rtems_assoc_local_by_remote(ap, b);
+
+ return local_value;
+}
+
+char *
+rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_remote(ap, b));
+ }
+
+ return buffer;
+}
+
+char *
+rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_local(ap, b));
+ }
+
+ return buffer;
+}
diff --git a/c/src/exec/libcsupport/src/error.c b/c/src/exec/libcsupport/src/error.c
new file mode 100644
index 0000000000..5bd481c3e6
--- /dev/null
+++ b/c/src/exec/libcsupport/src/error.c
@@ -0,0 +1,209 @@
+/*
+ * report errors and panics to RTEMS' stderr.
+ * Currently just used by RTEMS monitor.
+ *
+ * $Id$
+ */
+
+
+/*
+ * These routines provide general purpose error reporting.
+ * rtems_error reports an error to stderr and allows use of
+ * printf style formatting. A newline is appended to all messages.
+ *
+ * error_flag can be specified as any of the following:
+ *
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * It can also include a rtems_status value which can be OR'd
+ * with the above flags. *
+ *
+ * EXAMPLE
+ * #include <rtems.h>
+ * #include <rtems/error.h>
+ * rtems_error(0, "stray interrupt %d", intr);
+ *
+ * EXAMPLE
+ * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
+ * {
+ * rtems_error(status | RTEMS_ERROR_ABORT,
+ * "could not create task");
+ * }
+ *
+ * EXAMPLE
+ * if ((fd = open(pathname, O_RDNLY)) < 0)
+ * {
+ * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
+ * goto failed;
+ * }
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "error.h"
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h> /* _exit() */
+
+/* bug in hpux <errno.h>: no prototypes unless you are C++ */
+#ifdef hpux9
+char *strerror(int);
+#endif
+
+extern char *rtems_progname;
+int rtems_panic_in_progress;
+
+rtems_assoc_t rtems_status_assoc[] = {
+ { "successful completion", RTEMS_SUCCESSFUL, },
+ { "returned from a thread", RTEMS_TASK_EXITTED, },
+ { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
+ { "invalid object name", RTEMS_INVALID_NAME, },
+ { "invalid object id", RTEMS_INVALID_ID, },
+ { "too many", RTEMS_TOO_MANY, },
+ { "timed out waiting", RTEMS_TIMEOUT, },
+ { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
+ { "specified size was invalid", RTEMS_INVALID_SIZE, },
+ { "address specified is invalid", RTEMS_INVALID_ADDRESS, },
+ { "number was invalid", RTEMS_INVALID_NUMBER, },
+ { "item has not been initialized", RTEMS_NOT_DEFINED, },
+ { "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
+ { "request not satisfied", RTEMS_UNSATISFIED, },
+ { "thread is in wrong state", RTEMS_INCORRECT_STATE, },
+ { "thread already in state", RTEMS_ALREADY_SUSPENDED, },
+ { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
+ { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
+ { "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
+ { "invalid thread priority", RTEMS_INVALID_PRIORITY, },
+ { "invalid date/time", RTEMS_INVALID_CLOCK, },
+ { "invalid node id", RTEMS_INVALID_NODE, },
+ { "directive not configured", RTEMS_NOT_CONFIGURED, },
+ { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
+ { "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
+ { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
+ { "could not get enough memory", RTEMS_NO_MEMORY, },
+ { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
+ { 0, 0, 0 },
+};
+
+
+const char *
+rtems_status_text(
+ rtems_status_code status
+)
+{
+ return rtems_assoc_name_by_local(rtems_status_assoc, status);
+}
+
+
+static int rtems_verror(
+ unsigned32 error_flag,
+ const char *printf_format,
+ va_list arglist
+)
+{
+ int local_errno = 0;
+ int chars_written = 0;
+ rtems_status_code status;
+
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_panic_in_progress++;
+
+ /* disable task switches */
+ _Thread_Disable_dispatch();
+
+ /* don't aggravate things */
+ if (rtems_panic_in_progress > 2)
+ return 0;
+ }
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ status = error_flag & ~RTEMS_ERROR_MASK;
+ if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
+ local_errno = errno;
+
+ if (_System_state_Is_multiprocessing)
+ fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
+
+ if (rtems_progname && *rtems_progname)
+ chars_written += fprintf(stderr, "%s: ", rtems_progname);
+ chars_written += vfprintf(stderr, printf_format, arglist);
+
+ if (status)
+ chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
+
+ if (local_errno)
+ if ((local_errno > 0) && *strerror(local_errno))
+ chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
+ else
+ chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
+
+ chars_written += fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
+ {
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_error(0, "fatal error, exiting");
+ _exit(local_errno);
+ }
+ else
+ {
+ rtems_error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+ return chars_written;
+}
+
+
+/*
+ * Report an error.
+ * error_flag is as above; printf_format is a normal
+ * printf(3) format string, with its concommitant arguments.
+ *
+ * Returns the number of characters written.
+ */
+
+int rtems_error(
+ int error_flag,
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+ int chars_written;
+
+ va_start(arglist, printf_format);
+ chars_written = rtems_verror(error_flag, printf_format, arglist);
+ va_end(arglist);
+
+ return chars_written;
+}
+
+/*
+ * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
+ */
+
+void rtems_panic(
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+
+ va_start(arglist, printf_format);
+ (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
+ va_end(arglist);
+}
diff --git a/c/src/exec/libcsupport/src/hosterr.c b/c/src/exec/libcsupport/src/hosterr.c
new file mode 100644
index 0000000000..7fc2ca966e
--- /dev/null
+++ b/c/src/exec/libcsupport/src/hosterr.c
@@ -0,0 +1,43 @@
+/*
+ * Routines to access a host errno
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <errno.h>
+
+int host_errno(void);
+
+/*
+ * copy host errno, if any to thread aware errno, if any
+ */
+
+void fix_syscall_errno(void)
+{
+ errno = host_errno();
+}
+
+/*
+ * Get the host system errno, if any
+ * When using newlib (or possibly other libc's) on top of UNIX
+ * the errno returned by system calls may be unavailable due
+ * to trickery of making errno thread aware.
+ * This provides a kludge of getting at it.
+ */
+
+#undef errno
+extern int errno;
+int host_errno(void)
+{
+ return errno;
+}
+
diff --git a/c/src/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c
new file mode 100644
index 0000000000..a01dea7b8a
--- /dev/null
+++ b/c/src/exec/libcsupport/src/libio.c
@@ -0,0 +1,442 @@
+/*
+ * Provide UNIX/POSIX-like io system calls for RTEMS using the
+ * RTEMS IO manager
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
+
+#include <stdio.h> /* O_RDONLY, et.al. */
+#include <fcntl.h> /* O_RDONLY, et.al. */
+
+#if defined(solaris2)
+#define O_NDELAY O_NONBLOCK
+#elif defined(RTEMS_NEWLIB)
+#define O_NDELAY _FNBIO
+#endif
+
+#include <errno.h>
+#include <string.h> /* strcmp */
+#include <unistd.h>
+#include <stdlib.h> /* calloc() */
+
+#include "libio.h" /* libio.h not pulled in by rtems */
+
+/*
+ * Semaphore to protect the io table
+ */
+
+Objects_Id rtems_libio_semaphore;
+
+#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O')
+#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n)
+
+unsigned32 rtems_libio_number_iops;
+rtems_libio_t *rtems_libio_iops;
+rtems_libio_t *rtems_libio_last_iop;
+
+#define rtems_libio_iop(fd) ((((unsigned32)(fd)) < rtems_libio_number_iops) ? \
+ &rtems_libio_iops[fd] : 0)
+
+#define rtems_libio_check_fd(fd) \
+ do { \
+ if ((fd) >= rtems_libio_number_iops) \
+ { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_buffer(buffer) \
+ do { \
+ if ((buffer) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_count(count) \
+ do { \
+ if ((count) == 0) \
+ { \
+ return 0; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_permissions(iop, flag) \
+ do { \
+ if (((iop)->flags & (flag)) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+
+void
+rtems_libio_config(
+ rtems_configuration_table *config,
+ unsigned32 max_fds
+ )
+{
+ rtems_libio_number_iops = max_fds;
+
+ /*
+ * tweak config to reflect # of semaphores we will need
+ */
+
+ config->maximum_semaphores += 1; /* one for iop table */
+ config->maximum_semaphores += max_fds;
+}
+
+/*
+ * Called by bsp startup code to init the libio area.
+ */
+
+void
+rtems_libio_init(void)
+{
+ rtems_status_code rc;
+
+ if (rtems_libio_number_iops > 0)
+ {
+ rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops,
+ sizeof(rtems_libio_t));
+ if (rtems_libio_iops == NULL)
+ rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
+
+ rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
+ }
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_SEM,
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &rtems_libio_semaphore
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+}
+
+/*
+ * Convert RTEMS status to a UNIX errno
+ */
+
+rtems_assoc_t errno_assoc[] = {
+ { "OK", RTEMS_SUCCESSFUL, 0 },
+ { "TIMEOUT", RTEMS_TIMEOUT, ETIME },
+ { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_errno(rtems_status_code code)
+{
+ int rc;
+
+ if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code)))
+ {
+ errno = rc;
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
+ */
+
+rtems_assoc_t access_modes_assoc[] = {
+ { "READ", LIBIO_FLAGS_READ, O_RDONLY },
+ { "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY },
+ { "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR },
+ { 0, 0, 0 },
+};
+
+rtems_assoc_t status_flags_assoc[] = {
+ { "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
+ { "APPEND", LIBIO_FLAGS_APPEND, O_APPEND },
+ { "CREATE", LIBIO_FLAGS_CREATE, O_CREAT },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_fcntl_flags(unsigned32 fcntl_flags)
+{
+ unsigned32 flags = 0;
+ unsigned32 access_modes;
+
+ /*
+ * Access mode is a small integer
+ */
+
+ access_modes = fcntl_flags & O_ACCMODE;
+ fcntl_flags &= ~O_ACCMODE;
+ flags = rtems_assoc_local_by_remote(access_modes_assoc, access_modes);
+
+ /*
+ * Everything else is single bits
+ */
+
+ flags |= rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
+ return flags;
+}
+
+
+static rtems_libio_t *
+rtems_libio_allocate(void)
+{
+ rtems_libio_t *iop;
+ rtems_status_code rc;
+
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ for (iop = rtems_libio_iops; iop <= rtems_libio_last_iop; iop++)
+ if ((iop->flags & LIBIO_FLAGS_OPEN) == 0)
+ {
+ /*
+ * Got one; create a semaphore for it
+ */
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &iop->sem
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ iop->flags = LIBIO_FLAGS_OPEN;
+ goto done;
+ }
+
+failed:
+ iop = 0;
+
+done:
+ rtems_semaphore_release(rtems_libio_semaphore);
+ return iop;
+}
+
+static void
+rtems_libio_free(rtems_libio_t *iop)
+{
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ if (iop->sem)
+ rtems_semaphore_delete(iop->sem);
+ (void) memset(iop, 0, sizeof(*iop));
+
+ rtems_semaphore_release(rtems_libio_semaphore);
+}
+
+int
+__open(
+ const char *pathname,
+ unsigned32 flag,
+ unsigned32 mode)
+{
+ rtems_status_code rc;
+ rtems_libio_t *iop = 0;
+ rtems_driver_name_t *np;
+ rtems_libio_open_close_args_t args;
+
+ if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
+ goto done;
+
+ iop = rtems_libio_allocate();
+ if (iop == 0)
+ {
+ rc = RTEMS_TOO_MANY;
+ goto done;
+ }
+
+ iop->driver = np;
+ iop->pathname = (char *) pathname;
+ iop->flags |= rtems_libio_fcntl_flags(flag);
+
+ args.iop = iop;
+ args.flags = iop->flags;
+ args.mode = mode;
+
+ rc = rtems_io_open(np->major, np->minor, (void *) &args);
+
+done:
+ if (rc != RTEMS_SUCCESSFUL)
+ {
+ if (iop)
+ rtems_libio_free(iop);
+ return rtems_libio_errno(rc);
+ }
+
+ return iop - rtems_libio_iops;
+}
+
+int
+__close(
+ int fd
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_open_close_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.flags = 0;
+ args.mode = 0;
+
+ rc = rtems_io_close(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+ return 0;
+}
+
+int
+__read(
+ int fd,
+ void * buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_read(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__write(
+ int fd,
+ const void *buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_WRITE);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = (void *) buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_write(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__ioctl(
+ int fd,
+ unsigned32 command,
+ void * buffer)
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_ioctl_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.command = command;
+ args.buffer = buffer;
+
+ rc = rtems_io_control(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.ioctl_return;
+}
+
+/*
+ * internal only??
+ */
+
+
+int
+__lseek(
+ int fd,
+ rtems_libio_offset_t offset,
+ int whence
+ )
+{
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+
+ rtems_libio_check_fd(fd);
+
+ switch (whence)
+ {
+ case SEEK_SET:
+ iop->offset = offset;
+ break;
+
+ case SEEK_CUR:
+ iop->offset += offset;
+ break;
+
+ case SEEK_END:
+ iop->offset = iop->size - offset;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
diff --git a/c/src/exec/libcsupport/src/malloc.c b/c/src/exec/libcsupport/src/malloc.c
new file mode 100644
index 0000000000..de63df6ea0
--- /dev/null
+++ b/c/src/exec/libcsupport/src/malloc.c
@@ -0,0 +1,366 @@
+/*
+ * RTEMS Malloc Family Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "libcsupport.h"
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h> /* sbrk(2) */
+
+rtems_id RTEMS_Malloc_Heap;
+size_t RTEMS_Malloc_Sbrk_amount;
+
+#ifdef RTEMS_DEBUG
+#define MALLOC_STATS
+#define MALLOC_DIRTY
+#endif
+
+#ifdef MALLOC_STATS
+#define MSBUMP(f,n) malloc_stats.f += (n)
+
+struct {
+ unsigned32 space_available; /* current size of malloc area */
+ unsigned32 malloc_calls; /* # calls to malloc */
+ unsigned32 free_calls;
+ unsigned32 realloc_calls;
+ unsigned32 calloc_calls;
+ unsigned32 max_depth; /* most ever malloc'd at 1 time */
+ unsigned64 lifetime_allocated;
+ unsigned64 lifetime_freed;
+} malloc_stats;
+
+#else /* No malloc_stats */
+#define MSBUMP(f,n)
+#endif
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+)
+{
+ rtems_status_code status;
+ void *starting_address;
+ rtems_unsigned32 old_address;
+ rtems_unsigned32 u32_address;
+
+ /*
+ * If the starting address is 0 then we are to attempt to
+ * get length worth of memory using sbrk. Make sure we
+ * align the address that we get back.
+ */
+
+ starting_address = start;
+ RTEMS_Malloc_Sbrk_amount = sbrk_amount;
+
+ if (!starting_address) {
+ u32_address = (unsigned int)sbrk(length);
+
+ if (u32_address == -1) {
+ rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
+ /* DOES NOT RETURN!!! */
+ }
+
+ if (u32_address & (CPU_ALIGNMENT-1)) {
+ old_address = u32_address;
+ u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * adjust the length by whatever we aligned by
+ */
+
+ length -= u32_address - old_address;
+ }
+
+ starting_address = (void *)u32_address;
+ }
+
+ /*
+ * Unfortunately we cannot use assert if this fails because if this
+ * has failed we do not have a heap and if we do not have a heap
+ * STDIO cannot work because there will be no buffers.
+ */
+
+ status = rtems_region_create(
+ rtems_build_name( 'H', 'E', 'A', 'P' ),
+ starting_address,
+ length,
+ CPU_ALIGNMENT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &RTEMS_Malloc_Heap
+ );
+ if ( status != RTEMS_SUCCESSFUL )
+ rtems_fatal_error_occurred( status );
+
+#ifdef MALLOC_STATS
+ /* zero all the stats */
+ (void) memset(&malloc_stats, 0, sizeof(malloc_stats));
+#endif
+
+ MSBUMP(space_available, length);
+}
+
+void *malloc(
+ size_t size
+)
+{
+ void *return_this;
+ void *starting_address;
+ rtems_unsigned32 the_size;
+ rtems_unsigned32 sbrk_amount;
+ rtems_status_code status;
+
+ MSBUMP(malloc_calls, 1);
+
+ if ( !size )
+ return (void *) 0;
+
+ /*
+ * Try to give a segment in the current region if there is not
+ * enough space then try to grow the region using rtems_region_extend().
+ * If this fails then return a NULL pointer.
+ */
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+
+ if ( status != RTEMS_SUCCESSFUL ) {
+ /*
+ * Round to the "requested sbrk amount" so hopefully we won't have
+ * to grow again for a while. This effectively does sbrk() calls
+ * in "page" amounts.
+ */
+
+ sbrk_amount = RTEMS_Malloc_Sbrk_amount;
+
+ if ( sbrk_amount == 0 )
+ return (void *) 0;
+
+ the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
+
+ if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
+ return (void *) 0;
+
+ status = rtems_region_extend(
+ RTEMS_Malloc_Heap,
+ starting_address,
+ the_size
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ sbrk(-the_size);
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+
+ MSBUMP(space_available, the_size);
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+ }
+
+#ifdef MALLOC_STATS
+ if (return_this)
+ {
+ unsigned32 actual_size;
+ unsigned32 current_depth;
+ status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size);
+ MSBUMP(lifetime_allocated, actual_size);
+ current_depth = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+ if (current_depth > malloc_stats.max_depth)
+ malloc_stats.max_depth = current_depth;
+ }
+#endif
+
+#ifdef MALLOC_DIRTY
+ (void) memset(return_this, 0xCF, size);
+#endif
+
+ return return_this;
+}
+
+void *calloc(
+ size_t nelem,
+ size_t elsize
+)
+{
+ register char *cptr;
+ int length;
+
+ MSBUMP(calloc_calls, 1);
+
+ length = nelem * elsize;
+ cptr = malloc( length );
+ if ( cptr )
+ memset( cptr, '\0', length );
+
+ MSBUMP(malloc_calls, -1); /* subtract off the malloc */
+
+ return cptr;
+}
+
+void *realloc(
+ void *ptr,
+ size_t size
+)
+{
+ rtems_unsigned32 old_size;
+ rtems_status_code status;
+ char *new_area;
+
+ MSBUMP(realloc_calls, 1);
+
+ if ( !ptr )
+ return malloc( size );
+
+ if ( !size ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ new_area = malloc( size );
+ if ( !new_area ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ return (void *) 0;
+ }
+
+ memcpy( new_area, ptr, (size < old_size) ? size : old_size );
+ free( ptr );
+
+ return new_area;
+
+}
+
+void free(
+ void *ptr
+)
+{
+ rtems_status_code status;
+
+ MSBUMP(free_calls, 1);
+
+ if ( !ptr )
+ return;
+
+#ifdef MALLOC_STATS
+ {
+ unsigned32 size;
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ MSBUMP(lifetime_freed, size);
+ }
+ }
+#endif
+
+ status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ assert( 0 );
+ }
+}
+
+#ifdef MALLOC_STATS
+/*
+ * Dump the malloc statistics
+ * May be called via atexit() (installable by our bsp) or
+ * at any time by user
+ */
+
+void malloc_dump(void)
+{
+ unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+
+ printf("Malloc stats\n");
+ printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
+ (unsigned int) malloc_stats.space_available / 1024,
+ (unsigned int) allocated / 1024,
+ /* avoid float! */
+ (allocated * 100) / malloc_stats.space_available,
+ (unsigned int) malloc_stats.max_depth / 1024,
+ (malloc_stats.max_depth * 100) / malloc_stats.space_available,
+ (unsigned long long) malloc_stats.lifetime_allocated / 1024,
+ (unsigned long long) malloc_stats.lifetime_freed / 1024);
+ printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n",
+ malloc_stats.malloc_calls,
+ malloc_stats.free_calls,
+ malloc_stats.realloc_calls,
+ malloc_stats.calloc_calls);
+}
+#endif
+
+/*
+ * "Reentrant" versions of the above routines implemented above.
+ */
+
+#ifdef RTEMS_NEWLIB
+void *malloc_r(
+ struct _reent *ignored,
+ size_t size
+)
+{
+ return malloc( size );
+}
+
+void *calloc_r(
+ size_t nelem,
+ size_t elsize
+)
+{
+ return calloc( nelem, elsize );
+}
+
+void *realloc_r(
+ void *ptr,
+ size_t size
+)
+{
+ return realloc_r( ptr, size );
+}
+
+void free_r(
+ void *ptr
+)
+{
+ free( ptr );
+}
+#endif
+
diff --git a/c/src/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c
new file mode 100644
index 0000000000..8c9ed2e1a8
--- /dev/null
+++ b/c/src/exec/libcsupport/src/newlibc.c
@@ -0,0 +1,336 @@
+#if defined(RTEMS_NEWLIB)
+
+/*
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * Description:
+ * Implementation of hooks for the CYGNUS newlib libc
+ * These hooks set things up so that:
+ * '_REENT' is switched at task switch time.
+ *
+ *
+ * TODO:
+ *
+ * NOTE:
+ *
+ * $Id$
+ *
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <libcsupport.h>
+#include <stdlib.h> /* for free() */
+#include <string.h> /* for memset() */
+
+#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
+
+/*
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ * NOTE:
+ * There is some problem with doing this on the hpux version
+ * of the UNIX simulator (symptom is printf core dumps), so
+ * we just don't for now.
+ * Not sure if this is a problem with hpux, newlib, or something else.
+ */
+
+#if defined(RTEMS_UNIX) && !defined(hpux)
+#define NEED_SETVBUF
+#endif
+
+#ifdef NEED_SETVBUF
+#include <stdio.h>
+#endif
+
+#include "internal.h"
+
+#define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST
+
+
+int libc_reentrant; /* do we think we are reentrant? */
+struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);;
+
+/*
+ * CYGNUS newlib routine that does atexit() processing and flushes
+ * stdio streams
+ * undocumented
+ */
+
+extern void _wrapup_reent(struct _reent *);
+extern void _reclaim_reent(struct _reent *);
+
+void
+libc_wrapup(void)
+{
+ _wrapup_reent(0);
+ if (_REENT != &libc_global_reent)
+ {
+ _wrapup_reent(&libc_global_reent);
+#if 0
+ /* don't reclaim this one, just in case we do printfs */
+ /* on our way out to ROM */
+ _reclaim_reent(&libc_global_reent);
+#endif
+ _REENT = &libc_global_reent;
+ }
+}
+
+
+rtems_boolean
+libc_create_hook(rtems_tcb *current_task,
+ rtems_tcb *creating_task)
+{
+ MY_task_set_note(creating_task, LIBC_NOTEPAD, 0);
+ return TRUE;
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ */
+
+rtems_extension
+libc_start_hook(rtems_tcb *current_task,
+ rtems_tcb *starting_task)
+{
+ struct _reent *ptr;
+
+ /* NOTE: our malloc is reentrant without a reent ptr since
+ * it is based on region manager
+ */
+
+ ptr = (struct _reent *) malloc(sizeof(struct _reent));
+
+ /* GCC extension: structure constants */
+ *ptr = (struct _reent) _REENT_INIT((*ptr));
+
+ MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ *
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ */
+
+#ifdef RTEMS_UNIX
+rtems_extension
+libc_begin_hook(rtems_tcb *current_task)
+{
+ setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
+}
+#endif
+
+rtems_extension
+libc_switch_hook(rtems_tcb *current_task,
+ rtems_tcb *heir_task)
+{
+ rtems_unsigned32 impure_value;
+
+ /* XXX We can't use rtems_task_set_note() here since SYSI task has a
+ * tid of 0, which is treated specially (optimized, actually)
+ * by rtems_task_set_note
+ *
+ * NOTE: The above comment is no longer true and we need to use
+ * the extension data areas added about the same time.
+ */
+
+ /*
+ * Don't touch the outgoing task if it has been deleted.
+ */
+
+ if ( !_States_Is_transient( current_task->current_state ) ) {
+ impure_value = (rtems_unsigned32) _REENT;
+ MY_task_set_note(current_task, LIBC_NOTEPAD, impure_value);
+ }
+
+ _REENT = (struct _reent *) MY_task_get_note(heir_task, LIBC_NOTEPAD);
+
+}
+
+/*
+ * Function: libc_delete_hook
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called when a task is deleted.
+ * Must restore the new lib reentrancy state for the new current
+ * task.
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+rtems_extension
+libc_delete_hook(rtems_tcb *current_task,
+ rtems_tcb *deleted_task)
+{
+ struct _reent *ptr;
+
+ /*
+ * The reentrancy structure was allocated by newlib using malloc()
+ */
+
+ if (current_task == deleted_task)
+ {
+ ptr = _REENT;
+ }
+ else
+ {
+ ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
+ }
+
+ /* if (ptr) */
+ if (ptr && ptr != &libc_global_reent)
+ {
+ _wrapup_reent(ptr);
+ _reclaim_reent(ptr);
+ free(ptr);
+ }
+
+ MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
+
+ /*
+ * Require the switch back to another task to install its own
+ */
+
+ if (current_task == deleted_task)
+ {
+ _REENT = 0;
+ }
+}
+
+/*
+ * Function: libc_init
+ * Created: 94/12/10
+ *
+ * Description:
+ * Init libc for CYGNUS newlib
+ * Set up _REENT to use our global libc_global_reent.
+ * (newlib provides a global of its own, but we prefer our
+ * own name for it)
+ *
+ * If reentrancy is desired (which it should be), then
+ * we install the task extension hooks to maintain the
+ * newlib reentrancy global variable _REENT on task
+ * create, delete, switch, exit, etc.
+ *
+ * Parameters:
+ * reentrant non-zero if reentrant library desired.
+ *
+ * Returns:
+ *
+ * Side Effects:
+ * installs libc extensions if reentrant.
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ */
+
+void
+libc_init(int reentrant)
+{
+ rtems_extensions_table libc_extension;
+ rtems_id extension_id;
+ rtems_status_code rc;
+
+ _REENT = &libc_global_reent;
+
+ if (reentrant)
+ {
+ memset(&libc_extension, 0, sizeof(libc_extension));
+
+ libc_extension.thread_create = libc_create_hook;
+ libc_extension.thread_start = libc_start_hook;
+#ifdef RTEMS_UNIX
+ libc_extension.thread_begin = libc_begin_hook;
+#endif
+ libc_extension.thread_switch = libc_switch_hook;
+ libc_extension.thread_delete = libc_delete_hook;
+
+ rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
+ &libc_extension, &extension_id);
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+
+ libc_reentrant = reentrant;
+ }
+}
+
+
+void
+exit(int status)
+{
+ libc_wrapup();
+ rtems_shutdown_executive(status);
+}
+
+
+/*
+ * Function: _exit
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called from exit() after it does atexit() processing and stdio fflush's
+ *
+ * called from bottom of exit() to really delete the task.
+ * If we are using reentrant libc, then let the delete extension
+ * do all the work, otherwise if a shutdown is in progress,
+ * then just do it.
+ *
+ * Parameters:
+ * exit status
+ *
+ * Returns:
+ * does not return
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+#if !defined(RTEMS_UNIX) && !defined(__GO32__)
+void _exit(int status)
+{
+ rtems_shutdown_executive(status);
+}
+#endif
+
+#endif
diff --git a/c/src/exec/libcsupport/src/no_libc.c b/c/src/exec/libcsupport/src/no_libc.c
new file mode 100644
index 0000000000..9bb65f4df6
--- /dev/null
+++ b/c/src/exec/libcsupport/src/no_libc.c
@@ -0,0 +1,45 @@
+#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
+
+/* no_libc.h
+ *
+ * This file contains stubs for the reentrancy hooks when
+ * an unknown C library is used.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+
+#include "libcsupport.h"
+#include "internal.h"
+
+#include <stdlib.h> /* for free() */
+
+void
+libc_init(int reentrant)
+{
+}
+
+void libc_suspend_main(void)
+{
+}
+
+
+void libc_global_exit(rtems_unsigned32 code)
+{
+}
+
+void _exit(int status)
+{
+}
+
+#endif
diff --git a/c/src/exec/libcsupport/src/unixlibc.c b/c/src/exec/libcsupport/src/unixlibc.c
new file mode 100644
index 0000000000..2acd4fba8e
--- /dev/null
+++ b/c/src/exec/libcsupport/src/unixlibc.c
@@ -0,0 +1,11 @@
+/*
+ * $Id$
+ */
+
+#if defined(RTEMS_UNIXLIB)
+
+void libc_init(int reentrant)
+{
+}
+
+#endif
diff --git a/c/src/exec/libcsupport/src/utsname.c b/c/src/exec/libcsupport/src/utsname.c
new file mode 100644
index 0000000000..98b105023e
--- /dev/null
+++ b/c/src/exec/libcsupport/src/utsname.c
@@ -0,0 +1,61 @@
+/* utsname.c
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/utsname.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+)
+{
+ /* XXX: Here is what Solaris returns...
+ sysname = SunOS
+ nodename = node_name
+ release = 5.3
+ version = Generic_101318-12
+ machine = sun4m
+ */
+
+ strcpy( name->sysname, "RTEMS" );
+
+ sprintf( name->nodename, "Node %d\n", _Objects_Local_node );
+
+ /* XXX release string is in BAD format for this routine!!! */
+ strcpy( name->release, "3.2.0" );
+
+ /* XXX does this have any meaning for RTEMS */
+
+ strcpy( name->release, "" );
+
+ sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME );
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/base/aio.h b/c/src/exec/posix/base/aio.h
new file mode 100644
index 0000000000..504559c857
--- /dev/null
+++ b/c/src/exec/posix/base/aio.h
@@ -0,0 +1,137 @@
+/* aio.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_ASYNCHRONOUS_IO_h
+#define __POSIX_ASYNCHRONOUS_IO_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_ASYNCHRONOUS_IO)
+
+/*
+ * 6.7.1 Data Definitions for Asynchronous Input and Output,
+ * P1003.1b-1993, p. 151
+ */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <time.h>
+#include <fcntl.h>
+
+/*
+ * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
+ */
+
+#define AIO_CANCELED 0 /* all requested operations have been canceled */
+#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
+ /* since they are in progress */
+#define AIO_ALLDONE 0 /* none of the requested operations could be */
+ /* canceled since they are already complete */
+
+/* lio_listio() options */
+
+#define LIO_WAIT 0 /* calling process is to suspend until the */
+ /* operation is complete */
+#define LIO_NOWAIT 0 /* calling process is to continue execution while */
+ /* the operation is performed and no notification */
+ /* shall be given when the operation is completed */
+#define LIO_READ 0 /* request a read() */
+#define LIO_WRITE 0 /* request a write() */
+#define LIO_NOP 0 /* no transfer is requested */
+
+/*
+ * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
+ */
+
+struct aiocb {
+ int aio_fildes; /* File descriptor */
+ off_t aio_offset; /* File offset */
+ volatile void *aio_buf; /* Location of buffer */
+ size_t aio_nbytes; /* Length of transfer */
+ int aio_reqprio; /* Request priority offset */
+ struct sigevent aio_sigevent; /* Signal number and value */
+ int aoi_lio_opcode; /* Operation to be performed */
+};
+
+/*
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+);
+
+/*
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+);
+
+#if defined(_POSIX_SYNCHRONIZED_IO)
+
+/*
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+);
+
+#endif /* _POSIX_SYNCHRONIZED_IO */
+
+#endif /* _POSIX_ASYNCHRONOUS_IO */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/devctl.h b/c/src/exec/posix/base/devctl.h
new file mode 100644
index 0000000000..5073b475ee
--- /dev/null
+++ b/c/src/exec/posix/base/devctl.h
@@ -0,0 +1,30 @@
+/* devctl.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_DEVICE_CONTROL_h
+#define __POSIX_DEVICE_CONTROL_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_DEVICE_CONTROL)
+
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/intr.h b/c/src/exec/posix/base/intr.h
new file mode 100644
index 0000000000..f07d1f9552
--- /dev/null
+++ b/c/src/exec/posix/base/intr.h
@@ -0,0 +1,72 @@
+/* intr.h
+ *
+ * XXX: It is unclear if the type "intr_t" should be defined when
+ * _POSIX_INTERRUPT_CONTROL is not.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_INTERRUPTS_h
+#define __POSIX_INTERRUPTS_h
+
+#include <rtems/posix/features.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#if defined(_POSIX_INTERRUPT_CONTROL)
+
+/*
+ * 22.2 Concepts, P1003.4b/D8, p. 73
+ */
+
+typedef int intr_t;
+
+/*
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+/*
+ * Return codes from an interrupt handler
+ */
+
+#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
+ /* the thread that registered the */
+ /* ISR that the interrupt occurred. */
+#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
+ /* do NOT perform notification. */
+#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
+ /* let the next handler try. */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+);
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+);
+
+int intr_lock(
+ intr_t intr
+);
+
+int intr_unlock(
+ intr_t intr
+);
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/limits.h b/c/src/exec/posix/base/limits.h
new file mode 100644
index 0000000000..d46500bc36
--- /dev/null
+++ b/c/src/exec/posix/base/limits.h
@@ -0,0 +1,154 @@
+/* limits.h
+ *
+ * This file lists the minimums for the limits set by each of
+ * the POSIX features subsets.
+ *
+ * XXX: Careful attention needs to be paid to section 2.8 in 1003.1b-1993
+ * to segregrate the variables below based on their "class" according
+ * to our implementation. We also need to set the Run-Time Invariant
+ * and other related values.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_LIMITS_h
+#define __POSIX_LIMITS_h
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.1b-1993 defines the constants below this comment. *
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_AIO_LISTIO_MAX 2
+#define _POSIX_AIO_MAX 1
+#define _POSIX_ARG_MAX 4096
+#define _POSIX_CHILD_MAX 6
+#define _POSIX_DELAYTIMER_MAX 32
+#define _POSIX_LINK_MAX 8
+#define _POSIX_MAX_CANON 255
+#define _POSIX_MAX_INPUT 255
+#define _POSIX_MQ_OPEN_MAX 8
+#define _POSIX_MQ_PRIO_MAX 32
+#define _POSIX_NAME_MAX 14
+#define _POSIX_NGROUPS_MAX 0
+#define _POSIX_OPEN_MAX 16
+#define _POSIX_PATH_MAX 255
+#define _POSIX_PIPE_BUF 512
+#define _POSIX_RTSIG_MAX 8
+#define _POSIX_SEM_NSEMS_MAX 256
+#define _POSIX_SEM_VALUE_MAX 32767
+#define _POSIX_SIGQUEUE_MAX 32
+#define _POSIX_SSIZE_MAX 32767
+#define _POSIX_STREAM_MAX 8
+#define _POSIX_TIMER_MAX 32
+#define _POSIX_TZNAME_MAX 3
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define AIO_LISTIO_MAX 2
+#define AIO_MAX 1
+#define AIO_PRIO_DELTA_MAX 0
+#define ARG_MAX 4096
+#define CHILD_MAX 6
+#define DELAYTIMER_MAX 32
+#define MQ_OPEN_MAX 8
+#define MQ_PRIO_MAX 32
+#define OPEN_MAX 16
+#define PAGESIZE 1
+#define RTSIG_MAX 8
+#define SEM_NSEMS_MAX 256
+#define SEM_VALUE_MAX 32767
+#define SIGQUEUE_MAX 32
+#define STREAM_MAX 8
+#define TIMER_MAX 32
+#define TZNAME_MAX 3
+
+/*
+ * Pathname Variables
+ */
+
+#define LINK_MAX 8
+#define MAX_CANON 255
+#define MAX_INPUT 255
+#define NAME_MAX 14
+#define PATH_MAX 255
+#define PIPE_BUF 512
+
+/*
+ * Invariant values
+ */
+
+#define SSIZE_MAX 32767
+
+/*
+ * Maximum Values
+ */
+
+#define _POSIX_CLOCKRES_MIN 0 /* in nanoseconds */
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.1c/D10 defines the constants below this comment. *
+ *
+ * XXX: doc seems to have printing problems in this table :(
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_LOGIN_NAME_MAX 9
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX 28
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TTY_NAME_MAX 9
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define LOGIN_NAME_MAX 9
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+/*
+ * The maximum number of keys (PTHREAD_KEYS_MAX) and threads
+ * (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
+ */
+
+#define TTY_NAME_MAX 9
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.4b/D8 defines the constants below this comment. *
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_INTERRUPT_OVERRUN_MAX 32
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define INTERRUPT_OVERRUN_MAX 32
+
+/*
+ * Pathname Variables
+ */
+
+#define MIN_ALLOC_SIZE
+#define REC_MIN_XFER_SIZE
+#define REC_MAX_XFER_SIZE
+#define REC_INCR_XFER_SIZE
+#define REC_XFER_ALIGN
+#define MAX_ATOMIC_SIZE
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/mqueue.h b/c/src/exec/posix/base/mqueue.h
new file mode 100644
index 0000000000..f1b2250e5c
--- /dev/null
+++ b/c/src/exec/posix/base/mqueue.h
@@ -0,0 +1,145 @@
+/* mqueue.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_MESSAGE_QUEUE_h
+#define __POSIX_MESSAGE_QUEUE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_MESSAGE_PASSING)
+
+#include <sys/types.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+
+/*
+ * 15.1.1 Data Structures, P1003.1b-1993, p. 271
+ */
+
+typedef Objects_Id mqd_t;
+
+struct mq_attr {
+ long mq_flags; /* Message queue flags */
+ long mq_maxmsg; /* Maximum number of messages */
+ long mq_msgsize; /* Maximum message size */
+ long mq_curmsgs; /* Number of messages currently queued */
+};
+
+/*
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+);
+
+/*
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+);
+
+/*
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+#include <time.h>
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/*
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+);
+
+#endif /* _POSIX_REALTIME_SIGNALS */
+
+/*
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+);
+
+/*
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+);
+
+#endif /* _POSIX_MESSAGE_PASSING */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/pthread.h b/c/src/exec/posix/base/pthread.h
new file mode 100644
index 0000000000..ea9680f3c4
--- /dev/null
+++ b/c/src/exec/posix/base/pthread.h
@@ -0,0 +1,502 @@
+/* pthread.h
+ *
+ * $Id$
+ */
+
+#ifndef __PTHREAD_h
+#define __PTHREAD_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_THREADS)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+
+/*
+ * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
+ */
+
+int pthread_atfork(
+ void (*prepare)(void),
+ void (*parent)(void),
+ void (*child)(void)
+);
+
+/*
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_init(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_destroy(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_getpshared(
+ const pthread_mutexattr_t *attr,
+ int *pshared
+);
+
+int pthread_mutexattr_setpshared(
+ pthread_mutexattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_mutex_init(
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr
+);
+
+int pthread_mutex_destroy(
+ pthread_mutex_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_mutex_t. Example:
+ *
+ * pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ */
+
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_lock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_trylock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_unlock(
+ pthread_mutex_t *mutex
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int pthread_mutex_timedlock(
+ pthread_mutex_t *mutex,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_init(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_destroy(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_getpshared(
+ const pthread_condattr_t *attr,
+ int *pshared
+);
+
+int pthread_condattr_setpshared(
+ pthread_condattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_init(
+ pthread_cond_t *cond,
+ const pthread_condattr_t *attr
+);
+
+int pthread_cond_destroy(
+ pthread_cond_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_cond_t. Example:
+ *
+ * pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+ */
+
+#define PTHREAD_COND_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_signal(
+ pthread_cond_t *cond
+);
+
+int pthread_cond_broadcast(
+ pthread_cond_t *cond
+);
+
+/*
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_wait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex
+);
+
+int pthread_cond_timedwait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setscope(
+ pthread_attr_t *attr,
+ int contentionscope
+);
+
+int pthread_attr_getscope(
+ const pthread_attr_t *attr,
+ int *contentionscope
+);
+
+#define PTHREAD_INHERIT_SCHED 0 /* scheduling policy and associated */
+ /* attributes are inherited from */
+ /* the calling thread. */
+#define PTHREAD_EXPLICIT_SCHED 0 /* set from provided attribute object */
+
+int pthread_attr_setinheritsched(
+ pthread_attr_t *attr,
+ int inheritsched
+);
+
+int pthread_attr_getinheritsched(
+ const pthread_attr_t *attr,
+ int *inheritsched
+);
+
+int pthread_attr_setschedpolicy(
+ pthread_attr_t *attr,
+ int policy
+);
+
+int pthread_attr_getschedpolicy(
+ const pthread_attr_t *attr,
+ int *policy
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+int pthread_attr_setschedparam(
+ pthread_attr_t *attr,
+ const struct sched_param param
+);
+
+int pthread_attr_getschedparam(
+ const pthread_attr_t *attr,
+ struct sched_param *param
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_getschedparam(
+ pthread_t thread,
+ int *policy,
+ struct sched_param *param
+);
+
+int pthread_setschedparam(
+ pthread_t thread,
+ int policy,
+ struct sched_param *param
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+/*
+ * Values for protocol.
+ */
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+int pthread_mutexattr_setprotocol(
+ pthread_mutexattr_t *attr,
+ int protocol
+);
+
+int pthread_mutexattr_getprotocol(
+ const pthread_mutexattr_t *attr,
+ int *protocol
+);
+
+int pthread_mutexattr_setprioceiling(
+ pthread_mutexattr_t *attr,
+ int prioceiling
+);
+
+int pthread_mutexattr_getprioceiling(
+ const pthread_mutexattr_t *attr,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_setprioceiling(
+ pthread_mutex_t *mutex,
+ int prioceiling,
+ int *old_ceiling
+);
+
+int pthread_mutex_getprioceiling(
+ pthread_mutex_t *mutex,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_PROTECT */
+
+/*
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_init(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_destroy(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_getstacksize(
+ const pthread_attr_t *attr,
+ size_t *stacksize
+);
+
+int pthread_attr_setstacksize(
+ pthread_attr_t *attr,
+ size_t stacksize
+);
+
+int pthread_attr_getstackaddr(
+ const pthread_attr_t *attr,
+ void **stackaddr
+);
+
+int pthread_attr_setstackaddr(
+ pthread_attr_t *attr,
+ void *stackaddr
+);
+
+int pthread_attr_getdetachstate(
+ const pthread_attr_t *attr,
+ int *detachstate
+);
+
+int pthread_attr_setdetachstate(
+ pthread_attr_t *attr,
+ int detachstate
+);
+
+/*
+ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
+ */
+
+int pthread_create(
+ pthread_t *thread,
+ const pthread_attr_t *attr,
+ void (*start_routine)( void * ),
+ void *arg
+);
+
+/*
+ * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
+ */
+
+int pthread_join(
+ pthread_t thread,
+ void **value_ptr
+);
+
+/*
+ * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
+ */
+
+int pthread_detach(
+ pthread_t thread
+);
+
+/*
+ * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
+ */
+
+pthread_t pthread_self( void );
+
+/*
+ * 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
+ */
+
+int pthread_equal(
+ pthread_t t1,
+ pthread_t t2
+);
+
+/*
+ * 16.1.8 Dynamic Package Initialization
+ */
+
+/*
+ * This is used to statically initialize a pthread_once_t. Example:
+ *
+ * pthread_once_t once = PTHREAD_ONCE_INITIALIZER;
+ */
+
+#define PTHREAD_ONCE_INITIALIZER { TRUE, FALSE }
+
+int pthread_once(
+ pthread_once_t *once_control,
+ void (*init_routine)(void)
+);
+
+/*
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ */
+
+int pthread_key_create(
+ pthread_key_t *key,
+ void (*destructor)( void * )
+);
+
+/*
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+int pthread_setspecific(
+ pthread_key_t key,
+ const void *value
+);
+
+void *pthread_getspecific(
+ pthread_key_t key
+);
+
+/*
+ * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
+ */
+
+int pthread_key_delete(
+ pthread_key_t key
+);
+
+/*
+ * 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
+ */
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+int pthread_cancel(
+ pthread_t thread
+);
+
+/*
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcancelstate(
+ int state,
+ int *oldstate
+);
+
+int pthread_setcanceltype(
+ int type,
+ int *oldtype
+);
+
+void pthread_testcancel( void );
+
+/*
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_push(
+ void (*routine)( void * ),
+ void *arg
+);
+
+void pthread_cleanup_pop(
+ int execute
+);
+
+#if defined(_POSIX_THREAD_CPUTIME)
+
+/*
+ * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
+ */
+
+int pthread_getcpuclockid(
+ pthread_t pid,
+ clockid_t *clock_id
+);
+
+/*
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_setcputime(
+ pthread_attr_t *attr,
+ int clock_allowed
+);
+
+int pthread_attr_getcputime(
+ pthread_attr_t *attr,
+ int *clock_allowed
+);
+
+#endif /* defined(_POSIX_THREAD_CPUTIME) */
+
+#endif /* defined(_POSIX_THREADS) */
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/sched.h b/c/src/exec/posix/base/sched.h
new file mode 100644
index 0000000000..1ea27a1634
--- /dev/null
+++ b/c/src/exec/posix/base/sched.h
@@ -0,0 +1,88 @@
+/* sched.h
+ *
+ * $Id$
+ */
+
+
+#ifndef __POSIX_SCHEDULING_h
+#define __POSIX_SCHEDULING_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_PRIORITY_SCHEDULING)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+#include <pthread.h>
+
+/*
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+);
+
+/*
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+);
+
+int sched_get_priority_min(
+ int policy
+);
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+);
+
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+
+#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
+
+/*
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void );
+
+#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/base/semaphore.h b/c/src/exec/posix/base/semaphore.h
new file mode 100644
index 0000000000..0388f91ad9
--- /dev/null
+++ b/c/src/exec/posix/base/semaphore.h
@@ -0,0 +1,108 @@
+/* semaphore.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SEMAPHORE_h
+#define __POSIX_SEMAPHORE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_SEMAPHORES)
+
+#include <sys/time.h>
+
+/*
+ * 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
+ */
+
+typedef int sem_t;
+
+/*
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+);
+
+/*
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+);
+
+/*
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: Follows open() calling conventions.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+);
+
+/*
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+);
+
+/*
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+);
+
+int sem_trywait(
+ sem_t *sem
+);
+
+#if defined(_POSIX_TIMEOUTS)
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+);
+#endif
+
+/*
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+int sem_post(
+ sem_t *sem
+);
+
+/*
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+);
+
+#endif /* _POSIX_SEMAPHORES */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/unistd.h b/c/src/exec/posix/base/unistd.h
new file mode 100644
index 0000000000..147e80c11d
--- /dev/null
+++ b/c/src/exec/posix/base/unistd.h
@@ -0,0 +1,85 @@
+/* unistd.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_UNISTD_h
+#define __POSIX_UNISTD_h
+
+#include <rtems/posix/features.h>
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
+ *
+ * NOTE: Table 4-2, Configurable System Variables, p. 96
+ */
+
+#define _SC_AIO_LISTIO_MAX 0
+#define _SC_AIO_MAX 1
+#define _SC_AIO_PRIO_DELTA_MAX 2
+#define _SC_ARG_MAX 3
+#define _SC_CHILD_MAX 4
+#define _SC_CLK_TCK 5
+#define _SC_DELAYTIMER_MAX 6
+#define _SC_MQ_OPEN_MAX 7
+#define _SC_MQ_PRIO_MAX 8
+#define _SC_NGROUPS_MAX 9
+#define _SC_OPEN_MAX 10
+#define _SC_PAGESIZE 11
+#define _SC_RTSIG_MAX 12
+#define _SC_SEM_NSEMS_MAX 13
+#define _SC_SEM_VALUE_MAX 14
+#define _SC_SIGQUEUE_MAX 15
+#define _SC_STREAM_MAX 16
+#define _SC_TIMER_MAX 17
+#define _SC_TZNAME_MAX 18
+
+#define _SC_ASYNCHRONOUS_IO 19
+#define _SC_FSYNC 20
+#define _SC_JOB_CONTROL 21
+#define _SC_MAPPED_FILES 22
+#define _SC_MEMLOCK 23
+#define _SC_MEMLOCK_RANGE 24
+#define _SC_MEMORY_PROTECTION 25
+#define _SC_MESSAGE_PASSING 26
+#define _SC_PRIORITIZED_IO 27
+#define _SC_REALTIME_SIGNALS 28
+#define _SC_SAVED_IDS 29
+#define _SC_SEMAPHORES 30
+#define _SC_SHARED_MEMORY_OBJECTS 31
+#define _SC_SYNCHRONIZED_IO 32
+#define _SC_TIMERS 33
+#define _SC_VERSION 34
+
+/*
+ * P1003.1c/D10, p. 52 adds the following.
+ */
+
+#define _SC_GETGR_R_SIZE_MAX 35
+#define _SC_GETPW_R_SIZE_MAX
+#define _SC_LOGIN_NAME_MAX
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS
+#define _SC_THREAD_KEYS_MAX
+#define _SC_THREAD_STACK_MIN
+#define _SC_THREAD_THREADS_MAX
+#define _SC_TTY_NAME_MAX
+
+#define _SC_THREADS
+#define _SC_THREAD_ATTR_STACKADDR
+#define _SC_THREAD_ATTR_STACKSIZE
+#define _SC_THREAD_PRIORITY_SCHEDULING
+#define _SC_THREAD_PRIO_INHERIT
+#define _SC_THREAD_PRIO_CEILING
+#define _SC_THREAD_PROCESS_SHARED
+#define _SC_THREAD_SAGE_FUNCTIONS
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
+ */
+
+long sysconf(
+ int name
+);
+
+#endif
+/* end of include */
diff --git a/c/src/exec/posix/headers/cancel.h b/c/src/exec/posix/headers/cancel.h
new file mode 100644
index 0000000000..e6d80275f4
--- /dev/null
+++ b/c/src/exec/posix/headers/cancel.h
@@ -0,0 +1,16 @@
+/* rtems/posix/cancel.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CANCEL_h
+#define __RTEMS_POSIX_CANCEL_h
+
+typedef struct {
+ Chain_Node Node;
+ void (*routine)( void * );
+ void *arg;
+} POSIX_Cancel_Handler_control;
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/headers/cond.h b/c/src/exec/posix/headers/cond.h
new file mode 100644
index 0000000000..4448e38b6c
--- /dev/null
+++ b/c/src/exec/posix/headers/cond.h
@@ -0,0 +1,123 @@
+/* rtems/posix/cond.h
+ *
+ * This include file contains all the private support information for
+ * POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * Data Structure used to manage a POSIX condition variable
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ pthread_mutex_t Mutex;
+ Thread_queue_Control Wait_queue;
+} POSIX_Condition_variables_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Condition_variables_Information;
+
+/*
+ * _POSIX_Condition_variables_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Condition_variables_Manager_initialization(
+ unsigned32 maximum_condition_variables
+);
+
+/*
+ * _POSIX_Condition_variables_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a condition variable control block from
+ * the inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *
+ _POSIX_Condition_variables_Allocate( void );
+
+/*
+ * _POSIX_Condition_variables_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a condition variable control block to the
+ * inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+/*
+ * _POSIX_Condition_variables_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps condition variable IDs to condition variable control
+ * blocks. If ID corresponds to a local condition variable, then it returns
+ * the_condition variable control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the condition variable ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_condition variable is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_condition variable is undefined.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Condition_variables_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_condition variable is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+#include <rtems/posix/cond.inl>
+#include <rtems/posix/condmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/condmp.h b/c/src/exec/posix/headers/condmp.h
new file mode 100644
index 0000000000..12997b68f4
--- /dev/null
+++ b/c/src/exec/posix/headers/condmp.h
@@ -0,0 +1,162 @@
+/* condmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Condition Variable Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote condition variable operations.
+ */
+
+typedef enum {
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE = 0,
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE = 1,
+ POSIX_CONDITION_VARIABLES_MP_EXTRACT_PROXY = 2,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_REQUEST = 3,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_RESPONSE = 4,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_REQUEST = 5,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_RESPONSE = 6,
+} POSIX_Condition_variables_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote condition variable operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Condition_variables_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Condition_variables_MP_Packet;
+
+/*
+ * _POSIX_Condition_variables_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_process_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Condition_variables_MP_Send_request_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_response_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Condition_variables_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Condition_variables_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a condition variable mp packet.
+ */
+
+POSIX_Condition_variables_MP_Packet
+ *_POSIX_Condition_variables_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/headers/intr.h b/c/src/exec/posix/headers/intr.h
new file mode 100644
index 0000000000..ae1690f676
--- /dev/null
+++ b/c/src/exec/posix/headers/intr.h
@@ -0,0 +1,153 @@
+/* rtems/posix/intr.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage each POSIX Interrupt Vector
+ */
+
+typedef struct {
+ int number_installed;
+ int lock_count;
+ int deferred_count;
+ Chain_Control Handlers;
+} POSIX_Interrupt_Control;
+
+/*
+ * Data Structure used to manage a POSIX Interrupt Handler
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int is_active;
+ intr_t vector;
+ Thread_Control *server;
+ int (*handler)( void *area );
+ volatile void *user_data_area;
+} POSIX_Interrupt_Handler_control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Interrupt_Handlers_Information;
+
+/*
+ * The following is an array which is used to manage the set of
+ * interrupt handlers installed on each vector.
+ */
+
+EXTERN POSIX_Interrupt_Control _POSIX_Interrupt_Information[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _POSIX_Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Interrupt_Manager_initialization(
+ unsigned32 maximum_interrupt_handlers
+);
+
+/*
+ * _POSIX_Interrupt_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a interrupt handler control block from
+ * the inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void );
+
+/*
+ * _POSIX_Interrupt_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a interrupt handler control block to the
+ * inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps interrupt handler IDs to interrupt handler control
+ * blocks. If ID corresponds to a local interrupt handler, then it returns
+ * the_intr control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the interrupt handler ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_intr is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_intr is undefined.
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Interrupt_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_intr is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This function XXX.
+ */
+
+void _POSIX_Interrupt_Handler(
+ ISR_Vector_number vector
+);
+
+#include <rtems/posix/intr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/key.h b/c/src/exec/posix/headers/key.h
new file mode 100644
index 0000000000..0e690161b8
--- /dev/null
+++ b/c/src/exec/posix/headers/key.h
@@ -0,0 +1,136 @@
+/* rtems/posix/key.h
+ *
+ * This include file contains all the private support information for
+ * POSIX key.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX key
+ *
+ * NOTE: The Values is a table indexed by the index portion of the
+ * ID of the currently executing thread.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ boolean is_active;
+ void (*destructor)( void * );
+ void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
+} POSIX_Keys_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Keys_Information;
+
+/*
+ * _POSIX_Keys_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Key_Manager_initialization(
+ unsigned32 maximum_keys
+);
+
+/*
+ * _POSIX_Keys_Run_destructors
+ *
+ * DESCRIPTION:
+ *
+ * This function executes all the destructors associated with the thread's
+ * keys. This function will execute until all values have been set to NULL.
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ */
+
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+);
+
+/*
+ * _POSIX_Keys_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a keys control block from
+ * the inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void );
+
+/*
+ * _POSIX_Keys_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a keys control block to the
+ * inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+);
+
+/*
+ * _POSIX_Keys_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps key IDs to key control blocks.
+ * If ID corresponds to a local keys, then it returns
+ * the_key control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the keys ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_key is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_key is undefined.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Keys_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_key is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+);
+
+#include <rtems/posix/key.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/mqueue.h b/c/src/exec/posix/headers/mqueue.h
new file mode 100644
index 0000000000..5d5cfee61b
--- /dev/null
+++ b/c/src/exec/posix/headers/mqueue.h
@@ -0,0 +1,186 @@
+/* rtems/posix/mqueue.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Message Queues.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coremsg.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage a POSIX message queue
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ int flags;
+ boolean named;
+ boolean linked;
+ boolean blocking;
+ unsigned32 open_count;
+ CORE_message_queue_Control Message_queue;
+ struct sigevent notification;
+} POSIX_Message_queue_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Message_queue_Information;
+
+/*
+ * _POSIX_Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Create_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the creation of a message queue utilizing the
+ * core message queue.
+ */
+
+int _POSIX_Message_queue_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int oflag,
+ struct mq_attr *attr,
+ POSIX_Message_queue_Control **message_queue
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Send_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts a message to a specified message queue.
+ */
+
+int _POSIX_Message_queue_Send_support(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ unsigned32 msg_len,
+ Priority_Control msg_prio,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
+
+/*
+ * _POSIX_Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message queue control block to the
+ * inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control blocks.
+ * If ID corresponds to a local message queue, then it returns
+ * the_mq control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the message queue ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_message queue is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mq is undefined.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Message_queue_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+/*
+ * _POSIX_Message_queue_Priority_to_core
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+);
+
+#include <rtems/posix/mqueue.inl>
+#include <rtems/posix/mqueuemp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/mqueuemp.h b/c/src/exec/posix/headers/mqueuemp.h
new file mode 100644
index 0000000000..ae23f6af56
--- /dev/null
+++ b/c/src/exec/posix/headers/mqueuemp.h
@@ -0,0 +1,161 @@
+/* mqueuemp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Message Queue Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_REQUEST = 3,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_REQUEST = 5,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Message_queue_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Message_queue_MP_Packet;
+
+/*
+ * _POSIX_Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_process_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Message_queue_MP_Send_request_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_response_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Message_queue_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+POSIX_Message_queue_MP_Packet *_POSIX_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/headers/mutex.h b/c/src/exec/posix/headers/mutex.h
new file mode 100644
index 0000000000..5639d908d2
--- /dev/null
+++ b/c/src/exec/posix/headers/mutex.h
@@ -0,0 +1,117 @@
+/* rtems/posix/mutex.h
+ *
+ * This include file contains all the private support information for
+ * POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_h
+#define __RTEMS_POSIX_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX mutex
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ CORE_mutex_Control Mutex;
+} POSIX_Mutex_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Mutex_Information;
+
+/*
+ * _POSIX_Mutex_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Mutex_Manager_initialization(
+ unsigned32 maximum_mutexes
+);
+
+/*
+ * _POSIX_Mutex_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a mutexes control block from
+ * the inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
+
+/*
+ * _POSIX_Mutex_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a mutexes control block to the
+ * inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+);
+
+/*
+ * _POSIX_Mutex_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps mutexes IDs to mutexes control blocks.
+ * If ID corresponds to a local mutexes, then it returns
+ * the_mutex control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the mutexes ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_mutex is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mutex is undefined.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Mutex_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_mutex is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+);
+
+#include <rtems/posix/mutex.inl>
+#include <rtems/posix/mutexmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/mutexmp.h b/c/src/exec/posix/headers/mutexmp.h
new file mode 100644
index 0000000000..15ac5371e8
--- /dev/null
+++ b/c/src/exec/posix/headers/mutexmp.h
@@ -0,0 +1,161 @@
+/* mutexmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Mutex Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_MP_h
+#define __RTEMS_POSIX_MUTEX_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote mutex operations.
+ */
+
+typedef enum {
+ POSIX_MUTEX_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MUTEX_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MUTEX_MP_EXTRACT_PROXY = 2,
+ POSIX_MUTEX_MP_OBTAIN_REQUEST = 3,
+ POSIX_MUTEX_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MUTEX_MP_RELEASE_REQUEST = 5,
+ POSIX_MUTEX_MP_RELEASE_RESPONSE = 6,
+} POSIX_Mutex_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote mutex operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Mutex_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Mutex_MP_Packet;
+
+/*
+ * _POSIX_Mutex_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_process_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Mutex_MP_Send_request_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_response_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Mutex_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Mutex_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Mutex_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a mutex mp packet.
+ */
+
+POSIX_Mutex_MP_Packet *_POSIX_Mutex_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/headers/priority.h b/c/src/exec/posix/headers/priority.h
new file mode 100644
index 0000000000..f4cb717b7c
--- /dev/null
+++ b/c/src/exec/posix/headers/priority.h
@@ -0,0 +1,34 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_h
+#define __RTEMS_POSIX_PRIORITY_h
+
+#include <rtems/score/priority.h>
+
+/*
+ * RTEMS Core has priorities run in the opposite sense of the POSIX API.
+ */
+
+#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (255)
+
+#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+);
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+);
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+);
+
+#include <rtems/posix/priority.inl>
+
+#endif
diff --git a/c/src/exec/posix/headers/pthread.h b/c/src/exec/posix/headers/pthread.h
new file mode 100644
index 0000000000..538e737268
--- /dev/null
+++ b/c/src/exec/posix/headers/pthread.h
@@ -0,0 +1,113 @@
+/* rtems/posix/pthread.h
+ *
+ * This include file contains all the private support information for
+ * POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_h
+#define __RTEMS_POSIX_THREADS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX thread
+ */
+
+typedef Thread_Control POSIX_Threads_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Threads_Information;
+
+/*
+ * _POSIX_Threads_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Threads_Manager_initialization(
+ unsigned32 maximum_pthreads
+);
+
+/*
+ * _POSIX_Threads_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a pthread control block from
+ * the inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void );
+
+/*
+ * _POSIX_Threads_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a pthread control block to the
+ * inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+);
+
+/*
+ * _POSIX_Threads_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps pthread IDs to pthread control blocks.
+ * If ID corresponds to a local pthread, then it returns
+ * the_pthread control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the pthread ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_pthread is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_pthread is undefined.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Threads_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_pthread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+);
+
+#include <rtems/posix/pthread.inl>
+#include <rtems/posix/pthreadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/pthreadmp.h b/c/src/exec/posix/headers/pthreadmp.h
new file mode 100644
index 0000000000..e15534136b
--- /dev/null
+++ b/c/src/exec/posix/headers/pthreadmp.h
@@ -0,0 +1,161 @@
+/* pthreadmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Threads Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_MP_h
+#define __RTEMS_POSIX_THREADS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote pthread operations.
+ */
+
+typedef enum {
+ POSIX_THREADS_MP_ANNOUNCE_CREATE = 0,
+ POSIX_THREADS_MP_ANNOUNCE_DELETE = 1,
+ POSIX_THREADS_MP_EXTRACT_PROXY = 2,
+ POSIX_THREADS_MP_OBTAIN_REQUEST = 3,
+ POSIX_THREADS_MP_OBTAIN_RESPONSE = 4,
+ POSIX_THREADS_MP_RELEASE_REQUEST = 5,
+ POSIX_THREADS_MP_RELEASE_RESPONSE = 6
+} POSIX_Threads_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote pthread operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Threads_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait;
+ Objects_Id proxy_id;
+} POSIX_Threads_MP_Packet;
+
+/*
+ * _POSIX_Threads_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_process_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Threads_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Threads_MP_Send_request_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Threads_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_response_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Threads_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Threads_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Threads_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Threads_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Threads_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a pthread mp packet.
+ */
+
+POSIX_Threads_MP_Packet *_POSIX_Threads_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/headers/semaphore.h b/c/src/exec/posix/headers/semaphore.h
new file mode 100644
index 0000000000..a538663989
--- /dev/null
+++ b/c/src/exec/posix/headers/semaphore.h
@@ -0,0 +1,135 @@
+/* rtems/posix/semaphore.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_h
+#define __RTEMS_POSIX_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coresem.h>
+
+/*
+ * Data Structure used to manage a POSIX semaphore
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ boolean named;
+ boolean linked;
+ unsigned32 open_count;
+ CORE_semaphore_Control Semaphore;
+} POSIX_Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Semaphore_Information;
+
+/*
+ * _POSIX_Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphorees
+);
+
+/*
+ * _POSIX_Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
+
+/*
+ * _POSIX_Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Semaphore_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+#include <rtems/posix/semaphore.inl>
+#include <rtems/posix/semaphoremp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/semaphoremp.h b/c/src/exec/posix/headers/semaphoremp.h
new file mode 100644
index 0000000000..102b3d08a6
--- /dev/null
+++ b/c/src/exec/posix/headers/semaphoremp.h
@@ -0,0 +1,161 @@
+/* semaphoremp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_MP_h
+#define __RTEMS_POSIX_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ POSIX_SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ POSIX_SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ POSIX_SEMAPHORE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Semaphore_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Semaphore_MP_Packet;
+
+/*
+ * _POSIX_Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_process_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Semaphore_MP_Send_request_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_response_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Semaphore_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+POSIX_Semaphore_MP_Packet *_POSIX_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/headers/threadsup.h b/c/src/exec/posix/headers/threadsup.h
new file mode 100644
index 0000000000..26643445b4
--- /dev/null
+++ b/c/src/exec/posix/headers/threadsup.h
@@ -0,0 +1,30 @@
+/* threadsup.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
+#define __RTEMS_POSIX_THREAD_SUPPORT_h
+
+#include <rtems/score/coresem.h>
+
+typedef struct {
+ /*
+ * POSIX Interrupts
+ */
+ unsigned32 interrupts_installed;
+ CORE_semaphore_Control Interrupt_Semaphore;
+
+ /*
+ * POSIX Cancelability
+ */
+ int cancelability_state;
+ int cancelability_type;
+ int cancelation_requested;
+ Chain_Control Cancellation_Handlers;
+
+} POSIX_API_Thread_Support_Control;
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/headers/time.h b/c/src/exec/posix/headers/time.h
new file mode 100644
index 0000000000..0b11f2fa54
--- /dev/null
+++ b/c/src/exec/posix/headers/time.h
@@ -0,0 +1,14 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_TIME_h
+#define __RTEMS_POSIX_TIME_h
+
+Watchdog_Interval _POSIX_Time_Spec_to_interval(
+ const struct timespec *time
+);
+
+#endif
diff --git a/c/src/exec/posix/include/aio.h b/c/src/exec/posix/include/aio.h
new file mode 100644
index 0000000000..504559c857
--- /dev/null
+++ b/c/src/exec/posix/include/aio.h
@@ -0,0 +1,137 @@
+/* aio.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_ASYNCHRONOUS_IO_h
+#define __POSIX_ASYNCHRONOUS_IO_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_ASYNCHRONOUS_IO)
+
+/*
+ * 6.7.1 Data Definitions for Asynchronous Input and Output,
+ * P1003.1b-1993, p. 151
+ */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <time.h>
+#include <fcntl.h>
+
+/*
+ * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
+ */
+
+#define AIO_CANCELED 0 /* all requested operations have been canceled */
+#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
+ /* since they are in progress */
+#define AIO_ALLDONE 0 /* none of the requested operations could be */
+ /* canceled since they are already complete */
+
+/* lio_listio() options */
+
+#define LIO_WAIT 0 /* calling process is to suspend until the */
+ /* operation is complete */
+#define LIO_NOWAIT 0 /* calling process is to continue execution while */
+ /* the operation is performed and no notification */
+ /* shall be given when the operation is completed */
+#define LIO_READ 0 /* request a read() */
+#define LIO_WRITE 0 /* request a write() */
+#define LIO_NOP 0 /* no transfer is requested */
+
+/*
+ * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
+ */
+
+struct aiocb {
+ int aio_fildes; /* File descriptor */
+ off_t aio_offset; /* File offset */
+ volatile void *aio_buf; /* Location of buffer */
+ size_t aio_nbytes; /* Length of transfer */
+ int aio_reqprio; /* Request priority offset */
+ struct sigevent aio_sigevent; /* Signal number and value */
+ int aoi_lio_opcode; /* Operation to be performed */
+};
+
+/*
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+);
+
+/*
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+);
+
+#if defined(_POSIX_SYNCHRONIZED_IO)
+
+/*
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+);
+
+#endif /* _POSIX_SYNCHRONIZED_IO */
+
+#endif /* _POSIX_ASYNCHRONOUS_IO */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/devctl.h b/c/src/exec/posix/include/devctl.h
new file mode 100644
index 0000000000..5073b475ee
--- /dev/null
+++ b/c/src/exec/posix/include/devctl.h
@@ -0,0 +1,30 @@
+/* devctl.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_DEVICE_CONTROL_h
+#define __POSIX_DEVICE_CONTROL_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_DEVICE_CONTROL)
+
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/intr.h b/c/src/exec/posix/include/intr.h
new file mode 100644
index 0000000000..f07d1f9552
--- /dev/null
+++ b/c/src/exec/posix/include/intr.h
@@ -0,0 +1,72 @@
+/* intr.h
+ *
+ * XXX: It is unclear if the type "intr_t" should be defined when
+ * _POSIX_INTERRUPT_CONTROL is not.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_INTERRUPTS_h
+#define __POSIX_INTERRUPTS_h
+
+#include <rtems/posix/features.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#if defined(_POSIX_INTERRUPT_CONTROL)
+
+/*
+ * 22.2 Concepts, P1003.4b/D8, p. 73
+ */
+
+typedef int intr_t;
+
+/*
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+/*
+ * Return codes from an interrupt handler
+ */
+
+#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
+ /* the thread that registered the */
+ /* ISR that the interrupt occurred. */
+#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
+ /* do NOT perform notification. */
+#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
+ /* let the next handler try. */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+);
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+);
+
+int intr_lock(
+ intr_t intr
+);
+
+int intr_unlock(
+ intr_t intr
+);
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/limits.h b/c/src/exec/posix/include/limits.h
new file mode 100644
index 0000000000..d46500bc36
--- /dev/null
+++ b/c/src/exec/posix/include/limits.h
@@ -0,0 +1,154 @@
+/* limits.h
+ *
+ * This file lists the minimums for the limits set by each of
+ * the POSIX features subsets.
+ *
+ * XXX: Careful attention needs to be paid to section 2.8 in 1003.1b-1993
+ * to segregrate the variables below based on their "class" according
+ * to our implementation. We also need to set the Run-Time Invariant
+ * and other related values.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_LIMITS_h
+#define __POSIX_LIMITS_h
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.1b-1993 defines the constants below this comment. *
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_AIO_LISTIO_MAX 2
+#define _POSIX_AIO_MAX 1
+#define _POSIX_ARG_MAX 4096
+#define _POSIX_CHILD_MAX 6
+#define _POSIX_DELAYTIMER_MAX 32
+#define _POSIX_LINK_MAX 8
+#define _POSIX_MAX_CANON 255
+#define _POSIX_MAX_INPUT 255
+#define _POSIX_MQ_OPEN_MAX 8
+#define _POSIX_MQ_PRIO_MAX 32
+#define _POSIX_NAME_MAX 14
+#define _POSIX_NGROUPS_MAX 0
+#define _POSIX_OPEN_MAX 16
+#define _POSIX_PATH_MAX 255
+#define _POSIX_PIPE_BUF 512
+#define _POSIX_RTSIG_MAX 8
+#define _POSIX_SEM_NSEMS_MAX 256
+#define _POSIX_SEM_VALUE_MAX 32767
+#define _POSIX_SIGQUEUE_MAX 32
+#define _POSIX_SSIZE_MAX 32767
+#define _POSIX_STREAM_MAX 8
+#define _POSIX_TIMER_MAX 32
+#define _POSIX_TZNAME_MAX 3
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define AIO_LISTIO_MAX 2
+#define AIO_MAX 1
+#define AIO_PRIO_DELTA_MAX 0
+#define ARG_MAX 4096
+#define CHILD_MAX 6
+#define DELAYTIMER_MAX 32
+#define MQ_OPEN_MAX 8
+#define MQ_PRIO_MAX 32
+#define OPEN_MAX 16
+#define PAGESIZE 1
+#define RTSIG_MAX 8
+#define SEM_NSEMS_MAX 256
+#define SEM_VALUE_MAX 32767
+#define SIGQUEUE_MAX 32
+#define STREAM_MAX 8
+#define TIMER_MAX 32
+#define TZNAME_MAX 3
+
+/*
+ * Pathname Variables
+ */
+
+#define LINK_MAX 8
+#define MAX_CANON 255
+#define MAX_INPUT 255
+#define NAME_MAX 14
+#define PATH_MAX 255
+#define PIPE_BUF 512
+
+/*
+ * Invariant values
+ */
+
+#define SSIZE_MAX 32767
+
+/*
+ * Maximum Values
+ */
+
+#define _POSIX_CLOCKRES_MIN 0 /* in nanoseconds */
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.1c/D10 defines the constants below this comment. *
+ *
+ * XXX: doc seems to have printing problems in this table :(
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_LOGIN_NAME_MAX 9
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX 28
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TTY_NAME_MAX 9
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define LOGIN_NAME_MAX 9
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+/*
+ * The maximum number of keys (PTHREAD_KEYS_MAX) and threads
+ * (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
+ */
+
+#define TTY_NAME_MAX 9
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * P1003.4b/D8 defines the constants below this comment. *
+ * *
+ ****************************************************************************
+ ****************************************************************************/
+
+#define _POSIX_INTERRUPT_OVERRUN_MAX 32
+
+/*
+ * Definitions of the following may be omitted if the value is >= stated
+ * minimum but is indeterminate.
+ */
+
+#define INTERRUPT_OVERRUN_MAX 32
+
+/*
+ * Pathname Variables
+ */
+
+#define MIN_ALLOC_SIZE
+#define REC_MIN_XFER_SIZE
+#define REC_MAX_XFER_SIZE
+#define REC_INCR_XFER_SIZE
+#define REC_XFER_ALIGN
+#define MAX_ATOMIC_SIZE
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/mqueue.h b/c/src/exec/posix/include/mqueue.h
new file mode 100644
index 0000000000..f1b2250e5c
--- /dev/null
+++ b/c/src/exec/posix/include/mqueue.h
@@ -0,0 +1,145 @@
+/* mqueue.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_MESSAGE_QUEUE_h
+#define __POSIX_MESSAGE_QUEUE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_MESSAGE_PASSING)
+
+#include <sys/types.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+
+/*
+ * 15.1.1 Data Structures, P1003.1b-1993, p. 271
+ */
+
+typedef Objects_Id mqd_t;
+
+struct mq_attr {
+ long mq_flags; /* Message queue flags */
+ long mq_maxmsg; /* Maximum number of messages */
+ long mq_msgsize; /* Maximum message size */
+ long mq_curmsgs; /* Number of messages currently queued */
+};
+
+/*
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+);
+
+/*
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+);
+
+/*
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+#include <time.h>
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/*
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+);
+
+#endif /* _POSIX_REALTIME_SIGNALS */
+
+/*
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+);
+
+/*
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+);
+
+#endif /* _POSIX_MESSAGE_PASSING */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/pthread.h b/c/src/exec/posix/include/pthread.h
new file mode 100644
index 0000000000..ea9680f3c4
--- /dev/null
+++ b/c/src/exec/posix/include/pthread.h
@@ -0,0 +1,502 @@
+/* pthread.h
+ *
+ * $Id$
+ */
+
+#ifndef __PTHREAD_h
+#define __PTHREAD_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_THREADS)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+
+/*
+ * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
+ */
+
+int pthread_atfork(
+ void (*prepare)(void),
+ void (*parent)(void),
+ void (*child)(void)
+);
+
+/*
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_init(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_destroy(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_getpshared(
+ const pthread_mutexattr_t *attr,
+ int *pshared
+);
+
+int pthread_mutexattr_setpshared(
+ pthread_mutexattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_mutex_init(
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr
+);
+
+int pthread_mutex_destroy(
+ pthread_mutex_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_mutex_t. Example:
+ *
+ * pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ */
+
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_lock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_trylock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_unlock(
+ pthread_mutex_t *mutex
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int pthread_mutex_timedlock(
+ pthread_mutex_t *mutex,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_init(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_destroy(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_getpshared(
+ const pthread_condattr_t *attr,
+ int *pshared
+);
+
+int pthread_condattr_setpshared(
+ pthread_condattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_init(
+ pthread_cond_t *cond,
+ const pthread_condattr_t *attr
+);
+
+int pthread_cond_destroy(
+ pthread_cond_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_cond_t. Example:
+ *
+ * pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+ */
+
+#define PTHREAD_COND_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_signal(
+ pthread_cond_t *cond
+);
+
+int pthread_cond_broadcast(
+ pthread_cond_t *cond
+);
+
+/*
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_wait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex
+);
+
+int pthread_cond_timedwait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setscope(
+ pthread_attr_t *attr,
+ int contentionscope
+);
+
+int pthread_attr_getscope(
+ const pthread_attr_t *attr,
+ int *contentionscope
+);
+
+#define PTHREAD_INHERIT_SCHED 0 /* scheduling policy and associated */
+ /* attributes are inherited from */
+ /* the calling thread. */
+#define PTHREAD_EXPLICIT_SCHED 0 /* set from provided attribute object */
+
+int pthread_attr_setinheritsched(
+ pthread_attr_t *attr,
+ int inheritsched
+);
+
+int pthread_attr_getinheritsched(
+ const pthread_attr_t *attr,
+ int *inheritsched
+);
+
+int pthread_attr_setschedpolicy(
+ pthread_attr_t *attr,
+ int policy
+);
+
+int pthread_attr_getschedpolicy(
+ const pthread_attr_t *attr,
+ int *policy
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+int pthread_attr_setschedparam(
+ pthread_attr_t *attr,
+ const struct sched_param param
+);
+
+int pthread_attr_getschedparam(
+ const pthread_attr_t *attr,
+ struct sched_param *param
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_getschedparam(
+ pthread_t thread,
+ int *policy,
+ struct sched_param *param
+);
+
+int pthread_setschedparam(
+ pthread_t thread,
+ int policy,
+ struct sched_param *param
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+/*
+ * Values for protocol.
+ */
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+int pthread_mutexattr_setprotocol(
+ pthread_mutexattr_t *attr,
+ int protocol
+);
+
+int pthread_mutexattr_getprotocol(
+ const pthread_mutexattr_t *attr,
+ int *protocol
+);
+
+int pthread_mutexattr_setprioceiling(
+ pthread_mutexattr_t *attr,
+ int prioceiling
+);
+
+int pthread_mutexattr_getprioceiling(
+ const pthread_mutexattr_t *attr,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_setprioceiling(
+ pthread_mutex_t *mutex,
+ int prioceiling,
+ int *old_ceiling
+);
+
+int pthread_mutex_getprioceiling(
+ pthread_mutex_t *mutex,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_PROTECT */
+
+/*
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_init(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_destroy(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_getstacksize(
+ const pthread_attr_t *attr,
+ size_t *stacksize
+);
+
+int pthread_attr_setstacksize(
+ pthread_attr_t *attr,
+ size_t stacksize
+);
+
+int pthread_attr_getstackaddr(
+ const pthread_attr_t *attr,
+ void **stackaddr
+);
+
+int pthread_attr_setstackaddr(
+ pthread_attr_t *attr,
+ void *stackaddr
+);
+
+int pthread_attr_getdetachstate(
+ const pthread_attr_t *attr,
+ int *detachstate
+);
+
+int pthread_attr_setdetachstate(
+ pthread_attr_t *attr,
+ int detachstate
+);
+
+/*
+ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
+ */
+
+int pthread_create(
+ pthread_t *thread,
+ const pthread_attr_t *attr,
+ void (*start_routine)( void * ),
+ void *arg
+);
+
+/*
+ * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
+ */
+
+int pthread_join(
+ pthread_t thread,
+ void **value_ptr
+);
+
+/*
+ * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
+ */
+
+int pthread_detach(
+ pthread_t thread
+);
+
+/*
+ * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
+ */
+
+pthread_t pthread_self( void );
+
+/*
+ * 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
+ */
+
+int pthread_equal(
+ pthread_t t1,
+ pthread_t t2
+);
+
+/*
+ * 16.1.8 Dynamic Package Initialization
+ */
+
+/*
+ * This is used to statically initialize a pthread_once_t. Example:
+ *
+ * pthread_once_t once = PTHREAD_ONCE_INITIALIZER;
+ */
+
+#define PTHREAD_ONCE_INITIALIZER { TRUE, FALSE }
+
+int pthread_once(
+ pthread_once_t *once_control,
+ void (*init_routine)(void)
+);
+
+/*
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ */
+
+int pthread_key_create(
+ pthread_key_t *key,
+ void (*destructor)( void * )
+);
+
+/*
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+int pthread_setspecific(
+ pthread_key_t key,
+ const void *value
+);
+
+void *pthread_getspecific(
+ pthread_key_t key
+);
+
+/*
+ * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
+ */
+
+int pthread_key_delete(
+ pthread_key_t key
+);
+
+/*
+ * 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
+ */
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+int pthread_cancel(
+ pthread_t thread
+);
+
+/*
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcancelstate(
+ int state,
+ int *oldstate
+);
+
+int pthread_setcanceltype(
+ int type,
+ int *oldtype
+);
+
+void pthread_testcancel( void );
+
+/*
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_push(
+ void (*routine)( void * ),
+ void *arg
+);
+
+void pthread_cleanup_pop(
+ int execute
+);
+
+#if defined(_POSIX_THREAD_CPUTIME)
+
+/*
+ * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
+ */
+
+int pthread_getcpuclockid(
+ pthread_t pid,
+ clockid_t *clock_id
+);
+
+/*
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_setcputime(
+ pthread_attr_t *attr,
+ int clock_allowed
+);
+
+int pthread_attr_getcputime(
+ pthread_attr_t *attr,
+ int *clock_allowed
+);
+
+#endif /* defined(_POSIX_THREAD_CPUTIME) */
+
+#endif /* defined(_POSIX_THREADS) */
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/rtems/posix/cancel.h b/c/src/exec/posix/include/rtems/posix/cancel.h
new file mode 100644
index 0000000000..e6d80275f4
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/cancel.h
@@ -0,0 +1,16 @@
+/* rtems/posix/cancel.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CANCEL_h
+#define __RTEMS_POSIX_CANCEL_h
+
+typedef struct {
+ Chain_Node Node;
+ void (*routine)( void * );
+ void *arg;
+} POSIX_Cancel_Handler_control;
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/rtems/posix/cond.h b/c/src/exec/posix/include/rtems/posix/cond.h
new file mode 100644
index 0000000000..4448e38b6c
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/cond.h
@@ -0,0 +1,123 @@
+/* rtems/posix/cond.h
+ *
+ * This include file contains all the private support information for
+ * POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * Data Structure used to manage a POSIX condition variable
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ pthread_mutex_t Mutex;
+ Thread_queue_Control Wait_queue;
+} POSIX_Condition_variables_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Condition_variables_Information;
+
+/*
+ * _POSIX_Condition_variables_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Condition_variables_Manager_initialization(
+ unsigned32 maximum_condition_variables
+);
+
+/*
+ * _POSIX_Condition_variables_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a condition variable control block from
+ * the inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *
+ _POSIX_Condition_variables_Allocate( void );
+
+/*
+ * _POSIX_Condition_variables_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a condition variable control block to the
+ * inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+/*
+ * _POSIX_Condition_variables_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps condition variable IDs to condition variable control
+ * blocks. If ID corresponds to a local condition variable, then it returns
+ * the_condition variable control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the condition variable ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_condition variable is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_condition variable is undefined.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Condition_variables_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_condition variable is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+#include <rtems/posix/cond.inl>
+#include <rtems/posix/condmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/condmp.h b/c/src/exec/posix/include/rtems/posix/condmp.h
new file mode 100644
index 0000000000..12997b68f4
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/condmp.h
@@ -0,0 +1,162 @@
+/* condmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Condition Variable Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote condition variable operations.
+ */
+
+typedef enum {
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE = 0,
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE = 1,
+ POSIX_CONDITION_VARIABLES_MP_EXTRACT_PROXY = 2,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_REQUEST = 3,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_RESPONSE = 4,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_REQUEST = 5,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_RESPONSE = 6,
+} POSIX_Condition_variables_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote condition variable operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Condition_variables_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Condition_variables_MP_Packet;
+
+/*
+ * _POSIX_Condition_variables_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_process_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Condition_variables_MP_Send_request_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_response_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Condition_variables_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Condition_variables_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a condition variable mp packet.
+ */
+
+POSIX_Condition_variables_MP_Packet
+ *_POSIX_Condition_variables_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/include/rtems/posix/intr.h b/c/src/exec/posix/include/rtems/posix/intr.h
new file mode 100644
index 0000000000..ae1690f676
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/intr.h
@@ -0,0 +1,153 @@
+/* rtems/posix/intr.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage each POSIX Interrupt Vector
+ */
+
+typedef struct {
+ int number_installed;
+ int lock_count;
+ int deferred_count;
+ Chain_Control Handlers;
+} POSIX_Interrupt_Control;
+
+/*
+ * Data Structure used to manage a POSIX Interrupt Handler
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int is_active;
+ intr_t vector;
+ Thread_Control *server;
+ int (*handler)( void *area );
+ volatile void *user_data_area;
+} POSIX_Interrupt_Handler_control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Interrupt_Handlers_Information;
+
+/*
+ * The following is an array which is used to manage the set of
+ * interrupt handlers installed on each vector.
+ */
+
+EXTERN POSIX_Interrupt_Control _POSIX_Interrupt_Information[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _POSIX_Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Interrupt_Manager_initialization(
+ unsigned32 maximum_interrupt_handlers
+);
+
+/*
+ * _POSIX_Interrupt_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a interrupt handler control block from
+ * the inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void );
+
+/*
+ * _POSIX_Interrupt_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a interrupt handler control block to the
+ * inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps interrupt handler IDs to interrupt handler control
+ * blocks. If ID corresponds to a local interrupt handler, then it returns
+ * the_intr control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the interrupt handler ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_intr is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_intr is undefined.
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Interrupt_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_intr is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This function XXX.
+ */
+
+void _POSIX_Interrupt_Handler(
+ ISR_Vector_number vector
+);
+
+#include <rtems/posix/intr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/key.h b/c/src/exec/posix/include/rtems/posix/key.h
new file mode 100644
index 0000000000..0e690161b8
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/key.h
@@ -0,0 +1,136 @@
+/* rtems/posix/key.h
+ *
+ * This include file contains all the private support information for
+ * POSIX key.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX key
+ *
+ * NOTE: The Values is a table indexed by the index portion of the
+ * ID of the currently executing thread.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ boolean is_active;
+ void (*destructor)( void * );
+ void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
+} POSIX_Keys_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Keys_Information;
+
+/*
+ * _POSIX_Keys_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Key_Manager_initialization(
+ unsigned32 maximum_keys
+);
+
+/*
+ * _POSIX_Keys_Run_destructors
+ *
+ * DESCRIPTION:
+ *
+ * This function executes all the destructors associated with the thread's
+ * keys. This function will execute until all values have been set to NULL.
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ */
+
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+);
+
+/*
+ * _POSIX_Keys_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a keys control block from
+ * the inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void );
+
+/*
+ * _POSIX_Keys_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a keys control block to the
+ * inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+);
+
+/*
+ * _POSIX_Keys_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps key IDs to key control blocks.
+ * If ID corresponds to a local keys, then it returns
+ * the_key control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the keys ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_key is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_key is undefined.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Keys_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_key is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+);
+
+#include <rtems/posix/key.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/mqueue.h b/c/src/exec/posix/include/rtems/posix/mqueue.h
new file mode 100644
index 0000000000..5d5cfee61b
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/mqueue.h
@@ -0,0 +1,186 @@
+/* rtems/posix/mqueue.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Message Queues.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coremsg.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage a POSIX message queue
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ int flags;
+ boolean named;
+ boolean linked;
+ boolean blocking;
+ unsigned32 open_count;
+ CORE_message_queue_Control Message_queue;
+ struct sigevent notification;
+} POSIX_Message_queue_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Message_queue_Information;
+
+/*
+ * _POSIX_Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Create_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the creation of a message queue utilizing the
+ * core message queue.
+ */
+
+int _POSIX_Message_queue_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int oflag,
+ struct mq_attr *attr,
+ POSIX_Message_queue_Control **message_queue
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Send_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts a message to a specified message queue.
+ */
+
+int _POSIX_Message_queue_Send_support(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ unsigned32 msg_len,
+ Priority_Control msg_prio,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
+
+/*
+ * _POSIX_Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message queue control block to the
+ * inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control blocks.
+ * If ID corresponds to a local message queue, then it returns
+ * the_mq control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the message queue ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_message queue is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mq is undefined.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Message_queue_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+/*
+ * _POSIX_Message_queue_Priority_to_core
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+);
+
+#include <rtems/posix/mqueue.inl>
+#include <rtems/posix/mqueuemp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/mqueuemp.h b/c/src/exec/posix/include/rtems/posix/mqueuemp.h
new file mode 100644
index 0000000000..ae23f6af56
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/mqueuemp.h
@@ -0,0 +1,161 @@
+/* mqueuemp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Message Queue Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_REQUEST = 3,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_REQUEST = 5,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Message_queue_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Message_queue_MP_Packet;
+
+/*
+ * _POSIX_Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_process_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Message_queue_MP_Send_request_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_response_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Message_queue_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+POSIX_Message_queue_MP_Packet *_POSIX_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/include/rtems/posix/mutex.h b/c/src/exec/posix/include/rtems/posix/mutex.h
new file mode 100644
index 0000000000..5639d908d2
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/mutex.h
@@ -0,0 +1,117 @@
+/* rtems/posix/mutex.h
+ *
+ * This include file contains all the private support information for
+ * POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_h
+#define __RTEMS_POSIX_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX mutex
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ CORE_mutex_Control Mutex;
+} POSIX_Mutex_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Mutex_Information;
+
+/*
+ * _POSIX_Mutex_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Mutex_Manager_initialization(
+ unsigned32 maximum_mutexes
+);
+
+/*
+ * _POSIX_Mutex_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a mutexes control block from
+ * the inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
+
+/*
+ * _POSIX_Mutex_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a mutexes control block to the
+ * inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+);
+
+/*
+ * _POSIX_Mutex_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps mutexes IDs to mutexes control blocks.
+ * If ID corresponds to a local mutexes, then it returns
+ * the_mutex control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the mutexes ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_mutex is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mutex is undefined.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Mutex_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_mutex is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+);
+
+#include <rtems/posix/mutex.inl>
+#include <rtems/posix/mutexmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/mutexmp.h b/c/src/exec/posix/include/rtems/posix/mutexmp.h
new file mode 100644
index 0000000000..15ac5371e8
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/mutexmp.h
@@ -0,0 +1,161 @@
+/* mutexmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Mutex Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_MP_h
+#define __RTEMS_POSIX_MUTEX_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote mutex operations.
+ */
+
+typedef enum {
+ POSIX_MUTEX_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MUTEX_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MUTEX_MP_EXTRACT_PROXY = 2,
+ POSIX_MUTEX_MP_OBTAIN_REQUEST = 3,
+ POSIX_MUTEX_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MUTEX_MP_RELEASE_REQUEST = 5,
+ POSIX_MUTEX_MP_RELEASE_RESPONSE = 6,
+} POSIX_Mutex_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote mutex operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Mutex_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Mutex_MP_Packet;
+
+/*
+ * _POSIX_Mutex_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_process_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Mutex_MP_Send_request_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_response_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Mutex_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Mutex_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Mutex_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a mutex mp packet.
+ */
+
+POSIX_Mutex_MP_Packet *_POSIX_Mutex_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/include/rtems/posix/priority.h b/c/src/exec/posix/include/rtems/posix/priority.h
new file mode 100644
index 0000000000..f4cb717b7c
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/priority.h
@@ -0,0 +1,34 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_h
+#define __RTEMS_POSIX_PRIORITY_h
+
+#include <rtems/score/priority.h>
+
+/*
+ * RTEMS Core has priorities run in the opposite sense of the POSIX API.
+ */
+
+#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (255)
+
+#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+);
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+);
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+);
+
+#include <rtems/posix/priority.inl>
+
+#endif
diff --git a/c/src/exec/posix/include/rtems/posix/pthread.h b/c/src/exec/posix/include/rtems/posix/pthread.h
new file mode 100644
index 0000000000..538e737268
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/pthread.h
@@ -0,0 +1,113 @@
+/* rtems/posix/pthread.h
+ *
+ * This include file contains all the private support information for
+ * POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_h
+#define __RTEMS_POSIX_THREADS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX thread
+ */
+
+typedef Thread_Control POSIX_Threads_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Threads_Information;
+
+/*
+ * _POSIX_Threads_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Threads_Manager_initialization(
+ unsigned32 maximum_pthreads
+);
+
+/*
+ * _POSIX_Threads_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a pthread control block from
+ * the inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void );
+
+/*
+ * _POSIX_Threads_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a pthread control block to the
+ * inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+);
+
+/*
+ * _POSIX_Threads_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps pthread IDs to pthread control blocks.
+ * If ID corresponds to a local pthread, then it returns
+ * the_pthread control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the pthread ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_pthread is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_pthread is undefined.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Threads_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_pthread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+);
+
+#include <rtems/posix/pthread.inl>
+#include <rtems/posix/pthreadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/pthreadmp.h b/c/src/exec/posix/include/rtems/posix/pthreadmp.h
new file mode 100644
index 0000000000..e15534136b
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/pthreadmp.h
@@ -0,0 +1,161 @@
+/* pthreadmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Threads Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_MP_h
+#define __RTEMS_POSIX_THREADS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote pthread operations.
+ */
+
+typedef enum {
+ POSIX_THREADS_MP_ANNOUNCE_CREATE = 0,
+ POSIX_THREADS_MP_ANNOUNCE_DELETE = 1,
+ POSIX_THREADS_MP_EXTRACT_PROXY = 2,
+ POSIX_THREADS_MP_OBTAIN_REQUEST = 3,
+ POSIX_THREADS_MP_OBTAIN_RESPONSE = 4,
+ POSIX_THREADS_MP_RELEASE_REQUEST = 5,
+ POSIX_THREADS_MP_RELEASE_RESPONSE = 6
+} POSIX_Threads_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote pthread operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Threads_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait;
+ Objects_Id proxy_id;
+} POSIX_Threads_MP_Packet;
+
+/*
+ * _POSIX_Threads_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_process_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Threads_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Threads_MP_Send_request_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Threads_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_response_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Threads_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Threads_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Threads_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Threads_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Threads_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a pthread mp packet.
+ */
+
+POSIX_Threads_MP_Packet *_POSIX_Threads_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/include/rtems/posix/semaphore.h b/c/src/exec/posix/include/rtems/posix/semaphore.h
new file mode 100644
index 0000000000..a538663989
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/semaphore.h
@@ -0,0 +1,135 @@
+/* rtems/posix/semaphore.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_h
+#define __RTEMS_POSIX_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coresem.h>
+
+/*
+ * Data Structure used to manage a POSIX semaphore
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ boolean named;
+ boolean linked;
+ unsigned32 open_count;
+ CORE_semaphore_Control Semaphore;
+} POSIX_Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Semaphore_Information;
+
+/*
+ * _POSIX_Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphorees
+);
+
+/*
+ * _POSIX_Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
+
+/*
+ * _POSIX_Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Semaphore_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+#include <rtems/posix/semaphore.inl>
+#include <rtems/posix/semaphoremp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/semaphoremp.h b/c/src/exec/posix/include/rtems/posix/semaphoremp.h
new file mode 100644
index 0000000000..102b3d08a6
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/semaphoremp.h
@@ -0,0 +1,161 @@
+/* semaphoremp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_MP_h
+#define __RTEMS_POSIX_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ POSIX_SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ POSIX_SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ POSIX_SEMAPHORE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Semaphore_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Semaphore_MP_Packet;
+
+/*
+ * _POSIX_Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_process_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Semaphore_MP_Send_request_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_response_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Semaphore_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+POSIX_Semaphore_MP_Packet *_POSIX_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/posix/include/rtems/posix/threadsup.h b/c/src/exec/posix/include/rtems/posix/threadsup.h
new file mode 100644
index 0000000000..26643445b4
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/threadsup.h
@@ -0,0 +1,30 @@
+/* threadsup.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
+#define __RTEMS_POSIX_THREAD_SUPPORT_h
+
+#include <rtems/score/coresem.h>
+
+typedef struct {
+ /*
+ * POSIX Interrupts
+ */
+ unsigned32 interrupts_installed;
+ CORE_semaphore_Control Interrupt_Semaphore;
+
+ /*
+ * POSIX Cancelability
+ */
+ int cancelability_state;
+ int cancelability_type;
+ int cancelation_requested;
+ Chain_Control Cancellation_Handlers;
+
+} POSIX_API_Thread_Support_Control;
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/rtems/posix/time.h b/c/src/exec/posix/include/rtems/posix/time.h
new file mode 100644
index 0000000000..0b11f2fa54
--- /dev/null
+++ b/c/src/exec/posix/include/rtems/posix/time.h
@@ -0,0 +1,14 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_TIME_h
+#define __RTEMS_POSIX_TIME_h
+
+Watchdog_Interval _POSIX_Time_Spec_to_interval(
+ const struct timespec *time
+);
+
+#endif
diff --git a/c/src/exec/posix/include/sched.h b/c/src/exec/posix/include/sched.h
new file mode 100644
index 0000000000..1ea27a1634
--- /dev/null
+++ b/c/src/exec/posix/include/sched.h
@@ -0,0 +1,88 @@
+/* sched.h
+ *
+ * $Id$
+ */
+
+
+#ifndef __POSIX_SCHEDULING_h
+#define __POSIX_SCHEDULING_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_PRIORITY_SCHEDULING)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+#include <pthread.h>
+
+/*
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+);
+
+/*
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+);
+
+int sched_get_priority_min(
+ int policy
+);
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+);
+
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+
+#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
+
+/*
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void );
+
+#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/semaphore.h b/c/src/exec/posix/include/semaphore.h
new file mode 100644
index 0000000000..0388f91ad9
--- /dev/null
+++ b/c/src/exec/posix/include/semaphore.h
@@ -0,0 +1,108 @@
+/* semaphore.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SEMAPHORE_h
+#define __POSIX_SEMAPHORE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_SEMAPHORES)
+
+#include <sys/time.h>
+
+/*
+ * 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
+ */
+
+typedef int sem_t;
+
+/*
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+);
+
+/*
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+);
+
+/*
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: Follows open() calling conventions.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+);
+
+/*
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+);
+
+/*
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+);
+
+int sem_trywait(
+ sem_t *sem
+);
+
+#if defined(_POSIX_TIMEOUTS)
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+);
+#endif
+
+/*
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+int sem_post(
+ sem_t *sem
+);
+
+/*
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+);
+
+#endif /* _POSIX_SEMAPHORES */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/include/sys/utsname.h b/c/src/exec/posix/include/sys/utsname.h
new file mode 100644
index 0000000000..ca15230d40
--- /dev/null
+++ b/c/src/exec/posix/include/sys/utsname.h
@@ -0,0 +1,49 @@
+/* sys/utsname.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SYS_UTSNAME_h
+#define __POSIX_SYS_UTSNAME_h
+
+#include <sys/times.h>
+#include <sys/types.h>
+
+/*
+ * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
+ *
+ * NOTE: The lengths of the strings in this structure are
+ * just long enough to reliably contain the RTEMS information.
+ * For example, the fields are not long enough to support
+ * Internet hostnames.
+ */
+
+struct utsname {
+ char sysname[ 32 ]; /* Name of this implementation of the operating system */
+ char nodename[ 32 ]; /* Name of this node within an implementation */
+ /* specified communication network */
+ char release[ 32 ]; /* Current release level of this implementation */
+ char version[ 32 ]; /* Current version level of this release */
+ char machine[ 32 ]; /* Name of the hardware type on which the system */
+ /* is running */
+};
+
+/*
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+);
+
+/*
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+);
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/include/unistd.h b/c/src/exec/posix/include/unistd.h
new file mode 100644
index 0000000000..147e80c11d
--- /dev/null
+++ b/c/src/exec/posix/include/unistd.h
@@ -0,0 +1,85 @@
+/* unistd.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_UNISTD_h
+#define __POSIX_UNISTD_h
+
+#include <rtems/posix/features.h>
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
+ *
+ * NOTE: Table 4-2, Configurable System Variables, p. 96
+ */
+
+#define _SC_AIO_LISTIO_MAX 0
+#define _SC_AIO_MAX 1
+#define _SC_AIO_PRIO_DELTA_MAX 2
+#define _SC_ARG_MAX 3
+#define _SC_CHILD_MAX 4
+#define _SC_CLK_TCK 5
+#define _SC_DELAYTIMER_MAX 6
+#define _SC_MQ_OPEN_MAX 7
+#define _SC_MQ_PRIO_MAX 8
+#define _SC_NGROUPS_MAX 9
+#define _SC_OPEN_MAX 10
+#define _SC_PAGESIZE 11
+#define _SC_RTSIG_MAX 12
+#define _SC_SEM_NSEMS_MAX 13
+#define _SC_SEM_VALUE_MAX 14
+#define _SC_SIGQUEUE_MAX 15
+#define _SC_STREAM_MAX 16
+#define _SC_TIMER_MAX 17
+#define _SC_TZNAME_MAX 18
+
+#define _SC_ASYNCHRONOUS_IO 19
+#define _SC_FSYNC 20
+#define _SC_JOB_CONTROL 21
+#define _SC_MAPPED_FILES 22
+#define _SC_MEMLOCK 23
+#define _SC_MEMLOCK_RANGE 24
+#define _SC_MEMORY_PROTECTION 25
+#define _SC_MESSAGE_PASSING 26
+#define _SC_PRIORITIZED_IO 27
+#define _SC_REALTIME_SIGNALS 28
+#define _SC_SAVED_IDS 29
+#define _SC_SEMAPHORES 30
+#define _SC_SHARED_MEMORY_OBJECTS 31
+#define _SC_SYNCHRONIZED_IO 32
+#define _SC_TIMERS 33
+#define _SC_VERSION 34
+
+/*
+ * P1003.1c/D10, p. 52 adds the following.
+ */
+
+#define _SC_GETGR_R_SIZE_MAX 35
+#define _SC_GETPW_R_SIZE_MAX
+#define _SC_LOGIN_NAME_MAX
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS
+#define _SC_THREAD_KEYS_MAX
+#define _SC_THREAD_STACK_MIN
+#define _SC_THREAD_THREADS_MAX
+#define _SC_TTY_NAME_MAX
+
+#define _SC_THREADS
+#define _SC_THREAD_ATTR_STACKADDR
+#define _SC_THREAD_ATTR_STACKSIZE
+#define _SC_THREAD_PRIORITY_SCHEDULING
+#define _SC_THREAD_PRIO_INHERIT
+#define _SC_THREAD_PRIO_CEILING
+#define _SC_THREAD_PROCESS_SHARED
+#define _SC_THREAD_SAGE_FUNCTIONS
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
+ */
+
+long sysconf(
+ int name
+);
+
+#endif
+/* end of include */
diff --git a/c/src/exec/posix/inline/cond.inl b/c/src/exec/posix/inline/cond.inl
new file mode 100644
index 0000000000..f6d55af7c6
--- /dev/null
+++ b/c/src/exec/posix/inline/cond.inl
@@ -0,0 +1,76 @@
+/* rtems/posix/cond.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
+#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Allocate
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control
+ *_POSIX_Condition_variables_Allocate( void )
+{
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Allocate( &_POSIX_Condition_variables_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Free
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ _Objects_Free(
+ &_POSIX_Condition_variables_Information,
+ &the_condition_variable->Object
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Get
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+/* XXX really should validate pointer */
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ return !the_condition_variable;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/intr.inl b/c/src/exec/posix/inline/intr.inl
new file mode 100644
index 0000000000..56b1c9dd0b
--- /dev/null
+++ b/c/src/exec/posix/inline/intr.inl
@@ -0,0 +1,72 @@
+/* rtems/posix/intr.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Interrupt Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_INTERRUPT_inl
+#define __RTEMS_POSIX_INTERRUPT_inl
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Allocate
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void )
+{
+ return (POSIX_Interrupt_Handler_control *)
+ _Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Free
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ _Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Get
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Interrupt_Control *)
+ _Objects_Get( &_POSIX_Interrupt_Handlers_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ return !the_intr;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/key.inl b/c/src/exec/posix/inline/key.inl
new file mode 100644
index 0000000000..3b9c1e9e3c
--- /dev/null
+++ b/c/src/exec/posix/inline/key.inl
@@ -0,0 +1,70 @@
+/* rtems/posix/key.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX key's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_inl
+#define __RTEMS_POSIX_KEY_inl
+
+/*PAGE
+ *
+ * _POSIX_Keys_Allocate
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
+{
+ return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Free
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+)
+{
+ _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Get
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Keys_Control *)
+ _Objects_Get( &_POSIX_Keys_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+)
+{
+ return !the_key;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/mqueue.inl b/c/src/exec/posix/inline/mqueue.inl
new file mode 100644
index 0000000000..140a37a6a6
--- /dev/null
+++ b/c/src/exec/posix/inline/mqueue.inl
@@ -0,0 +1,83 @@
+/* rtems/posix/mqueue.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Message Queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
+#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Allocate
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Allocate( &_POSIX_Message_queue_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Free
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Get
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Get( &_POSIX_Message_queue_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ return !the_mq;
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Priority_to_core
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+)
+{
+ return priority;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/mutex.inl b/c/src/exec/posix/inline/mutex.inl
new file mode 100644
index 0000000000..f663eb3c7d
--- /dev/null
+++ b/c/src/exec/posix/inline/mutex.inl
@@ -0,0 +1,88 @@
+/* rtems/posix/mutex.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_inl
+#define __RTEMS_POSIX_MUTEX_inl
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Allocate
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
+{
+ return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Free
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Get
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ int status;
+
+ if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
+ /*
+ * Do an "auto-create" here.
+ */
+
+ status = pthread_mutex_init( id, 0 );
+ if ( status ) {
+ *location = OBJECTS_ERROR;
+ return (POSIX_Mutex_Control *) 0;
+ }
+ }
+
+ /*
+ * Now call Objects_Get()
+ */
+
+ return (POSIX_Mutex_Control *)
+ _Objects_Get( &_POSIX_Mutex_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ return !the_mutex;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/priority.inl b/c/src/exec/posix/inline/priority.inl
new file mode 100644
index 0000000000..90dfaead02
--- /dev/null
+++ b/c/src/exec/posix/inline/priority.inl
@@ -0,0 +1,29 @@
+/*
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_inl
+#define __RTEMS_POSIX_PRIORITY_inl
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+)
+{
+ return (boolean) priority >= 1 && priority <= 255;
+}
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+)
+{
+ return (Priority_Control) 256 - priority;
+}
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+)
+{
+ return 256 - priority;
+}
+
+#endif
diff --git a/c/src/exec/posix/inline/pthread.inl b/c/src/exec/posix/inline/pthread.inl
new file mode 100644
index 0000000000..256372d326
--- /dev/null
+++ b/c/src/exec/posix/inline/pthread.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/pthread.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_inl
+#define __RTEMS_POSIX_THREADS_inl
+
+/*PAGE
+ *
+ * _POSIX_Threads_Allocate
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void )
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Allocate( &_POSIX_Threads_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Free
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ _Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Get
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Get( &_POSIX_Threads_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ return !the_pthread;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/cond.inl b/c/src/exec/posix/inline/rtems/posix/cond.inl
new file mode 100644
index 0000000000..f6d55af7c6
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/cond.inl
@@ -0,0 +1,76 @@
+/* rtems/posix/cond.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
+#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Allocate
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control
+ *_POSIX_Condition_variables_Allocate( void )
+{
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Allocate( &_POSIX_Condition_variables_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Free
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ _Objects_Free(
+ &_POSIX_Condition_variables_Information,
+ &the_condition_variable->Object
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Get
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+/* XXX really should validate pointer */
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ return !the_condition_variable;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/intr.inl b/c/src/exec/posix/inline/rtems/posix/intr.inl
new file mode 100644
index 0000000000..56b1c9dd0b
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/intr.inl
@@ -0,0 +1,72 @@
+/* rtems/posix/intr.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Interrupt Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_INTERRUPT_inl
+#define __RTEMS_POSIX_INTERRUPT_inl
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Allocate
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void )
+{
+ return (POSIX_Interrupt_Handler_control *)
+ _Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Free
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ _Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Get
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Interrupt_Control *)
+ _Objects_Get( &_POSIX_Interrupt_Handlers_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ return !the_intr;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/key.inl b/c/src/exec/posix/inline/rtems/posix/key.inl
new file mode 100644
index 0000000000..3b9c1e9e3c
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/key.inl
@@ -0,0 +1,70 @@
+/* rtems/posix/key.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX key's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_inl
+#define __RTEMS_POSIX_KEY_inl
+
+/*PAGE
+ *
+ * _POSIX_Keys_Allocate
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
+{
+ return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Free
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+)
+{
+ _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Get
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Keys_Control *)
+ _Objects_Get( &_POSIX_Keys_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+)
+{
+ return !the_key;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/mqueue.inl b/c/src/exec/posix/inline/rtems/posix/mqueue.inl
new file mode 100644
index 0000000000..140a37a6a6
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/mqueue.inl
@@ -0,0 +1,83 @@
+/* rtems/posix/mqueue.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Message Queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
+#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Allocate
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Allocate( &_POSIX_Message_queue_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Free
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Get
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Get( &_POSIX_Message_queue_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ return !the_mq;
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Priority_to_core
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+)
+{
+ return priority;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/mutex.inl b/c/src/exec/posix/inline/rtems/posix/mutex.inl
new file mode 100644
index 0000000000..f663eb3c7d
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/mutex.inl
@@ -0,0 +1,88 @@
+/* rtems/posix/mutex.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_inl
+#define __RTEMS_POSIX_MUTEX_inl
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Allocate
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
+{
+ return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Free
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Get
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ int status;
+
+ if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
+ /*
+ * Do an "auto-create" here.
+ */
+
+ status = pthread_mutex_init( id, 0 );
+ if ( status ) {
+ *location = OBJECTS_ERROR;
+ return (POSIX_Mutex_Control *) 0;
+ }
+ }
+
+ /*
+ * Now call Objects_Get()
+ */
+
+ return (POSIX_Mutex_Control *)
+ _Objects_Get( &_POSIX_Mutex_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ return !the_mutex;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/priority.inl b/c/src/exec/posix/inline/rtems/posix/priority.inl
new file mode 100644
index 0000000000..90dfaead02
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/priority.inl
@@ -0,0 +1,29 @@
+/*
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_inl
+#define __RTEMS_POSIX_PRIORITY_inl
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+)
+{
+ return (boolean) priority >= 1 && priority <= 255;
+}
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+)
+{
+ return (Priority_Control) 256 - priority;
+}
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+)
+{
+ return 256 - priority;
+}
+
+#endif
diff --git a/c/src/exec/posix/inline/rtems/posix/pthread.inl b/c/src/exec/posix/inline/rtems/posix/pthread.inl
new file mode 100644
index 0000000000..256372d326
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/pthread.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/pthread.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_inl
+#define __RTEMS_POSIX_THREADS_inl
+
+/*PAGE
+ *
+ * _POSIX_Threads_Allocate
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void )
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Allocate( &_POSIX_Threads_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Free
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ _Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Get
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Get( &_POSIX_Threads_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ return !the_pthread;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/rtems/posix/semaphore.inl b/c/src/exec/posix/inline/rtems/posix/semaphore.inl
new file mode 100644
index 0000000000..33af0bd000
--- /dev/null
+++ b/c/src/exec/posix/inline/rtems/posix/semaphore.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/semaphore.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_inl
+#define __RTEMS_POSIX_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Allocate
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void )
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Allocate( &_POSIX_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Free
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Get
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Get( &_POSIX_Semaphore_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ return !the_semaphore;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/inline/semaphore.inl b/c/src/exec/posix/inline/semaphore.inl
new file mode 100644
index 0000000000..33af0bd000
--- /dev/null
+++ b/c/src/exec/posix/inline/semaphore.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/semaphore.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_inl
+#define __RTEMS_POSIX_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Allocate
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void )
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Allocate( &_POSIX_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Free
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Get
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Get( &_POSIX_Semaphore_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ return !the_semaphore;
+}
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/src/aio.c b/c/src/exec/posix/src/aio.c
new file mode 100644
index 0000000000..491c2772cf
--- /dev/null
+++ b/c/src/exec/posix/src/aio.c
@@ -0,0 +1,113 @@
+/* aio.c
+ *
+ * $Id$
+ */
+
+#include <aio.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+#endif
diff --git a/c/src/exec/posix/src/cancel.c b/c/src/exec/posix/src/cancel.c
new file mode 100644
index 0000000000..2ad972c626
--- /dev/null
+++ b/c/src/exec/posix/src/cancel.c
@@ -0,0 +1,227 @@
+/* cancel.c
+ *
+ * $Id$
+ */
+
+#include <pthread.h>
+#include <errno.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/posix/cancel.h>
+#include <rtems/posix/pthread.h>
+#include <rtems/posix/threadsup.h>
+
+/*PAGE
+ *
+ * POSIX_Thread_cancel_run
+ *
+ */
+
+void POSIX_Thread_cancel_run(
+ Thread_Control *the_thread
+)
+{
+ int old_cancel_state;
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+ ISR_Level level;
+
+ thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ old_cancel_state = thread_support->cancelability_state;
+
+ thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE;
+
+ while ( !_Chain_Is_empty( handler_stack ) ) {
+ _ISR_Disable( level );
+ handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
+ _Chain_Extract_unprotected( &handler->Node );
+ _ISR_Enable( level );
+
+ (*handler->routine)( handler->arg );
+
+ _Workspace_Free( handler );
+ }
+
+ thread_support->cancelation_requested = 0;
+
+ thread_support->cancelability_state = old_cancel_state;
+}
+
+/*PAGE
+ *
+ * 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
+ */
+
+int pthread_cancel(
+ pthread_t thread
+)
+{
+ Thread_Control *the_thread;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Objects_Locations location;
+
+ the_thread = _POSIX_Threads_Get( &thread, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED();
+ case OBJECTS_LOCAL:
+ thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
+
+ thread_support->cancelation_requested = 1;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcancelstate(
+ int state,
+ int *oldstate
+)
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !oldstate )
+ return EINVAL;
+
+ if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
+ return EINVAL;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ *oldstate = thread_support->cancelability_state;
+ thread_support->cancelability_state = state;
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcanceltype(
+ int type,
+ int *oldtype
+)
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !oldtype )
+ return EINVAL;
+
+ if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
+ return EINVAL;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ *oldtype = thread_support->cancelability_type;
+ thread_support->cancelability_type = type;
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+void pthread_testcancel( void )
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+}
+
+/*PAGE
+ *
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_push(
+ void (*routine)( void * ),
+ void *arg
+)
+{
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !routine )
+ return; /* XXX what to do really? */
+
+ handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
+
+ if ( !handler )
+ return; /* XXX what to do really? */
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ handler->routine = routine;
+ handler->arg = arg;
+
+ _Chain_Append( handler_stack, &handler->Node );
+}
+
+/*PAGE
+ *
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_pop(
+ int execute
+)
+{
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+ ISR_Level level;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ if ( _Chain_Is_empty( handler_stack ) )
+ return;
+
+ _ISR_Disable( level );
+ handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
+ _Chain_Extract_unprotected( &handler->Node );
+ _ISR_Enable( level );
+
+ if ( execute )
+ (*handler->routine)( handler->arg );
+
+ _Workspace_Free( handler );
+}
diff --git a/c/src/exec/posix/src/cond.c b/c/src/exec/posix/src/cond.c
new file mode 100644
index 0000000000..e20cfe5359
--- /dev/null
+++ b/c/src/exec/posix/src/cond.c
@@ -0,0 +1,400 @@
+/* cond.c
+ *
+ * $Id$
+ */
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/cond.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * The default condition variable attributes structure.
+ */
+
+const pthread_condattr_t _POSIX_Condition_variables_Default_attributes = {
+ TRUE, /* is_initialized */
+ PTHREAD_PROCESS_PRIVATE /* process_shared */
+};
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Manager_initialization
+ *
+ * This routine initializes all condition variable manager related data
+ * structures.
+ *
+ * Input parameters:
+ * maximum_condition_variables - maximum configured condition_variables
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Condition_variables_Manager_initialization(
+ unsigned32 maximum_condition_variables
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Condition_variables_Information,
+ OBJECTS_POSIX_CONDITION_VARIABLES,
+ TRUE,
+ maximum_condition_variables,
+ sizeof( POSIX_Condition_variables_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_init(
+ pthread_condattr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Condition_variables_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_destroy(
+ pthread_condattr_t *attr
+)
+{
+ if ( !attr || attr->is_initialized == FALSE )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_getpshared(
+ const pthread_condattr_t *attr,
+ int *pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *pshared = attr->process_shared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_setpshared(
+ pthread_condattr_t *attr,
+ int pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->process_shared = pshared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_init(
+ pthread_cond_t *cond,
+ const pthread_condattr_t *attr
+)
+{
+ POSIX_Condition_variables_Control *the_cond;
+ const pthread_condattr_t *the_attr;
+
+ if ( attr ) the_attr = attr;
+ else the_attr = &_POSIX_Condition_variables_Default_attributes;
+
+ /*
+ * XXX: Be careful about attributes when global!!!
+ */
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ return POSIX_MP_NOT_IMPLEMENTED();
+
+ if ( !the_attr->is_initialized )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_cond = _POSIX_Condition_variables_Allocate();
+
+ if ( !the_cond ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Condition_variables_Information,
+ 0, the_cond->Object.id, FALSE ) ) ) {
+ _POSIX_Condition_variables_Free( the_cond );
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_cond->process_shared = the_attr->process_shared;
+
+ the_cond->Mutex = 0;
+
+/* XXX some more initialization might need to go here */
+ _Thread_queue_Initialize(
+ &the_cond->Wait_queue,
+ OBJECTS_POSIX_CONDITION_VARIABLES,
+ THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_CONDITION_VARIABLE,
+ _POSIX_Condition_variables_MP_Send_extract_proxy,
+ ETIMEDOUT
+ );
+
+ _Objects_Open(
+ &_POSIX_Condition_variables_Information,
+ &the_cond->Object,
+ 0
+ );
+
+ *cond = the_cond->Object.id;
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Condition_variables_MP_Send_process_packet(
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE,
+ the_cond->Object.id,
+ 0, /* Name not used */
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_destroy(
+ pthread_cond_t *cond
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ _Objects_Close(
+ &_POSIX_Condition_variables_Information,
+ &the_cond->Object
+ );
+
+ if ( _Thread_queue_Get_number_waiting( &the_cond->Wait_queue ) )
+ return EBUSY;
+
+ _POSIX_Condition_variables_Free( the_cond );
+
+ if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Condition_variables_Information,
+ the_cond->Object.id
+ );
+
+ _POSIX_Condition_variables_MP_Send_process_packet(
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE,
+ the_cond->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Signal_support
+ *
+ * A support routine which implements guts of the broadcast and single task
+ * wake up version of the "signal" operation.
+ */
+
+int _POSIX_Condition_variables_Signal_support(
+ pthread_cond_t *cond,
+ boolean is_broadcast
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+ Thread_Control *the_thread;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ do {
+ the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
+ } while ( is_broadcast && the_thread );
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_signal(
+ pthread_cond_t *cond
+)
+{
+ return _POSIX_Condition_variables_Signal_support( cond, FALSE );
+}
+
+/*PAGE
+ *
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_broadcast(
+ pthread_cond_t *cond
+)
+{
+ return _POSIX_Condition_variables_Signal_support( cond, TRUE );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Wait_support
+ *
+ * A support routine which implements guts of the blocking, non-blocking, and
+ * timed wait version of condition variable wait routines.
+ */
+
+int _POSIX_Condition_variables_Wait_support(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+ int status;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ /*
+ * XXX: should be an error if cond->Mutex != mutex
+ */
+
+ status = pthread_mutex_unlock( mutex );
+ if ( !status )
+ return status;
+
+ the_cond->Mutex = *mutex;
+
+/* XXX .. enter critical section .. */
+ _Thread_queue_Enqueue( &the_cond->Wait_queue, 0 );
+
+ _Thread_Enable_dispatch();
+
+ status = pthread_mutex_lock( mutex );
+ if ( !status )
+ return status;
+
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_wait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Condition_variables_Wait_support(
+ cond,
+ mutex,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_timedwait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime
+)
+{
+ return _POSIX_Condition_variables_Wait_support(
+ cond,
+ mutex,
+ _POSIX_Time_Spec_to_interval( abstime )
+ );
+}
diff --git a/c/src/exec/posix/src/devctl.c b/c/src/exec/posix/src/devctl.c
new file mode 100644
index 0000000000..6581e0296c
--- /dev/null
+++ b/c/src/exec/posix/src/devctl.c
@@ -0,0 +1,25 @@
+/* devctl.c
+ *
+ * $Id$
+ */
+
+#include <devctl.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/src/intr.c b/c/src/exec/posix/src/intr.c
new file mode 100644
index 0000000000..11fbe6969a
--- /dev/null
+++ b/c/src/exec/posix/src/intr.c
@@ -0,0 +1,338 @@
+/* intr.c
+ *
+ * NOTE: Each task has an interrupt semaphore associated with it.
+ * No matter which interrupt occurs that it has registered,
+ * the same semaphore is used.
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <intr.h>
+
+#include <pthread.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/intr.h>
+#include <rtems/posix/time.h>
+#include <rtems/posix/threadsup.h>
+
+/*
+ * _POSIX_Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Interrupt_Manager_initialization(
+ unsigned32 maximum_interrupt_handlers
+)
+{
+ unsigned32 index;
+ POSIX_Interrupt_Control *the_vector;
+
+ _Objects_Initialize_information(
+ &_POSIX_Interrupt_Handlers_Information,
+ OBJECTS_POSIX_INTERRUPTS,
+ FALSE,
+ maximum_interrupt_handlers,
+ sizeof( POSIX_Interrupt_Handler_control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+
+ for ( index=0 ; index < CPU_INTERRUPT_NUMBER_OF_VECTORS ; index++ ) {
+ the_vector = &_POSIX_Interrupt_Information[ index ];
+
+ the_vector->number_installed = 0;
+ the_vector->lock_count = 0;
+ the_vector->deferred_count = 0;
+ _Chain_Initialize_empty( &the_vector->Handlers );
+ }
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+)
+{
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ proc_ptr old_handler;
+
+ if ( !_ISR_Is_vector_number_valid( intr ) ||
+ !_ISR_Is_valid_user_handler( intr_handler ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_intr = _POSIX_Interrupt_Allocate();
+
+ if ( !the_intr ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_intr->vector = intr;
+ the_intr->handler = intr_handler;
+ the_intr->user_data_area = area;
+ the_intr->server = _Thread_Executing;
+ the_intr->is_active = TRUE;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ thread_support->interrupts_installed++;
+
+/* XXX should we malloc the semaphore on the fly??? if so we probably need to
+ release it when the thread has released all interrupts and keep
+ a count of how many it has installed. CURRENTLY NO.. ALLOCATED w/TCB
+*/
+
+ /*
+ * This is sufficient to have the handlers invoked in the opposite
+ * order of installation. The loop invoking them can then go from
+ * the front of the list to the end.
+ */
+
+ _Chain_Prepend( &the_vector->Handlers, &the_intr->Object.Node );
+
+ if ( !the_vector->number_installed++ )
+ _ISR_Install_vector(
+ intr,
+ (proc_ptr) _POSIX_Interrupt_Handler,
+ &old_handler
+ );
+
+ _Objects_Open( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object, 0 );
+
+ /*
+ * Normally, an Id would be returned here.
+ */
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+)
+{
+ boolean found;
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Chain_Node *the_node;
+
+ if ( !_ISR_Is_valid_user_handler( intr_handler ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * Since interrupt handlers do not have a user visible id, there is
+ * no choice but to search the entire set of active interrupt handlers
+ * to find this one.
+ */
+
+ found = FALSE;
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_node = _Chain_Head( &the_vector->Handlers );
+
+ for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
+ the_intr = (POSIX_Interrupt_Handler_control *) the_node;
+
+ if ( the_intr->handler == intr_handler ) {
+ found = TRUE;
+ break;
+ }
+ the_node = the_node->next;
+ }
+
+ if ( !found ) {
+ _Thread_Enable_dispatch();
+ return EINVAL;
+ }
+
+ if ( !_Thread_Is_executing( the_intr->server ) ) {
+ _Thread_Enable_dispatch();
+ return EINVAL; /* XXX should be ENOISR; */
+ }
+
+ /*
+ * OK now we have found the interrupt handler and can do some work.
+ */
+
+ _Chain_Extract( &the_intr->Object.Node );
+
+ the_intr->is_active = FALSE;
+
+ the_vector->number_installed -= 1;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ thread_support->interrupts_installed--;
+
+ /*
+ * It is unnecessary to flush the semaphore since the handler can only
+ * be "removed" by the thread which installed it. Thus it cannot be
+ * blocked on the semaphore or it would not be executing this routine.
+ */
+
+ _Objects_Close( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
+
+ _POSIX_Interrupt_Free( the_intr );
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_lock(
+ intr_t intr
+)
+{
+ POSIX_Interrupt_Control *the_vector;
+
+ _Thread_Disable_dispatch();
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_vector->lock_count++;
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_unlock(
+ intr_t intr
+)
+{
+ POSIX_Interrupt_Control *the_vector;
+
+ _Thread_Disable_dispatch();
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ if ( !--the_vector->lock_count ) {
+ while ( --the_vector->deferred_count ) {
+ _POSIX_Interrupt_Handler( intr );
+ }
+ }
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+)
+{
+ Watchdog_Interval ticks;
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ ticks = _POSIX_Time_Spec_to_interval( timeout );
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ _Thread_Disable_dispatch();
+
+ _CORE_semaphore_Seize(
+ &thread_support->Interrupt_Semaphore,
+ 0, /* XXX does id=0 hurt in this case? */
+ TRUE,
+ ticks
+ );
+ _Thread_Enable_dispatch();
+
+ return _Thread_Executing->Wait.return_code; /* XXX should be POSIX */
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Handler
+ *
+ */
+
+void _POSIX_Interrupt_Handler(
+ ISR_Vector_number vector
+)
+{
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Chain_Node *the_node;
+ int status;
+
+ the_vector = &_POSIX_Interrupt_Information[ vector ];
+
+ the_node = _Chain_Head( &the_vector->Handlers );
+
+ for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
+ the_intr = (POSIX_Interrupt_Handler_control *) the_node;
+
+ status = (*the_intr->handler)( (void *) the_intr->user_data_area );
+
+ switch ( status ) {
+ case INTR_HANDLED_NOTIFY:
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ _CORE_semaphore_Surrender(
+ &thread_support->Interrupt_Semaphore,
+ 0, /* XXX is id=0 a problem */
+ 0 /* XXX is this a problem (mp support)*/
+ );
+ return;
+
+ case INTR_HANDLED_DO_NOT_NOTIFY:
+ return;
+
+ case INTR_NOT_HANDLED:
+ default: /* this should not happen */
+ break;
+ }
+ the_node = the_node->next;
+ }
+
+ /* XXX
+ *
+ * This is an unhandled interrupt!!!
+ */
+}
diff --git a/c/src/exec/posix/src/key.c b/c/src/exec/posix/src/key.c
new file mode 100644
index 0000000000..3bcc1b5170
--- /dev/null
+++ b/c/src/exec/posix/src/key.c
@@ -0,0 +1,260 @@
+/* key.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <pthread.h>
+#include <string.h>
+
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/posix/key.h>
+
+/*
+ * _POSIX_Key_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Key_Manager_initialization(
+ unsigned32 maximum_keys
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Keys_Information,
+ OBJECTS_POSIX_KEYS,
+ FALSE,
+ maximum_keys,
+ sizeof( POSIX_Keys_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ */
+
+int pthread_key_create(
+ pthread_key_t *key,
+ void (*destructor)( void * )
+)
+{
+ POSIX_Keys_Control *the_key;
+ void *table;
+ unsigned32 the_class;
+ unsigned32 bytes_to_allocate;
+
+
+ _Thread_Disable_dispatch();
+
+ the_key = _POSIX_Keys_Allocate();
+
+ if ( !the_key ) {
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_key->destructor = destructor;
+
+ for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
+ the_class++ ) {
+
+ bytes_to_allocate =
+ (_Objects_Information_table[ the_class ]->maximum + 1) * sizeof( void * );
+
+ table = _Workspace_Allocate( bytes_to_allocate );
+
+ if ( !table ) {
+ for ( --the_class;
+ the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class-- )
+ _Workspace_Free( the_key->Values[ the_class ] );
+
+ _POSIX_Keys_Free( the_key );
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ the_key->Values[ the_class ] = table;
+ memset( table, '\0', bytes_to_allocate );
+ }
+
+ the_key->is_active = TRUE;
+
+ _Objects_Open( &_POSIX_Keys_Information, &the_key->Object, 0 );
+
+ *key = the_key->Object.id;
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+int pthread_setspecific(
+ pthread_key_t key,
+ const void *value
+)
+{
+ register POSIX_Keys_Control *the_key;
+ unsigned32 index;
+ unsigned32 class;
+ Objects_Locations location;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return EINVAL; /* should never happen */
+ case OBJECTS_LOCAL:
+ index = _Objects_Get_index( _Thread_Executing->Object.id );
+ class = _Objects_Get_class( _Thread_Executing->Object.id );
+ the_key->Values[ class ][ index ] = (void *) value;
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+void *pthread_getspecific(
+ pthread_key_t key
+)
+{
+ register POSIX_Keys_Control *the_key;
+ unsigned32 index;
+ unsigned32 class;
+ Objects_Locations location;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return NULL;
+ case OBJECTS_REMOTE:
+ return 0; /* should never happen */
+ case OBJECTS_LOCAL:
+ index = _Objects_Get_index( _Thread_Executing->Object.id );
+ class = _Objects_Get_class( _Thread_Executing->Object.id );
+ return (void *) the_key->Values[ class ][ index ];
+ }
+ return (void *) POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
+ */
+
+int pthread_key_delete(
+ pthread_key_t key
+)
+{
+ register POSIX_Keys_Control *the_key;
+ Objects_Locations location;
+ unsigned32 the_class;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return 0; /* should never happen */
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
+
+ the_key->is_active = FALSE;
+
+ for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
+ the_class++ )
+ _Workspace_Free( the_key->Values[ the_class ] );
+
+ /*
+ * NOTE: The destructor is not called and it is the responsibility
+ * of the application to free the memory.
+ */
+
+ _POSIX_Keys_Free( the_key );
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Run_destructors
+ *
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ *
+ * XXX: This needs to be hooked to the thread exitting -- SOMEHOW.
+ */
+
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+)
+{
+ unsigned32 index;
+ unsigned32 pthread_index;
+ unsigned32 pthread_class;
+ unsigned32 iterations;
+ boolean are_all_null;
+ POSIX_Keys_Control *the_key;
+ void *value;
+
+ pthread_index = _Objects_Get_index( thread->Object.id );
+ pthread_class = _Objects_Get_class( thread->Object.id );
+
+ iterations = 0;
+
+ for ( ; ; ) {
+
+ are_all_null = TRUE;
+
+ for ( index=1 ; index <= _POSIX_Keys_Information.maximum ; index++ ) {
+
+ the_key = (POSIX_Keys_Control *)
+ _POSIX_Keys_Information.local_table[ index ];
+
+ if ( the_key && the_key->is_active && the_key->destructor ) {
+ value = the_key->Values[ pthread_class ][ pthread_index ];
+ if ( value ) {
+ (*the_key->destructor)( value );
+ if ( the_key->Values[ pthread_class ][ pthread_index ] )
+ are_all_null = FALSE;
+ }
+ }
+ }
+
+ if ( are_all_null == TRUE )
+ return;
+
+ iterations++;
+
+ /*
+ * The standard allows one to not do this and thus go into an infinite
+ * loop. It seems rude to unnecessarily lock up a system.
+ */
+
+ if ( iterations >= PTHREAD_DESTRUCTOR_ITERATIONS )
+ return;
+ }
+}
diff --git a/c/src/exec/posix/src/mqueue.c b/c/src/exec/posix/src/mqueue.c
new file mode 100644
index 0000000000..e175300355
--- /dev/null
+++ b/c/src/exec/posix/src/mqueue.c
@@ -0,0 +1,715 @@
+/* mqueue.c
+ *
+ * NOTE: The structure of the routines is identical to that of POSIX
+ * Message_queues to leave the option of having unnamed message
+ * queues at a future date. They are currently not part of the
+ * POSIX standard but unnamed message_queues are. This is also
+ * the reason for the apparently unnecessary tracking of
+ * the process_shared attribute. [In addition to the fact that
+ * it would be trivial to add pshared to the mq_attr structure
+ * and have process private message queues.]
+ *
+ * This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
+ * time.
+ *
+ * $Id$
+ */
+
+#include <stdarg.h>
+
+#include <pthread.h>
+#include <limits.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <mqueue.h>
+#include <rtems/system.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/mqueue.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Manager_initialization
+ *
+ * This routine initializes all message_queue manager related data structures.
+ *
+ * Input parameters:
+ * maximum_message_queues - maximum configured message_queues
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Message_queue_Information,
+ OBJECTS_POSIX_MESSAGE_QUEUES,
+ TRUE,
+ maximum_message_queues,
+ sizeof( POSIX_Message_queue_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Create_support
+ */
+
+int _POSIX_Message_queue_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int oflag,
+ struct mq_attr *attr,
+ POSIX_Message_queue_Control **message_queue
+)
+{
+ POSIX_Message_queue_Control *the_mq;
+
+ _Thread_Disable_dispatch();
+
+ the_mq = _POSIX_Message_queue_Allocate();
+
+ if ( !the_mq ) {
+ _Thread_Enable_dispatch();
+ seterrno( ENFILE );
+ return -1;
+ }
+
+ if ( pshared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Message_queue_Information, 0,
+ the_mq->Object.id, FALSE ) ) ) {
+ _POSIX_Message_queue_Free( the_mq );
+ _Thread_Enable_dispatch();
+ seterrno( ENFILE );
+ return -1;
+ }
+
+ the_mq->process_shared = pshared;
+
+ if ( name ) {
+ the_mq->named = TRUE;
+ the_mq->open_count = 1;
+ the_mq->linked = TRUE;
+ }
+ else
+ the_mq->named = FALSE;
+
+ if ( oflag & O_NONBLOCK )
+ the_mq->blocking = FALSE;
+ else
+ the_mq->blocking = TRUE;
+
+ /* XXX
+ *
+ * Note that this should be based on the current scheduling policy.
+ */
+
+ /* XXX
+ *
+ * Message and waiting disciplines are not distinguished.
+ */
+/*
+ the_mq_attr->message_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+ the_mq_attr->waiting_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+ */
+
+ the_mq->Message_queue.Attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+
+ if ( ! _CORE_message_queue_Initialize(
+ &the_mq->Message_queue,
+ OBJECTS_POSIX_MESSAGE_QUEUES,
+ &the_mq->Message_queue.Attributes,
+ attr->mq_maxmsg,
+ attr->mq_msgsize,
+ _POSIX_Message_queue_MP_Send_extract_proxy ) ) {
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _Objects_MP_Close( &_POSIX_Message_queue_Information, the_mq->Object.id );
+
+ _POSIX_Message_queue_Free( the_mq );
+ _Thread_Enable_dispatch();
+ seterrno( ENOSPC );
+ return -1;
+ }
+
+
+ /* XXX - need Names to be a string!!! */
+ _Objects_Open(
+ &_POSIX_Message_queue_Information,
+ &the_mq->Object,
+ (char *) name
+ );
+
+ *message_queue = the_mq;
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Message_queue_MP_Send_process_packet(
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
+ the_mq->Object.id,
+ (char *) name,
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+/*PAGE
+ *
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+ /* mode_t mode, */
+ /* struct mq_attr attr */
+)
+{
+ va_list arg;
+ mode_t mode;
+ struct mq_attr *attr;
+ int status;
+ Objects_Id the_mq_id;
+ POSIX_Message_queue_Control *the_mq;
+
+ if ( oflag & O_CREAT ) {
+ va_start(arg, oflag);
+ mode = (mode_t) va_arg( arg, mode_t * );
+ attr = (struct mq_attr *) va_arg( arg, struct mq_attr ** );
+ va_end(arg);
+ }
+
+ status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
+
+ /*
+ * If the name to id translation worked, then the message queue exists
+ * and we can just return a pointer to the id. Otherwise we may
+ * need to check to see if this is a "message queue does not exist"
+ * or some other miscellaneous error on the name.
+ */
+
+ if ( status ) {
+
+ if ( status == EINVAL ) { /* name -> ID translation failed */
+ if ( !(oflag & O_CREAT) ) { /* willing to create it? */
+ seterrno( ENOENT );
+ return (mqd_t) -1;
+ }
+ /* we are willing to create it */
+ }
+ seterrno( status ); /* some type of error */
+ return (mqd_t) -1;
+
+ } else { /* name -> ID translation succeeded */
+
+ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
+ seterrno( EEXIST );
+ return (mqd_t) -1;
+ }
+
+ /*
+ * XXX In this case we need to do an ID->pointer conversion to
+ * check the mode. This is probably a good place for a subroutine.
+ */
+
+ the_mq->open_count += 1;
+
+ return (mqd_t)&the_mq->Object.id;
+
+ }
+
+ /* XXX verify this comment...
+ *
+ * At this point, the message queue does not exist and everything has been
+ * checked. We should go ahead and create a message queue.
+ */
+
+ status = _POSIX_Message_queue_Create_support(
+ name,
+ TRUE, /* shared across processes */
+ oflag,
+ attr,
+ &the_mq
+ );
+
+ if ( status == -1 )
+ return (mqd_t) -1;
+
+ return (mqd_t) &the_mq->Object.id;
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Delete
+ */
+
+void _POSIX_Message_queue_Delete(
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ if ( !the_mq->linked && !the_mq->open_count ) {
+ _POSIX_Message_queue_Free( the_mq );
+
+ if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Message_queue_Information,
+ the_mq->Object.id
+ );
+
+ _POSIX_Message_queue_MP_Send_process_packet(
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
+ the_mq->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ }
+}
+
+/*PAGE
+ *
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ the_mq->open_count -= 1;
+ _POSIX_Message_queue_Delete( the_mq );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+)
+{
+ int status;
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Id the_mq_id;
+ Objects_Locations location;
+
+ status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
+
+ if ( !status ) {
+ seterrno( status );
+ return -1;
+ }
+
+ the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+
+ _Objects_MP_Close(
+ &_POSIX_Message_queue_Information,
+ the_mq->Object.id
+ );
+
+ the_mq->linked = FALSE;
+
+ _POSIX_Message_queue_Delete( the_mq );
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Send_support
+ */
+
+int _POSIX_Message_queue_Send_support(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ unsigned32 msg_len,
+ Priority_Control msg_prio,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /* XXX must add support for timeout and priority */
+ _CORE_message_queue_Send(
+ &the_mq->Message_queue,
+ (void *) msg_ptr,
+ msg_len,
+ mqdes,
+ NULL /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+)
+{
+ return _POSIX_Message_queue_Send_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Message_queue_Send_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Receive_support
+ */
+
+/* XXX be careful ... watch the size going through all the layers ... */
+
+ssize_t _POSIX_Message_queue_Receive_support(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ unsigned32 status = 0;
+ unsigned32 length_out;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /* XXX need to define the options argument to this */
+ length_out = msg_len;
+ _CORE_message_queue_Seize(
+ &the_mq->Message_queue,
+ mqdes,
+ msg_ptr,
+ &length_out,
+ /* msg_prio, XXXX */
+ the_mq->blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ if ( !status )
+ return length_out;
+ /* XXX --- the return codes gotta be looked at .. fix this */
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+)
+{
+ return _POSIX_Message_queue_Receive_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Message_queue_Receive_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Notify_handler
+ *
+ */
+
+void _POSIX_Message_queue_Notify_handler(
+ void *user_data
+)
+{
+ POSIX_Message_queue_Control *the_mq;
+
+ the_mq = user_data;
+
+ /* XXX do something with signals here!!!! */
+}
+
+/*PAGE
+ *
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EBADF );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ if ( notification ) {
+ if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
+ _Thread_Enable_dispatch();
+ seterrno( EBUSY );
+ return( -1 );
+ }
+
+ _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
+
+ the_mq->notification = *notification;
+
+ _CORE_message_queue_Set_notify(
+ &the_mq->Message_queue,
+ _POSIX_Message_queue_Notify_handler,
+ the_mq
+ );
+ } else {
+
+ _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
+
+ }
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ CORE_message_queue_Attributes *the_mq_attr;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Return the old values.
+ */
+
+ /* XXX this is the same stuff as is in mq_getattr... and probably */
+ /* XXX should be in an inlined private routine */
+
+ the_mq_attr = &the_mq->Message_queue.Attributes;
+
+ omqstat->mq_flags = the_mq->flags;
+ omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
+ omqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
+ omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
+
+ /*
+ * Ignore everything except the O_NONBLOCK bit.
+ */
+
+ if ( mqstat->mq_flags & O_NONBLOCK )
+ the_mq->blocking = FALSE;
+ else
+ the_mq->blocking = TRUE;
+
+ the_mq->flags = mqstat->mq_flags;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ CORE_message_queue_Attributes *the_mq_attr;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Return the old values.
+ */
+
+ /* XXX this is the same stuff as is in mq_setattr... and probably */
+ /* XXX should be in an inlined private routine */
+
+ the_mq_attr = &the_mq->Message_queue.Attributes;
+
+ mqstat->mq_flags = the_mq->flags;
+ mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
+ mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
+ mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/c/src/exec/posix/src/mutex.c b/c/src/exec/posix/src/mutex.c
new file mode 100644
index 0000000000..9ff4acff99
--- /dev/null
+++ b/c/src/exec/posix/src/mutex.c
@@ -0,0 +1,570 @@
+/* mutex.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <pthread.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/mpci.h>
+
+#include <rtems/posix/mutex.h>
+#include <rtems/posix/priority.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * The default mutex attributes structure.
+ */
+
+const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
+ TRUE, /* is_initialized */
+ PTHREAD_PROCESS_PRIVATE, /* process_shared */
+ POSIX_SCHEDULER_MINIMUM_PRIORITY, /* prio_ceiling */
+ PTHREAD_PRIO_NONE, /* protocol */
+ FALSE /* recursive */
+};
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Manager_initialization
+ *
+ * This routine initializes all mutex manager related data structures.
+ *
+ * Input parameters:
+ * maximum_mutexes - maximum configured mutexes
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Mutex_Manager_initialization(
+ unsigned32 maximum_mutexes
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Mutex_Information,
+ OBJECTS_POSIX_MUTEXES,
+ TRUE,
+ maximum_mutexes,
+ sizeof( POSIX_Mutex_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_init(
+ pthread_mutexattr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Mutex_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_destroy(
+ pthread_mutexattr_t *attr
+)
+{
+ if ( !attr || attr->is_initialized == FALSE )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_getpshared(
+ const pthread_mutexattr_t *attr,
+ int *pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *pshared = attr->process_shared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_setpshared(
+ pthread_mutexattr_t *attr,
+ int pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->process_shared = pshared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ *
+ * NOTE: XXX Could be optimized so all the attribute error checking
+ * is not performed when attr is NULL.
+ */
+
+int pthread_mutex_init(
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr
+)
+{
+ POSIX_Mutex_Control *the_mutex;
+ CORE_mutex_Attributes *the_mutex_attr;
+ const pthread_mutexattr_t *the_attr;
+ CORE_mutex_Disciplines the_discipline;
+
+ if ( attr ) the_attr = attr;
+ else the_attr = &_POSIX_Mutex_Default_attributes;
+
+ /*
+ * XXX: Be careful about attributes when global!!!
+ */
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ return POSIX_MP_NOT_IMPLEMENTED();
+
+ if ( !the_attr->is_initialized )
+ return EINVAL;
+
+ /*
+ * Determine the discipline of the mutex
+ */
+
+ switch ( the_attr->protocol ) {
+ case PTHREAD_PRIO_NONE:
+ the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
+ break;
+ case PTHREAD_PRIO_INHERIT:
+ the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+ break;
+ case PTHREAD_PRIO_PROTECT:
+ the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+ break;
+ default:
+ return EINVAL;
+ }
+
+ if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_mutex = _POSIX_Mutex_Allocate();
+
+ if ( !the_mutex ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Mutex_Information, 0,
+ the_mutex->Object.id, FALSE ) ) ) {
+ _POSIX_Mutex_Free( the_mutex );
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_mutex->process_shared = the_attr->process_shared;
+
+ the_mutex_attr = &the_mutex->Mutex.Attributes;
+
+ the_mutex_attr->allow_nesting = the_attr->recursive;
+ the_mutex_attr->priority_ceiling =
+ _POSIX_Priority_To_core( the_attr->prio_ceiling );
+ the_mutex_attr->discipline = the_discipline;
+
+ /*
+ * Must be initialized to unlocked.
+ */
+
+ _CORE_mutex_Initialize(
+ &the_mutex->Mutex,
+ OBJECTS_POSIX_MUTEXES,
+ the_mutex_attr,
+ CORE_MUTEX_UNLOCKED,
+ 0 /* XXX proxy_extract_callout */
+ );
+
+ _Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
+
+ *mutex = the_mutex->Object.id;
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Mutex_MP_Send_process_packet(
+ POSIX_MUTEX_MP_ANNOUNCE_CREATE,
+ the_mutex->Object.id,
+ 0, /* Name not used */
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_mutex_destroy(
+ pthread_mutex_t *mutex
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+ /*
+ * XXX: There is an error for the mutex being locked
+ * or being in use by a condition variable.
+ */
+
+ if ( _CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
+ _Thread_Enable_dispatch();
+ return EBUSY;
+ }
+
+ _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
+
+ _CORE_mutex_Flush(
+ &the_mutex->Mutex,
+ _POSIX_Mutex_MP_Send_object_was_deleted,
+ EINVAL
+ );
+
+ _POSIX_Mutex_Free( the_mutex );
+
+ if ( the_mutex->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close( &_POSIX_Mutex_Information, the_mutex->Object.id );
+
+ _POSIX_Mutex_MP_Send_process_packet(
+ POSIX_MUTEX_MP_ANNOUNCE_DELETE,
+ the_mutex->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*
+ * _POSIX_Mutex_Lock_support
+ *
+ * A support routine which implements guts of the blocking, non-blocking, and
+ * timed wait version of mutex lock.
+ */
+
+int _POSIX_Mutex_Lock_support(
+ pthread_mutex_t *mutex,
+ boolean blocking,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return _POSIX_Mutex_MP_Send_request_packet(
+ POSIX_MUTEX_MP_OBTAIN_REQUEST,
+ *mutex,
+ 0, /* must define the option set */
+ WATCHDOG_NO_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ _CORE_mutex_Seize(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ break;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_lock(
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Mutex_Lock_support( mutex, TRUE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_trylock(
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Mutex_Lock_support( mutex, FALSE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+void POSIX_Threads_mutex_MP_support(
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ (void) POSIX_MP_NOT_IMPLEMENTED(); /* XXX: should never get here */
+}
+
+int pthread_mutex_unlock(
+ pthread_mutex_t *mutex
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return _POSIX_Mutex_MP_Send_request_packet(
+ POSIX_MUTEX_MP_RELEASE_REQUEST,
+ *mutex,
+ 0, /* Not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ _CORE_mutex_Surrender(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ POSIX_Threads_mutex_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code; /* XXX return status */
+ break;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_timedlock(
+ pthread_mutex_t *mutex,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Mutex_Lock_support(
+ mutex,
+ TRUE,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_setprotocol(
+ pthread_mutexattr_t *attr,
+ int protocol
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->protocol = protocol;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_getprotocol(
+ const pthread_mutexattr_t *attr,
+ int *protocol
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *protocol = attr->protocol;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_setprioceiling(
+ pthread_mutexattr_t *attr,
+ int prioceiling
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ if ( !_POSIX_Priority_Is_valid( attr->prio_ceiling ) )
+ return EINVAL;
+
+ attr->prio_ceiling = prioceiling;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_getprioceiling(
+ const pthread_mutexattr_t *attr,
+ int *prioceiling
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *prioceiling = attr->prio_ceiling;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_setprioceiling(
+ pthread_mutex_t *mutex,
+ int prioceiling,
+ int *old_ceiling
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+ Priority_Control the_priority;
+ int status;
+
+ if ( !_POSIX_Priority_Is_valid( prioceiling ) )
+ return EINVAL;
+
+ the_priority = _POSIX_Priority_To_core( prioceiling );
+
+ /*
+ * Must acquire the mutex before we can change it's ceiling
+ */
+
+ status = pthread_mutex_lock( mutex );
+ if ( status )
+ return status;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
+ return EINVAL;
+ case OBJECTS_LOCAL:
+ the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
+ _CORE_mutex_Surrender(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ POSIX_Threads_mutex_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_getprioceiling(
+ pthread_mutex_t *mutex,
+ int *prioceiling
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
+ case OBJECTS_LOCAL:
+ *prioceiling = _POSIX_Priority_From_core(
+ the_mutex->Mutex.Attributes.priority_ceiling
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/c/src/exec/posix/src/psignal.c b/c/src/exec/posix/src/psignal.c
new file mode 100644
index 0000000000..9ad7406e21
--- /dev/null
+++ b/c/src/exec/posix/src/psignal.c
@@ -0,0 +1,258 @@
+/* signal.c
+ *
+ * $Id$
+ */
+
+#include <signal.h>
+
+#include <rtems/score/thread.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*
+ * 3.3.2 Send a Signal to a Process, P1003.1b-1993, p. 68
+ *
+ * NOTE: Behavior of kill() depends on _POSIX_SAVED_IDS.
+ */
+
+int kill(
+ int pid_t,
+ int sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigemptyset(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigfillset(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigaddset(
+ sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigdelset(
+ sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigismember(
+ const sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.4 Examine and Change Signal Action, P1003.1b-1993, p. 70
+ */
+
+int sigaction(
+ int sig,
+ const struct sigaction *act,
+ struct sigaction *oact
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73
+ *
+ * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask().
+ */
+
+int sigprocmask(
+ int how,
+ const sigset_t *set,
+ sigset_t *oset
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73
+ *
+ * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask().
+ */
+
+int pthread_sigmask(
+ int how,
+ const sigset_t *set,
+ sigset_t *oset
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.6 Examine Pending Signals, P1003.1b-1993, p. 75
+ */
+
+int sigpending(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.7 Wait for a Signal, P1003.1b-1993, p. 75
+ */
+
+int sigsuspend(
+ const sigset_t *sigmask
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigwaitinfo(
+ const sigset_t *set,
+ siginfo_t *info
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigtimedwait(
+ const sigset_t *set,
+ siginfo_t *info,
+ const struct timespec *timeout
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigwait(
+ const sigset_t *set,
+ int *sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78
+ */
+
+int sigqueue(
+ pid_t pid,
+ int signo,
+ const union sigval value
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.10 Send a Signal to a Thread, P1003.1c/D10, p. 43
+ */
+
+int pthread_kill(
+ pthread_t thread,
+ int sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.4.1 Schedule Alarm, P1003.1b-1993, p. 79
+ */
+
+unsigned int alarm(
+ unsigned int seconds
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.4.2 Suspend Process Execution, P1003.1b-1993, p. 80
+ */
+
+int pause( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*
+ * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 73
+ */
+
+unsigned int sleep(
+ unsigned int seconds
+)
+{
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended, /* XXX may need to be POSIX specific */
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_seconds( &_Thread_Executing->Timer, seconds );
+ _Thread_Enable_dispatch();
+ return 0; /* XXX should account for signal */
+}
diff --git a/c/src/exec/posix/src/pthread.c b/c/src/exec/posix/src/pthread.c
new file mode 100644
index 0000000000..7247586685
--- /dev/null
+++ b/c/src/exec/posix/src/pthread.c
@@ -0,0 +1,553 @@
+/* pthread.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <pthread.h>
+#include <limits.h>
+
+#include <rtems/score/stack.h>
+#include <rtems/score/thread.h>
+#include <rtems/posix/pthread.h>
+
+/*PAGE
+ *
+ * The default pthreads attributes structure.
+ */
+
+const pthread_attr_t _POSIX_Threads_Default_attributes = {
+ TRUE, /* is_initialized */
+ 0, /* stackaddr */
+ STACK_MINIMUM_SIZE, /* stacksize */
+ PTHREAD_SCOPE_PROCESS, /* contentionscope */
+ PTHREAD_INHERIT_SCHED, /* inheritsched */
+ SCHED_FIFO, /* schedpolicy */
+ { /* schedparam */
+ 128, /* sched_priority */
+ 0, /* ss_low_priority */
+ { 0L, 0 }, /* ss_replenish_period */
+ { 0L, 0 } /* ss_initial_budget */
+ },
+ PTHREAD_CREATE_DETACHED, /* detachstate */
+ 1 /* cputime_clock_allowed */
+};
+
+/*PAGE
+ *
+ * _POSIX_Threads_Manager_initialization
+ *
+ * This routine initializes all threads manager related data structures.
+ *
+ * Input parameters:
+ * maximum_pthreads - maximum configured pthreads
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Threads_Manager_initialization(
+ unsigned32 maximum_pthreads
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Threads_Information,
+ OBJECTS_POSIX_THREADS,
+ TRUE,
+ maximum_pthreads,
+ sizeof( POSIX_Threads_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ TRUE
+ );
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
+ */
+
+int pthread_atfork(
+ void (*prepare)(void),
+ void (*parent)(void),
+ void (*child)(void)
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setscope(
+ pthread_attr_t *attr,
+ int contentionscope
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->contentionscope = contentionscope;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getscope(
+ const pthread_attr_t *attr,
+ int *contentionscope
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *contentionscope = attr->contentionscope;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setinheritsched(
+ pthread_attr_t *attr,
+ int inheritsched
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->inheritsched = inheritsched;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getinheritsched(
+ const pthread_attr_t *attr,
+ int *inheritsched
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *inheritsched = attr->inheritsched;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setschedpolicy(
+ pthread_attr_t *attr,
+ int policy
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->schedpolicy = policy;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getschedpolicy(
+ const pthread_attr_t *attr,
+ int *policy
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *policy = attr->schedpolicy;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setschedparam(
+ pthread_attr_t *attr,
+ const struct sched_param param
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->schedparam = param;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getschedparam(
+ const pthread_attr_t *attr,
+ struct sched_param *param
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *param = attr->schedparam;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_getschedparam(
+ pthread_t thread,
+ int *policy,
+ struct sched_param *param
+)
+{
+ pthread_attr_t *attr; /* XXX: really need to get this from the thread */
+
+ if ( !policy || !param )
+ return EINVAL;
+
+ *policy = attr->schedpolicy;
+ *param = attr->schedparam;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_setschedparam(
+ pthread_t thread,
+ int policy,
+ struct sched_param *param
+)
+{
+ /* XXX need to reschedule after doing this to the thread */
+ pthread_attr_t *attr; /* XXX: really need to get this from the thread */
+
+ if ( !param )
+ return EINVAL;
+
+ attr->schedpolicy = policy;
+ attr->schedparam = *param;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_init(
+ pthread_attr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Threads_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_destroy(
+ pthread_attr_t *attr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getstacksize(
+ const pthread_attr_t *attr,
+ size_t *stacksize
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *stacksize = attr->stacksize;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setstacksize(
+ pthread_attr_t *attr,
+ size_t stacksize
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->stacksize = stacksize;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getstackaddr(
+ const pthread_attr_t *attr,
+ void **stackaddr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *stackaddr = attr->stackaddr;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setstackaddr(
+ pthread_attr_t *attr,
+ void *stackaddr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->stackaddr = stackaddr;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getdetachstate(
+ const pthread_attr_t *attr,
+ int *detachstate
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *detachstate = attr->detachstate;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setdetachstate(
+ pthread_attr_t *attr,
+ int detachstate
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->detachstate = detachstate;
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
+ */
+
+int pthread_create(
+ pthread_t *thread,
+ const pthread_attr_t *attr,
+ void (*start_routine)( void * ),
+ void *arg
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
+ */
+
+int pthread_join(
+ pthread_t thread,
+ void **value_ptr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
+ */
+
+int pthread_detach(
+ pthread_t thread
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
+ */
+
+pthread_t pthread_self( void )
+{
+ return _Thread_Executing->Object.id;
+}
+
+/*PAGE
+ *
+ * 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
+ */
+
+int pthread_equal(
+ pthread_t t1,
+ pthread_t t2
+)
+{
+#ifdef RTEMS_DEBUG
+ /* XXX may want to do a "get" to make sure both are valid. */
+ /* XXX behavior is undefined if not valid pthread_t's */
+#endif
+ return _Objects_Are_ids_equal( t1, t1 );
+}
+
+/*PAGE
+ *
+ * 16.1.8 Dynamic Package Initialization
+ */
+
+int pthread_once(
+ pthread_once_t *once_control,
+ void (*init_routine)(void)
+)
+{
+ /* XXX: Should we implement this routine this way or make it a full */
+ /* XXX: fledged object? */
+
+ if ( !once_control || !init_routine )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ if ( !once_control->is_initialized ) {
+
+ once_control->is_initialized = TRUE;
+ once_control->init_executed = TRUE;
+ (*init_routine)();
+
+ } if ( !once_control->init_executed ) {
+
+ once_control->init_executed = TRUE;
+ (*init_routine)();
+
+ }
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
+ */
+
+int pthread_getcpuclockid(
+ pthread_t pid,
+ clockid_t *clock_id
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_setcputime(
+ pthread_attr_t *attr,
+ int clock_allowed
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->cputime_clock_allowed = clock_allowed;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_getcputime(
+ pthread_attr_t *attr,
+ int *clock_allowed
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *clock_allowed = attr->cputime_clock_allowed;
+ return 0;
+}
diff --git a/c/src/exec/posix/src/sched.c b/c/src/exec/posix/src/sched.c
new file mode 100644
index 0000000000..b131b52397
--- /dev/null
+++ b/c/src/exec/posix/src/sched.c
@@ -0,0 +1,127 @@
+/* sched.c
+ *
+ * $Id$
+ */
+
+#include <sched.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/thread.h>
+#include <rtems/posix/priority.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+)
+{
+ /* XXX error check the policy */
+ return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
+}
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_min(
+ int policy
+)
+{
+ /* XXX error check the policy */
+ return POSIX_SCHEDULER_MINIMUM_PRIORITY;
+}
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+)
+{
+ time_t us_per_quantum;
+
+ /* XXX eventually should support different time quantums per thread */
+
+ /* XXX should get for errors? (bad pid) */
+
+ us_per_quantum = _TOD_Microseconds_per_tick * _Thread_Ticks_per_timeslice;
+
+ interval->tv_sec = us_per_quantum / TOD_MICROSECONDS_PER_SECOND;
+ interval->tv_nsec = (us_per_quantum % TOD_MICROSECONDS_PER_SECOND) * 1000;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void )
+{
+ _Thread_Yield_processor();
+ return 0;
+}
diff --git a/c/src/exec/posix/src/semaphore.c b/c/src/exec/posix/src/semaphore.c
new file mode 100644
index 0000000000..e17124152c
--- /dev/null
+++ b/c/src/exec/posix/src/semaphore.c
@@ -0,0 +1,576 @@
+/* semaphore.c
+ *
+ * $Id$
+ */
+
+#include <stdarg.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <limits.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/posix/semaphore.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Manager_initialization
+ *
+ * This routine initializes all semaphore manager related data structures.
+ *
+ * Input parameters:
+ * maximum_semaphores - maximum configured semaphores
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Semaphore_Information,
+ OBJECTS_POSIX_SEMAPHORES,
+ TRUE,
+ maximum_semaphores,
+ sizeof( POSIX_Semaphore_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Create_support
+ */
+
+int _POSIX_Semaphore_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int value,
+ POSIX_Semaphore_Control **the_sem
+)
+{
+ POSIX_Semaphore_Control *the_semaphore;
+ CORE_semaphore_Attributes *the_sem_attr;
+
+ _Thread_Disable_dispatch();
+
+ the_semaphore = _POSIX_Semaphore_Allocate();
+
+ if ( !the_semaphore ) {
+ _Thread_Enable_dispatch();
+ seterrno( ENOMEM );
+ return -1;
+ }
+
+ if ( pshared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Semaphore_Information, 0,
+ the_semaphore->Object.id, FALSE ) ) ) {
+ _POSIX_Semaphore_Free( the_semaphore );
+ _Thread_Enable_dispatch();
+ seterrno( EAGAIN );
+ return -1;
+ }
+
+ the_semaphore->process_shared = pshared;
+
+ if ( name ) {
+ the_semaphore->named = TRUE;
+ the_semaphore->open_count = 1;
+ the_semaphore->linked = TRUE;
+ }
+ else
+ the_semaphore->named = FALSE;
+
+ the_sem_attr = &the_semaphore->Semaphore.Attributes;
+
+ /* XXX
+ *
+ * Note should this be based on the current scheduling policy?
+ */
+
+ the_sem_attr->discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
+
+ _CORE_semaphore_Initialize(
+ &the_semaphore->Semaphore,
+ OBJECTS_POSIX_SEMAPHORES,
+ the_sem_attr,
+ value,
+ 0 /* XXX - proxy_extract_callout is unused */
+ );
+
+ /* XXX - need Names to be a string!!! */
+ _Objects_Open(
+ &_POSIX_Semaphore_Information,
+ &the_semaphore->Object,
+ (char *) name
+ );
+
+ *the_sem = the_semaphore;
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE,
+ the_semaphore->Object.id,
+ (char *) name,
+ 0 /* proxy id - Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+
+/*PAGE
+ *
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+)
+{
+ int status;
+ POSIX_Semaphore_Control *the_semaphore;
+
+ status = _POSIX_Semaphore_Create_support(
+ NULL,
+ pshared,
+ value,
+ &the_semaphore
+ );
+
+ if ( status != -1 )
+ *sem = the_semaphore->Object.id;
+
+ return status;
+}
+
+/*PAGE
+ *
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Undefined operation on a named semaphore.
+ */
+
+ if ( the_semaphore->named == TRUE ) {
+ seterrno( EINVAL );
+ return( -1 );
+ }
+
+ _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+
+ _CORE_semaphore_Flush(
+ &the_semaphore->Semaphore,
+ _POSIX_Semaphore_MP_Send_object_was_deleted,
+ -1 /* XXX should also seterrno -> EINVAL */
+ );
+
+ _POSIX_Semaphore_Free( the_semaphore );
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: When oflag is O_CREAT, then optional third and fourth
+ * parameters must be present.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+ /* mode_t mode, */
+ /* unsigned int value */
+)
+{
+ va_list arg;
+ mode_t mode;
+ unsigned int value;
+ int status;
+ Objects_Id the_semaphore_id;
+ POSIX_Semaphore_Control *the_semaphore;
+
+
+ if ( oflag & O_CREAT ) {
+ va_start(arg, oflag);
+ mode = (mode_t) va_arg( arg, mode_t * );
+ value = (unsigned int) va_arg( arg, unsigned int * );
+ va_end(arg);
+ }
+
+ status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
+
+ /*
+ * If the name to id translation worked, then the semaphore exists
+ * and we can just return a pointer to the id. Otherwise we may
+ * need to check to see if this is a "semaphore does not exist"
+ * or some other miscellaneous error on the name.
+ */
+
+ if ( status ) {
+
+ if ( status == EINVAL ) { /* name -> ID translation failed */
+ if ( !(oflag & O_CREAT) ) { /* willing to create it? */
+ seterrno( ENOENT );
+ return (sem_t *) -1;
+ }
+ /* we are willing to create it */
+ }
+ seterrno( status ); /* some type of error */
+ return (sem_t *) -1;
+
+ } else { /* name -> ID translation succeeded */
+
+ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
+ seterrno( EEXIST );
+ return (sem_t *) -1;
+ }
+
+ /*
+ * XXX In this case we need to do an ID->pointer conversion to
+ * check the mode. This is probably a good place for a subroutine.
+ */
+
+ the_semaphore->open_count += 1;
+
+ return (sem_t *)&the_semaphore->Object.id;
+
+ }
+
+ /* XXX verify this comment...
+ *
+ * At this point, the semaphore does not exist and everything has been
+ * checked. We should go ahead and create a semaphore.
+ */
+
+ status = _POSIX_Semaphore_Create_support(
+ name,
+ TRUE, /* shared across processes */
+ value,
+ &the_semaphore
+ );
+
+ if ( status == -1 )
+ return (sem_t *) -1;
+
+ return (sem_t *) &the_semaphore->Object.id;
+
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Delete
+ */
+
+void _POSIX_Semaphore_Delete(
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ if ( !the_semaphore->linked && !the_semaphore->open_count ) {
+ _POSIX_Semaphore_Free( the_semaphore );
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ }
+}
+
+/*PAGE
+ *
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ the_semaphore->open_count -= 1;
+ _POSIX_Semaphore_Delete( the_semaphore );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+)
+{
+ int status;
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Id the_semaphore_id;
+ Objects_Locations location;
+
+ status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
+
+ if ( !status ) {
+ seterrno( status );
+ return -1;
+ }
+
+ the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+ }
+
+ the_semaphore->linked = FALSE;
+
+ _POSIX_Semaphore_Delete( the_semaphore );
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Wait_support
+ */
+
+int _POSIX_Semaphore_Wait_support(
+ sem_t *sem,
+ boolean blocking,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ _CORE_semaphore_Seize(
+ &the_semaphore->Semaphore,
+ the_semaphore->Object.id,
+ blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+)
+{
+ return _POSIX_Semaphore_Wait_support( sem, TRUE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_trywait(
+ sem_t *sem
+)
+{
+ return _POSIX_Semaphore_Wait_support( sem, FALSE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Semaphore_Wait_support(
+ sem,
+ TRUE,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+void POSIX_Semaphore_MP_support(
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ (void) POSIX_MP_NOT_IMPLEMENTED();
+}
+
+
+int sem_post(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ _CORE_semaphore_Surrender(
+ &the_semaphore->Semaphore,
+ the_semaphore->Object.id,
+ POSIX_Semaphore_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ *sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/c/src/exec/posix/src/time.c b/c/src/exec/posix/src/time.c
new file mode 100644
index 0000000000..cfe980793a
--- /dev/null
+++ b/c/src/exec/posix/src/time.c
@@ -0,0 +1,193 @@
+/* time.c
+ *
+ * $Id$
+ */
+
+#include <time.h>
+#include <rtems/score/tod.h>
+
+/*
+ * Seconds from January 1, 1970 to January 1, 1988. Used to account for
+ * differences between POSIX API and RTEMS core.
+ */
+
+#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \
+ (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
+ (4 * TOD_SECONDS_PER_DAY))
+
+/*
+ * 4.5.1 Get System Time, P1003.1b-1993, p. 91
+ */
+
+time_t time(
+ time_t *tloc
+)
+{
+ time_t seconds_since_epoch;
+
+ if ( !_TOD_Is_set() ) {
+ /* XXX set errno */
+ return -1;
+ }
+
+ /*
+ * Internally the RTEMS epoch is 1988. This must be taken into account.
+ */
+
+ seconds_since_epoch = _TOD_Seconds_since_epoch;
+
+ seconds_since_epoch += POSIX_TIME_SECONDS_1970_THROUGH_1988;
+
+ if ( tloc )
+ *tloc = seconds_since_epoch;
+
+ return seconds_since_epoch;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_settime(
+ clockid_t clock_id,
+ const struct timespec *tp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_gettime(
+ clockid_t clock_id,
+ struct timespec *tp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_getres(
+ clockid_t clock_id,
+ struct timespec *res
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264
+ */
+
+int timer_create(
+ clockid_t clock_id,
+ struct sigevent *evp,
+ timer_t *timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266
+ */
+
+int timer_delete(
+ timer_t timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_settime(
+ timer_t timerid,
+ int flags,
+ const struct itimerspec *value,
+ struct itimerspec *ovalue
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_gettime(
+ timer_t timerid,
+ struct itimerspec *value
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_getoverrun(
+ timer_t timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
+ */
+
+int nanosleep(
+ const struct timespec *rqtp,
+ struct timespec *rmtp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
+ */
+
+int clock_getcpuclockid(
+ pid_t pid,
+ clockid_t *clock_id
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
+ */
+
+int clock_setenable_attr(
+ clockid_t clock_id,
+ int attr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
+ */
+
+int clock_getenable_attr(
+ clockid_t clock_id,
+ int *attr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/src/types.c b/c/src/exec/posix/src/types.c
new file mode 100644
index 0000000000..e6e743ade5
--- /dev/null
+++ b/c/src/exec/posix/src/types.c
@@ -0,0 +1,168 @@
+/* types.c
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
+ */
+
+pid_t getpid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
+ */
+
+pid_t getppid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+uid_t getuid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+uid_t geteuid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+gid_t getgid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+gid_t getegid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
+ */
+
+int setuid(
+ uid_t uid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
+ */
+
+int setgid(
+ gid_t gid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.3 Get Supplementary IDs, P1003.1b-1993, p. 86
+ */
+
+int getgroups(
+ int gidsetsize,
+ gid_t grouplist[]
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.4 Get User Name, P1003.1b-1993, p. 87
+ *
+ * NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
+ */
+
+char *getlogin( void )
+{
+ return (char *)POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.4 Get User Name, P1003.1b-1993, p. 87
+ *
+ * NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
+ */
+
+char *getlogin_r( void )
+{
+ return (char *)POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.1 Get Process Group IDs, P1003.1b-1993, p. 89
+ */
+
+pid_t getpgrp( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88
+ */
+
+pid_t setsid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89
+ */
+
+int setpgid(
+ pid_t pid,
+ pid_t pgid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/src/unistd.c b/c/src/exec/posix/src/unistd.c
new file mode 100644
index 0000000000..909d89f923
--- /dev/null
+++ b/c/src/exec/posix/src/unistd.c
@@ -0,0 +1,21 @@
+/* unistd.c
+ *
+ * $Id$
+ */
+
+#include <unistd.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
+ */
+
+long sysconf(
+ int name
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/src/utsname.c b/c/src/exec/posix/src/utsname.c
new file mode 100644
index 0000000000..98b105023e
--- /dev/null
+++ b/c/src/exec/posix/src/utsname.c
@@ -0,0 +1,61 @@
+/* utsname.c
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/utsname.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+)
+{
+ /* XXX: Here is what Solaris returns...
+ sysname = SunOS
+ nodename = node_name
+ release = 5.3
+ version = Generic_101318-12
+ machine = sun4m
+ */
+
+ strcpy( name->sysname, "RTEMS" );
+
+ sprintf( name->nodename, "Node %d\n", _Objects_Local_node );
+
+ /* XXX release string is in BAD format for this routine!!! */
+ strcpy( name->release, "3.2.0" );
+
+ /* XXX does this have any meaning for RTEMS */
+
+ strcpy( name->release, "" );
+
+ sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME );
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/exec/posix/sys/utsname.h b/c/src/exec/posix/sys/utsname.h
new file mode 100644
index 0000000000..ca15230d40
--- /dev/null
+++ b/c/src/exec/posix/sys/utsname.h
@@ -0,0 +1,49 @@
+/* sys/utsname.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SYS_UTSNAME_h
+#define __POSIX_SYS_UTSNAME_h
+
+#include <sys/times.h>
+#include <sys/types.h>
+
+/*
+ * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
+ *
+ * NOTE: The lengths of the strings in this structure are
+ * just long enough to reliably contain the RTEMS information.
+ * For example, the fields are not long enough to support
+ * Internet hostnames.
+ */
+
+struct utsname {
+ char sysname[ 32 ]; /* Name of this implementation of the operating system */
+ char nodename[ 32 ]; /* Name of this node within an implementation */
+ /* specified communication network */
+ char release[ 32 ]; /* Current release level of this implementation */
+ char version[ 32 ]; /* Current version level of this release */
+ char machine[ 32 ]; /* Name of the hardware type on which the system */
+ /* is running */
+};
+
+/*
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+);
+
+/*
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+);
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/rtems/headers/asr.h b/c/src/exec/rtems/headers/asr.h
new file mode 100644
index 0000000000..31758fc06b
--- /dev/null
+++ b/c/src/exec/rtems/headers/asr.h
@@ -0,0 +1,112 @@
+/* asr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Asynchronous Signal Handler. This Handler provides the low-level
+ * support required by the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ASR_h
+#define __RTEMS_ASR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/modes.h>
+
+/*
+ *
+ * The following type defines the control block used to manage
+ * each signal set.
+ */
+
+typedef unsigned32 rtems_signal_set;
+
+/*
+ * Return type for ASR Handler
+ */
+
+typedef void rtems_asr;
+
+/*
+ * The following type corresponds to the applications asynchronous
+ * signal processing routine.
+ */
+
+typedef rtems_asr ( *rtems_asr_entry )(
+ rtems_signal_set
+ );
+
+/*
+ *
+ * The following defines the control structure used to manage
+ * signals. Each thread has a copy of this record.
+ */
+
+typedef struct {
+ boolean is_enabled; /* are ASRs enabled currently? */
+ rtems_asr_entry handler; /* address of RTEMS_ASR */
+ Modes_Control mode_set; /* RTEMS_ASR mode */
+ rtems_signal_set signals_posted; /* signal set */
+ rtems_signal_set signals_pending; /* pending signal set */
+ unsigned32 nest_level; /* nest level of RTEMS_ASR */
+} ASR_Information;
+
+/*
+ * The following constants define the individual signals which may
+ * be used to compose a signal set.
+ */
+
+#define RTEMS_SIGNAL_0 0x00000001
+#define RTEMS_SIGNAL_1 0x00000002
+#define RTEMS_SIGNAL_2 0x00000004
+#define RTEMS_SIGNAL_3 0x00000008
+#define RTEMS_SIGNAL_4 0x00000010
+#define RTEMS_SIGNAL_5 0x00000020
+#define RTEMS_SIGNAL_6 0x00000040
+#define RTEMS_SIGNAL_7 0x00000080
+#define RTEMS_SIGNAL_8 0x00000100
+#define RTEMS_SIGNAL_9 0x00000200
+#define RTEMS_SIGNAL_10 0x00000400
+#define RTEMS_SIGNAL_11 0x00000800
+#define RTEMS_SIGNAL_12 0x00001000
+#define RTEMS_SIGNAL_13 0x00002000
+#define RTEMS_SIGNAL_14 0x00004000
+#define RTEMS_SIGNAL_15 0x00008000
+#define RTEMS_SIGNAL_16 0x00010000
+#define RTEMS_SIGNAL_17 0x00020000
+#define RTEMS_SIGNAL_18 0x00040000
+#define RTEMS_SIGNAL_19 0x00080000
+#define RTEMS_SIGNAL_20 0x00100000
+#define RTEMS_SIGNAL_21 0x00200000
+#define RTEMS_SIGNAL_22 0x00400000
+#define RTEMS_SIGNAL_23 0x00800000
+#define RTEMS_SIGNAL_24 0x01000000
+#define RTEMS_SIGNAL_25 0x02000000
+#define RTEMS_SIGNAL_26 0x04000000
+#define RTEMS_SIGNAL_27 0x08000000
+#define RTEMS_SIGNAL_28 0x10000000
+#define RTEMS_SIGNAL_29 0x20000000
+#define RTEMS_SIGNAL_30 0x40000000
+#define RTEMS_SIGNAL_31 0x80000000
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/asr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/attr.h b/c/src/exec/rtems/headers/attr.h
new file mode 100644
index 0000000000..8262a3a381
--- /dev/null
+++ b/c/src/exec/rtems/headers/attr.h
@@ -0,0 +1,84 @@
+/* attr.h
+ *
+ * This include file contains all information about the Object Attributes
+ * Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ATTRIBUTES_h
+#define __RTEMS_ATTRIBUTES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+typedef unsigned32 rtems_attribute;
+
+/* constants */
+
+#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
+
+#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
+#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
+
+#define RTEMS_LOCAL 0x00000000 /* local resource */
+#define RTEMS_GLOBAL 0x00000002 /* global resource */
+
+#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
+#define RTEMS_PRIORITY 0x00000004 /* process by priority */
+
+#define RTEMS_COUNTING_SEMAPHORE 0x00000000
+#define RTEMS_BINARY_SEMAPHORE 0x00000010
+
+#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
+#define RTEMS_INHERIT_PRIORITY 0x00000020
+
+#define RTEMS_NO_PRIORITY_CEILING 0x00000000
+#define RTEMS_PRIORITY_CEILING 0x00000040
+
+#if ( CPU_HARDWARE_FP == TRUE )
+#define ATTRIBUTES_NOT_SUPPORTED 0
+#else
+#define ATTRIBUTES_NOT_SUPPORTED RTEMS_FLOATING_POINT
+#endif
+
+#if ( CPU_ALL_TASKS_ARE_FP == TRUE )
+#define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT
+#else
+#define ATTRIBUTES_REQUIRED 0
+#endif
+
+/*
+ * _Attributes_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs initialization for this handler.
+ *
+ * NOTE: There is no initialization required in C. Conditional compilation
+ * takes care of this in C.
+ */
+
+#define _Attributes_Handler_initialization()
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/attr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/clock.h b/c/src/exec/rtems/headers/clock.h
new file mode 100644
index 0000000000..d7c032a282
--- /dev/null
+++ b/c/src/exec/rtems/headers/clock.h
@@ -0,0 +1,103 @@
+/* clock.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Clock Manager. This manager provides facilities to set, obtain,
+ * and continually update the current date and time.
+ *
+ * This manager provides directives to:
+ *
+ * + set the current date and time
+ * + obtain the current date and time
+ * + announce a clock tick
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CLOCK_h
+#define __RTEMS_CLOCK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tod.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * List of things which can be returned by the rtems_clock_get directive.
+ */
+
+typedef enum {
+ RTEMS_CLOCK_GET_TOD,
+ RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ RTEMS_CLOCK_GET_TICKS_PER_SECOND,
+ RTEMS_CLOCK_GET_TIME_VALUE
+} rtems_clock_get_options;
+
+/*
+ * Standard flavor style to return TOD in for a rtems_clock_get option.
+ */
+
+typedef struct {
+ unsigned32 seconds;
+ unsigned32 microseconds;
+} rtems_clock_time_value;
+
+/*
+ * rtems_clock_get
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_get directive. It returns
+ * one of the following:
+ * + current time of day
+ * + seconds since epoch
+ * + ticks since boot
+ * + ticks per second
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+);
+
+/*
+ * rtems_clock_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_set directive. It sets
+ * the current time of day to that in the time_buffer record.
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_clock_tick
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_tick directive. It is invoked
+ * to inform RTEMS of the occurrence of a clock tick.
+ */
+
+rtems_status_code rtems_clock_tick( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/dpmem.h b/c/src/exec/rtems/headers/dpmem.h
new file mode 100644
index 0000000000..fc580c1a8a
--- /dev/null
+++ b/c/src/exec/rtems/headers/dpmem.h
@@ -0,0 +1,157 @@
+/* dpmem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Dual Ported Memory Manager. This manager provides a mechanism
+ * for converting addresses between internal and external representations
+ * for multiple dual-ported memory areas.
+ *
+ * Directives provided are:
+ *
+ * + create a port
+ * + get ID of a port
+ * + delete a port
+ * + convert external to internal address
+ * + convert internal to external address
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DUAL_PORTED_MEMORY_h
+#define __RTEMS_DUAL_PORTED_MEMORY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following structure defines the port control block. Each port
+ * has a control block associated with it. This control block contains
+ * all information required to support the port related operations.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *internal_base; /* base internal address */
+ void *external_base; /* base external address */
+ unsigned32 length; /* length of dual-ported area */
+} Dual_ported_memory_Control;
+
+/*
+ * The following define the internal Dual Ported Memory information.
+ */
+
+EXTERN Objects_Information _Dual_ported_memory_Information;
+
+/*
+ * _Dual_ported_memory_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+);
+
+/*
+ * rtems_port_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_create directive. The port
+ * will have the name name. The port maps onto an area of dual ported
+ * memory of length bytes which has internal_start and external_start
+ * as the internal and external starting addresses, respectively.
+ * It returns the id of the created port in ID.
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_ident directive. This directive
+ * returns the port ID associated with name. If more than one port is
+ * named name, then the port to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_delete directive. It deletes
+ * the port associated with ID.
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_port_external_to_internal
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_external_to_internal directive.
+ * It returns the internal port address which maps to the provided
+ * external port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+);
+
+/*
+ * rtems_port_internal_to_external
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the Port_internal_to_external directive.
+ * It returns the external port address which maps to the provided
+ * internal port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/dpmem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/event.h b/c/src/exec/rtems/headers/event.h
new file mode 100644
index 0000000000..4cd3b1cbea
--- /dev/null
+++ b/c/src/exec/rtems/headers/event.h
@@ -0,0 +1,174 @@
+/* event.h
+ *
+ * This include file contains the information pertaining to the Event
+ * Manager. This manager provides a high performance method of communication
+ * and synchronization.
+ *
+ * Directives provided are:
+ *
+ * + send an event set to a task
+ * + receive event condition
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_h
+#define __RTEMS_EVENT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/eventset.h>
+
+/*
+ * This constant is passed as the event_in to the
+ * rtems_event_receive directive to determine which events are pending.
+ */
+
+#define EVENT_CURRENT 0
+
+/*
+ * The following enumerated types indicate what happened while the event
+ * manager was in the synchronization window.
+ */
+
+typedef enum {
+ EVENT_SYNC_SYNCHRONIZED,
+ EVENT_SYNC_NOTHING_HAPPENED,
+ EVENT_SYNC_TIMEOUT,
+ EVENT_SYNC_SATISFIED
+} Event_Sync_states;
+
+/*
+ * Event_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Event_Manager_initialization( void );
+
+/*
+ * rtems_event_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_send directive. It sends
+ * event_in to the task specified by ID. If the task is blocked
+ * waiting to receive events and the posting of event_in satisfies
+ * the task's event condition, then it is unblocked.
+ */
+
+rtems_status_code rtems_event_send (
+ Objects_Id id,
+ rtems_event_set event_in
+);
+
+/*
+ * rtems_event_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_receive directive. This
+ * directive is invoked when the calling task wishes to receive
+ * the event_in event condition. One of the fields in the option_set
+ * parameter determines whether the receive request is satisfied if
+ * any or all of the events are pending. If the event condition
+ * is not satisfied immediately, then the task may block with an
+ * optional timeout of TICKS clock ticks or return immediately.
+ * This determination is based on another field in the option_set
+ * parameter. This directive returns the events received in the
+ * event_out parameter.
+ */
+
+rtems_status_code rtems_event_receive (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition event_in is
+ * satisfied. If so or if the no_wait option is enabled in option_set,
+ * then the procedure returns immediately. If neither of these
+ * conditions is true, then the calling task is blocked with an
+ * optional timeout of ticks clock ticks.
+ */
+
+void _Event_Seize (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition of the_thread
+ * has been satisfied. If so, it unblocks the_thread.
+ */
+
+void _Event_Surrender (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Event_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's event receive request
+ * has not been satisfied after the specified timeout interval.
+ * The task represented by ID will be unblocked and its status
+ * code will be set in it's control block to indicate that a timeout
+ * has occurred.
+ */
+
+void _Event_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * The following defines the synchronization flag used by the
+ * Event Manager to insure that signals sent to the currently
+ * executing thread are received properly.
+ */
+
+EXTERN volatile Event_Sync_states _Event_Sync_state;
+
+#include <rtems/rtems/eventmp.h>
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/event.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/eventmp.h b/c/src/exec/rtems/headers/eventmp.h
new file mode 100644
index 0000000000..a6f5b912b0
--- /dev/null
+++ b/c/src/exec/rtems/headers/eventmp.h
@@ -0,0 +1,147 @@
+/* eventmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_MP_h
+#define __RTEMS_EVENT_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/event.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote event operations.
+ */
+
+typedef enum {
+ EVENT_MP_SEND_REQUEST = 0,
+ EVENT_MP_SEND_RESPONSE = 1
+} Event_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Event_MP_Remote_operations operation;
+ rtems_event_set event_in;
+} Event_MP_Packet;
+
+/*
+ * _Event_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Event_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Event_MP_Send_request_packet (
+ Event_MP_Remote_operations operation,
+ Objects_Id event_id,
+ rtems_event_set event_in
+);
+
+/*
+ * _Event_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Event_MP_Send_response_packet (
+ Event_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Event_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Event_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Event_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a event mp packet.
+ */
+
+Event_MP_Packet *_Event_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/eventset.h b/c/src/exec/rtems/headers/eventset.h
new file mode 100644
index 0000000000..0f3e122e5f
--- /dev/null
+++ b/c/src/exec/rtems/headers/eventset.h
@@ -0,0 +1,89 @@
+/* eventset.h
+ *
+ * This include file contains the information pertaining to the
+ * Event Sets Handler. This handler provides methods for the manipulation
+ * of event sets which will be sent and received by tasks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_SET_h
+#define __RTEMS_EVENT_SET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following defines the type used to control event sets.
+ */
+
+typedef unsigned32 rtems_event_set;
+
+/*
+ * The following constants define the individual events which may
+ * be used to compose an event set.
+ */
+
+#define RTEMS_PENDING_EVENTS 0 /* receive pending events */
+#define RTEMS_ALL_EVENTS 0xFFFFFFFF
+
+#define RTEMS_EVENT_0 0x00000001
+#define RTEMS_EVENT_1 0x00000002
+#define RTEMS_EVENT_2 0x00000004
+#define RTEMS_EVENT_3 0x00000008
+#define RTEMS_EVENT_4 0x00000010
+#define RTEMS_EVENT_5 0x00000020
+#define RTEMS_EVENT_6 0x00000040
+#define RTEMS_EVENT_7 0x00000080
+#define RTEMS_EVENT_8 0x00000100
+#define RTEMS_EVENT_9 0x00000200
+#define RTEMS_EVENT_10 0x00000400
+#define RTEMS_EVENT_11 0x00000800
+#define RTEMS_EVENT_12 0x00001000
+#define RTEMS_EVENT_13 0x00002000
+#define RTEMS_EVENT_14 0x00004000
+#define RTEMS_EVENT_15 0x00008000
+#define RTEMS_EVENT_16 0x00010000
+#define RTEMS_EVENT_17 0x00020000
+#define RTEMS_EVENT_18 0x00040000
+#define RTEMS_EVENT_19 0x00080000
+#define RTEMS_EVENT_20 0x00100000
+#define RTEMS_EVENT_21 0x00200000
+#define RTEMS_EVENT_22 0x00400000
+#define RTEMS_EVENT_23 0x00800000
+#define RTEMS_EVENT_24 0x01000000
+#define RTEMS_EVENT_25 0x02000000
+#define RTEMS_EVENT_26 0x04000000
+#define RTEMS_EVENT_27 0x08000000
+#define RTEMS_EVENT_28 0x10000000
+#define RTEMS_EVENT_29 0x20000000
+#define RTEMS_EVENT_30 0x40000000
+#define RTEMS_EVENT_31 0x80000000
+
+
+/*
+ * The following constant is the value of an event set which
+ * has no events pending.
+ */
+
+#define EVENT_SETS_NONE_PENDING 0
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/eventset.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/intr.h b/c/src/exec/rtems/headers/intr.h
new file mode 100644
index 0000000000..8681ccf9e0
--- /dev/null
+++ b/c/src/exec/rtems/headers/intr.h
@@ -0,0 +1,160 @@
+/* intr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERRUPT_h
+#define __RTEMS_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * Interrupt level type
+ */
+
+typedef ISR_Level rtems_interrupt_level;
+
+/*
+ * The following type defines the control block used to manage
+ * the vectors.
+ */
+
+typedef ISR_Vector_number rtems_vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void rtems_isr;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef rtems_isr ( *rtems_isr_entry )(
+ rtems_vector_number
+ );
+
+/*
+ * _Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the interrupt manager.
+ *
+ */
+
+void _Interrupt_Manager_initialization( void );
+
+/*
+ * rtems_interrupt_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_interrupt_catch directive. This
+ * directive installs new_isr_handler as the RTEMS interrupt service
+ * routine for vector. The previous RTEMS interrupt service
+ * routine is returned in old_isr_handler.
+ */
+
+rtems_status_code rtems_interrupt_catch(
+ rtems_isr_entry new_isr_handler,
+ rtems_vector_number vector,
+ rtems_isr_entry *old_isr_handler
+);
+
+/*
+ * rtems_interrupt_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all maskable interrupts and returns the
+ * previous level in _isr_cookie.
+ */
+
+#define rtems_interrupt_disable( _isr_cookie ) \
+ _ISR_Disable(_isr_cookie)
+
+/*
+ * rtems_interrupt_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables maskable interrupts to the level indicated
+ * _isr_cookie.
+ */
+
+#define rtems_interrupt_enable( _isr_cookie ) \
+ _ISR_Enable(_isr_cookie)
+
+/*
+ * rtems_interrupt_flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables maskable interrupts to the
+ * level in _isr_cookie before redisabling them.
+ */
+
+#define rtems_interrupt_flash( _isr_cookie ) \
+ _ISR_Flash(_isr_cookie)
+
+/*
+ * rtems_interrupt_is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+#define rtems_interrupt_is_in_progress() \
+ _ISR_Is_in_progress()
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine generates an interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_cause( _interrupt_to_cause )
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the specified interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_clear( _interrupt_to_clear )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/message.h b/c/src/exec/rtems/headers/message.h
new file mode 100644
index 0000000000..0469f8ddbf
--- /dev/null
+++ b/c/src/exec/rtems/headers/message.h
@@ -0,0 +1,317 @@
+/* message.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message Queue Manager. This manager provides a mechanism for
+ * communication and synchronization between tasks using messages.
+ *
+ * Directives provided are:
+ *
+ * + create a queue
+ * + get ID of a queue
+ * + delete a queue
+ * + put a message at the rear of a queue
+ * + put a message at the front of a queue
+ * + broadcast N messages to a queue
+ * + receive message from a queue
+ * + flush all messages on a queue
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_h
+#define __RTEMS_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/coremsg.h>
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_SEND_REQUEST = 0,
+ MESSAGE_QUEUE_URGENT_REQUEST = 1
+} Message_queue_Submit_types;
+
+/*
+ * The following records define the control block used to manage
+ * each message queue.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ CORE_message_queue_Control message_queue;
+} Message_queue_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Message_queue_Information;
+
+/*
+ * _Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ * rtems_message_queue_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_create directive. The
+ * message queue will have the name name. If the attribute_set indicates
+ * that the message queue is to be limited in the number of messages
+ * that can be outstanding, then count indicates the maximum number of
+ * messages that will be held. It returns the id of the created
+ * message queue in ID.
+ */
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_ident directive.
+ * This directive returns the message queue ID associated with NAME.
+ * If more than one message queue is named name, then the message
+ * queue to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the message queue named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_delete directive. The
+ * message queue indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_message_queue_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+);
+
+/*
+ * rtems_message_queue_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_receive directive.
+ * This directive is invoked when the calling task wishes to receive
+ * a message from the message queue indicated by ID. The received
+ * message is to be placed in buffer. If no messages are outstanding
+ * and the option_set indicates that the task is willing to block,
+ * then the task will be blocked until a message arrives or until,
+ * optionally, timeout clock ticks have passed.
+ */
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_message_queue_flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_flush directive.
+ * This directive takes all outstanding messages for the message
+ * queue indicated by ID and returns them to the inactive message
+ * chain. The number of messages flushed is returned in COUNT.
+ */
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+);
+
+/*
+ * _Message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the directives rtems_message_queue_send
+ * and rtems_message_queue_urgent. It processes a message that is
+ * to be submitted to the designated message queue. The message will
+ * either be processed as a send 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.
+ */
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+);
+
+/*
+ * _Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+Message_queue_Control *_Message_queue_Allocate (
+ unsigned32 count,
+ unsigned32 max_message_size
+);
+
+/*
+ * _Message_queue_Translate_core_message_queue_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the core message queue
+ * status code specified.
+ */
+
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+ unsigned32 the_message_queue_status
+);
+
+/*
+ *
+ * _Message_queue_Core_message_queue_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the message was submitted to
+ * id - id of the message queue
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Core_message_queue_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/message.inl>
+#endif
+#include <rtems/rtems/msgmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/modes.h b/c/src/exec/rtems/headers/modes.h
new file mode 100644
index 0000000000..34a23c7b20
--- /dev/null
+++ b/c/src/exec/rtems/headers/modes.h
@@ -0,0 +1,89 @@
+/* modes.h
+ *
+ * This include file contains all constants and structures associated
+ * with the RTEMS thread and RTEMS_ASR modes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MODES_h
+#define __RTEMS_MODES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * The following type defines the control block used to manage
+ * each a mode set.
+ */
+
+typedef unsigned32 Modes_Control;
+
+/*
+ * The following constants define the individual modes and masks
+ * which may be used to compose a mode set and to alter modes.
+ */
+
+#define RTEMS_ALL_MODE_MASKS 0x0000ffff
+
+#define RTEMS_DEFAULT_MODES 0x00000000
+#define RTEMS_CURRENT_MODE 0
+
+#define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */
+#define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */
+#define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */
+#define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK
+
+#define RTEMS_PREEMPT 0x00000000 /* enable preemption */
+#define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */
+
+#define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */
+#define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */
+
+#define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */
+#define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */
+
+/*
+ * The number of bits for interrupt levels is CPU dependent.
+ * RTEMS supports 0 to 256 levels in bits 0-7 of the mode.
+ */
+
+/*PAGE
+ *
+ * RTEMS_INTERRUPT_LEVEL
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the processor dependent interrupt
+ * level which corresponds to the requested interrupt level.
+ *
+ * NOTE: RTEMS supports 256 interrupt levels using the least
+ * significant eight bits of MODES.CONTROL. On any
+ * particular CPU, fewer than 256 levels may be supported.
+ */
+
+#define RTEMS_INTERRUPT_LEVEL( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/modes.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/mp.h b/c/src/exec/rtems/headers/mp.h
new file mode 100644
index 0000000000..079f55b093
--- /dev/null
+++ b/c/src/exec/rtems/headers/mp.h
@@ -0,0 +1,53 @@
+/* mp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MP_h
+#define __RTEMS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *
+ * _Multiprocessing_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Multiprocessing_Manager_initialization ( void );
+
+/*
+ *
+ * rtems_multiprocessing_announce
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the MULTIPROCESSING_ANNOUNCE directive.
+ * It is invoked by the MPCI layer to indicate that an MPCI packet
+ * has been received.
+ */
+
+void rtems_multiprocessing_announce ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/msgmp.h b/c/src/exec/rtems/headers/msgmp.h
new file mode 100644
index 0000000000..070ed6fcaa
--- /dev/null
+++ b/c/src/exec/rtems/headers/msgmp.h
@@ -0,0 +1,175 @@
+/* msgmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_MP_h
+#define __RTEMS_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/message.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ MESSAGE_QUEUE_MP_RECEIVE_REQUEST = 3,
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE = 4,
+ MESSAGE_QUEUE_MP_SEND_REQUEST = 5,
+ MESSAGE_QUEUE_MP_SEND_RESPONSE = 6,
+ MESSAGE_QUEUE_MP_URGENT_REQUEST = 7,
+ MESSAGE_QUEUE_MP_URGENT_RESPONSE = 8,
+ MESSAGE_QUEUE_MP_BROADCAST_REQUEST = 9,
+ MESSAGE_QUEUE_MP_BROADCAST_RESPONSE = 10,
+ MESSAGE_QUEUE_MP_FLUSH_REQUEST = 11,
+ MESSAGE_QUEUE_MP_FLUSH_RESPONSE = 12
+} Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Message_queue_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+ unsigned32 count;
+ unsigned32 size;
+ unsigned32 pad0;
+ CORE_message_queue_Buffer Buffer;
+} Message_queue_MP_Packet;
+
+/*
+ * _Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_process_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Message_queue_MP_Send_request_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ void *buffer,
+ unsigned32 *size_p,
+ rtems_option option_set,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_response_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Message_queue_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/options.h b/c/src/exec/rtems/headers/options.h
new file mode 100644
index 0000000000..069d7721b3
--- /dev/null
+++ b/c/src/exec/rtems/headers/options.h
@@ -0,0 +1,53 @@
+/* options.h
+ *
+ * This include file contains information which defines the
+ * options available on many directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OPTIONS_h
+#define __RTEMS_OPTIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * option sets.
+ */
+
+typedef unsigned32 rtems_option;
+
+/*
+ * The following constants define the individual options which may
+ * be used to compose an option set.
+ */
+
+#define RTEMS_DEFAULT_OPTIONS 0x00000000
+
+#define RTEMS_WAIT 0x00000000 /* wait on resource */
+#define RTEMS_NO_WAIT 0x00000001 /* do not wait on resource */
+
+#define RTEMS_EVENT_ALL 0x00000000 /* wait for all events */
+#define RTEMS_EVENT_ANY 0x00000002 /* wait on any event */
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/options.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/part.h b/c/src/exec/rtems/headers/part.h
new file mode 100644
index 0000000000..e06a2e4b86
--- /dev/null
+++ b/c/src/exec/rtems/headers/part.h
@@ -0,0 +1,168 @@
+/* partition.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Partition Manager. This manager provides facilities to
+ * dynamically allocate memory in fixed-sized units which are returned
+ * as buffers.
+ *
+ * Directives provided are:
+ *
+ * + create a partition
+ * + get an ID of a partition
+ * + delete a partition
+ * + get a buffer from a partition
+ * + return a buffer to a partition
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_h
+#define __RTEMS_PARTITION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following defines the control block used to manage each partition.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *starting_address; /* physical address */
+ unsigned32 length; /* in bytes */
+ unsigned32 buffer_size; /* in bytes */
+ rtems_attribute attribute_set; /* attributes */
+ unsigned32 number_of_used_blocks; /* or allocated buffers */
+ Chain_Control Memory; /* buffer chain */
+} Partition_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Partition_Information;
+
+/*
+ * _Partition_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+);
+
+/*
+ * rtems_partition_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_create directive. The
+ * partition will have the name name. The memory area managed by
+ * the partition is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many buffers of
+ * buffer_size bytes as possible. The attribute_set determines if
+ * the partition is global or local. It returns the id of the
+ * created partition in ID.
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_ident directive.
+ * This directive returns the partition ID associated with name.
+ * If more than one partition is named name, then the partition
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the partition named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_delete directive. The
+ * partition indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_partition_get_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_get_buffer directive. It
+ * attempts to allocate a buffer from the partition associated with ID.
+ * If a buffer is allocated, its address is returned in buffer.
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+);
+
+/*
+ * rtems_partition_return_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_return_buffer directive. It
+ * frees the buffer to the partition associated with ID. The buffer must
+ * have been previously allocated from the same partition.
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/part.inl>
+#endif
+#include <rtems/rtems/partmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/partmp.h b/c/src/exec/rtems/headers/partmp.h
new file mode 100644
index 0000000000..fd7d442dd3
--- /dev/null
+++ b/c/src/exec/rtems/headers/partmp.h
@@ -0,0 +1,161 @@
+/* partmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_MP_h
+#define __RTEMS_PARTITION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/part.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote partition operations.
+ */
+
+typedef enum {
+ PARTITION_MP_ANNOUNCE_CREATE = 0,
+ PARTITION_MP_ANNOUNCE_DELETE = 1,
+ PARTITION_MP_EXTRACT_PROXY = 2,
+ PARTITION_MP_GET_BUFFER_REQUEST = 3,
+ PARTITION_MP_GET_BUFFER_RESPONSE = 4,
+ PARTITION_MP_RETURN_BUFFER_REQUEST = 5,
+ PARTITION_MP_RETURN_BUFFER_RESPONSE = 6
+} Partition_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote partition operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Partition_MP_Remote_operations operation;
+ rtems_name name;
+ void *buffer;
+ Objects_Id proxy_id;
+} Partition_MP_Packet;
+
+/*
+ * _Partition_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Partition_MP_Send_process_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Partition_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Partition_MP_Send_request_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ void *buffer
+);
+
+/*
+ * _Partition_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Partition_MP_Send_response_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Partition_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Partition_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Partition_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Partition since a partition
+ * cannot be deleted when buffers are in use.
+ */
+
+/*
+ * _Partition_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Partition_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Partition_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a partition mp packet.
+ */
+
+Partition_MP_Packet *_Partition_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/ratemon.h b/c/src/exec/rtems/headers/ratemon.h
new file mode 100644
index 0000000000..a85bbcdc09
--- /dev/null
+++ b/c/src/exec/rtems/headers/ratemon.h
@@ -0,0 +1,185 @@
+/* ratemon.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Rate Monotonic Manager. This manager
+ * provides facilities to implement tasks which execute in a periodic fashion.
+ *
+ * Directives provided are:
+ *
+ * + create a rate monotonic timer
+ * + cancel a period
+ * + delete a rate monotonic timer
+ * + conclude current and start the next period
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RATE_MONOTONIC_h
+#define __RTEMS_RATE_MONOTONIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the states in which a
+ * period may be.
+ */
+
+typedef enum {
+ RATE_MONOTONIC_INACTIVE, /* off chain, never initialized */
+ RATE_MONOTONIC_OWNER_IS_BLOCKING, /* on chain, owner is blocking on it */
+ RATE_MONOTONIC_ACTIVE, /* on chain, running continuously */
+ RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
+ /* was blocking on it */
+ RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */
+ /* rtems_rate_monotonic_period */
+} Rate_Monotonic_Period_states;
+
+/*
+ * The following constant is the interval passed to the rate_monontonic_period
+ * directive to obtain status information.
+ */
+
+#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following structure defines the control block used to manage
+ * each period.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Timer;
+ Rate_Monotonic_Period_states state;
+ Thread_Control *owner;
+} Rate_monotonic_Control;
+
+EXTERN Objects_Information _Rate_monotonic_Information;
+
+/*
+ * _Rate_monotonic_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+);
+
+/*
+ * rtems_rate_monotonic_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rate_monotonic_create directive. The
+ * period will have the name name. It returns the id of the
+ * created period in ID.
+ */
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_ident directive.
+ * This directive returns the period ID associated with name.
+ * If more than one period is named name, then the period
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_cancel directive. This
+ * directive stops the period associated with ID from continuing to
+ * run.
+ */
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_delete directive. The
+ * period indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_period
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_period directive. When
+ * length is non-zero, this directive initiates the period associated with
+ * ID from continuing for a period of length. If length is zero, then
+ * result is set to indicate the current state of the period.
+ */
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+);
+
+/*
+ * _Rate_monotonic_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the period represented
+ * by ID expires. If the task which owns this period is blocked
+ * waiting for the period to expire, then it is readied and the
+ * period is restarted. If the owning task is not waiting for the
+ * period to expire, then the period is placed in the EXPIRED
+ * state and not restarted.
+ */
+
+void _Rate_monotonic_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/ratemon.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/region.h b/c/src/exec/rtems/headers/region.h
new file mode 100644
index 0000000000..7ee2658cd2
--- /dev/null
+++ b/c/src/exec/rtems/headers/region.h
@@ -0,0 +1,234 @@
+/* region.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Region Manager. This manager provides facilities to dynamically
+ * allocate memory in variable sized units which are returned as segments.
+ *
+ * Directives provided are:
+ *
+ * + create a region
+ * + get an ID of a region
+ * + delete a region
+ * + get a segment from a region
+ * + return a segment to a region
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_h
+#define __RTEMS_REGION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/heap.h>
+#include <rtems/debug.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following records define the control block used to manage
+ * each region.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Thread_queue_Control Wait_queue; /* waiting threads */
+ void *starting_address; /* physical start addr */
+ unsigned32 length; /* physical length(bytes) */
+ unsigned32 page_size; /* in bytes */
+ unsigned32 maximum_segment_size; /* in bytes */
+ rtems_attribute attribute_set;
+ unsigned32 number_of_used_blocks; /* blocks allocated */
+ Heap_Control Memory;
+} Region_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Region_Information;
+
+/*
+ * _Region_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+);
+
+/*
+ * rtems_region_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_create directive. The
+ * region will have the name name. The memory area managed by
+ * the region is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many allocatable units of
+ * page_size bytes as possible. The attribute_set determines which
+ * thread queue discipline is used by the region. It returns the
+ * id of the created region in ID.
+ */
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_extend directive. The
+ * region will have the name name. The memory area managed by
+ * the region will be attempted to be grown by length bytes using
+ * the memory starting at starting_address.
+ */
+
+rtems_status_code rtems_region_extend(
+ Objects_Id id,
+ void *starting_address,
+ unsigned32 length
+);
+
+/*
+ * rtems_region_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_ident directive.
+ * This directive returns the region ID associated with name.
+ * If more than one region is named name, then the region
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_delete directive. The
+ * region indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_region_get_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment directive. It
+ * attempts to allocate a segment from the region associated with ID.
+ * If a segment of the requested size can be allocated, its address
+ * is returned in segment. If no segment is available, then the task
+ * may return immediately or block waiting for a segment with an optional
+ * timeout of timeout clock ticks. Whether the task blocks or returns
+ * immediately is based on the no_wait option in the option_set.
+ */
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+);
+
+/*
+ * rtems_region_get_segment_size
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment_size directive. It
+ * returns the size in bytes of the specified user memory area.
+ */
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+);
+
+/*
+ * rtems_region_return_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_return_segment directive. It
+ * frees the segment to the region associated with ID. The segment must
+ * have been previously allocated from the same region. If freeing the
+ * segment results in enough memory being available to satisfy the
+ * rtems_region_get_segment of the first blocked task, then that task and as
+ * many subsequent tasks as possible will be unblocked with their requests
+ * satisfied.
+ */
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/region.inl>
+#endif
+#include <rtems/rtems/regionmp.h>
+
+/*
+ * _Region_Debug_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to verify the integrity of a heap associated
+ * with the_region.
+ */
+
+#ifdef RTEMS_DEBUG
+
+#define _Region_Debug_Walk( _the_region, _source ) \
+ do { \
+ if ( _Debug_Is_enabled( RTEMS_DEBUG_REGION ) ) \
+ _Heap_Walk( &(_the_region)->Memory, _source, FALSE ); \
+ } while ( 0 )
+
+#else
+
+#define _Region_Debug_Walk( _the_region, _source )
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/regionmp.h b/c/src/exec/rtems/headers/regionmp.h
new file mode 100644
index 0000000000..b59fe9235e
--- /dev/null
+++ b/c/src/exec/rtems/headers/regionmp.h
@@ -0,0 +1,166 @@
+/* regionmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_MP_h
+#define __RTEMS_REGION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote region operations.
+ */
+
+typedef enum {
+ REGION_MP_ANNOUNCE_CREATE = 0,
+ REGION_MP_ANNOUNCE_DELETE = 1,
+ REGION_MP_EXTRACT_PROXY = 2,
+ REGION_MP_GET_SEGMENT_REQUEST = 3,
+ REGION_MP_GET_SEGMENT_RESPONSE = 4,
+ REGION_MP_RETURN_SEGMENT_REQUEST = 5,
+ REGION_MP_RETURN_SEGMENT_RESPONSE = 6
+} Region_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote region operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Region_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ unsigned32 size;
+ Objects_Id proxy_id;
+ void *segment;
+} Region_MP_Packet;
+
+/*
+ * _Region_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Region_MP_Send_process_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Region_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Region_MP_Send_request_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ void *segment,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Region_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Region_MP_Send_response_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Region_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Region_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Region_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Region since a region
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _Region_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Region_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Region_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a region mp packet.
+ */
+
+Region_MP_Packet *_Region_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/rtems.h b/c/src/exec/rtems/headers/rtems.h
new file mode 100644
index 0000000000..e8826079b9
--- /dev/null
+++ b/c/src/exec/rtems/headers/rtems.h
@@ -0,0 +1,121 @@
+/* rtems.h
+ *
+ * This include file contains information about RTEMS executive that
+ * is required by the application and is CPU independent. It includes
+ * two (2) CPU dependent files to tailor its data structures for a
+ * particular processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_GENERIC_h
+#define __RTEMS_RTEMS_GENERIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unless told otherwise, the RTEMS include files will hide some stuff
+ * from normal application code. Defining this crosses a boundary which
+ * is undesirable since it means your application is using RTEMS features
+ * which are not included in the formally defined and supported API.
+ * Define this at your own risk.
+ */
+
+#ifndef __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#define __RTEMS_APPLICATION__
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+#include <rtems/config.h>
+#include <rtems/init.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/extension.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/io.h>
+#include <rtems/fatal.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/mp.h>
+
+#include <rtems/rtems/support.h>
+#include <rtems/score/sysstate.h>
+
+#define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES
+#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
+#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE
+#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
+#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
+
+#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
+#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/rtemsapi.h b/c/src/exec/rtems/headers/rtemsapi.h
new file mode 100644
index 0000000000..e43de773fd
--- /dev/null
+++ b/c/src/exec/rtems/headers/rtemsapi.h
@@ -0,0 +1,34 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_API_h
+#define __RTEMS_API_h
+
+#include <rtems/config.h>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+);
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/sem.h b/c/src/exec/rtems/headers/sem.h
new file mode 100644
index 0000000000..c4f8574b17
--- /dev/null
+++ b/c/src/exec/rtems/headers/sem.h
@@ -0,0 +1,248 @@
+/* semaphore.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Semaphore Manager. This manager utilizes standard Dijkstra
+ * counting semaphores to provide synchronization and mutual exclusion
+ * capabilities.
+ *
+ * Directives provided are:
+ *
+ * + create a semaphore
+ * + get an ID of a semaphore
+ * + delete a semaphore
+ * + acquire a semaphore
+ * + release a semaphore
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_h
+#define __RTEMS_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/object.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * The following defines the control block used to manage each semaphore.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ union {
+ CORE_mutex_Control mutex;
+ CORE_semaphore_Control semaphore;
+ } Core_control;
+} Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Semaphore_Information;
+
+/*
+ * _Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+);
+
+/*
+ * rtems_semaphore_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_create directive. The
+ * semaphore will have the name name. The starting count for
+ * the semaphore is count. The attribute_set determines if
+ * the semaphore is global or local and the thread queue
+ * discipline. It returns the id of the created semaphore in ID.
+ */
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_ident directive.
+ * This directive returns the semaphore ID associated with name.
+ * If more than one semaphore is named name, then the semaphore
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the semaphore named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_delete directive. The
+ * semaphore indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_semaphore_delete(
+ rtems_id id
+);
+
+/*
+ * rtems_semaphore_obtain
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_obtain directive. It
+ * attempts to obtain a unit from the semaphore associated with ID.
+ * If a unit can be allocated, the calling task will return immediately.
+ * If no unit is available, then the task may return immediately or
+ * block waiting for a unit with an optional timeout of timeout
+ * clock ticks. Whether the task blocks or returns immediately
+ * is based on the RTEMS_NO_WAIT option in the option_set.
+ */
+
+rtems_status_code rtems_semaphore_obtain(
+ rtems_id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_semaphore_release
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_release directive. It
+ * frees a unit to the semaphore associated with ID. If a task was
+ * blocked waiting for a unit from this semaphore, then that task will
+ * be readied and the unit given to that task. Otherwise, the unit
+ * will be returned to the semaphore.
+ */
+
+rtems_status_code rtems_semaphore_release(
+ rtems_id id
+);
+
+/*
+ * _Semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the RTEMS_NO_WAIT option is enabled in
+ * option_set, then the routine returns. Otherwise, the calling task
+ * is blocked until a unit becomes available.
+ */
+
+boolean _Semaphore_Seize(
+ Semaphore_Control *the_semaphore,
+ unsigned32 option_set
+);
+
+/*
+ * _Semaphore_Translate_core_mutex_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the mutex
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_mutex_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*
+ * _Semaphore_Translate_core_semaphore_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the semaphore
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mutex_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core mutex. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_mutex_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core semaphore. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_semaphore_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/sem.inl>
+#endif
+#include <rtems/rtems/semmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/semmp.h b/c/src/exec/rtems/headers/semmp.h
new file mode 100644
index 0000000000..4d9618256d
--- /dev/null
+++ b/c/src/exec/rtems/headers/semmp.h
@@ -0,0 +1,163 @@
+/* semmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_MP_h
+#define __RTEMS_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ SEMAPHORE_MP_RELEASE_RESPONSE = 6
+} Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Semaphore_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+} Semaphore_MP_Packet;
+
+/*
+ * _Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_process_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Semaphore_MP_Send_request_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_response_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Semaphore_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/signal.h b/c/src/exec/rtems/headers/signal.h
new file mode 100644
index 0000000000..e72bcb2dbc
--- /dev/null
+++ b/c/src/exec/rtems/headers/signal.h
@@ -0,0 +1,83 @@
+/* signal.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Signal Manager. This manager provides capabilities required
+ * for asynchronous communication between tasks via signal sets.
+ *
+ * Directives provided are:
+ *
+ * + establish an asynchronous signal routine
+ * + send a signal set to a task
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_h
+#define __RTEMS_SIGNAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * _Signal_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Signal_Manager_initialization( void );
+
+/*
+ * rtems_signal_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_catch directive. This directive
+ * is used to establish asr_handler as the Asynchronous Signal Routine
+ * (RTEMS_ASR) for the calling task. The asr_handler will execute with a
+ * mode of mode_set.
+ */
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry asr_handler,
+ rtems_mode mode_set
+);
+
+/*
+ * rtems_signal_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_send directive. This directive
+ * sends the signal_set to the task specified by ID.
+ */
+
+rtems_status_code rtems_signal_send(
+ Objects_Id id,
+ rtems_signal_set signal_set
+);
+
+#include <rtems/rtems/signalmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/signalmp.h b/c/src/exec/rtems/headers/signalmp.h
new file mode 100644
index 0000000000..91d36b729f
--- /dev/null
+++ b/c/src/exec/rtems/headers/signalmp.h
@@ -0,0 +1,147 @@
+/* signalmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_MP_h
+#define __RTEMS_SIGNAL_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote signal operations.
+ */
+
+typedef enum {
+ SIGNAL_MP_SEND_REQUEST = 0,
+ SIGNAL_MP_SEND_RESPONSE = 1
+} Signal_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote signal operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Signal_MP_Remote_operations operation;
+ rtems_signal_set signal_in;
+} Signal_MP_Packet;
+
+/*
+ * _Signal_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Signal_MP_Send_request_packet (
+ Signal_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_signal_set signal_in
+);
+
+/*
+ * _Signal_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Signal_MP_Send_response_packet (
+ Signal_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Signal_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Signal_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Signal_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a signal mp packet.
+ */
+
+Signal_MP_Packet *_Signal_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/status.h b/c/src/exec/rtems/headers/status.h
new file mode 100644
index 0000000000..23c1c830c6
--- /dev/null
+++ b/c/src/exec/rtems/headers/status.h
@@ -0,0 +1,82 @@
+/* status.h
+ *
+ * This include file contains the status codes returned from the
+ * executive directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATUS_h
+#define __RTEMS_STATUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+typedef enum {
+ RTEMS_SUCCESSFUL = 0, /* successful completion */
+ RTEMS_TASK_EXITTED = 1, /* returned from a thread */
+ RTEMS_MP_NOT_CONFIGURED = 2, /* multiprocessing not configured */
+ RTEMS_INVALID_NAME = 3, /* invalid object name */
+ RTEMS_INVALID_ID = 4, /* invalid object id */
+ RTEMS_TOO_MANY = 5, /* too many */
+ RTEMS_TIMEOUT = 6, /* timed out waiting */
+ RTEMS_OBJECT_WAS_DELETED = 7, /* object deleted while waiting */
+ RTEMS_INVALID_SIZE = 8, /* specified size was invalid */
+ RTEMS_INVALID_ADDRESS = 9, /* address specified is invalid */
+ RTEMS_INVALID_NUMBER = 10, /* number was invalid */
+ RTEMS_NOT_DEFINED = 11, /* item has not been initialized */
+ RTEMS_RESOURCE_IN_USE = 12, /* resources still outstanding */
+ RTEMS_UNSATISFIED = 13, /* request not satisfied */
+ RTEMS_INCORRECT_STATE = 14, /* thread is in wrong state */
+ RTEMS_ALREADY_SUSPENDED = 15, /* thread already in state */
+ RTEMS_ILLEGAL_ON_SELF = 16, /* illegal on calling thread */
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17, /* illegal for remote object */
+ RTEMS_CALLED_FROM_ISR = 18, /* called from wrong environment */
+ RTEMS_INVALID_PRIORITY = 19, /* invalid thread priority */
+ RTEMS_INVALID_CLOCK = 20, /* invalid date/time */
+ RTEMS_INVALID_NODE = 21, /* invalid node id */
+ RTEMS_NOT_CONFIGURED = 22, /* directive not configured */
+ RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
+ RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
+ RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
+ RTEMS_NO_MEMORY = 26 /* could not get enough memory */
+} rtems_status_code;
+
+#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
+#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
+
+extern rtems_status_code _Status_Object_name_errors_to_status[];
+
+#ifdef INIT
+rtems_status_code _Status_Object_name_errors_to_status[] = {
+ RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */
+ RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */
+ RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */
+};
+#endif
+
+/*
+ * Applications are allowed to use the macros to compare status codes.
+ */
+
+#include <rtems/rtems/status.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/support.h b/c/src/exec/rtems/headers/support.h
new file mode 100644
index 0000000000..3305ffd4d3
--- /dev/null
+++ b/c/src/exec/rtems/headers/support.h
@@ -0,0 +1,97 @@
+/* support.h
+ *
+ * This include file contains information about support functions for
+ * the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_SUPPORT_h
+#define __RTEMS_RTEMS_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+
+/*
+ * rtems_build_name
+ *
+ * DESCRIPTION:
+ *
+ * This function returns an object name composed of the four characters
+ * C1, C2, C3, and C4.
+ *
+ * NOTE:
+ *
+ * This must be implemented as a macro for use in Configuration Tables.
+ *
+ */
+
+#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
+ ( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
+
+/*
+ * rtems_get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ *
+ */
+
+#define rtems_get_class( _id ) \
+ _Objects_Get_class( _id )
+
+/*
+ * rtems_get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ *
+ */
+
+#define rtems_get_node( _id ) \
+ _Objects_Get_node( _id )
+
+/*
+ * rtems_get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ *
+ */
+
+#define rtems_get_index( _id ) \
+ _Objects_Get_index( _id )
+
+/*
+ * Time related
+ */
+
+#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
+ TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
+#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
+ TOD_MILLISECONDS_TO_TICKS(_ms)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/support.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/taskmp.h b/c/src/exec/rtems/headers/taskmp.h
new file mode 100644
index 0000000000..032d5645d1
--- /dev/null
+++ b/c/src/exec/rtems/headers/taskmp.h
@@ -0,0 +1,167 @@
+/* taskmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the multiprocessing support in the task manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_MP_h
+#define __RTEMS_RTEMS_TASKS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote task operations.
+ */
+
+typedef enum {
+ RTEMS_TASKS_MP_ANNOUNCE_CREATE = 0,
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE = 1,
+ RTEMS_TASKS_MP_SUSPEND_REQUEST = 2,
+ RTEMS_TASKS_MP_SUSPEND_RESPONSE = 3,
+ RTEMS_TASKS_MP_RESUME_REQUEST = 4,
+ RTEMS_TASKS_MP_RESUME_RESPONSE = 5,
+ RTEMS_TASKS_MP_SET_PRIORITY_REQUEST = 6,
+ RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE = 7,
+ RTEMS_TASKS_MP_GET_NOTE_REQUEST = 8,
+ RTEMS_TASKS_MP_GET_NOTE_RESPONSE = 9,
+ RTEMS_TASKS_MP_SET_NOTE_REQUEST = 10,
+ RTEMS_TASKS_MP_SET_NOTE_RESPONSE = 11
+} RTEMS_tasks_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote task operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ RTEMS_tasks_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_task_priority the_priority;
+ unsigned32 notepad;
+ unsigned32 note;
+} RTEMS_tasks_MP_Packet;
+
+/*
+ * _RTEMS_tasks_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_process_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_name name
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_task_priority the_priority,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_response_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _RTEMS_tasks_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _RTEMS_tasks_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by RTEMS_tasks since a task
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _RTEMS_tasks_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*
+ * _RTEMS_tasks_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a task mp packet.
+ */
+
+RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/headers/tasks.h b/c/src/exec/rtems/headers/tasks.h
new file mode 100644
index 0000000000..b86d85a562
--- /dev/null
+++ b/c/src/exec/rtems/headers/tasks.h
@@ -0,0 +1,419 @@
+/* tasks.h
+ *
+ * This include file contains all constants and structures associated
+ * with RTEMS tasks. This manager provides a comprehensive set of directives
+ * to create, delete, and administer tasks.
+ *
+ * Directives provided are:
+ *
+ * + create a task
+ * + get an ID of a task
+ * + start a task
+ * + restart a task
+ * + delete a task
+ * + suspend a task
+ * + resume a task
+ * + set a task's priority
+ * + change the current task's mode
+ * + get a task notepad entry
+ * + set a task notepad entry
+ * + wake up after interval
+ * + wake up when specified
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_h
+#define __RTEMS_RTEMS_TASKS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/eventset.h>
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/attr.h>
+
+/*
+ * Constant to be used as the ID of current task
+ */
+
+#define RTEMS_SELF OBJECTS_ID_OF_SELF
+
+/*
+ * This constant is passed to the rtems_task_wake_after directive as the
+ * interval when a task wishes to yield the CPU.
+ */
+
+#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
+
+/*
+ * Define the type for an RTEMS API task priority.
+ */
+
+typedef Priority_Control rtems_task_priority;
+
+#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
+
+#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1)
+#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM
+
+/*
+ * The following constant is passed to rtems_task_set_priority when the
+ * caller wants to obtain the current priority.
+ */
+
+#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM
+
+/*
+ * Notepads constants (indices into notepad array)
+ */
+
+#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */
+#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */
+#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */
+#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */
+#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */
+#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */
+#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */
+#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */
+#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */
+#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */
+#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */
+#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */
+#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */
+#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */
+#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */
+#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */
+#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */
+#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */
+
+#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1)
+
+/*
+ * External API name for Thread_Control
+ */
+
+typedef Thread_Control rtems_tcb;
+
+/*
+ * The following defines the "return type" of an RTEMS task.
+ */
+
+typedef void rtems_task;
+
+/*
+ * The following defines the argument to an RTEMS task.
+ */
+
+typedef unsigned32 rtems_task_argument;
+
+/*
+ * The following defines the type for the entry point of an RTEMS task.
+ */
+
+typedef rtems_task ( *rtems_task_entry )(
+ rtems_task_argument
+ );
+
+/*
+ * The following records define the Initialization Tasks Table.
+ * Each entry contains the information required by RTEMS to
+ * create and start a user task automatically at executive
+ * initialization time.
+ */
+
+typedef struct {
+ rtems_name name; /* task name */
+ unsigned32 stack_size; /* task stack size */
+ rtems_task_priority initial_priority; /* task priority */
+ rtems_attribute attribute_set; /* task attributes */
+ rtems_task_entry entry_point; /* task entry point */
+ rtems_mode mode_set; /* task initial mode */
+ unsigned32 argument; /* task argument */
+} rtems_initialization_tasks_table;
+
+/*
+ * This is the API specific information required by each thread for
+ * the RTEMS API to function correctly.
+ */
+
+
+typedef struct {
+ unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
+ rtems_event_set pending_events;
+ rtems_event_set event_condition;
+ ASR_Information Signal;
+} RTEMS_API_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _RTEMS_tasks_Information;
+
+/*
+ * These are used to manage the user initialization tasks.
+ */
+
+EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks;
+EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks;
+
+/*
+ * _RTEMS_tasks_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all Task Manager related data structures.
+ */
+
+void _RTEMS_tasks_Manager_initialization(
+ unsigned32 maximum_tasks,
+ unsigned32 number_of_initialization_tasks,
+ rtems_initialization_tasks_table *user_tasks
+);
+
+/*
+ * rtems_task_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_create directive. The task
+ * will have the name name. The attribute_set can be used to indicate
+ * that the task will be globally accessible or utilize floating point.
+ * The task's stack will be stack_size bytes. The task will begin
+ * execution with initial_priority and initial_modes. It returns the
+ * id of the created task in ID.
+ */
+
+rtems_status_code rtems_task_create(
+ rtems_name name,
+ rtems_task_priority initial_priority,
+ unsigned32 stack_size,
+ rtems_mode initial_modes,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_ident directive.
+ * This directive returns the task ID associated with name.
+ * If more than one task is named name, then the task to
+ * which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the task named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_task_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_delete directive. The
+ * task indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_task_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_get_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_get_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_get_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 *note
+);
+
+/*
+ * rtems_task_set_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_set_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * rtems_task_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_mode directive. The current
+ * values of the modes indicated by mask of the calling task are changed
+ * to that indicated in mode_set. The former mode of the task is
+ * returned in mode_set.
+ */
+
+rtems_status_code rtems_task_mode(
+ rtems_mode mode_set,
+ rtems_mode mask,
+ rtems_mode *previous_mode_set
+);
+
+/*
+ * rtems_task_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_restart directive. The
+ * task associated with ID is restarted at its initial entry
+ * point with the new argument.
+ */
+
+rtems_status_code rtems_task_restart(
+ Objects_Id id,
+ unsigned32 arg
+);
+
+/*
+ * rtems_task_suspend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_suspend directive. The
+ * SUSPENDED state is set for task associated with ID.
+ */
+
+rtems_status_code rtems_task_suspend(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_resume Directive. The
+ * SUSPENDED state is cleared for task associated with ID.
+ */
+
+rtems_status_code rtems_task_resume(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_priority directive. The
+ * current priority of the task associated with ID is set to
+ * new_priority. The former priority of that task is returned
+ * in old_priority.
+ */
+
+rtems_status_code rtems_task_set_priority(
+ Objects_Id id,
+ rtems_task_priority new_priority,
+ rtems_task_priority *old_priority
+);
+
+/*
+ * rtems_task_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_start directive. The
+ * starting execution point of the task associated with ID is
+ * set to entry_point with the initial argument.
+ */
+
+rtems_status_code rtems_task_start(
+ Objects_Id id,
+ rtems_task_entry entry_point,
+ unsigned32 argument
+);
+
+/*
+ * rtems_task_wake_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_when directive. The
+ * calling task is blocked until the current time of day is
+ * equal to that indicated by time_buffer.
+ */
+
+rtems_status_code rtems_task_wake_when(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_task_wake_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_after directive. The
+ * calling task is blocked until the indicated number of clock
+ * ticks have occurred.
+ */
+
+rtems_status_code rtems_task_wake_after(
+ rtems_interval ticks
+);
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Initialize_user_tasks
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Initialize_user_tasks( void );
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/tasks.inl>
+#endif
+#include <rtems/rtems/taskmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/timer.h b/c/src/exec/rtems/headers/timer.h
new file mode 100644
index 0000000000..d09b80d5ff
--- /dev/null
+++ b/c/src/exec/rtems/headers/timer.h
@@ -0,0 +1,207 @@
+/* timer.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Timer Manager. This manager provides
+ * facilities to configure, initiate, cancel, and delete timers which will
+ * fire at specified intervals of time.
+ *
+ * Directives provided are:
+ *
+ * + create a timer
+ * + get an ID of a timer
+ * + delete a timer
+ * + set a timer to fire after a number of ticks have passed
+ * + set a timer to fire when a specified date and time has been reached
+ * + reset a timer
+ * + cancel a time
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TIMER_h
+#define __RTEMS_TIMER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type details the classes to which a timer
+ * may belong.
+ */
+
+typedef enum {
+ TIMER_INTERVAL,
+ TIMER_TIME_OF_DAY,
+ TIMER_DORMANT
+} Timer_Classes;
+
+/*
+ * The following types define a pointer to a timer service routine.
+ */
+
+typedef void rtems_timer_service_routine;
+
+typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
+ rtems_id,
+ void *
+ );
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Timer_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each timer.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Ticker;
+ Timer_Classes the_class;
+} Timer_Control;
+
+/*
+ * _Timer_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+);
+
+/*
+ * rtems_timer_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_create directive. The
+ * timer will have the name name. It returns the id of the
+ * created timer in ID.
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_ident directive.
+ * This directive returns the timer ID associated with name.
+ * If more than one timer is named name, then the timer
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_cancel directive. It is used
+ * to stop the timer associated with ID from firing.
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_delete directive. The
+ * timer indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_fire_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_after directive. It
+ * initiates the timer associated with ID to fire in ticks clock
+ * ticks. When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_fire_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_when directive. It
+ * initiates the timer associated with ID to fire at wall_time
+ * When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_reset directive. It is used
+ * to reinitialize the interval timer associated with ID just as if
+ * rtems_timer_fire_after were re-invoked with the same arguments that
+ * were used to initiate this timer.
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/timer.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/headers/types.h b/c/src/exec/rtems/headers/types.h
new file mode 100644
index 0000000000..1dc8cd5373
--- /dev/null
+++ b/c/src/exec/rtems/headers/types.h
@@ -0,0 +1,96 @@
+/* types.h
+ *
+ * This include file defines the types used by the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TYPES_h
+#define __RTEMS_RTEMS_TYPES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+
+/*
+ * RTEMS basic type definitions
+ */
+
+typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */
+typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */
+typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */
+
+typedef signed8 rtems_signed8; /* signed 8-bit value */
+typedef signed16 rtems_signed16; /* signed 16-bit value */
+typedef signed32 rtems_signed32; /* signed 32-bit value */
+
+/*
+ * some C++ compilers (eg: HP's) don't do 'long long'
+ */
+#if defined(__GNUC__)
+typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */
+typedef signed64 rtems_signed64; /* signed 64-bit value */
+#endif
+
+typedef single_precision rtems_single; /* single precision float */
+typedef double_precision rtems_double; /* double precision float */
+
+typedef boolean rtems_boolean;
+
+typedef unsigned32 rtems_name;
+typedef Objects_Id rtems_id;
+
+typedef Context_Control rtems_context;
+typedef Context_Control_fp rtems_context_fp;
+typedef CPU_Interrupt_frame rtems_interrupt_frame;
+
+/*
+ * Time related
+ */
+
+typedef Watchdog_Interval rtems_interval;
+typedef TOD_Control rtems_time_of_day;
+
+/*
+ * Define the type for an RTEMS API task mode.
+ */
+
+typedef Modes_Control rtems_mode;
+
+/*
+ * MPCI related entries
+ */
+
+typedef MP_packet_Classes rtems_mp_packet_classes;
+typedef MP_packet_Prefix rtems_packet_prefix;
+
+typedef MPCI_initialization_entry rtems_mpci_initialization_entry;
+typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry;
+typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry;
+typedef MPCI_send_entry rtems_mpci_send_packet_entry;
+typedef MPCI_receive_entry rtems_mpci_receive_packet_entry;
+
+typedef MPCI_Entry rtems_mpci_entry;
+
+typedef MPCI_Control rtems_mpci_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems.h b/c/src/exec/rtems/include/rtems.h
new file mode 100644
index 0000000000..e8826079b9
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems.h
@@ -0,0 +1,121 @@
+/* rtems.h
+ *
+ * This include file contains information about RTEMS executive that
+ * is required by the application and is CPU independent. It includes
+ * two (2) CPU dependent files to tailor its data structures for a
+ * particular processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_GENERIC_h
+#define __RTEMS_RTEMS_GENERIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unless told otherwise, the RTEMS include files will hide some stuff
+ * from normal application code. Defining this crosses a boundary which
+ * is undesirable since it means your application is using RTEMS features
+ * which are not included in the formally defined and supported API.
+ * Define this at your own risk.
+ */
+
+#ifndef __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#define __RTEMS_APPLICATION__
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+#include <rtems/config.h>
+#include <rtems/init.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/extension.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/io.h>
+#include <rtems/fatal.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/mp.h>
+
+#include <rtems/rtems/support.h>
+#include <rtems/score/sysstate.h>
+
+#define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES
+#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
+#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE
+#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
+#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
+
+#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
+#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/asr.h b/c/src/exec/rtems/include/rtems/rtems/asr.h
new file mode 100644
index 0000000000..31758fc06b
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/asr.h
@@ -0,0 +1,112 @@
+/* asr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Asynchronous Signal Handler. This Handler provides the low-level
+ * support required by the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ASR_h
+#define __RTEMS_ASR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/modes.h>
+
+/*
+ *
+ * The following type defines the control block used to manage
+ * each signal set.
+ */
+
+typedef unsigned32 rtems_signal_set;
+
+/*
+ * Return type for ASR Handler
+ */
+
+typedef void rtems_asr;
+
+/*
+ * The following type corresponds to the applications asynchronous
+ * signal processing routine.
+ */
+
+typedef rtems_asr ( *rtems_asr_entry )(
+ rtems_signal_set
+ );
+
+/*
+ *
+ * The following defines the control structure used to manage
+ * signals. Each thread has a copy of this record.
+ */
+
+typedef struct {
+ boolean is_enabled; /* are ASRs enabled currently? */
+ rtems_asr_entry handler; /* address of RTEMS_ASR */
+ Modes_Control mode_set; /* RTEMS_ASR mode */
+ rtems_signal_set signals_posted; /* signal set */
+ rtems_signal_set signals_pending; /* pending signal set */
+ unsigned32 nest_level; /* nest level of RTEMS_ASR */
+} ASR_Information;
+
+/*
+ * The following constants define the individual signals which may
+ * be used to compose a signal set.
+ */
+
+#define RTEMS_SIGNAL_0 0x00000001
+#define RTEMS_SIGNAL_1 0x00000002
+#define RTEMS_SIGNAL_2 0x00000004
+#define RTEMS_SIGNAL_3 0x00000008
+#define RTEMS_SIGNAL_4 0x00000010
+#define RTEMS_SIGNAL_5 0x00000020
+#define RTEMS_SIGNAL_6 0x00000040
+#define RTEMS_SIGNAL_7 0x00000080
+#define RTEMS_SIGNAL_8 0x00000100
+#define RTEMS_SIGNAL_9 0x00000200
+#define RTEMS_SIGNAL_10 0x00000400
+#define RTEMS_SIGNAL_11 0x00000800
+#define RTEMS_SIGNAL_12 0x00001000
+#define RTEMS_SIGNAL_13 0x00002000
+#define RTEMS_SIGNAL_14 0x00004000
+#define RTEMS_SIGNAL_15 0x00008000
+#define RTEMS_SIGNAL_16 0x00010000
+#define RTEMS_SIGNAL_17 0x00020000
+#define RTEMS_SIGNAL_18 0x00040000
+#define RTEMS_SIGNAL_19 0x00080000
+#define RTEMS_SIGNAL_20 0x00100000
+#define RTEMS_SIGNAL_21 0x00200000
+#define RTEMS_SIGNAL_22 0x00400000
+#define RTEMS_SIGNAL_23 0x00800000
+#define RTEMS_SIGNAL_24 0x01000000
+#define RTEMS_SIGNAL_25 0x02000000
+#define RTEMS_SIGNAL_26 0x04000000
+#define RTEMS_SIGNAL_27 0x08000000
+#define RTEMS_SIGNAL_28 0x10000000
+#define RTEMS_SIGNAL_29 0x20000000
+#define RTEMS_SIGNAL_30 0x40000000
+#define RTEMS_SIGNAL_31 0x80000000
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/asr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/attr.h b/c/src/exec/rtems/include/rtems/rtems/attr.h
new file mode 100644
index 0000000000..8262a3a381
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/attr.h
@@ -0,0 +1,84 @@
+/* attr.h
+ *
+ * This include file contains all information about the Object Attributes
+ * Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ATTRIBUTES_h
+#define __RTEMS_ATTRIBUTES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+typedef unsigned32 rtems_attribute;
+
+/* constants */
+
+#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
+
+#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
+#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
+
+#define RTEMS_LOCAL 0x00000000 /* local resource */
+#define RTEMS_GLOBAL 0x00000002 /* global resource */
+
+#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
+#define RTEMS_PRIORITY 0x00000004 /* process by priority */
+
+#define RTEMS_COUNTING_SEMAPHORE 0x00000000
+#define RTEMS_BINARY_SEMAPHORE 0x00000010
+
+#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
+#define RTEMS_INHERIT_PRIORITY 0x00000020
+
+#define RTEMS_NO_PRIORITY_CEILING 0x00000000
+#define RTEMS_PRIORITY_CEILING 0x00000040
+
+#if ( CPU_HARDWARE_FP == TRUE )
+#define ATTRIBUTES_NOT_SUPPORTED 0
+#else
+#define ATTRIBUTES_NOT_SUPPORTED RTEMS_FLOATING_POINT
+#endif
+
+#if ( CPU_ALL_TASKS_ARE_FP == TRUE )
+#define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT
+#else
+#define ATTRIBUTES_REQUIRED 0
+#endif
+
+/*
+ * _Attributes_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs initialization for this handler.
+ *
+ * NOTE: There is no initialization required in C. Conditional compilation
+ * takes care of this in C.
+ */
+
+#define _Attributes_Handler_initialization()
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/attr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/clock.h b/c/src/exec/rtems/include/rtems/rtems/clock.h
new file mode 100644
index 0000000000..d7c032a282
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/clock.h
@@ -0,0 +1,103 @@
+/* clock.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Clock Manager. This manager provides facilities to set, obtain,
+ * and continually update the current date and time.
+ *
+ * This manager provides directives to:
+ *
+ * + set the current date and time
+ * + obtain the current date and time
+ * + announce a clock tick
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CLOCK_h
+#define __RTEMS_CLOCK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tod.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * List of things which can be returned by the rtems_clock_get directive.
+ */
+
+typedef enum {
+ RTEMS_CLOCK_GET_TOD,
+ RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ RTEMS_CLOCK_GET_TICKS_PER_SECOND,
+ RTEMS_CLOCK_GET_TIME_VALUE
+} rtems_clock_get_options;
+
+/*
+ * Standard flavor style to return TOD in for a rtems_clock_get option.
+ */
+
+typedef struct {
+ unsigned32 seconds;
+ unsigned32 microseconds;
+} rtems_clock_time_value;
+
+/*
+ * rtems_clock_get
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_get directive. It returns
+ * one of the following:
+ * + current time of day
+ * + seconds since epoch
+ * + ticks since boot
+ * + ticks per second
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+);
+
+/*
+ * rtems_clock_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_set directive. It sets
+ * the current time of day to that in the time_buffer record.
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_clock_tick
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_tick directive. It is invoked
+ * to inform RTEMS of the occurrence of a clock tick.
+ */
+
+rtems_status_code rtems_clock_tick( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/dpmem.h b/c/src/exec/rtems/include/rtems/rtems/dpmem.h
new file mode 100644
index 0000000000..fc580c1a8a
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/dpmem.h
@@ -0,0 +1,157 @@
+/* dpmem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Dual Ported Memory Manager. This manager provides a mechanism
+ * for converting addresses between internal and external representations
+ * for multiple dual-ported memory areas.
+ *
+ * Directives provided are:
+ *
+ * + create a port
+ * + get ID of a port
+ * + delete a port
+ * + convert external to internal address
+ * + convert internal to external address
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DUAL_PORTED_MEMORY_h
+#define __RTEMS_DUAL_PORTED_MEMORY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following structure defines the port control block. Each port
+ * has a control block associated with it. This control block contains
+ * all information required to support the port related operations.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *internal_base; /* base internal address */
+ void *external_base; /* base external address */
+ unsigned32 length; /* length of dual-ported area */
+} Dual_ported_memory_Control;
+
+/*
+ * The following define the internal Dual Ported Memory information.
+ */
+
+EXTERN Objects_Information _Dual_ported_memory_Information;
+
+/*
+ * _Dual_ported_memory_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+);
+
+/*
+ * rtems_port_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_create directive. The port
+ * will have the name name. The port maps onto an area of dual ported
+ * memory of length bytes which has internal_start and external_start
+ * as the internal and external starting addresses, respectively.
+ * It returns the id of the created port in ID.
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_ident directive. This directive
+ * returns the port ID associated with name. If more than one port is
+ * named name, then the port to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_delete directive. It deletes
+ * the port associated with ID.
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_port_external_to_internal
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_external_to_internal directive.
+ * It returns the internal port address which maps to the provided
+ * external port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+);
+
+/*
+ * rtems_port_internal_to_external
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the Port_internal_to_external directive.
+ * It returns the external port address which maps to the provided
+ * internal port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/dpmem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/event.h b/c/src/exec/rtems/include/rtems/rtems/event.h
new file mode 100644
index 0000000000..4cd3b1cbea
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/event.h
@@ -0,0 +1,174 @@
+/* event.h
+ *
+ * This include file contains the information pertaining to the Event
+ * Manager. This manager provides a high performance method of communication
+ * and synchronization.
+ *
+ * Directives provided are:
+ *
+ * + send an event set to a task
+ * + receive event condition
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_h
+#define __RTEMS_EVENT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/eventset.h>
+
+/*
+ * This constant is passed as the event_in to the
+ * rtems_event_receive directive to determine which events are pending.
+ */
+
+#define EVENT_CURRENT 0
+
+/*
+ * The following enumerated types indicate what happened while the event
+ * manager was in the synchronization window.
+ */
+
+typedef enum {
+ EVENT_SYNC_SYNCHRONIZED,
+ EVENT_SYNC_NOTHING_HAPPENED,
+ EVENT_SYNC_TIMEOUT,
+ EVENT_SYNC_SATISFIED
+} Event_Sync_states;
+
+/*
+ * Event_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Event_Manager_initialization( void );
+
+/*
+ * rtems_event_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_send directive. It sends
+ * event_in to the task specified by ID. If the task is blocked
+ * waiting to receive events and the posting of event_in satisfies
+ * the task's event condition, then it is unblocked.
+ */
+
+rtems_status_code rtems_event_send (
+ Objects_Id id,
+ rtems_event_set event_in
+);
+
+/*
+ * rtems_event_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_receive directive. This
+ * directive is invoked when the calling task wishes to receive
+ * the event_in event condition. One of the fields in the option_set
+ * parameter determines whether the receive request is satisfied if
+ * any or all of the events are pending. If the event condition
+ * is not satisfied immediately, then the task may block with an
+ * optional timeout of TICKS clock ticks or return immediately.
+ * This determination is based on another field in the option_set
+ * parameter. This directive returns the events received in the
+ * event_out parameter.
+ */
+
+rtems_status_code rtems_event_receive (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition event_in is
+ * satisfied. If so or if the no_wait option is enabled in option_set,
+ * then the procedure returns immediately. If neither of these
+ * conditions is true, then the calling task is blocked with an
+ * optional timeout of ticks clock ticks.
+ */
+
+void _Event_Seize (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition of the_thread
+ * has been satisfied. If so, it unblocks the_thread.
+ */
+
+void _Event_Surrender (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Event_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's event receive request
+ * has not been satisfied after the specified timeout interval.
+ * The task represented by ID will be unblocked and its status
+ * code will be set in it's control block to indicate that a timeout
+ * has occurred.
+ */
+
+void _Event_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * The following defines the synchronization flag used by the
+ * Event Manager to insure that signals sent to the currently
+ * executing thread are received properly.
+ */
+
+EXTERN volatile Event_Sync_states _Event_Sync_state;
+
+#include <rtems/rtems/eventmp.h>
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/event.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/eventmp.h b/c/src/exec/rtems/include/rtems/rtems/eventmp.h
new file mode 100644
index 0000000000..a6f5b912b0
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/eventmp.h
@@ -0,0 +1,147 @@
+/* eventmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_MP_h
+#define __RTEMS_EVENT_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/event.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote event operations.
+ */
+
+typedef enum {
+ EVENT_MP_SEND_REQUEST = 0,
+ EVENT_MP_SEND_RESPONSE = 1
+} Event_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Event_MP_Remote_operations operation;
+ rtems_event_set event_in;
+} Event_MP_Packet;
+
+/*
+ * _Event_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Event_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Event_MP_Send_request_packet (
+ Event_MP_Remote_operations operation,
+ Objects_Id event_id,
+ rtems_event_set event_in
+);
+
+/*
+ * _Event_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Event_MP_Send_response_packet (
+ Event_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Event_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Event_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Event_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a event mp packet.
+ */
+
+Event_MP_Packet *_Event_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/eventset.h b/c/src/exec/rtems/include/rtems/rtems/eventset.h
new file mode 100644
index 0000000000..0f3e122e5f
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/eventset.h
@@ -0,0 +1,89 @@
+/* eventset.h
+ *
+ * This include file contains the information pertaining to the
+ * Event Sets Handler. This handler provides methods for the manipulation
+ * of event sets which will be sent and received by tasks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_SET_h
+#define __RTEMS_EVENT_SET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following defines the type used to control event sets.
+ */
+
+typedef unsigned32 rtems_event_set;
+
+/*
+ * The following constants define the individual events which may
+ * be used to compose an event set.
+ */
+
+#define RTEMS_PENDING_EVENTS 0 /* receive pending events */
+#define RTEMS_ALL_EVENTS 0xFFFFFFFF
+
+#define RTEMS_EVENT_0 0x00000001
+#define RTEMS_EVENT_1 0x00000002
+#define RTEMS_EVENT_2 0x00000004
+#define RTEMS_EVENT_3 0x00000008
+#define RTEMS_EVENT_4 0x00000010
+#define RTEMS_EVENT_5 0x00000020
+#define RTEMS_EVENT_6 0x00000040
+#define RTEMS_EVENT_7 0x00000080
+#define RTEMS_EVENT_8 0x00000100
+#define RTEMS_EVENT_9 0x00000200
+#define RTEMS_EVENT_10 0x00000400
+#define RTEMS_EVENT_11 0x00000800
+#define RTEMS_EVENT_12 0x00001000
+#define RTEMS_EVENT_13 0x00002000
+#define RTEMS_EVENT_14 0x00004000
+#define RTEMS_EVENT_15 0x00008000
+#define RTEMS_EVENT_16 0x00010000
+#define RTEMS_EVENT_17 0x00020000
+#define RTEMS_EVENT_18 0x00040000
+#define RTEMS_EVENT_19 0x00080000
+#define RTEMS_EVENT_20 0x00100000
+#define RTEMS_EVENT_21 0x00200000
+#define RTEMS_EVENT_22 0x00400000
+#define RTEMS_EVENT_23 0x00800000
+#define RTEMS_EVENT_24 0x01000000
+#define RTEMS_EVENT_25 0x02000000
+#define RTEMS_EVENT_26 0x04000000
+#define RTEMS_EVENT_27 0x08000000
+#define RTEMS_EVENT_28 0x10000000
+#define RTEMS_EVENT_29 0x20000000
+#define RTEMS_EVENT_30 0x40000000
+#define RTEMS_EVENT_31 0x80000000
+
+
+/*
+ * The following constant is the value of an event set which
+ * has no events pending.
+ */
+
+#define EVENT_SETS_NONE_PENDING 0
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/eventset.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/intr.h b/c/src/exec/rtems/include/rtems/rtems/intr.h
new file mode 100644
index 0000000000..8681ccf9e0
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/intr.h
@@ -0,0 +1,160 @@
+/* intr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERRUPT_h
+#define __RTEMS_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * Interrupt level type
+ */
+
+typedef ISR_Level rtems_interrupt_level;
+
+/*
+ * The following type defines the control block used to manage
+ * the vectors.
+ */
+
+typedef ISR_Vector_number rtems_vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void rtems_isr;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef rtems_isr ( *rtems_isr_entry )(
+ rtems_vector_number
+ );
+
+/*
+ * _Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the interrupt manager.
+ *
+ */
+
+void _Interrupt_Manager_initialization( void );
+
+/*
+ * rtems_interrupt_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_interrupt_catch directive. This
+ * directive installs new_isr_handler as the RTEMS interrupt service
+ * routine for vector. The previous RTEMS interrupt service
+ * routine is returned in old_isr_handler.
+ */
+
+rtems_status_code rtems_interrupt_catch(
+ rtems_isr_entry new_isr_handler,
+ rtems_vector_number vector,
+ rtems_isr_entry *old_isr_handler
+);
+
+/*
+ * rtems_interrupt_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all maskable interrupts and returns the
+ * previous level in _isr_cookie.
+ */
+
+#define rtems_interrupt_disable( _isr_cookie ) \
+ _ISR_Disable(_isr_cookie)
+
+/*
+ * rtems_interrupt_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables maskable interrupts to the level indicated
+ * _isr_cookie.
+ */
+
+#define rtems_interrupt_enable( _isr_cookie ) \
+ _ISR_Enable(_isr_cookie)
+
+/*
+ * rtems_interrupt_flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables maskable interrupts to the
+ * level in _isr_cookie before redisabling them.
+ */
+
+#define rtems_interrupt_flash( _isr_cookie ) \
+ _ISR_Flash(_isr_cookie)
+
+/*
+ * rtems_interrupt_is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+#define rtems_interrupt_is_in_progress() \
+ _ISR_Is_in_progress()
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine generates an interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_cause( _interrupt_to_cause )
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the specified interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_clear( _interrupt_to_clear )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/message.h b/c/src/exec/rtems/include/rtems/rtems/message.h
new file mode 100644
index 0000000000..0469f8ddbf
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/message.h
@@ -0,0 +1,317 @@
+/* message.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message Queue Manager. This manager provides a mechanism for
+ * communication and synchronization between tasks using messages.
+ *
+ * Directives provided are:
+ *
+ * + create a queue
+ * + get ID of a queue
+ * + delete a queue
+ * + put a message at the rear of a queue
+ * + put a message at the front of a queue
+ * + broadcast N messages to a queue
+ * + receive message from a queue
+ * + flush all messages on a queue
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_h
+#define __RTEMS_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/coremsg.h>
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_SEND_REQUEST = 0,
+ MESSAGE_QUEUE_URGENT_REQUEST = 1
+} Message_queue_Submit_types;
+
+/*
+ * The following records define the control block used to manage
+ * each message queue.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ CORE_message_queue_Control message_queue;
+} Message_queue_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Message_queue_Information;
+
+/*
+ * _Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ * rtems_message_queue_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_create directive. The
+ * message queue will have the name name. If the attribute_set indicates
+ * that the message queue is to be limited in the number of messages
+ * that can be outstanding, then count indicates the maximum number of
+ * messages that will be held. It returns the id of the created
+ * message queue in ID.
+ */
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_ident directive.
+ * This directive returns the message queue ID associated with NAME.
+ * If more than one message queue is named name, then the message
+ * queue to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the message queue named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_delete directive. The
+ * message queue indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_message_queue_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+);
+
+/*
+ * rtems_message_queue_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_receive directive.
+ * This directive is invoked when the calling task wishes to receive
+ * a message from the message queue indicated by ID. The received
+ * message is to be placed in buffer. If no messages are outstanding
+ * and the option_set indicates that the task is willing to block,
+ * then the task will be blocked until a message arrives or until,
+ * optionally, timeout clock ticks have passed.
+ */
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_message_queue_flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_flush directive.
+ * This directive takes all outstanding messages for the message
+ * queue indicated by ID and returns them to the inactive message
+ * chain. The number of messages flushed is returned in COUNT.
+ */
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+);
+
+/*
+ * _Message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the directives rtems_message_queue_send
+ * and rtems_message_queue_urgent. It processes a message that is
+ * to be submitted to the designated message queue. The message will
+ * either be processed as a send 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.
+ */
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+);
+
+/*
+ * _Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+Message_queue_Control *_Message_queue_Allocate (
+ unsigned32 count,
+ unsigned32 max_message_size
+);
+
+/*
+ * _Message_queue_Translate_core_message_queue_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the core message queue
+ * status code specified.
+ */
+
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+ unsigned32 the_message_queue_status
+);
+
+/*
+ *
+ * _Message_queue_Core_message_queue_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the message was submitted to
+ * id - id of the message queue
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Core_message_queue_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/message.inl>
+#endif
+#include <rtems/rtems/msgmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/modes.h b/c/src/exec/rtems/include/rtems/rtems/modes.h
new file mode 100644
index 0000000000..34a23c7b20
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/modes.h
@@ -0,0 +1,89 @@
+/* modes.h
+ *
+ * This include file contains all constants and structures associated
+ * with the RTEMS thread and RTEMS_ASR modes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MODES_h
+#define __RTEMS_MODES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * The following type defines the control block used to manage
+ * each a mode set.
+ */
+
+typedef unsigned32 Modes_Control;
+
+/*
+ * The following constants define the individual modes and masks
+ * which may be used to compose a mode set and to alter modes.
+ */
+
+#define RTEMS_ALL_MODE_MASKS 0x0000ffff
+
+#define RTEMS_DEFAULT_MODES 0x00000000
+#define RTEMS_CURRENT_MODE 0
+
+#define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */
+#define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */
+#define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */
+#define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK
+
+#define RTEMS_PREEMPT 0x00000000 /* enable preemption */
+#define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */
+
+#define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */
+#define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */
+
+#define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */
+#define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */
+
+/*
+ * The number of bits for interrupt levels is CPU dependent.
+ * RTEMS supports 0 to 256 levels in bits 0-7 of the mode.
+ */
+
+/*PAGE
+ *
+ * RTEMS_INTERRUPT_LEVEL
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the processor dependent interrupt
+ * level which corresponds to the requested interrupt level.
+ *
+ * NOTE: RTEMS supports 256 interrupt levels using the least
+ * significant eight bits of MODES.CONTROL. On any
+ * particular CPU, fewer than 256 levels may be supported.
+ */
+
+#define RTEMS_INTERRUPT_LEVEL( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/modes.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/mp.h b/c/src/exec/rtems/include/rtems/rtems/mp.h
new file mode 100644
index 0000000000..079f55b093
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/mp.h
@@ -0,0 +1,53 @@
+/* mp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MP_h
+#define __RTEMS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *
+ * _Multiprocessing_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Multiprocessing_Manager_initialization ( void );
+
+/*
+ *
+ * rtems_multiprocessing_announce
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the MULTIPROCESSING_ANNOUNCE directive.
+ * It is invoked by the MPCI layer to indicate that an MPCI packet
+ * has been received.
+ */
+
+void rtems_multiprocessing_announce ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/msgmp.h b/c/src/exec/rtems/include/rtems/rtems/msgmp.h
new file mode 100644
index 0000000000..070ed6fcaa
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/msgmp.h
@@ -0,0 +1,175 @@
+/* msgmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_MP_h
+#define __RTEMS_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/message.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ MESSAGE_QUEUE_MP_RECEIVE_REQUEST = 3,
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE = 4,
+ MESSAGE_QUEUE_MP_SEND_REQUEST = 5,
+ MESSAGE_QUEUE_MP_SEND_RESPONSE = 6,
+ MESSAGE_QUEUE_MP_URGENT_REQUEST = 7,
+ MESSAGE_QUEUE_MP_URGENT_RESPONSE = 8,
+ MESSAGE_QUEUE_MP_BROADCAST_REQUEST = 9,
+ MESSAGE_QUEUE_MP_BROADCAST_RESPONSE = 10,
+ MESSAGE_QUEUE_MP_FLUSH_REQUEST = 11,
+ MESSAGE_QUEUE_MP_FLUSH_RESPONSE = 12
+} Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Message_queue_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+ unsigned32 count;
+ unsigned32 size;
+ unsigned32 pad0;
+ CORE_message_queue_Buffer Buffer;
+} Message_queue_MP_Packet;
+
+/*
+ * _Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_process_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Message_queue_MP_Send_request_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ void *buffer,
+ unsigned32 *size_p,
+ rtems_option option_set,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_response_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Message_queue_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/options.h b/c/src/exec/rtems/include/rtems/rtems/options.h
new file mode 100644
index 0000000000..069d7721b3
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/options.h
@@ -0,0 +1,53 @@
+/* options.h
+ *
+ * This include file contains information which defines the
+ * options available on many directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OPTIONS_h
+#define __RTEMS_OPTIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * option sets.
+ */
+
+typedef unsigned32 rtems_option;
+
+/*
+ * The following constants define the individual options which may
+ * be used to compose an option set.
+ */
+
+#define RTEMS_DEFAULT_OPTIONS 0x00000000
+
+#define RTEMS_WAIT 0x00000000 /* wait on resource */
+#define RTEMS_NO_WAIT 0x00000001 /* do not wait on resource */
+
+#define RTEMS_EVENT_ALL 0x00000000 /* wait for all events */
+#define RTEMS_EVENT_ANY 0x00000002 /* wait on any event */
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/options.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/part.h b/c/src/exec/rtems/include/rtems/rtems/part.h
new file mode 100644
index 0000000000..e06a2e4b86
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/part.h
@@ -0,0 +1,168 @@
+/* partition.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Partition Manager. This manager provides facilities to
+ * dynamically allocate memory in fixed-sized units which are returned
+ * as buffers.
+ *
+ * Directives provided are:
+ *
+ * + create a partition
+ * + get an ID of a partition
+ * + delete a partition
+ * + get a buffer from a partition
+ * + return a buffer to a partition
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_h
+#define __RTEMS_PARTITION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following defines the control block used to manage each partition.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *starting_address; /* physical address */
+ unsigned32 length; /* in bytes */
+ unsigned32 buffer_size; /* in bytes */
+ rtems_attribute attribute_set; /* attributes */
+ unsigned32 number_of_used_blocks; /* or allocated buffers */
+ Chain_Control Memory; /* buffer chain */
+} Partition_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Partition_Information;
+
+/*
+ * _Partition_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+);
+
+/*
+ * rtems_partition_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_create directive. The
+ * partition will have the name name. The memory area managed by
+ * the partition is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many buffers of
+ * buffer_size bytes as possible. The attribute_set determines if
+ * the partition is global or local. It returns the id of the
+ * created partition in ID.
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_ident directive.
+ * This directive returns the partition ID associated with name.
+ * If more than one partition is named name, then the partition
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the partition named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_delete directive. The
+ * partition indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_partition_get_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_get_buffer directive. It
+ * attempts to allocate a buffer from the partition associated with ID.
+ * If a buffer is allocated, its address is returned in buffer.
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+);
+
+/*
+ * rtems_partition_return_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_return_buffer directive. It
+ * frees the buffer to the partition associated with ID. The buffer must
+ * have been previously allocated from the same partition.
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/part.inl>
+#endif
+#include <rtems/rtems/partmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/partmp.h b/c/src/exec/rtems/include/rtems/rtems/partmp.h
new file mode 100644
index 0000000000..fd7d442dd3
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/partmp.h
@@ -0,0 +1,161 @@
+/* partmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_MP_h
+#define __RTEMS_PARTITION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/part.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote partition operations.
+ */
+
+typedef enum {
+ PARTITION_MP_ANNOUNCE_CREATE = 0,
+ PARTITION_MP_ANNOUNCE_DELETE = 1,
+ PARTITION_MP_EXTRACT_PROXY = 2,
+ PARTITION_MP_GET_BUFFER_REQUEST = 3,
+ PARTITION_MP_GET_BUFFER_RESPONSE = 4,
+ PARTITION_MP_RETURN_BUFFER_REQUEST = 5,
+ PARTITION_MP_RETURN_BUFFER_RESPONSE = 6
+} Partition_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote partition operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Partition_MP_Remote_operations operation;
+ rtems_name name;
+ void *buffer;
+ Objects_Id proxy_id;
+} Partition_MP_Packet;
+
+/*
+ * _Partition_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Partition_MP_Send_process_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Partition_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Partition_MP_Send_request_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ void *buffer
+);
+
+/*
+ * _Partition_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Partition_MP_Send_response_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Partition_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Partition_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Partition_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Partition since a partition
+ * cannot be deleted when buffers are in use.
+ */
+
+/*
+ * _Partition_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Partition_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Partition_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a partition mp packet.
+ */
+
+Partition_MP_Packet *_Partition_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/ratemon.h b/c/src/exec/rtems/include/rtems/rtems/ratemon.h
new file mode 100644
index 0000000000..a85bbcdc09
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/ratemon.h
@@ -0,0 +1,185 @@
+/* ratemon.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Rate Monotonic Manager. This manager
+ * provides facilities to implement tasks which execute in a periodic fashion.
+ *
+ * Directives provided are:
+ *
+ * + create a rate monotonic timer
+ * + cancel a period
+ * + delete a rate monotonic timer
+ * + conclude current and start the next period
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RATE_MONOTONIC_h
+#define __RTEMS_RATE_MONOTONIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the states in which a
+ * period may be.
+ */
+
+typedef enum {
+ RATE_MONOTONIC_INACTIVE, /* off chain, never initialized */
+ RATE_MONOTONIC_OWNER_IS_BLOCKING, /* on chain, owner is blocking on it */
+ RATE_MONOTONIC_ACTIVE, /* on chain, running continuously */
+ RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
+ /* was blocking on it */
+ RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */
+ /* rtems_rate_monotonic_period */
+} Rate_Monotonic_Period_states;
+
+/*
+ * The following constant is the interval passed to the rate_monontonic_period
+ * directive to obtain status information.
+ */
+
+#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following structure defines the control block used to manage
+ * each period.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Timer;
+ Rate_Monotonic_Period_states state;
+ Thread_Control *owner;
+} Rate_monotonic_Control;
+
+EXTERN Objects_Information _Rate_monotonic_Information;
+
+/*
+ * _Rate_monotonic_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+);
+
+/*
+ * rtems_rate_monotonic_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rate_monotonic_create directive. The
+ * period will have the name name. It returns the id of the
+ * created period in ID.
+ */
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_ident directive.
+ * This directive returns the period ID associated with name.
+ * If more than one period is named name, then the period
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_cancel directive. This
+ * directive stops the period associated with ID from continuing to
+ * run.
+ */
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_delete directive. The
+ * period indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_period
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_period directive. When
+ * length is non-zero, this directive initiates the period associated with
+ * ID from continuing for a period of length. If length is zero, then
+ * result is set to indicate the current state of the period.
+ */
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+);
+
+/*
+ * _Rate_monotonic_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the period represented
+ * by ID expires. If the task which owns this period is blocked
+ * waiting for the period to expire, then it is readied and the
+ * period is restarted. If the owning task is not waiting for the
+ * period to expire, then the period is placed in the EXPIRED
+ * state and not restarted.
+ */
+
+void _Rate_monotonic_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/ratemon.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/region.h b/c/src/exec/rtems/include/rtems/rtems/region.h
new file mode 100644
index 0000000000..7ee2658cd2
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/region.h
@@ -0,0 +1,234 @@
+/* region.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Region Manager. This manager provides facilities to dynamically
+ * allocate memory in variable sized units which are returned as segments.
+ *
+ * Directives provided are:
+ *
+ * + create a region
+ * + get an ID of a region
+ * + delete a region
+ * + get a segment from a region
+ * + return a segment to a region
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_h
+#define __RTEMS_REGION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/heap.h>
+#include <rtems/debug.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following records define the control block used to manage
+ * each region.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Thread_queue_Control Wait_queue; /* waiting threads */
+ void *starting_address; /* physical start addr */
+ unsigned32 length; /* physical length(bytes) */
+ unsigned32 page_size; /* in bytes */
+ unsigned32 maximum_segment_size; /* in bytes */
+ rtems_attribute attribute_set;
+ unsigned32 number_of_used_blocks; /* blocks allocated */
+ Heap_Control Memory;
+} Region_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Region_Information;
+
+/*
+ * _Region_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+);
+
+/*
+ * rtems_region_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_create directive. The
+ * region will have the name name. The memory area managed by
+ * the region is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many allocatable units of
+ * page_size bytes as possible. The attribute_set determines which
+ * thread queue discipline is used by the region. It returns the
+ * id of the created region in ID.
+ */
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_extend directive. The
+ * region will have the name name. The memory area managed by
+ * the region will be attempted to be grown by length bytes using
+ * the memory starting at starting_address.
+ */
+
+rtems_status_code rtems_region_extend(
+ Objects_Id id,
+ void *starting_address,
+ unsigned32 length
+);
+
+/*
+ * rtems_region_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_ident directive.
+ * This directive returns the region ID associated with name.
+ * If more than one region is named name, then the region
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_delete directive. The
+ * region indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_region_get_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment directive. It
+ * attempts to allocate a segment from the region associated with ID.
+ * If a segment of the requested size can be allocated, its address
+ * is returned in segment. If no segment is available, then the task
+ * may return immediately or block waiting for a segment with an optional
+ * timeout of timeout clock ticks. Whether the task blocks or returns
+ * immediately is based on the no_wait option in the option_set.
+ */
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+);
+
+/*
+ * rtems_region_get_segment_size
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment_size directive. It
+ * returns the size in bytes of the specified user memory area.
+ */
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+);
+
+/*
+ * rtems_region_return_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_return_segment directive. It
+ * frees the segment to the region associated with ID. The segment must
+ * have been previously allocated from the same region. If freeing the
+ * segment results in enough memory being available to satisfy the
+ * rtems_region_get_segment of the first blocked task, then that task and as
+ * many subsequent tasks as possible will be unblocked with their requests
+ * satisfied.
+ */
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/region.inl>
+#endif
+#include <rtems/rtems/regionmp.h>
+
+/*
+ * _Region_Debug_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to verify the integrity of a heap associated
+ * with the_region.
+ */
+
+#ifdef RTEMS_DEBUG
+
+#define _Region_Debug_Walk( _the_region, _source ) \
+ do { \
+ if ( _Debug_Is_enabled( RTEMS_DEBUG_REGION ) ) \
+ _Heap_Walk( &(_the_region)->Memory, _source, FALSE ); \
+ } while ( 0 )
+
+#else
+
+#define _Region_Debug_Walk( _the_region, _source )
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/regionmp.h b/c/src/exec/rtems/include/rtems/rtems/regionmp.h
new file mode 100644
index 0000000000..b59fe9235e
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/regionmp.h
@@ -0,0 +1,166 @@
+/* regionmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_MP_h
+#define __RTEMS_REGION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote region operations.
+ */
+
+typedef enum {
+ REGION_MP_ANNOUNCE_CREATE = 0,
+ REGION_MP_ANNOUNCE_DELETE = 1,
+ REGION_MP_EXTRACT_PROXY = 2,
+ REGION_MP_GET_SEGMENT_REQUEST = 3,
+ REGION_MP_GET_SEGMENT_RESPONSE = 4,
+ REGION_MP_RETURN_SEGMENT_REQUEST = 5,
+ REGION_MP_RETURN_SEGMENT_RESPONSE = 6
+} Region_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote region operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Region_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ unsigned32 size;
+ Objects_Id proxy_id;
+ void *segment;
+} Region_MP_Packet;
+
+/*
+ * _Region_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Region_MP_Send_process_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Region_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Region_MP_Send_request_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ void *segment,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Region_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Region_MP_Send_response_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Region_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Region_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Region_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Region since a region
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _Region_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Region_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Region_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a region mp packet.
+ */
+
+Region_MP_Packet *_Region_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h b/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h
new file mode 100644
index 0000000000..e43de773fd
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h
@@ -0,0 +1,34 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_API_h
+#define __RTEMS_API_h
+
+#include <rtems/config.h>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+);
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/sem.h b/c/src/exec/rtems/include/rtems/rtems/sem.h
new file mode 100644
index 0000000000..c4f8574b17
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/sem.h
@@ -0,0 +1,248 @@
+/* semaphore.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Semaphore Manager. This manager utilizes standard Dijkstra
+ * counting semaphores to provide synchronization and mutual exclusion
+ * capabilities.
+ *
+ * Directives provided are:
+ *
+ * + create a semaphore
+ * + get an ID of a semaphore
+ * + delete a semaphore
+ * + acquire a semaphore
+ * + release a semaphore
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_h
+#define __RTEMS_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/object.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * The following defines the control block used to manage each semaphore.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ union {
+ CORE_mutex_Control mutex;
+ CORE_semaphore_Control semaphore;
+ } Core_control;
+} Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Semaphore_Information;
+
+/*
+ * _Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+);
+
+/*
+ * rtems_semaphore_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_create directive. The
+ * semaphore will have the name name. The starting count for
+ * the semaphore is count. The attribute_set determines if
+ * the semaphore is global or local and the thread queue
+ * discipline. It returns the id of the created semaphore in ID.
+ */
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_ident directive.
+ * This directive returns the semaphore ID associated with name.
+ * If more than one semaphore is named name, then the semaphore
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the semaphore named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_delete directive. The
+ * semaphore indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_semaphore_delete(
+ rtems_id id
+);
+
+/*
+ * rtems_semaphore_obtain
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_obtain directive. It
+ * attempts to obtain a unit from the semaphore associated with ID.
+ * If a unit can be allocated, the calling task will return immediately.
+ * If no unit is available, then the task may return immediately or
+ * block waiting for a unit with an optional timeout of timeout
+ * clock ticks. Whether the task blocks or returns immediately
+ * is based on the RTEMS_NO_WAIT option in the option_set.
+ */
+
+rtems_status_code rtems_semaphore_obtain(
+ rtems_id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_semaphore_release
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_release directive. It
+ * frees a unit to the semaphore associated with ID. If a task was
+ * blocked waiting for a unit from this semaphore, then that task will
+ * be readied and the unit given to that task. Otherwise, the unit
+ * will be returned to the semaphore.
+ */
+
+rtems_status_code rtems_semaphore_release(
+ rtems_id id
+);
+
+/*
+ * _Semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the RTEMS_NO_WAIT option is enabled in
+ * option_set, then the routine returns. Otherwise, the calling task
+ * is blocked until a unit becomes available.
+ */
+
+boolean _Semaphore_Seize(
+ Semaphore_Control *the_semaphore,
+ unsigned32 option_set
+);
+
+/*
+ * _Semaphore_Translate_core_mutex_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the mutex
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_mutex_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*
+ * _Semaphore_Translate_core_semaphore_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the semaphore
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mutex_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core mutex. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_mutex_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core semaphore. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_semaphore_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/sem.inl>
+#endif
+#include <rtems/rtems/semmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/semmp.h b/c/src/exec/rtems/include/rtems/rtems/semmp.h
new file mode 100644
index 0000000000..4d9618256d
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/semmp.h
@@ -0,0 +1,163 @@
+/* semmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_MP_h
+#define __RTEMS_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ SEMAPHORE_MP_RELEASE_RESPONSE = 6
+} Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Semaphore_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+} Semaphore_MP_Packet;
+
+/*
+ * _Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_process_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Semaphore_MP_Send_request_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_response_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Semaphore_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/signal.h b/c/src/exec/rtems/include/rtems/rtems/signal.h
new file mode 100644
index 0000000000..e72bcb2dbc
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/signal.h
@@ -0,0 +1,83 @@
+/* signal.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Signal Manager. This manager provides capabilities required
+ * for asynchronous communication between tasks via signal sets.
+ *
+ * Directives provided are:
+ *
+ * + establish an asynchronous signal routine
+ * + send a signal set to a task
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_h
+#define __RTEMS_SIGNAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * _Signal_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Signal_Manager_initialization( void );
+
+/*
+ * rtems_signal_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_catch directive. This directive
+ * is used to establish asr_handler as the Asynchronous Signal Routine
+ * (RTEMS_ASR) for the calling task. The asr_handler will execute with a
+ * mode of mode_set.
+ */
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry asr_handler,
+ rtems_mode mode_set
+);
+
+/*
+ * rtems_signal_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_send directive. This directive
+ * sends the signal_set to the task specified by ID.
+ */
+
+rtems_status_code rtems_signal_send(
+ Objects_Id id,
+ rtems_signal_set signal_set
+);
+
+#include <rtems/rtems/signalmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/signalmp.h b/c/src/exec/rtems/include/rtems/rtems/signalmp.h
new file mode 100644
index 0000000000..91d36b729f
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/signalmp.h
@@ -0,0 +1,147 @@
+/* signalmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_MP_h
+#define __RTEMS_SIGNAL_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote signal operations.
+ */
+
+typedef enum {
+ SIGNAL_MP_SEND_REQUEST = 0,
+ SIGNAL_MP_SEND_RESPONSE = 1
+} Signal_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote signal operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Signal_MP_Remote_operations operation;
+ rtems_signal_set signal_in;
+} Signal_MP_Packet;
+
+/*
+ * _Signal_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Signal_MP_Send_request_packet (
+ Signal_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_signal_set signal_in
+);
+
+/*
+ * _Signal_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Signal_MP_Send_response_packet (
+ Signal_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Signal_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Signal_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Signal_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a signal mp packet.
+ */
+
+Signal_MP_Packet *_Signal_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/status.h b/c/src/exec/rtems/include/rtems/rtems/status.h
new file mode 100644
index 0000000000..23c1c830c6
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/status.h
@@ -0,0 +1,82 @@
+/* status.h
+ *
+ * This include file contains the status codes returned from the
+ * executive directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATUS_h
+#define __RTEMS_STATUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+typedef enum {
+ RTEMS_SUCCESSFUL = 0, /* successful completion */
+ RTEMS_TASK_EXITTED = 1, /* returned from a thread */
+ RTEMS_MP_NOT_CONFIGURED = 2, /* multiprocessing not configured */
+ RTEMS_INVALID_NAME = 3, /* invalid object name */
+ RTEMS_INVALID_ID = 4, /* invalid object id */
+ RTEMS_TOO_MANY = 5, /* too many */
+ RTEMS_TIMEOUT = 6, /* timed out waiting */
+ RTEMS_OBJECT_WAS_DELETED = 7, /* object deleted while waiting */
+ RTEMS_INVALID_SIZE = 8, /* specified size was invalid */
+ RTEMS_INVALID_ADDRESS = 9, /* address specified is invalid */
+ RTEMS_INVALID_NUMBER = 10, /* number was invalid */
+ RTEMS_NOT_DEFINED = 11, /* item has not been initialized */
+ RTEMS_RESOURCE_IN_USE = 12, /* resources still outstanding */
+ RTEMS_UNSATISFIED = 13, /* request not satisfied */
+ RTEMS_INCORRECT_STATE = 14, /* thread is in wrong state */
+ RTEMS_ALREADY_SUSPENDED = 15, /* thread already in state */
+ RTEMS_ILLEGAL_ON_SELF = 16, /* illegal on calling thread */
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17, /* illegal for remote object */
+ RTEMS_CALLED_FROM_ISR = 18, /* called from wrong environment */
+ RTEMS_INVALID_PRIORITY = 19, /* invalid thread priority */
+ RTEMS_INVALID_CLOCK = 20, /* invalid date/time */
+ RTEMS_INVALID_NODE = 21, /* invalid node id */
+ RTEMS_NOT_CONFIGURED = 22, /* directive not configured */
+ RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
+ RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
+ RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
+ RTEMS_NO_MEMORY = 26 /* could not get enough memory */
+} rtems_status_code;
+
+#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
+#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
+
+extern rtems_status_code _Status_Object_name_errors_to_status[];
+
+#ifdef INIT
+rtems_status_code _Status_Object_name_errors_to_status[] = {
+ RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */
+ RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */
+ RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */
+};
+#endif
+
+/*
+ * Applications are allowed to use the macros to compare status codes.
+ */
+
+#include <rtems/rtems/status.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/support.h b/c/src/exec/rtems/include/rtems/rtems/support.h
new file mode 100644
index 0000000000..3305ffd4d3
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/support.h
@@ -0,0 +1,97 @@
+/* support.h
+ *
+ * This include file contains information about support functions for
+ * the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_SUPPORT_h
+#define __RTEMS_RTEMS_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+
+/*
+ * rtems_build_name
+ *
+ * DESCRIPTION:
+ *
+ * This function returns an object name composed of the four characters
+ * C1, C2, C3, and C4.
+ *
+ * NOTE:
+ *
+ * This must be implemented as a macro for use in Configuration Tables.
+ *
+ */
+
+#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
+ ( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
+
+/*
+ * rtems_get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ *
+ */
+
+#define rtems_get_class( _id ) \
+ _Objects_Get_class( _id )
+
+/*
+ * rtems_get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ *
+ */
+
+#define rtems_get_node( _id ) \
+ _Objects_Get_node( _id )
+
+/*
+ * rtems_get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ *
+ */
+
+#define rtems_get_index( _id ) \
+ _Objects_Get_index( _id )
+
+/*
+ * Time related
+ */
+
+#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
+ TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
+#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
+ TOD_MILLISECONDS_TO_TICKS(_ms)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/support.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/taskmp.h b/c/src/exec/rtems/include/rtems/rtems/taskmp.h
new file mode 100644
index 0000000000..032d5645d1
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/taskmp.h
@@ -0,0 +1,167 @@
+/* taskmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the multiprocessing support in the task manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_MP_h
+#define __RTEMS_RTEMS_TASKS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote task operations.
+ */
+
+typedef enum {
+ RTEMS_TASKS_MP_ANNOUNCE_CREATE = 0,
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE = 1,
+ RTEMS_TASKS_MP_SUSPEND_REQUEST = 2,
+ RTEMS_TASKS_MP_SUSPEND_RESPONSE = 3,
+ RTEMS_TASKS_MP_RESUME_REQUEST = 4,
+ RTEMS_TASKS_MP_RESUME_RESPONSE = 5,
+ RTEMS_TASKS_MP_SET_PRIORITY_REQUEST = 6,
+ RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE = 7,
+ RTEMS_TASKS_MP_GET_NOTE_REQUEST = 8,
+ RTEMS_TASKS_MP_GET_NOTE_RESPONSE = 9,
+ RTEMS_TASKS_MP_SET_NOTE_REQUEST = 10,
+ RTEMS_TASKS_MP_SET_NOTE_RESPONSE = 11
+} RTEMS_tasks_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote task operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ RTEMS_tasks_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_task_priority the_priority;
+ unsigned32 notepad;
+ unsigned32 note;
+} RTEMS_tasks_MP_Packet;
+
+/*
+ * _RTEMS_tasks_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_process_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_name name
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_task_priority the_priority,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_response_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _RTEMS_tasks_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _RTEMS_tasks_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by RTEMS_tasks since a task
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _RTEMS_tasks_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*
+ * _RTEMS_tasks_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a task mp packet.
+ */
+
+RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h
new file mode 100644
index 0000000000..b86d85a562
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h
@@ -0,0 +1,419 @@
+/* tasks.h
+ *
+ * This include file contains all constants and structures associated
+ * with RTEMS tasks. This manager provides a comprehensive set of directives
+ * to create, delete, and administer tasks.
+ *
+ * Directives provided are:
+ *
+ * + create a task
+ * + get an ID of a task
+ * + start a task
+ * + restart a task
+ * + delete a task
+ * + suspend a task
+ * + resume a task
+ * + set a task's priority
+ * + change the current task's mode
+ * + get a task notepad entry
+ * + set a task notepad entry
+ * + wake up after interval
+ * + wake up when specified
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_h
+#define __RTEMS_RTEMS_TASKS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/eventset.h>
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/attr.h>
+
+/*
+ * Constant to be used as the ID of current task
+ */
+
+#define RTEMS_SELF OBJECTS_ID_OF_SELF
+
+/*
+ * This constant is passed to the rtems_task_wake_after directive as the
+ * interval when a task wishes to yield the CPU.
+ */
+
+#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
+
+/*
+ * Define the type for an RTEMS API task priority.
+ */
+
+typedef Priority_Control rtems_task_priority;
+
+#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
+
+#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1)
+#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM
+
+/*
+ * The following constant is passed to rtems_task_set_priority when the
+ * caller wants to obtain the current priority.
+ */
+
+#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM
+
+/*
+ * Notepads constants (indices into notepad array)
+ */
+
+#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */
+#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */
+#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */
+#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */
+#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */
+#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */
+#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */
+#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */
+#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */
+#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */
+#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */
+#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */
+#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */
+#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */
+#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */
+#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */
+#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */
+#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */
+
+#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1)
+
+/*
+ * External API name for Thread_Control
+ */
+
+typedef Thread_Control rtems_tcb;
+
+/*
+ * The following defines the "return type" of an RTEMS task.
+ */
+
+typedef void rtems_task;
+
+/*
+ * The following defines the argument to an RTEMS task.
+ */
+
+typedef unsigned32 rtems_task_argument;
+
+/*
+ * The following defines the type for the entry point of an RTEMS task.
+ */
+
+typedef rtems_task ( *rtems_task_entry )(
+ rtems_task_argument
+ );
+
+/*
+ * The following records define the Initialization Tasks Table.
+ * Each entry contains the information required by RTEMS to
+ * create and start a user task automatically at executive
+ * initialization time.
+ */
+
+typedef struct {
+ rtems_name name; /* task name */
+ unsigned32 stack_size; /* task stack size */
+ rtems_task_priority initial_priority; /* task priority */
+ rtems_attribute attribute_set; /* task attributes */
+ rtems_task_entry entry_point; /* task entry point */
+ rtems_mode mode_set; /* task initial mode */
+ unsigned32 argument; /* task argument */
+} rtems_initialization_tasks_table;
+
+/*
+ * This is the API specific information required by each thread for
+ * the RTEMS API to function correctly.
+ */
+
+
+typedef struct {
+ unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
+ rtems_event_set pending_events;
+ rtems_event_set event_condition;
+ ASR_Information Signal;
+} RTEMS_API_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _RTEMS_tasks_Information;
+
+/*
+ * These are used to manage the user initialization tasks.
+ */
+
+EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks;
+EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks;
+
+/*
+ * _RTEMS_tasks_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all Task Manager related data structures.
+ */
+
+void _RTEMS_tasks_Manager_initialization(
+ unsigned32 maximum_tasks,
+ unsigned32 number_of_initialization_tasks,
+ rtems_initialization_tasks_table *user_tasks
+);
+
+/*
+ * rtems_task_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_create directive. The task
+ * will have the name name. The attribute_set can be used to indicate
+ * that the task will be globally accessible or utilize floating point.
+ * The task's stack will be stack_size bytes. The task will begin
+ * execution with initial_priority and initial_modes. It returns the
+ * id of the created task in ID.
+ */
+
+rtems_status_code rtems_task_create(
+ rtems_name name,
+ rtems_task_priority initial_priority,
+ unsigned32 stack_size,
+ rtems_mode initial_modes,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_ident directive.
+ * This directive returns the task ID associated with name.
+ * If more than one task is named name, then the task to
+ * which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the task named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_task_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_delete directive. The
+ * task indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_task_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_get_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_get_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_get_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 *note
+);
+
+/*
+ * rtems_task_set_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_set_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * rtems_task_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_mode directive. The current
+ * values of the modes indicated by mask of the calling task are changed
+ * to that indicated in mode_set. The former mode of the task is
+ * returned in mode_set.
+ */
+
+rtems_status_code rtems_task_mode(
+ rtems_mode mode_set,
+ rtems_mode mask,
+ rtems_mode *previous_mode_set
+);
+
+/*
+ * rtems_task_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_restart directive. The
+ * task associated with ID is restarted at its initial entry
+ * point with the new argument.
+ */
+
+rtems_status_code rtems_task_restart(
+ Objects_Id id,
+ unsigned32 arg
+);
+
+/*
+ * rtems_task_suspend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_suspend directive. The
+ * SUSPENDED state is set for task associated with ID.
+ */
+
+rtems_status_code rtems_task_suspend(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_resume Directive. The
+ * SUSPENDED state is cleared for task associated with ID.
+ */
+
+rtems_status_code rtems_task_resume(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_priority directive. The
+ * current priority of the task associated with ID is set to
+ * new_priority. The former priority of that task is returned
+ * in old_priority.
+ */
+
+rtems_status_code rtems_task_set_priority(
+ Objects_Id id,
+ rtems_task_priority new_priority,
+ rtems_task_priority *old_priority
+);
+
+/*
+ * rtems_task_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_start directive. The
+ * starting execution point of the task associated with ID is
+ * set to entry_point with the initial argument.
+ */
+
+rtems_status_code rtems_task_start(
+ Objects_Id id,
+ rtems_task_entry entry_point,
+ unsigned32 argument
+);
+
+/*
+ * rtems_task_wake_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_when directive. The
+ * calling task is blocked until the current time of day is
+ * equal to that indicated by time_buffer.
+ */
+
+rtems_status_code rtems_task_wake_when(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_task_wake_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_after directive. The
+ * calling task is blocked until the indicated number of clock
+ * ticks have occurred.
+ */
+
+rtems_status_code rtems_task_wake_after(
+ rtems_interval ticks
+);
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Initialize_user_tasks
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Initialize_user_tasks( void );
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/tasks.inl>
+#endif
+#include <rtems/rtems/taskmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/timer.h b/c/src/exec/rtems/include/rtems/rtems/timer.h
new file mode 100644
index 0000000000..d09b80d5ff
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/timer.h
@@ -0,0 +1,207 @@
+/* timer.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Timer Manager. This manager provides
+ * facilities to configure, initiate, cancel, and delete timers which will
+ * fire at specified intervals of time.
+ *
+ * Directives provided are:
+ *
+ * + create a timer
+ * + get an ID of a timer
+ * + delete a timer
+ * + set a timer to fire after a number of ticks have passed
+ * + set a timer to fire when a specified date and time has been reached
+ * + reset a timer
+ * + cancel a time
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TIMER_h
+#define __RTEMS_TIMER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type details the classes to which a timer
+ * may belong.
+ */
+
+typedef enum {
+ TIMER_INTERVAL,
+ TIMER_TIME_OF_DAY,
+ TIMER_DORMANT
+} Timer_Classes;
+
+/*
+ * The following types define a pointer to a timer service routine.
+ */
+
+typedef void rtems_timer_service_routine;
+
+typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
+ rtems_id,
+ void *
+ );
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Timer_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each timer.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Ticker;
+ Timer_Classes the_class;
+} Timer_Control;
+
+/*
+ * _Timer_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+);
+
+/*
+ * rtems_timer_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_create directive. The
+ * timer will have the name name. It returns the id of the
+ * created timer in ID.
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_ident directive.
+ * This directive returns the timer ID associated with name.
+ * If more than one timer is named name, then the timer
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_cancel directive. It is used
+ * to stop the timer associated with ID from firing.
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_delete directive. The
+ * timer indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_fire_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_after directive. It
+ * initiates the timer associated with ID to fire in ticks clock
+ * ticks. When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_fire_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_when directive. It
+ * initiates the timer associated with ID to fire at wall_time
+ * When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_reset directive. It is used
+ * to reinitialize the interval timer associated with ID just as if
+ * rtems_timer_fire_after were re-invoked with the same arguments that
+ * were used to initiate this timer.
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/timer.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/include/rtems/rtems/types.h b/c/src/exec/rtems/include/rtems/rtems/types.h
new file mode 100644
index 0000000000..1dc8cd5373
--- /dev/null
+++ b/c/src/exec/rtems/include/rtems/rtems/types.h
@@ -0,0 +1,96 @@
+/* types.h
+ *
+ * This include file defines the types used by the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TYPES_h
+#define __RTEMS_RTEMS_TYPES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+
+/*
+ * RTEMS basic type definitions
+ */
+
+typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */
+typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */
+typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */
+
+typedef signed8 rtems_signed8; /* signed 8-bit value */
+typedef signed16 rtems_signed16; /* signed 16-bit value */
+typedef signed32 rtems_signed32; /* signed 32-bit value */
+
+/*
+ * some C++ compilers (eg: HP's) don't do 'long long'
+ */
+#if defined(__GNUC__)
+typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */
+typedef signed64 rtems_signed64; /* signed 64-bit value */
+#endif
+
+typedef single_precision rtems_single; /* single precision float */
+typedef double_precision rtems_double; /* double precision float */
+
+typedef boolean rtems_boolean;
+
+typedef unsigned32 rtems_name;
+typedef Objects_Id rtems_id;
+
+typedef Context_Control rtems_context;
+typedef Context_Control_fp rtems_context_fp;
+typedef CPU_Interrupt_frame rtems_interrupt_frame;
+
+/*
+ * Time related
+ */
+
+typedef Watchdog_Interval rtems_interval;
+typedef TOD_Control rtems_time_of_day;
+
+/*
+ * Define the type for an RTEMS API task mode.
+ */
+
+typedef Modes_Control rtems_mode;
+
+/*
+ * MPCI related entries
+ */
+
+typedef MP_packet_Classes rtems_mp_packet_classes;
+typedef MP_packet_Prefix rtems_packet_prefix;
+
+typedef MPCI_initialization_entry rtems_mpci_initialization_entry;
+typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry;
+typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry;
+typedef MPCI_send_entry rtems_mpci_send_packet_entry;
+typedef MPCI_receive_entry rtems_mpci_receive_packet_entry;
+
+typedef MPCI_Entry rtems_mpci_entry;
+
+typedef MPCI_Control rtems_mpci_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/asr.inl b/c/src/exec/rtems/inline/asr.inl
new file mode 100644
index 0000000000..fc52778875
--- /dev/null
+++ b/c/src/exec/rtems/inline/asr.inl
@@ -0,0 +1,128 @@
+/* inline/asr.inl
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_inl
+#define __INLINE_ASR_inl
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the given RTEMS_ASR information record.
+ */
+
+STATIC INLINE void _ASR_Initialize (
+ ASR_Information *information
+)
+{
+ information->is_enabled = TRUE;
+ information->handler = NULL;
+ information->mode_set = RTEMS_DEFAULT_MODES;
+ information->signals_posted = 0;
+ information->signals_pending = 0;
+ information->nest_level = 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine atomically swaps the pending and posted signal
+ * sets. This is done when the thread alters its mode in such a
+ * way that the RTEMS_ASR disable/enable flag changes.
+ */
+
+STATIC INLINE void _ASR_Swap_signals (
+ ASR_Information *information
+)
+{
+ rtems_signal_set _signals;
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ _signals = information->signals_pending;
+ information->signals_pending = information->signals_posted;
+ information->signals_posted = _signals;
+ _ISR_Enable( _level );
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given asr_handler is NULL and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Is_null_handler (
+ rtems_asr_entry asr_handler
+)
+{
+ return asr_handler == NULL;
+}
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there are signals pending in the
+ * given RTEMS_ASR information record and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Are_signals_pending (
+ ASR_Information *information
+)
+{
+ return information->signals_posted != 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given signals into the signal_set
+ * passed in. The result is returned to the user in signal_set.
+ *
+ * NOTE: This must be implemented as a macro.
+ */
+
+STATIC INLINE void _ASR_Post_signals(
+ rtems_signal_set signals,
+ rtems_signal_set *signal_set
+)
+{
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ *signal_set |= signals;
+ _ISR_Enable( _level );
+}
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/attr.inl b/c/src/exec/rtems/inline/attr.inl
new file mode 100644
index 0000000000..53c613382f
--- /dev/null
+++ b/c/src/exec/rtems/inline/attr.inl
@@ -0,0 +1,159 @@
+/* inline/attr.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ATTRIBUTES_inl
+#define __INLINE_ATTRIBUTES_inl
+
+/*PAGE
+ *
+ * _Attributes_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Set (
+ rtems_attribute new_attributes,
+ rtems_attribute attribute_set
+)
+{
+ return attribute_set | new_attributes;
+}
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Clear (
+ rtems_attribute attribute_set,
+ rtems_attribute mask
+)
+{
+ return attribute_set & ~mask;
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_floating_point(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_FLOATING_POINT );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the global object attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_global(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_GLOBAL );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the binary semaphore attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_binary_semaphore(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_BINARY_SEMAPHORE );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority inheritance attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_inherit_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_INHERIT_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority ceiling attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority_ceiling(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY_CEILING );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/dpmem.inl b/c/src/exec/rtems/inline/dpmem.inl
new file mode 100644
index 0000000000..4bd13bcd80
--- /dev/null
+++ b/c/src/exec/rtems/inline/dpmem.inl
@@ -0,0 +1,95 @@
+/* inline/dpmem.inl
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_DPMEM_inl
+#define __INLINE_DPMEM_inl
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a port control block from the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE Dual_ported_memory_Control
+ *_Dual_ported_memory_Allocate ( void )
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Allocate( &_Dual_ported_memory_Information );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a port control block to the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE void _Dual_ported_memory_Free (
+ Dual_ported_memory_Control *the_port
+)
+{
+ _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps port IDs to port control blocks. If ID
+ * corresponds to a local port, then it returns the_port control
+ * pointer which maps to ID and location is set to OBJECTS_LOCAL.
+ * Global ports are not supported, thus if ID does not map to a
+ * local port, location is set to OBJECTS_ERROR and the_port is
+ * undefined.
+ */
+
+STATIC INLINE Dual_ported_memory_Control *_Dual_ported_memory_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Get( &_Dual_ported_memory_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_port is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Dual_ported_memory_Is_null(
+ Dual_ported_memory_Control *the_port
+)
+{
+ return ( the_port == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/event.inl b/c/src/exec/rtems/inline/event.inl
new file mode 100644
index 0000000000..1f41e0a5fc
--- /dev/null
+++ b/c/src/exec/rtems/inline/event.inl
@@ -0,0 +1,21 @@
+/* inline/event.inl
+ *
+ * This include file contains the static inline implementation of
+ * macros for the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_inl
+#define __MACROS_EVENT_inl
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/eventset.inl b/c/src/exec/rtems/inline/eventset.inl
new file mode 100644
index 0000000000..ec0789b207
--- /dev/null
+++ b/c/src/exec/rtems/inline/eventset.inl
@@ -0,0 +1,91 @@
+/* inline/eventset.inl
+ *
+ * This include file contains the information pertaining to event sets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_EVENT_SET_inl
+#define __INLINE_EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if on events are posted in the event_set,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Event_sets_Is_empty(
+ rtems_event_set the_event_set
+)
+{
+ return ( the_event_set == 0 );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Post
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given new_events into the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE void _Event_sets_Post(
+ rtems_event_set the_new_events,
+ rtems_event_set *the_event_set
+)
+{
+ *the_event_set |= the_new_events;
+}
+
+/*PAGE
+ *
+ * _Event_sets_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the events in event_condition which are
+ * set in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Get(
+ rtems_event_set the_event_set,
+ rtems_event_set the_event_condition
+)
+{
+ return ( the_event_set & the_event_condition );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the events in mask from the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Clear(
+ rtems_event_set the_event_set,
+ rtems_event_set the_mask
+)
+{
+ return ( the_event_set & ~(the_mask) );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/message.inl b/c/src/exec/rtems/inline/message.inl
new file mode 100644
index 0000000000..c34ad5082a
--- /dev/null
+++ b/c/src/exec/rtems/inline/message.inl
@@ -0,0 +1,83 @@
+/* message.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+#include <rtems/score/wkspace.h>
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE boolean _Message_queue_Is_null (
+ Message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a message queue control block into
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _Message_queue_Free (
+ Message_queue_Control *the_message_queue
+)
+{
+ _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
+}
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control
+ * blocks. If ID corresponds to a local message queue, then it
+ * returns the_message_queue control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the message queue ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_message_queue is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_message_queue is undefined.
+ */
+
+STATIC INLINE Message_queue_Control *_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Message_queue_Control *)
+ _Objects_Get( &_Message_queue_Information, id, location );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/modes.inl b/c/src/exec/rtems/inline/modes.inl
new file mode 100644
index 0000000000..803febd49a
--- /dev/null
+++ b/c/src/exec/rtems/inline/modes.inl
@@ -0,0 +1,152 @@
+/* modes.inl
+ *
+ * This include file contains the static inline implementation of the
+ * inlined routines in the Mode Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the mode flags in mask
+ * are set in mode_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Mask_changed (
+ Modes_Control mode_set,
+ Modes_Control masks
+)
+{
+ return ( mode_set & masks );
+}
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that Asynchronous
+ * Signal Processing is disabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_asr_disabled (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that preemption
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_preempt (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that timeslicing
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_timeslice (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
+}
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the interrupt level portion of the mode_set.
+ */
+
+STATIC INLINE ISR_Level _Modes_Get_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ return ( mode_set & RTEMS_INTERRUPT_MASK );
+}
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * in the mode_set.
+ */
+
+STATIC INLINE void _Modes_Set_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) );
+}
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the modes in old_mode_set indicated by
+ * mask to the requested values in new_mode_set. The resulting
+ * mode set is returned in out_mode_set and the modes that changed
+ * is returned in changed.
+ */
+
+STATIC INLINE void _Modes_Change (
+ Modes_Control old_mode_set,
+ Modes_Control new_mode_set,
+ Modes_Control mask,
+ Modes_Control *out_mode_set,
+ Modes_Control *changed
+)
+{
+ Modes_Control _out_mode;
+
+ _out_mode = old_mode_set;
+ _out_mode &= ~mask;
+ _out_mode |= new_mode_set & mask;
+ *changed = _out_mode ^ old_mode_set;
+ *out_mode_set = _out_mode;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/options.inl b/c/src/exec/rtems/inline/options.inl
new file mode 100644
index 0000000000..9dba30e895
--- /dev/null
+++ b/c/src/exec/rtems/inline/options.inl
@@ -0,0 +1,55 @@
+/* options.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_NO_WAIT option is enabled in
+ * option_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_no_wait (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_NO_WAIT);
+}
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_EVENT_ANY option is enabled in
+ * OPTION_SET, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_any (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_EVENT_ANY);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/part.inl b/c/src/exec/rtems/inline/part.inl
new file mode 100644
index 0000000000..9088755aa7
--- /dev/null
+++ b/c/src/exec/rtems/inline/part.inl
@@ -0,0 +1,199 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a buffer from the_partition.
+ * If successful, it returns the address of the allocated buffer.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Partition_Allocate_buffer (
+ Partition_Control *the_partition
+)
+{
+ return _Chain_Get( &the_partition->Memory );
+}
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees the_buffer to the_partition.
+ */
+
+STATIC INLINE void _Partition_Free_buffer (
+ Partition_Control *the_partition,
+ Chain_Node *the_buffer
+)
+{
+ _Chain_Append( &the_partition->Memory, the_buffer );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is on a valid buffer
+ * boundary for the_partition, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_on_boundary (
+ void *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ unsigned32 offset;
+
+ offset = (unsigned32) _Addresses_Subtract(
+ the_buffer,
+ the_partition->starting_address
+ );
+
+ return ((offset % the_partition->buffer_size) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is a valid buffer from
+ * the_partition, otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_valid (
+ Chain_Node *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ void *starting;
+ void *ending;
+
+ starting = the_partition->starting_address;
+ ending = _Addresses_Add_offset( starting, the_partition->length );
+
+ return (
+ _Addresses_Is_in_range( the_buffer, starting, ending ) &&
+ _Partition_Is_buffer_on_boundary( the_buffer, the_partition )
+ );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the use of the specified buffer_size
+ * will result in the allocation of buffers whose first byte is
+ * properly aligned, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_size_aligned (
+ unsigned32 buffer_size
+)
+{
+ return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a partition control block from
+ * the inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Allocate ( void )
+{
+ return (Partition_Control *) _Objects_Allocate( &_Partition_Information );
+}
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a partition control block to the
+ * inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE void _Partition_Free (
+ Partition_Control *the_partition
+)
+{
+ _Objects_Free( &_Partition_Information, &the_partition->Object );
+}
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps partition IDs to partition control blocks.
+ * If ID corresponds to a local partition, then it returns
+ * the_partition control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. If the partition ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_partition is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_partition is undefined.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Partition_Control *)
+ _Objects_Get( &_Partition_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_partition is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_null (
+ Partition_Control *the_partition
+)
+{
+ return ( the_partition == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/ratemon.inl b/c/src/exec/rtems/inline/ratemon.inl
new file mode 100644
index 0000000000..0450988329
--- /dev/null
+++ b/c/src/exec/rtems/inline/ratemon.inl
@@ -0,0 +1,143 @@
+/* ratemon.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Allocate( &_Rate_monotonic_Information );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE void _Rate_monotonic_Free (
+ Rate_monotonic_Control *the_period
+)
+{
+ _Objects_Free( &_Rate_monotonic_Information, &the_period->Object );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps period IDs to period control blocks.
+ * If ID corresponds to a local period, then it returns
+ * the_period control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_period is undefined.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Get( &_Rate_monotonic_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_active (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_ACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_inactive (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_INACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the EXPIRED state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_expired (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_EXPIRED);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_null (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period == NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/region.inl b/c/src/exec/rtems/inline/region.inl
new file mode 100644
index 0000000000..aae042bed4
--- /dev/null
+++ b/c/src/exec/rtems/inline/region.inl
@@ -0,0 +1,127 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a region control block from
+ * the inactive chain of free region control blocks.
+ */
+
+STATIC INLINE Region_Control *_Region_Allocate( void )
+{
+ return (Region_Control *) _Objects_Allocate( &_Region_Information );
+}
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a region control block to the
+ * inactive chain of free region control blocks.
+ */
+
+STATIC INLINE void _Region_Free (
+ Region_Control *the_region
+)
+{
+ _Objects_Free( &_Region_Information, &the_region->Object );
+}
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps region IDs to region control blocks.
+ * If ID corresponds to a local region, then it returns
+ * the_region control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_region is undefined.
+ */
+
+STATIC INLINE Region_Control *_Region_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Region_Control *)
+ _Objects_Get( &_Region_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a segment from the_region.
+ * If successful, it returns the address of the allocated segment.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Region_Allocate_segment (
+ Region_Control *the_region,
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &the_region->Memory, size );
+}
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the_segment to the_region.
+ */
+
+STATIC INLINE boolean _Region_Free_segment (
+ Region_Control *the_region,
+ void *the_segment
+)
+{
+ return _Heap_Free( &the_region->Memory, the_segment );
+}
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_region is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Region_Is_null (
+ Region_Control *the_region
+)
+{
+ return ( the_region == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/asr.inl b/c/src/exec/rtems/inline/rtems/rtems/asr.inl
new file mode 100644
index 0000000000..fc52778875
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/asr.inl
@@ -0,0 +1,128 @@
+/* inline/asr.inl
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_inl
+#define __INLINE_ASR_inl
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the given RTEMS_ASR information record.
+ */
+
+STATIC INLINE void _ASR_Initialize (
+ ASR_Information *information
+)
+{
+ information->is_enabled = TRUE;
+ information->handler = NULL;
+ information->mode_set = RTEMS_DEFAULT_MODES;
+ information->signals_posted = 0;
+ information->signals_pending = 0;
+ information->nest_level = 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine atomically swaps the pending and posted signal
+ * sets. This is done when the thread alters its mode in such a
+ * way that the RTEMS_ASR disable/enable flag changes.
+ */
+
+STATIC INLINE void _ASR_Swap_signals (
+ ASR_Information *information
+)
+{
+ rtems_signal_set _signals;
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ _signals = information->signals_pending;
+ information->signals_pending = information->signals_posted;
+ information->signals_posted = _signals;
+ _ISR_Enable( _level );
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given asr_handler is NULL and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Is_null_handler (
+ rtems_asr_entry asr_handler
+)
+{
+ return asr_handler == NULL;
+}
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there are signals pending in the
+ * given RTEMS_ASR information record and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Are_signals_pending (
+ ASR_Information *information
+)
+{
+ return information->signals_posted != 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given signals into the signal_set
+ * passed in. The result is returned to the user in signal_set.
+ *
+ * NOTE: This must be implemented as a macro.
+ */
+
+STATIC INLINE void _ASR_Post_signals(
+ rtems_signal_set signals,
+ rtems_signal_set *signal_set
+)
+{
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ *signal_set |= signals;
+ _ISR_Enable( _level );
+}
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/attr.inl b/c/src/exec/rtems/inline/rtems/rtems/attr.inl
new file mode 100644
index 0000000000..53c613382f
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/attr.inl
@@ -0,0 +1,159 @@
+/* inline/attr.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ATTRIBUTES_inl
+#define __INLINE_ATTRIBUTES_inl
+
+/*PAGE
+ *
+ * _Attributes_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Set (
+ rtems_attribute new_attributes,
+ rtems_attribute attribute_set
+)
+{
+ return attribute_set | new_attributes;
+}
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Clear (
+ rtems_attribute attribute_set,
+ rtems_attribute mask
+)
+{
+ return attribute_set & ~mask;
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_floating_point(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_FLOATING_POINT );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the global object attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_global(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_GLOBAL );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the binary semaphore attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_binary_semaphore(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_BINARY_SEMAPHORE );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority inheritance attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_inherit_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_INHERIT_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority ceiling attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority_ceiling(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY_CEILING );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/dpmem.inl b/c/src/exec/rtems/inline/rtems/rtems/dpmem.inl
new file mode 100644
index 0000000000..4bd13bcd80
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/dpmem.inl
@@ -0,0 +1,95 @@
+/* inline/dpmem.inl
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_DPMEM_inl
+#define __INLINE_DPMEM_inl
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a port control block from the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE Dual_ported_memory_Control
+ *_Dual_ported_memory_Allocate ( void )
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Allocate( &_Dual_ported_memory_Information );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a port control block to the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE void _Dual_ported_memory_Free (
+ Dual_ported_memory_Control *the_port
+)
+{
+ _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps port IDs to port control blocks. If ID
+ * corresponds to a local port, then it returns the_port control
+ * pointer which maps to ID and location is set to OBJECTS_LOCAL.
+ * Global ports are not supported, thus if ID does not map to a
+ * local port, location is set to OBJECTS_ERROR and the_port is
+ * undefined.
+ */
+
+STATIC INLINE Dual_ported_memory_Control *_Dual_ported_memory_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Get( &_Dual_ported_memory_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_port is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Dual_ported_memory_Is_null(
+ Dual_ported_memory_Control *the_port
+)
+{
+ return ( the_port == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/event.inl b/c/src/exec/rtems/inline/rtems/rtems/event.inl
new file mode 100644
index 0000000000..1f41e0a5fc
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/event.inl
@@ -0,0 +1,21 @@
+/* inline/event.inl
+ *
+ * This include file contains the static inline implementation of
+ * macros for the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_inl
+#define __MACROS_EVENT_inl
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/eventset.inl b/c/src/exec/rtems/inline/rtems/rtems/eventset.inl
new file mode 100644
index 0000000000..ec0789b207
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/eventset.inl
@@ -0,0 +1,91 @@
+/* inline/eventset.inl
+ *
+ * This include file contains the information pertaining to event sets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_EVENT_SET_inl
+#define __INLINE_EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if on events are posted in the event_set,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Event_sets_Is_empty(
+ rtems_event_set the_event_set
+)
+{
+ return ( the_event_set == 0 );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Post
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given new_events into the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE void _Event_sets_Post(
+ rtems_event_set the_new_events,
+ rtems_event_set *the_event_set
+)
+{
+ *the_event_set |= the_new_events;
+}
+
+/*PAGE
+ *
+ * _Event_sets_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the events in event_condition which are
+ * set in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Get(
+ rtems_event_set the_event_set,
+ rtems_event_set the_event_condition
+)
+{
+ return ( the_event_set & the_event_condition );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the events in mask from the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Clear(
+ rtems_event_set the_event_set,
+ rtems_event_set the_mask
+)
+{
+ return ( the_event_set & ~(the_mask) );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/message.inl b/c/src/exec/rtems/inline/rtems/rtems/message.inl
new file mode 100644
index 0000000000..c34ad5082a
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/message.inl
@@ -0,0 +1,83 @@
+/* message.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+#include <rtems/score/wkspace.h>
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE boolean _Message_queue_Is_null (
+ Message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a message queue control block into
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _Message_queue_Free (
+ Message_queue_Control *the_message_queue
+)
+{
+ _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
+}
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control
+ * blocks. If ID corresponds to a local message queue, then it
+ * returns the_message_queue control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the message queue ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_message_queue is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_message_queue is undefined.
+ */
+
+STATIC INLINE Message_queue_Control *_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Message_queue_Control *)
+ _Objects_Get( &_Message_queue_Information, id, location );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/modes.inl b/c/src/exec/rtems/inline/rtems/rtems/modes.inl
new file mode 100644
index 0000000000..803febd49a
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/modes.inl
@@ -0,0 +1,152 @@
+/* modes.inl
+ *
+ * This include file contains the static inline implementation of the
+ * inlined routines in the Mode Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the mode flags in mask
+ * are set in mode_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Mask_changed (
+ Modes_Control mode_set,
+ Modes_Control masks
+)
+{
+ return ( mode_set & masks );
+}
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that Asynchronous
+ * Signal Processing is disabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_asr_disabled (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that preemption
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_preempt (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that timeslicing
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_timeslice (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
+}
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the interrupt level portion of the mode_set.
+ */
+
+STATIC INLINE ISR_Level _Modes_Get_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ return ( mode_set & RTEMS_INTERRUPT_MASK );
+}
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * in the mode_set.
+ */
+
+STATIC INLINE void _Modes_Set_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) );
+}
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the modes in old_mode_set indicated by
+ * mask to the requested values in new_mode_set. The resulting
+ * mode set is returned in out_mode_set and the modes that changed
+ * is returned in changed.
+ */
+
+STATIC INLINE void _Modes_Change (
+ Modes_Control old_mode_set,
+ Modes_Control new_mode_set,
+ Modes_Control mask,
+ Modes_Control *out_mode_set,
+ Modes_Control *changed
+)
+{
+ Modes_Control _out_mode;
+
+ _out_mode = old_mode_set;
+ _out_mode &= ~mask;
+ _out_mode |= new_mode_set & mask;
+ *changed = _out_mode ^ old_mode_set;
+ *out_mode_set = _out_mode;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/options.inl b/c/src/exec/rtems/inline/rtems/rtems/options.inl
new file mode 100644
index 0000000000..9dba30e895
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/options.inl
@@ -0,0 +1,55 @@
+/* options.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_NO_WAIT option is enabled in
+ * option_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_no_wait (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_NO_WAIT);
+}
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_EVENT_ANY option is enabled in
+ * OPTION_SET, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_any (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_EVENT_ANY);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/part.inl b/c/src/exec/rtems/inline/rtems/rtems/part.inl
new file mode 100644
index 0000000000..9088755aa7
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/part.inl
@@ -0,0 +1,199 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a buffer from the_partition.
+ * If successful, it returns the address of the allocated buffer.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Partition_Allocate_buffer (
+ Partition_Control *the_partition
+)
+{
+ return _Chain_Get( &the_partition->Memory );
+}
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees the_buffer to the_partition.
+ */
+
+STATIC INLINE void _Partition_Free_buffer (
+ Partition_Control *the_partition,
+ Chain_Node *the_buffer
+)
+{
+ _Chain_Append( &the_partition->Memory, the_buffer );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is on a valid buffer
+ * boundary for the_partition, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_on_boundary (
+ void *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ unsigned32 offset;
+
+ offset = (unsigned32) _Addresses_Subtract(
+ the_buffer,
+ the_partition->starting_address
+ );
+
+ return ((offset % the_partition->buffer_size) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is a valid buffer from
+ * the_partition, otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_valid (
+ Chain_Node *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ void *starting;
+ void *ending;
+
+ starting = the_partition->starting_address;
+ ending = _Addresses_Add_offset( starting, the_partition->length );
+
+ return (
+ _Addresses_Is_in_range( the_buffer, starting, ending ) &&
+ _Partition_Is_buffer_on_boundary( the_buffer, the_partition )
+ );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the use of the specified buffer_size
+ * will result in the allocation of buffers whose first byte is
+ * properly aligned, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_size_aligned (
+ unsigned32 buffer_size
+)
+{
+ return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a partition control block from
+ * the inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Allocate ( void )
+{
+ return (Partition_Control *) _Objects_Allocate( &_Partition_Information );
+}
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a partition control block to the
+ * inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE void _Partition_Free (
+ Partition_Control *the_partition
+)
+{
+ _Objects_Free( &_Partition_Information, &the_partition->Object );
+}
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps partition IDs to partition control blocks.
+ * If ID corresponds to a local partition, then it returns
+ * the_partition control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. If the partition ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_partition is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_partition is undefined.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Partition_Control *)
+ _Objects_Get( &_Partition_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_partition is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_null (
+ Partition_Control *the_partition
+)
+{
+ return ( the_partition == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/ratemon.inl b/c/src/exec/rtems/inline/rtems/rtems/ratemon.inl
new file mode 100644
index 0000000000..0450988329
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/ratemon.inl
@@ -0,0 +1,143 @@
+/* ratemon.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Allocate( &_Rate_monotonic_Information );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE void _Rate_monotonic_Free (
+ Rate_monotonic_Control *the_period
+)
+{
+ _Objects_Free( &_Rate_monotonic_Information, &the_period->Object );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps period IDs to period control blocks.
+ * If ID corresponds to a local period, then it returns
+ * the_period control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_period is undefined.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Get( &_Rate_monotonic_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_active (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_ACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_inactive (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_INACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the EXPIRED state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_expired (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_EXPIRED);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_null (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period == NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/region.inl b/c/src/exec/rtems/inline/rtems/rtems/region.inl
new file mode 100644
index 0000000000..aae042bed4
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/region.inl
@@ -0,0 +1,127 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a region control block from
+ * the inactive chain of free region control blocks.
+ */
+
+STATIC INLINE Region_Control *_Region_Allocate( void )
+{
+ return (Region_Control *) _Objects_Allocate( &_Region_Information );
+}
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a region control block to the
+ * inactive chain of free region control blocks.
+ */
+
+STATIC INLINE void _Region_Free (
+ Region_Control *the_region
+)
+{
+ _Objects_Free( &_Region_Information, &the_region->Object );
+}
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps region IDs to region control blocks.
+ * If ID corresponds to a local region, then it returns
+ * the_region control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_region is undefined.
+ */
+
+STATIC INLINE Region_Control *_Region_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Region_Control *)
+ _Objects_Get( &_Region_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a segment from the_region.
+ * If successful, it returns the address of the allocated segment.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Region_Allocate_segment (
+ Region_Control *the_region,
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &the_region->Memory, size );
+}
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the_segment to the_region.
+ */
+
+STATIC INLINE boolean _Region_Free_segment (
+ Region_Control *the_region,
+ void *the_segment
+)
+{
+ return _Heap_Free( &the_region->Memory, the_segment );
+}
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_region is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Region_Is_null (
+ Region_Control *the_region
+)
+{
+ return ( the_region == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/sem.inl b/c/src/exec/rtems/inline/rtems/rtems/sem.inl
new file mode 100644
index 0000000000..c80431f9b1
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/sem.inl
@@ -0,0 +1,93 @@
+/* sem.inl
+ *
+ * This file contains the static inlin implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Allocate( void )
+{
+ return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _Semaphore_Free (
+ Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Semaphore_Control *)
+ _Objects_Get( &_Semaphore_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Semaphore_Is_null (
+ Semaphore_Control *the_semaphore
+)
+{
+ return ( the_semaphore == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/status.inl b/c/src/exec/rtems/inline/rtems/rtems/status.inl
new file mode 100644
index 0000000000..f85b4c6d0b
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/status.inl
@@ -0,0 +1,56 @@
+/* inline/status.inl
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_STATUS_inl
+#define __INLINE_STATUS_inl
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_is_status_successful(
+ rtems_status_code code
+)
+{
+ return (code == RTEMS_SUCCESSFUL);
+}
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code1 is equal to code2,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_are_statuses_equal(
+ rtems_status_code code1,
+ rtems_status_code code2
+)
+{
+ return (code1 == code2);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/support.inl b/c/src/exec/rtems/inline/rtems/rtems/support.inl
new file mode 100644
index 0000000000..856b24e7f9
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/support.inl
@@ -0,0 +1,61 @@
+/* support.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the name is valid, and FALSE otherwise.
+ */
+
+STATIC INLINE rtems_boolean rtems_is_name_valid (
+ rtems_name name
+)
+{
+ return ( name != 0 );
+}
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ * DESCRIPTION:
+ *
+ * This function breaks the object name into the four component
+ * characters C1, C2, C3, and C4.
+ */
+
+STATIC INLINE void rtems_name_to_characters(
+ rtems_name name,
+ char *c1,
+ char *c2,
+ char *c3,
+ char *c4
+)
+{
+ *c1 = (name >> 24) & 0xff;
+ *c2 = (name >> 16) & 0xff;
+ *c3 = (name >> 8) & 0xff;
+ *c4 = name & 0xff;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl
new file mode 100644
index 0000000000..6caa34ea80
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl
@@ -0,0 +1,90 @@
+/* tasks.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a task control block from
+ * the inactive chain of free task control blocks.
+ */
+
+STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a task control block to the
+ * inactive chain of free task control blocks.
+ */
+
+STATIC INLINE void _RTEMS_tasks_Free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free(
+ _Objects_Get_information( the_task->Object.id ),
+ &the_task->Object
+ );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ *
+ * DESCRIPTION:
+ *
+ * This function converts an RTEMS API priority into a core priority.
+ */
+
+STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core(
+ rtems_task_priority priority
+)
+{
+ return (Priority_Control) priority;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority is a valid user task priority
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid (
+ rtems_task_priority the_priority
+)
+{
+ return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
+ ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/rtems/rtems/timer.inl b/c/src/exec/rtems/inline/rtems/rtems/timer.inl
new file mode 100644
index 0000000000..dedcdffa36
--- /dev/null
+++ b/c/src/exec/rtems/inline/rtems/rtems/timer.inl
@@ -0,0 +1,142 @@
+/* timer.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a timer control block from
+ * the inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Allocate( void )
+{
+ return (Timer_Control *) _Objects_Allocate( &_Timer_Information );
+}
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a timer control block to the
+ * inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE void _Timer_Free (
+ Timer_Control *the_timer
+)
+{
+ _Objects_Free( &_Timer_Information, &the_timer->Object );
+}
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps timer IDs to timer control blocks.
+ * If ID corresponds to a local timer, then it returns
+ * the timer control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Timer_Control *)
+ _Objects_Get( &_Timer_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_interval_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_INTERVAL );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_timer_of_day_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_TIME_OF_DAY );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of a DORMANT
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_dormant_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_DORMANT );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_timer is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_null (
+ Timer_Control *the_timer
+)
+{
+ return ( the_timer == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/sem.inl b/c/src/exec/rtems/inline/sem.inl
new file mode 100644
index 0000000000..c80431f9b1
--- /dev/null
+++ b/c/src/exec/rtems/inline/sem.inl
@@ -0,0 +1,93 @@
+/* sem.inl
+ *
+ * This file contains the static inlin implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Allocate( void )
+{
+ return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _Semaphore_Free (
+ Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Semaphore_Control *)
+ _Objects_Get( &_Semaphore_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Semaphore_Is_null (
+ Semaphore_Control *the_semaphore
+)
+{
+ return ( the_semaphore == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/status.inl b/c/src/exec/rtems/inline/status.inl
new file mode 100644
index 0000000000..f85b4c6d0b
--- /dev/null
+++ b/c/src/exec/rtems/inline/status.inl
@@ -0,0 +1,56 @@
+/* inline/status.inl
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_STATUS_inl
+#define __INLINE_STATUS_inl
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_is_status_successful(
+ rtems_status_code code
+)
+{
+ return (code == RTEMS_SUCCESSFUL);
+}
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code1 is equal to code2,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_are_statuses_equal(
+ rtems_status_code code1,
+ rtems_status_code code2
+)
+{
+ return (code1 == code2);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/support.inl b/c/src/exec/rtems/inline/support.inl
new file mode 100644
index 0000000000..856b24e7f9
--- /dev/null
+++ b/c/src/exec/rtems/inline/support.inl
@@ -0,0 +1,61 @@
+/* support.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the name is valid, and FALSE otherwise.
+ */
+
+STATIC INLINE rtems_boolean rtems_is_name_valid (
+ rtems_name name
+)
+{
+ return ( name != 0 );
+}
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ * DESCRIPTION:
+ *
+ * This function breaks the object name into the four component
+ * characters C1, C2, C3, and C4.
+ */
+
+STATIC INLINE void rtems_name_to_characters(
+ rtems_name name,
+ char *c1,
+ char *c2,
+ char *c3,
+ char *c4
+)
+{
+ *c1 = (name >> 24) & 0xff;
+ *c2 = (name >> 16) & 0xff;
+ *c3 = (name >> 8) & 0xff;
+ *c4 = name & 0xff;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/tasks.inl b/c/src/exec/rtems/inline/tasks.inl
new file mode 100644
index 0000000000..6caa34ea80
--- /dev/null
+++ b/c/src/exec/rtems/inline/tasks.inl
@@ -0,0 +1,90 @@
+/* tasks.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a task control block from
+ * the inactive chain of free task control blocks.
+ */
+
+STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a task control block to the
+ * inactive chain of free task control blocks.
+ */
+
+STATIC INLINE void _RTEMS_tasks_Free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free(
+ _Objects_Get_information( the_task->Object.id ),
+ &the_task->Object
+ );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ *
+ * DESCRIPTION:
+ *
+ * This function converts an RTEMS API priority into a core priority.
+ */
+
+STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core(
+ rtems_task_priority priority
+)
+{
+ return (Priority_Control) priority;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority is a valid user task priority
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid (
+ rtems_task_priority the_priority
+)
+{
+ return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
+ ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/inline/timer.inl b/c/src/exec/rtems/inline/timer.inl
new file mode 100644
index 0000000000..dedcdffa36
--- /dev/null
+++ b/c/src/exec/rtems/inline/timer.inl
@@ -0,0 +1,142 @@
+/* timer.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a timer control block from
+ * the inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Allocate( void )
+{
+ return (Timer_Control *) _Objects_Allocate( &_Timer_Information );
+}
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a timer control block to the
+ * inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE void _Timer_Free (
+ Timer_Control *the_timer
+)
+{
+ _Objects_Free( &_Timer_Information, &the_timer->Object );
+}
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps timer IDs to timer control blocks.
+ * If ID corresponds to a local timer, then it returns
+ * the timer control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Timer_Control *)
+ _Objects_Get( &_Timer_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_interval_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_INTERVAL );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_timer_of_day_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_TIME_OF_DAY );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of a DORMANT
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_dormant_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_DORMANT );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_timer is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_null (
+ Timer_Control *the_timer
+)
+{
+ return ( the_timer == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/asr.inl b/c/src/exec/rtems/macros/asr.inl
new file mode 100644
index 0000000000..d6806b00f6
--- /dev/null
+++ b/c/src/exec/rtems/macros/asr.inl
@@ -0,0 +1,90 @@
+/* macros/asr.h
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_h
+#define __INLINE_ASR_h
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ */
+
+#define _ASR_Initialize( _information ) \
+{ \
+ (_information)->is_enabled = TRUE; \
+ (_information)->handler = NULL; \
+ (_information)->mode_set = RTEMS_DEFAULT_MODES; \
+ (_information)->signals_posted = 0; \
+ (_information)->signals_pending = 0; \
+ (_information)->nest_level = 0; \
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ */
+
+#define _ASR_Swap_signals( _information ) \
+{ \
+ rtems_signal_set _signals; \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ _signals = (_information)->signals_pending; \
+ (_information)->signals_pending = (_information)->signals_posted; \
+ (_information)->signals_posted = _signals; \
+ _ISR_Enable( _level ); \
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ */
+
+#define _ASR_Is_null_handler( _asr_handler ) \
+ ( (_asr_handler) == NULL )
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ */
+
+#define _ASR_Are_signals_pending( _information ) \
+ ( (_information)->signals_posted != 0 )
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ */
+
+#define _ASR_Post_signals( _signals, _signal_set ) \
+ do { \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ *(_signal_set) |= (_signals); \
+ _ISR_Enable( _level ); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/attr.inl b/c/src/exec/rtems/macros/attr.inl
new file mode 100644
index 0000000000..27231871ba
--- /dev/null
+++ b/c/src/exec/rtems/macros/attr.inl
@@ -0,0 +1,91 @@
+/* macros/attr.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ATTRIBUTES_h
+#define __MACROS_ATTRIBUTES_h
+
+/*PAGE
+ *
+ * _Attributes_Set
+ */
+
+#define _Attributes_Set( _new_attributes, _attribute_set ) \
+ ( (_attribute_set) | (_new_attributes) )
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ */
+
+#define _Attributes_Clear( _attribute_set, _mask ) \
+ ( (_attribute_set) & ~(_mask) )
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ */
+
+#define _Attributes_Is_floating_point( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_FLOATING_POINT )
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ */
+
+#define _Attributes_Is_global( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_GLOBAL )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ */
+
+#define _Attributes_Is_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ */
+
+#define _Attributes_Is_binary_semaphore( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_BINARY_SEMAPHORE )
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ */
+
+#define _Attributes_Is_inherit_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_INHERIT_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ */
+
+#define _Attributes_Is_priority_ceiling( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY_CEILING )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/dpmem.inl b/c/src/exec/rtems/macros/dpmem.inl
new file mode 100644
index 0000000000..3e1d7bce95
--- /dev/null
+++ b/c/src/exec/rtems/macros/dpmem.inl
@@ -0,0 +1,59 @@
+/* macros/dpmem.h
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_DPMEM_h
+#define __MACROS_DPMEM_h
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ */
+
+#define _Dual_ported_memory_Allocate() \
+ (Dual_ported_memory_Control *) \
+ _Objects_Allocate( &_Dual_ported_memory_Information )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ */
+
+#define _Dual_ported_memory_Free( _the_port ) \
+ _Objects_Free( &_Dual_ported_memory_Information, &(_the_port)->Object )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ */
+
+#define _Dual_ported_memory_Get( _id, _location ) \
+ (Dual_ported_memory_Control *) \
+ _Objects_Get( &_Dual_ported_memory_Information, (_id), (_location) )
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ */
+
+#define _Dual_ported_memory_Is_null( _the_port ) \
+ ( (_the_port) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/event.inl b/c/src/exec/rtems/macros/event.inl
new file mode 100644
index 0000000000..e37f6813bf
--- /dev/null
+++ b/c/src/exec/rtems/macros/event.inl
@@ -0,0 +1,21 @@
+/* macros/event.h
+ *
+ * This include file contains the implementation of macros for
+ * the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_h
+#define __MACROS_EVENT_h
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/eventset.inl b/c/src/exec/rtems/macros/eventset.inl
new file mode 100644
index 0000000000..1803d18637
--- /dev/null
+++ b/c/src/exec/rtems/macros/eventset.inl
@@ -0,0 +1,53 @@
+/* eventset.inl
+ *
+ * This include file contains the macro implementation of inlined
+ * routines in the event set object.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EVENT_SET_inl
+#define __EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Is_empty( _the_event_set ) \
+ ((_the_event_set) == 0 )
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Post( _the_new_events, _the_event_set ) \
+ *(_the_event_set) |= (_the_new_events)
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Get( _the_event_set, _the_event_condition ) \
+ ((_the_event_set) & (_the_event_condition))
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ */
+
+#define _Event_sets_Clear( _the_event_set, _the_mask ) \
+ ((_the_event_set) & ~(_the_mask))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/message.inl b/c/src/exec/rtems/macros/message.inl
new file mode 100644
index 0000000000..62b6ac0ceb
--- /dev/null
+++ b/c/src/exec/rtems/macros/message.inl
@@ -0,0 +1,49 @@
+/* message.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ */
+
+#define _Message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ */
+
+#define _Message_queue_Free( _the_message_queue ) \
+ _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ */
+
+#define _Message_queue_Get( _id, _location ) \
+ (Message_queue_Control *) \
+ _Objects_Get( &_Message_queue_Information, (_id), (_location) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/modes.inl b/c/src/exec/rtems/macros/modes.inl
new file mode 100644
index 0000000000..a7dea6516d
--- /dev/null
+++ b/c/src/exec/rtems/macros/modes.inl
@@ -0,0 +1,92 @@
+/* modes.inl
+ *
+ * This include file contains the macro implementation of the
+ * inlined routines in the Mode Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ */
+
+#define _Modes_Mask_changed( _mode_set, _masks ) \
+ ( (_mode_set) & (_masks) )
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ */
+
+#define _Modes_Is_asr_disabled( _mode_set ) \
+ (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR)
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ */
+
+#define _Modes_Is_preempt( _mode_set ) \
+ ( ( (_mode_set) & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT )
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ */
+
+#define _Modes_Is_timeslice( _mode_set ) \
+ (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE)
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ */
+
+#define _Modes_Get_interrupt_level( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ */
+
+#define _Modes_Set_interrupt_level( _mode_set ) \
+ _ISR_Set_level( _Modes_Get_interrupt_level( (_mode_set) ) )
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ */
+
+#define _Modes_Change( _old_mode_set, _new_mode_set, \
+ _mask, _out_mode_set, _changed ) \
+ { Modes_Control _out_mode; \
+ \
+ _out_mode = (_old_mode_set); \
+ _out_mode &= ~(_mask); \
+ _out_mode |= (_new_mode_set) & (_mask); \
+ *(_changed) = _out_mode ^ (_old_mode_set); \
+ *(_out_mode_set) = _out_mode; \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/options.inl b/c/src/exec/rtems/macros/options.inl
new file mode 100644
index 0000000000..7c14e4fe4f
--- /dev/null
+++ b/c/src/exec/rtems/macros/options.inl
@@ -0,0 +1,39 @@
+/* options.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ */
+
+#define _Options_Is_no_wait( _option_set ) \
+ ( (_option_set) & RTEMS_NO_WAIT )
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ */
+
+#define _Options_Is_any( _option_set ) \
+ ( (_option_set) & RTEMS_EVENT_ANY )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/part.inl b/c/src/exec/rtems/macros/part.inl
new file mode 100644
index 0000000000..55c188b210
--- /dev/null
+++ b/c/src/exec/rtems/macros/part.inl
@@ -0,0 +1,117 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ */
+
+#define _Partition_Allocate_buffer( _the_partition ) \
+ _Chain_Get( &(_the_partition)->Memory )
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ */
+
+#define _Partition_Free_buffer( _the_partition, _the_buffer ) \
+ _Chain_Append( &(_the_partition)->Memory, (_the_buffer) )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ */
+
+#define _Partition_Is_buffer_on_boundary( _the_buffer, _the_partition ) \
+ ((((unsigned32) _Addresses_Subtract( \
+ (_the_buffer), \
+ (_the_partition)->starting_address ) \
+ ) % \
+ (_the_partition)->buffer_size) == 0)
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ */
+
+#define _Partition_Is_buffer_valid( _the_buffer, _the_partition ) \
+ ( \
+ _Addresses_Is_in_range( \
+ (_the_buffer), \
+ (_the_partition)->starting_address, \
+ _Addresses_Add_offset( \
+ (_the_partition)->starting_address, \
+ (_the_partition)->length \
+ ) \
+ ) && \
+ _Partition_Is_buffer_on_boundary( (_the_buffer), (_the_partition) ) \
+ )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ */
+
+#define _Partition_Is_buffer_size_aligned( _buffer_size ) \
+ ((_buffer_size) % CPU_PARTITION_ALIGNMENT == 0)
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ */
+
+#define _Partition_Allocate() \
+ (Partition_Control *) _Objects_Allocate( &_Partition_Information )
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ */
+
+#define _Partition_Free( _the_partition ) \
+ _Objects_Free( &_Partition_Information, &(_the_partition)->Object )
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ */
+
+#define _Partition_Get( _id, _location ) \
+ (Partition_Control *) \
+ _Objects_Get( &_Partition_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ */
+
+#define _Partition_Is_null( _the_partition ) \
+ ( (_the_partition) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/ratemon.inl b/c/src/exec/rtems/macros/ratemon.inl
new file mode 100644
index 0000000000..ebb182e6f1
--- /dev/null
+++ b/c/src/exec/rtems/macros/ratemon.inl
@@ -0,0 +1,85 @@
+/* ratemon.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ */
+
+#define _Rate_monotonic_Allocate() \
+ (Rate_monotonic_Control *) \
+ _Objects_Allocate( &_Rate_monotonic_Information )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ */
+
+#define _Rate_monotonic_Free( _the_period ) \
+ _Objects_Free( &_Rate_monotonic_Information, &(_the_period)->Object )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ */
+
+#define _Rate_monotonic_Get( _id, _location ) \
+ (Rate_monotonic_Control *) \
+ _Objects_Get( &_Rate_monotonic_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ */
+
+#define _Rate_monotonic_Is_active( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_ACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ */
+
+#define _Rate_monotonic_Is_inactive( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_INACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ */
+
+#define _Rate_monotonic_Is_expired( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_EXPIRED)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ */
+
+#define _Rate_monotonic_Is_null( _the_period ) ( (_the_period) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/region.inl b/c/src/exec/rtems/macros/region.inl
new file mode 100644
index 0000000000..667d77e307
--- /dev/null
+++ b/c/src/exec/rtems/macros/region.inl
@@ -0,0 +1,75 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ */
+
+#define _Region_Allocate() \
+ (Region_Control *) _Objects_Allocate( &_Region_Information )
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ */
+
+#define _Region_Free( _the_region ) \
+ _Objects_Free( &_Region_Information, &(_the_region)->Object )
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ */
+
+#define _Region_Get( _id, _location ) \
+ (Region_Control *) \
+ _Objects_Get( &_Region_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ */
+
+#define _Region_Allocate_segment( _the_region, _size ) \
+ _Heap_Allocate( &(_the_region)->Memory, (_size) )
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ */
+
+#define _Region_Free_segment( _the_region, _the_segment ) \
+ _Heap_Free( &(_the_region)->Memory, (_the_segment) )
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ */
+
+#define _Region_Is_null( _the_region ) ( (_the_region) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/asr.inl b/c/src/exec/rtems/macros/rtems/rtems/asr.inl
new file mode 100644
index 0000000000..d6806b00f6
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/asr.inl
@@ -0,0 +1,90 @@
+/* macros/asr.h
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_h
+#define __INLINE_ASR_h
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ */
+
+#define _ASR_Initialize( _information ) \
+{ \
+ (_information)->is_enabled = TRUE; \
+ (_information)->handler = NULL; \
+ (_information)->mode_set = RTEMS_DEFAULT_MODES; \
+ (_information)->signals_posted = 0; \
+ (_information)->signals_pending = 0; \
+ (_information)->nest_level = 0; \
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ */
+
+#define _ASR_Swap_signals( _information ) \
+{ \
+ rtems_signal_set _signals; \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ _signals = (_information)->signals_pending; \
+ (_information)->signals_pending = (_information)->signals_posted; \
+ (_information)->signals_posted = _signals; \
+ _ISR_Enable( _level ); \
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ */
+
+#define _ASR_Is_null_handler( _asr_handler ) \
+ ( (_asr_handler) == NULL )
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ */
+
+#define _ASR_Are_signals_pending( _information ) \
+ ( (_information)->signals_posted != 0 )
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ */
+
+#define _ASR_Post_signals( _signals, _signal_set ) \
+ do { \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ *(_signal_set) |= (_signals); \
+ _ISR_Enable( _level ); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/attr.inl b/c/src/exec/rtems/macros/rtems/rtems/attr.inl
new file mode 100644
index 0000000000..27231871ba
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/attr.inl
@@ -0,0 +1,91 @@
+/* macros/attr.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ATTRIBUTES_h
+#define __MACROS_ATTRIBUTES_h
+
+/*PAGE
+ *
+ * _Attributes_Set
+ */
+
+#define _Attributes_Set( _new_attributes, _attribute_set ) \
+ ( (_attribute_set) | (_new_attributes) )
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ */
+
+#define _Attributes_Clear( _attribute_set, _mask ) \
+ ( (_attribute_set) & ~(_mask) )
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ */
+
+#define _Attributes_Is_floating_point( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_FLOATING_POINT )
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ */
+
+#define _Attributes_Is_global( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_GLOBAL )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ */
+
+#define _Attributes_Is_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ */
+
+#define _Attributes_Is_binary_semaphore( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_BINARY_SEMAPHORE )
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ */
+
+#define _Attributes_Is_inherit_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_INHERIT_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ */
+
+#define _Attributes_Is_priority_ceiling( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY_CEILING )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/dpmem.inl b/c/src/exec/rtems/macros/rtems/rtems/dpmem.inl
new file mode 100644
index 0000000000..3e1d7bce95
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/dpmem.inl
@@ -0,0 +1,59 @@
+/* macros/dpmem.h
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_DPMEM_h
+#define __MACROS_DPMEM_h
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ */
+
+#define _Dual_ported_memory_Allocate() \
+ (Dual_ported_memory_Control *) \
+ _Objects_Allocate( &_Dual_ported_memory_Information )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ */
+
+#define _Dual_ported_memory_Free( _the_port ) \
+ _Objects_Free( &_Dual_ported_memory_Information, &(_the_port)->Object )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ */
+
+#define _Dual_ported_memory_Get( _id, _location ) \
+ (Dual_ported_memory_Control *) \
+ _Objects_Get( &_Dual_ported_memory_Information, (_id), (_location) )
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ */
+
+#define _Dual_ported_memory_Is_null( _the_port ) \
+ ( (_the_port) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/event.inl b/c/src/exec/rtems/macros/rtems/rtems/event.inl
new file mode 100644
index 0000000000..e37f6813bf
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/event.inl
@@ -0,0 +1,21 @@
+/* macros/event.h
+ *
+ * This include file contains the implementation of macros for
+ * the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_h
+#define __MACROS_EVENT_h
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/eventset.inl b/c/src/exec/rtems/macros/rtems/rtems/eventset.inl
new file mode 100644
index 0000000000..1803d18637
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/eventset.inl
@@ -0,0 +1,53 @@
+/* eventset.inl
+ *
+ * This include file contains the macro implementation of inlined
+ * routines in the event set object.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EVENT_SET_inl
+#define __EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Is_empty( _the_event_set ) \
+ ((_the_event_set) == 0 )
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Post( _the_new_events, _the_event_set ) \
+ *(_the_event_set) |= (_the_new_events)
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Get( _the_event_set, _the_event_condition ) \
+ ((_the_event_set) & (_the_event_condition))
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ */
+
+#define _Event_sets_Clear( _the_event_set, _the_mask ) \
+ ((_the_event_set) & ~(_the_mask))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/message.inl b/c/src/exec/rtems/macros/rtems/rtems/message.inl
new file mode 100644
index 0000000000..62b6ac0ceb
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/message.inl
@@ -0,0 +1,49 @@
+/* message.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ */
+
+#define _Message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ */
+
+#define _Message_queue_Free( _the_message_queue ) \
+ _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ */
+
+#define _Message_queue_Get( _id, _location ) \
+ (Message_queue_Control *) \
+ _Objects_Get( &_Message_queue_Information, (_id), (_location) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/modes.inl b/c/src/exec/rtems/macros/rtems/rtems/modes.inl
new file mode 100644
index 0000000000..a7dea6516d
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/modes.inl
@@ -0,0 +1,92 @@
+/* modes.inl
+ *
+ * This include file contains the macro implementation of the
+ * inlined routines in the Mode Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ */
+
+#define _Modes_Mask_changed( _mode_set, _masks ) \
+ ( (_mode_set) & (_masks) )
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ */
+
+#define _Modes_Is_asr_disabled( _mode_set ) \
+ (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR)
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ */
+
+#define _Modes_Is_preempt( _mode_set ) \
+ ( ( (_mode_set) & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT )
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ */
+
+#define _Modes_Is_timeslice( _mode_set ) \
+ (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE)
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ */
+
+#define _Modes_Get_interrupt_level( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ */
+
+#define _Modes_Set_interrupt_level( _mode_set ) \
+ _ISR_Set_level( _Modes_Get_interrupt_level( (_mode_set) ) )
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ */
+
+#define _Modes_Change( _old_mode_set, _new_mode_set, \
+ _mask, _out_mode_set, _changed ) \
+ { Modes_Control _out_mode; \
+ \
+ _out_mode = (_old_mode_set); \
+ _out_mode &= ~(_mask); \
+ _out_mode |= (_new_mode_set) & (_mask); \
+ *(_changed) = _out_mode ^ (_old_mode_set); \
+ *(_out_mode_set) = _out_mode; \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/options.inl b/c/src/exec/rtems/macros/rtems/rtems/options.inl
new file mode 100644
index 0000000000..7c14e4fe4f
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/options.inl
@@ -0,0 +1,39 @@
+/* options.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ */
+
+#define _Options_Is_no_wait( _option_set ) \
+ ( (_option_set) & RTEMS_NO_WAIT )
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ */
+
+#define _Options_Is_any( _option_set ) \
+ ( (_option_set) & RTEMS_EVENT_ANY )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/part.inl b/c/src/exec/rtems/macros/rtems/rtems/part.inl
new file mode 100644
index 0000000000..55c188b210
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/part.inl
@@ -0,0 +1,117 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ */
+
+#define _Partition_Allocate_buffer( _the_partition ) \
+ _Chain_Get( &(_the_partition)->Memory )
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ */
+
+#define _Partition_Free_buffer( _the_partition, _the_buffer ) \
+ _Chain_Append( &(_the_partition)->Memory, (_the_buffer) )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ */
+
+#define _Partition_Is_buffer_on_boundary( _the_buffer, _the_partition ) \
+ ((((unsigned32) _Addresses_Subtract( \
+ (_the_buffer), \
+ (_the_partition)->starting_address ) \
+ ) % \
+ (_the_partition)->buffer_size) == 0)
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ */
+
+#define _Partition_Is_buffer_valid( _the_buffer, _the_partition ) \
+ ( \
+ _Addresses_Is_in_range( \
+ (_the_buffer), \
+ (_the_partition)->starting_address, \
+ _Addresses_Add_offset( \
+ (_the_partition)->starting_address, \
+ (_the_partition)->length \
+ ) \
+ ) && \
+ _Partition_Is_buffer_on_boundary( (_the_buffer), (_the_partition) ) \
+ )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ */
+
+#define _Partition_Is_buffer_size_aligned( _buffer_size ) \
+ ((_buffer_size) % CPU_PARTITION_ALIGNMENT == 0)
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ */
+
+#define _Partition_Allocate() \
+ (Partition_Control *) _Objects_Allocate( &_Partition_Information )
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ */
+
+#define _Partition_Free( _the_partition ) \
+ _Objects_Free( &_Partition_Information, &(_the_partition)->Object )
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ */
+
+#define _Partition_Get( _id, _location ) \
+ (Partition_Control *) \
+ _Objects_Get( &_Partition_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ */
+
+#define _Partition_Is_null( _the_partition ) \
+ ( (_the_partition) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/ratemon.inl b/c/src/exec/rtems/macros/rtems/rtems/ratemon.inl
new file mode 100644
index 0000000000..ebb182e6f1
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/ratemon.inl
@@ -0,0 +1,85 @@
+/* ratemon.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ */
+
+#define _Rate_monotonic_Allocate() \
+ (Rate_monotonic_Control *) \
+ _Objects_Allocate( &_Rate_monotonic_Information )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ */
+
+#define _Rate_monotonic_Free( _the_period ) \
+ _Objects_Free( &_Rate_monotonic_Information, &(_the_period)->Object )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ */
+
+#define _Rate_monotonic_Get( _id, _location ) \
+ (Rate_monotonic_Control *) \
+ _Objects_Get( &_Rate_monotonic_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ */
+
+#define _Rate_monotonic_Is_active( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_ACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ */
+
+#define _Rate_monotonic_Is_inactive( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_INACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ */
+
+#define _Rate_monotonic_Is_expired( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_EXPIRED)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ */
+
+#define _Rate_monotonic_Is_null( _the_period ) ( (_the_period) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/region.inl b/c/src/exec/rtems/macros/rtems/rtems/region.inl
new file mode 100644
index 0000000000..667d77e307
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/region.inl
@@ -0,0 +1,75 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ */
+
+#define _Region_Allocate() \
+ (Region_Control *) _Objects_Allocate( &_Region_Information )
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ */
+
+#define _Region_Free( _the_region ) \
+ _Objects_Free( &_Region_Information, &(_the_region)->Object )
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ */
+
+#define _Region_Get( _id, _location ) \
+ (Region_Control *) \
+ _Objects_Get( &_Region_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ */
+
+#define _Region_Allocate_segment( _the_region, _size ) \
+ _Heap_Allocate( &(_the_region)->Memory, (_size) )
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ */
+
+#define _Region_Free_segment( _the_region, _the_segment ) \
+ _Heap_Free( &(_the_region)->Memory, (_the_segment) )
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ */
+
+#define _Region_Is_null( _the_region ) ( (_the_region) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/sem.inl b/c/src/exec/rtems/macros/rtems/rtems/sem.inl
new file mode 100644
index 0000000000..7e94069009
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/sem.inl
@@ -0,0 +1,58 @@
+/* sem.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ */
+
+#define _Semaphore_Allocate() \
+ (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information )
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ */
+
+#define _Semaphore_Free( _the_semaphore ) \
+ _Objects_Free( &_Semaphore_Information, &(_the_semaphore)->Object )
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ */
+
+#define _Semaphore_Get( _id, _location ) \
+ (Semaphore_Control *) \
+ _Objects_Get( &_Semaphore_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ */
+
+#define _Semaphore_Is_null( _the_semaphore ) \
+ ( (_the_semaphore) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/status.inl b/c/src/exec/rtems/macros/rtems/rtems/status.inl
new file mode 100644
index 0000000000..408cb816d1
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/status.inl
@@ -0,0 +1,39 @@
+/* macros/status.h
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_STATUS_h
+#define __MACROS_STATUS_h
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ */
+
+#define rtems_is_status_successful( _code ) \
+ ( (_code) == RTEMS_SUCCESSFUL )
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ */
+
+#define rtems_are_statuses_equal( _code1, _code2 ) \
+ ((_code1) == (_code2))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/support.inl b/c/src/exec/rtems/macros/rtems/rtems/support.inl
new file mode 100644
index 0000000000..a25b445aff
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/support.inl
@@ -0,0 +1,44 @@
+/* support.inl
+ *
+ * This include file contains the macros implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ */
+
+#define rtems_is_name_valid( _name ) \
+ ( (_name) != 0 )
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ */
+
+#define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \
+ { \
+ (*(_c1) = ((_name) >> 24) & 0xff; \
+ (*(_c2) = ((_name) >> 16) & 0xff; \
+ (*(_c3) = ((_name) >> 8) & 0xff; \
+ (*(_c4) = ((_name)) & 0xff; \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl
new file mode 100644
index 0000000000..8dd6ff351b
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl
@@ -0,0 +1,58 @@
+/* tasks.inl
+ *
+ * This file contains the macro implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ */
+
+#define _RTEMS_tasks_Allocate() \
+ (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ */
+
+#define _RTEMS_tasks_Free( _the_task ) \
+ _Objects_Free( &_RTEMS_tasks_Information, &(_the_task)->Object )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ */
+
+#define _RTEMS_tasks_Priority_to_Core( _priority ) \
+ ((Priority_Control) (_priority))
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ */
+
+#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \
+ ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \
+ ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) )
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/rtems/rtems/timer.inl b/c/src/exec/rtems/macros/rtems/rtems/timer.inl
new file mode 100644
index 0000000000..9026bed570
--- /dev/null
+++ b/c/src/exec/rtems/macros/rtems/rtems/timer.inl
@@ -0,0 +1,85 @@
+/* timer.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ */
+
+#define _Timer_Allocate() \
+ (Timer_Control *) _Objects_Allocate( &_Timer_Information )
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ */
+
+#define _Timer_Free( _the_timer ) \
+ _Objects_Free( &_Timer_Information, &(_the_timer)->Object )
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ */
+
+#define _Timer_Get( _id, _location ) \
+ (Timer_Control *) \
+ _Objects_Get( &_Timer_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ */
+
+#define _Timer_Is_interval_class( _the_class ) \
+ ( (_the_class) == TIMER_INTERVAL )
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ */
+
+#define _Timer_Is_time_of_day_class( _the_class ) \
+ ( (_the_class) == TIMER_TIME_OF_DAY )
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ */
+
+#define _Timer_Is_dormant_class( _the_class ) \
+ ( (_the_class) == TIMER_DORMANT )
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ */
+
+#define _Timer_Is_null( _the_timer ) \
+ ( (_the_timer) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/sem.inl b/c/src/exec/rtems/macros/sem.inl
new file mode 100644
index 0000000000..7e94069009
--- /dev/null
+++ b/c/src/exec/rtems/macros/sem.inl
@@ -0,0 +1,58 @@
+/* sem.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ */
+
+#define _Semaphore_Allocate() \
+ (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information )
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ */
+
+#define _Semaphore_Free( _the_semaphore ) \
+ _Objects_Free( &_Semaphore_Information, &(_the_semaphore)->Object )
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ */
+
+#define _Semaphore_Get( _id, _location ) \
+ (Semaphore_Control *) \
+ _Objects_Get( &_Semaphore_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ */
+
+#define _Semaphore_Is_null( _the_semaphore ) \
+ ( (_the_semaphore) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/status.inl b/c/src/exec/rtems/macros/status.inl
new file mode 100644
index 0000000000..408cb816d1
--- /dev/null
+++ b/c/src/exec/rtems/macros/status.inl
@@ -0,0 +1,39 @@
+/* macros/status.h
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_STATUS_h
+#define __MACROS_STATUS_h
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ */
+
+#define rtems_is_status_successful( _code ) \
+ ( (_code) == RTEMS_SUCCESSFUL )
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ */
+
+#define rtems_are_statuses_equal( _code1, _code2 ) \
+ ((_code1) == (_code2))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/support.inl b/c/src/exec/rtems/macros/support.inl
new file mode 100644
index 0000000000..a25b445aff
--- /dev/null
+++ b/c/src/exec/rtems/macros/support.inl
@@ -0,0 +1,44 @@
+/* support.inl
+ *
+ * This include file contains the macros implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ */
+
+#define rtems_is_name_valid( _name ) \
+ ( (_name) != 0 )
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ */
+
+#define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \
+ { \
+ (*(_c1) = ((_name) >> 24) & 0xff; \
+ (*(_c2) = ((_name) >> 16) & 0xff; \
+ (*(_c3) = ((_name) >> 8) & 0xff; \
+ (*(_c4) = ((_name)) & 0xff; \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/tasks.inl b/c/src/exec/rtems/macros/tasks.inl
new file mode 100644
index 0000000000..8dd6ff351b
--- /dev/null
+++ b/c/src/exec/rtems/macros/tasks.inl
@@ -0,0 +1,58 @@
+/* tasks.inl
+ *
+ * This file contains the macro implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ */
+
+#define _RTEMS_tasks_Allocate() \
+ (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ */
+
+#define _RTEMS_tasks_Free( _the_task ) \
+ _Objects_Free( &_RTEMS_tasks_Information, &(_the_task)->Object )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ */
+
+#define _RTEMS_tasks_Priority_to_Core( _priority ) \
+ ((Priority_Control) (_priority))
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ */
+
+#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \
+ ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \
+ ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) )
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/macros/timer.inl b/c/src/exec/rtems/macros/timer.inl
new file mode 100644
index 0000000000..9026bed570
--- /dev/null
+++ b/c/src/exec/rtems/macros/timer.inl
@@ -0,0 +1,85 @@
+/* timer.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ */
+
+#define _Timer_Allocate() \
+ (Timer_Control *) _Objects_Allocate( &_Timer_Information )
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ */
+
+#define _Timer_Free( _the_timer ) \
+ _Objects_Free( &_Timer_Information, &(_the_timer)->Object )
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ */
+
+#define _Timer_Get( _id, _location ) \
+ (Timer_Control *) \
+ _Objects_Get( &_Timer_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ */
+
+#define _Timer_Is_interval_class( _the_class ) \
+ ( (_the_class) == TIMER_INTERVAL )
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ */
+
+#define _Timer_Is_time_of_day_class( _the_class ) \
+ ( (_the_class) == TIMER_TIME_OF_DAY )
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ */
+
+#define _Timer_Is_dormant_class( _the_class ) \
+ ( (_the_class) == TIMER_DORMANT )
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ */
+
+#define _Timer_Is_null( _the_timer ) \
+ ( (_the_timer) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/rtems/optman/no-dpmem.c b/c/src/exec/rtems/optman/no-dpmem.c
new file mode 100644
index 0000000000..11f2641feb
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-dpmem.c
@@ -0,0 +1,98 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/dpmem.h>
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+)
+{
+}
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/rtems/optman/no-event.c b/c/src/exec/rtems/optman/no-event.c
new file mode 100644
index 0000000000..4eb984c011
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-event.c
@@ -0,0 +1,56 @@
+/*
+ * Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Event_Manager_initialization( void )
+{
+}
+
+rtems_status_code rtems_event_send(
+ Objects_Id id,
+ rtems_event_set event_in
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_event_receive(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
diff --git a/c/src/exec/rtems/optman/no-mp.c b/c/src/exec/rtems/optman/no-mp.c
new file mode 100644
index 0000000000..f6adc53c76
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-mp.c
@@ -0,0 +1,201 @@
+/*
+ * Multiprocessing Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/interr.h>
+
+void _Multiprocessing_Manager_initialization ( void )
+{
+}
+
+void rtems_multiprocessing_announce ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table,
+ unsigned32 timeout_status
+)
+{
+}
+
+void _MPCI_Create_server( void )
+{
+}
+
+void _MPCI_Initialization ( void )
+{
+}
+
+void _MPCI_Register_packet_processor(
+ Objects_Classes the_class,
+ MPCI_Packet_processor the_packet_processor
+
+)
+{
+}
+
+MP_packet_Prefix *_MPCI_Get_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+void _MPCI_Return_packet (
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Send_process_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+unsigned32 _MPCI_Send_request_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet,
+ States_Control extra_state
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return 0;
+}
+
+void _MPCI_Send_response_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+MP_packet_Prefix *_MPCI_Receive_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+Thread_Control *_MPCI_Process_response (
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+Thread _MPCI_Receive_server(
+ unsigned32 ignore
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Announce ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+
+void _MPCI_Internal_packets_Send_process_packet (
+ MPCI_Internal_Remote_operations operation
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Internal_packets_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/optman/no-msg.c b/c/src/exec/rtems/optman/no-msg.c
new file mode 100644
index 0000000000..6a5b84652a
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-msg.c
@@ -0,0 +1,192 @@
+/*
+ * Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/interr.h>
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+}
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size_p,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+unsigned32 _Message_queue_Flush_support(
+ Message_queue_Control *the_message_queue
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+ return 0;
+}
+
+boolean _Message_queue_Seize(
+ Message_queue_Control *the_message_queue,
+ rtems_option option_set,
+ void *buffer,
+ unsigned32 *size_p
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+ _Thread_Executing->Wait.return_code = RTEMS_UNSATISFIED;
+ return TRUE;
+}
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/rtems/optman/no-part.c b/c/src/exec/rtems/optman/no-part.c
new file mode 100644
index 0000000000..36eb4aee12
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-part.c
@@ -0,0 +1,97 @@
+/*
+ * Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+)
+{
+}
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/rtems/optman/no-region.c b/c/src/exec/rtems/optman/no-region.c
new file mode 100644
index 0000000000..6a779fb785
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-region.c
@@ -0,0 +1,114 @@
+/*
+ * Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+)
+{
+}
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/rtems/optman/no-rtmon.c b/c/src/exec/rtems/optman/no-rtmon.c
new file mode 100644
index 0000000000..fb064dafc5
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-rtmon.c
@@ -0,0 +1,117 @@
+/*
+ * Rate Monotonic Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/ratemon.h>
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+)
+{
+}
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+void _Rate_monotonic_Timeout(
+ Objects_Id id,
+ void *ignored
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+boolean _Rate_monotonic_Set_state(
+Rate_monotonic_Control *the_period
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return FALSE;
+}
diff --git a/c/src/exec/rtems/optman/no-sem.c b/c/src/exec/rtems/optman/no-sem.c
new file mode 100644
index 0000000000..3f79491075
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-sem.c
@@ -0,0 +1,114 @@
+/*
+ * Semaphore Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/interr.h>
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+}
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_obtain(
+ Objects_Id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_release(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+boolean _Semaphore_Seize(
+ Semaphore_Control *the_semaphore,
+ rtems_option option_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ _Thread_Executing->Wait.return_code = RTEMS_UNSATISFIED;
+ return TRUE;
+}
diff --git a/c/src/exec/rtems/optman/no-signal.c b/c/src/exec/rtems/optman/no-signal.c
new file mode 100644
index 0000000000..fdd90efb38
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-signal.c
@@ -0,0 +1,56 @@
+/*
+ * Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/rtems/signal.h>
+
+void _Signal_Manager_initialization( void )
+{
+}
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry handler,
+ rtems_mode mode_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_signal_send(
+ rtems_id id,
+ rtems_signal_set signal_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/optman/no-timer.c b/c/src/exec/rtems/optman/no-timer.c
new file mode 100644
index 0000000000..c133a48328
--- /dev/null
+++ b/c/src/exec/rtems/optman/no-timer.c
@@ -0,0 +1,123 @@
+/*
+ * Timer Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/timer.h>
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+)
+{
+}
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/rtems/src/clock.c b/c/src/exec/rtems/src/clock.c
new file mode 100644
index 0000000000..ea340ae5f4
--- /dev/null
+++ b/c/src/exec/rtems/src/clock.c
@@ -0,0 +1,151 @@
+/*
+ * Clock Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * rtems_clock_get
+ *
+ * This directive returns the current date and time. If the time has
+ * not been set by a tm_set then an error is returned.
+ *
+ * Input parameters:
+ * option - which value to return
+ * time_buffer - pointer to output buffer (a time and date structure
+ * or an interval)
+ *
+ * Output parameters:
+ * time_buffer - output filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+)
+{
+ ISR_Level level;
+ rtems_interval tmp;
+
+ switch ( option ) {
+ case RTEMS_CLOCK_GET_TOD:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_time_of_day *)time_buffer = _TOD_Current;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_PER_SECOND:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_per_second;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TIME_VALUE:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ _ISR_Disable( level );
+ ((rtems_clock_time_value *)time_buffer)->seconds =
+ _TOD_Seconds_since_epoch;
+ tmp = _TOD_Current.ticks;
+ _ISR_Enable( level );
+
+ tmp *= _TOD_Microseconds_per_tick;
+ ((rtems_clock_time_value *)time_buffer)->microseconds = tmp;
+
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* should never get here */
+
+}
+
+/*PAGE
+ *
+ * rtems_clock_set
+ *
+ * This directive sets the date and time for this node.
+ *
+ * Input parameters:
+ * time_buffer - pointer to the time and date structure
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+)
+{
+ rtems_interval seconds;
+
+ if ( _TOD_Validate( time_buffer ) ) {
+ seconds = _TOD_To_seconds( time_buffer );
+ _Thread_Disable_dispatch();
+ _TOD_Set( time_buffer, seconds );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_INVALID_CLOCK;
+}
+
+/*PAGE
+ *
+ * rtems_clock_tick
+ *
+ * This directive notifies the executve that a tick has occurred.
+ * When the tick occurs the time manager updates and maintains
+ * the calendar time, timeslicing, and any timeout delays.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ *
+ * NOTE: This routine only works for leap-years through 2099.
+ */
+
+rtems_status_code rtems_clock_tick( void )
+{
+ _TOD_Tickle_ticks();
+
+ _Watchdog_Tickle_ticks();
+
+ _Thread_Tickle_timeslice();
+
+ if ( _Thread_Is_context_switch_necessary() &&
+ _Thread_Is_dispatching_enabled() )
+ _Thread_Dispatch();
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/exec/rtems/src/dpmem.c b/c/src/exec/rtems/src/dpmem.c
new file mode 100644
index 0000000000..982116d859
--- /dev/null
+++ b/c/src/exec/rtems/src/dpmem.c
@@ -0,0 +1,281 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Manager_initialization
+ *
+ * This routine initializes all dual-ported memory manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_ports - number of ports to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+)
+{
+ _Objects_Initialize_information(
+ &_Dual_ported_memory_Information,
+ OBJECTS_RTEMS_PORTS,
+ FALSE,
+ maximum_ports,
+ sizeof( Dual_ported_memory_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_port_create
+ *
+ * This directive creates a port into a dual-ported memory area.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * internal_start - internal start address of port
+ * external_start - external start address of port
+ * length - physical length in bytes
+ * id - address of port id to set
+ *
+ * Output parameters:
+ * id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+
+ if ( !rtems_is_name_valid( name) )
+ return RTEMS_INVALID_NAME;
+
+ if ( !_Addresses_Is_aligned( internal_start ) ||
+ !_Addresses_Is_aligned( external_start ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_port = _Dual_ported_memory_Allocate();
+
+ if ( !the_port ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_port->internal_base = internal_start;
+ the_port->external_base = external_start;
+ the_port->length = length - 1;
+
+ _Objects_Open(
+ &_Dual_ported_memory_Information,
+ &the_port->Object,
+ &name
+ );
+
+ *id = the_port->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_port_ident
+ *
+ * This directive returns the system ID associated with
+ * the port name.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * id - pointer to port id
+ *
+ * Output parameters:
+ * *id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Dual_ported_memory_Information,
+ &name,
+ OBJECTS_SEARCH_ALL_NODES,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_port_delete
+ *
+ * This directive allows a thread to delete a dual-ported memory area
+ * specified by the dual-ported memory identifier.
+ *
+ * Input parameters:
+ * id - dual-ported memory area id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object );
+ _Dual_ported_memory_Free( the_port );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_port_internal_to_external
+ *
+ * This directive converts an internal dual-ported memory address to an
+ * external dual-ported memory address. If the given internal address
+ * is an invalid dual-ported address, then the external address is set
+ * to the given internal address.
+ *
+ * Input parameters:
+ * id - id of dual-ported memory object
+ * internal - internal address to set
+ * external - pointer to external address
+ *
+ * Output parameters:
+ * external - external address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( internal, the_port->internal_base );
+ if ( ending > the_port->length )
+ *external = internal;
+ else
+ *external = _Addresses_Add_offset( the_port->external_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_port_external_to_internal
+ *
+ * This directive converts an external dual-ported memory address to an
+ * internal dual-ported memory address. If the given external address
+ * is an invalid dual-ported address, then the internal address is set
+ * to the given external address.
+ *
+ * Input parameters:
+ * id - id of dp memory object
+ * external - external address
+ * internal - pointer of internal address to set
+ *
+ * Output parameters:
+ * internal - internal address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( external, the_port->external_base );
+ if ( ending > the_port->length )
+ *internal = external;
+ else
+ *internal = _Addresses_Add_offset( the_port->internal_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/event.c b/c/src/exec/rtems/src/event.c
new file mode 100644
index 0000000000..ab00bc757e
--- /dev/null
+++ b/c/src/exec/rtems/src/event.c
@@ -0,0 +1,383 @@
+/*
+ * Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/tasks.h>
+
+/*PAGE
+ *
+ * _Event_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Event_Manager_initialization( void )
+{
+ _Event_Sync_state = EVENT_SYNC_SYNCHRONIZED;
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet );
+}
+
+/*PAGE
+ *
+ * rtems_event_send
+ *
+ * This directive allows a thread send an event set to another thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * event - event set
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_event_send(
+ Objects_Id id,
+ rtems_event_set event_in
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _Event_MP_Send_request_packet(
+ EVENT_MP_SEND_REQUEST,
+ id,
+ event_in
+ )
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ _Event_sets_Post( event_in, &api->pending_events );
+ _Event_Surrender( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_event_receive
+ *
+ * This directive allows a thread to receive a set of events.
+ *
+ * Input parameters:
+ * event_in - input event condition
+ * option_set - options
+ * ticks - number of ticks to wait (0 means wait forever)
+ * event_out - pointer to output event set
+ *
+ * Output parameters:
+ * event out - event set
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_event_receive(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ RTEMS_API_Control *api;
+
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+
+ if ( _Event_sets_Is_empty( event_in ) ) {
+ *event_out = api->pending_events;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ _Thread_Disable_dispatch();
+ _Event_Seize( event_in, option_set, ticks, event_out );
+ _Thread_Enable_dispatch();
+ return( _Thread_Executing->Wait.return_code );
+}
+
+
+/*PAGE
+ *
+ * _Event_Seize
+ *
+ * This routine attempts to satisfy the requested event condition
+ * for the running thread.
+ *
+ * Input parameters:
+ * event_in - the event condition to satisfy
+ * option_set - acquire event options
+ * ticks - interval to wait
+ * event_out - pointer to event set output area
+ *
+ * Output parameters: NONE
+ * *event_out - event set output area filled in
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ * check sync
+ */
+
+void _Event_Seize(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ Thread_Control *executing;
+ rtems_event_set seized_events;
+ rtems_event_set pending_events;
+ ISR_Level level;
+ RTEMS_API_Control *api;
+ Event_Sync_states sync_state;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = RTEMS_SUCCESSFUL;
+
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+
+ _ISR_Disable( level );
+ pending_events = api->pending_events;
+ seized_events = _Event_sets_Get( pending_events, event_in );
+
+ if ( !_Event_sets_Is_empty( seized_events ) &&
+ (seized_events == event_in || _Options_Is_any( option_set )) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events, seized_events );
+ _ISR_Enable( level );
+ *event_out = seized_events;
+ return;
+ }
+
+ if ( _Options_Is_no_wait( option_set ) ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = RTEMS_UNSATISFIED;
+ *event_out = seized_events;
+ return;
+ }
+
+ _Event_Sync_state = EVENT_SYNC_NOTHING_HAPPENED;
+
+ executing->Wait.option = (unsigned32) option_set;
+ executing->Wait.count = (unsigned32) event_in;
+ executing->Wait.return_argument = event_out;
+
+ _ISR_Enable( level );
+
+ if ( ticks ) {
+ _Watchdog_Initialize(
+ &executing->Timer,
+ _Event_Timeout,
+ executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &executing->Timer, ticks );
+ }
+
+ _Thread_Set_state( executing, STATES_WAITING_FOR_EVENT );
+
+ _ISR_Disable( level );
+
+ sync_state = _Event_Sync_state;
+ _Event_Sync_state = EVENT_SYNC_SYNCHRONIZED;
+
+ switch ( sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
+ /*
+ * This cannot happen. It indicates that this routine did not
+ * enter the synchronization states above.
+ */
+ return;
+
+ case EVENT_SYNC_NOTHING_HAPPENED:
+ _ISR_Enable( level );
+ return;
+
+ case EVENT_SYNC_TIMEOUT:
+ executing->Wait.return_code = RTEMS_TIMEOUT;
+ _ISR_Enable( level );
+ _Thread_Unblock( executing );
+ return;
+
+ case EVENT_SYNC_SATISFIED:
+ if ( _Watchdog_Is_active( &executing->Timer ) ) {
+ _Watchdog_Deactivate( &executing->Timer );
+ _ISR_Enable( level );
+ (void) _Watchdog_Remove( &executing->Timer );
+ } else
+ _ISR_Enable( level );
+ _Thread_Unblock( executing );
+ return;
+ }
+}
+
+/*PAGE
+ *
+ * _Event_Surrender
+ *
+ * This routines remove a thread from the specified threadq.
+ *
+ * Input parameters:
+ * the_thread - pointer to thread to be dequeued
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * before flash
+ * after flash
+ * check sync
+ */
+
+void _Event_Surrender(
+ Thread_Control *the_thread
+)
+{
+ ISR_Level level;
+ rtems_event_set pending_events;
+ rtems_event_set event_condition;
+ rtems_event_set seized_events;
+ rtems_option option_set;
+ RTEMS_API_Control *api;
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ option_set = (rtems_option) the_thread->Wait.option;
+
+ _ISR_Disable( level );
+ pending_events = api->pending_events;
+ event_condition = (rtems_event_set) the_thread->Wait.count;
+
+ seized_events = _Event_sets_Get( pending_events, event_condition );
+
+ if ( !_Event_sets_Is_empty( seized_events ) ) {
+ if ( _States_Is_waiting_for_event( the_thread->current_state ) ) {
+ if ( seized_events == event_condition || _Options_Is_any( option_set ) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events, seized_events );
+ *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
+
+ _ISR_Flash( level );
+
+ 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 );
+ }
+ return;
+ }
+ }
+
+ switch ( _Event_Sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
+ case EVENT_SYNC_SATISFIED:
+ break;
+
+ case EVENT_SYNC_NOTHING_HAPPENED:
+ case EVENT_SYNC_TIMEOUT:
+ if ( !_Thread_Is_executing( the_thread ) )
+ break;
+
+ if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events,seized_events );
+ *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
+ _Event_Sync_state = EVENT_SYNC_SATISFIED;
+ }
+ break;
+ }
+ }
+ _ISR_Enable( level );
+}
+
+/*PAGE
+ *
+ * _Event_Timeout
+ *
+ * This routine processes a thread which timeouts while waiting to
+ * receive an event_set. It is called by the watchdog handler.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters: NONE
+ */
+
+void _Event_Timeout(
+ 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:
+
+ /*
+ * If the event manager 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 ( _Event_Sync_state != EVENT_SYNC_SYNCHRONIZED &&
+ _Thread_Is_executing( the_thread ) ) {
+ if ( _Event_Sync_state != EVENT_SYNC_SATISFIED )
+ _Event_Sync_state = EVENT_SYNC_TIMEOUT;
+ } else {
+ the_thread->Wait.return_code = RTEMS_TIMEOUT;
+ _Thread_Unblock( the_thread );
+ }
+ _Thread_Unnest_dispatch();
+ break;
+ }
+}
diff --git a/c/src/exec/rtems/src/eventmp.c b/c/src/exec/rtems/src/eventmp.c
new file mode 100644
index 0000000000..30cd1166c6
--- /dev/null
+++ b/c/src/exec/rtems/src/eventmp.c
@@ -0,0 +1,190 @@
+/*
+ * Multiprocessing Support for the Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Event_MP_Send_process_packet
+ *
+ * This subprogram is not needed since there are no process
+ * packets to be sent by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Event_MP_Send_request_packet (
+ Event_MP_Remote_operations operation,
+ Objects_Id event_id,
+ rtems_event_set event_in
+)
+{
+ Event_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case EVENT_MP_SEND_REQUEST:
+
+ the_packet = _Event_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_EVENT;
+ the_packet->Prefix.length = sizeof ( Event_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = event_id;
+ the_packet->event_in = event_in;
+
+ return
+ _MPCI_Send_request_packet(
+ rtems_get_node( event_id ),
+ &the_packet->Prefix,
+ STATES_READY
+ );
+
+ break;
+
+ case EVENT_MP_SEND_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Event_MP_Send_response_packet
+ *
+ */
+
+void _Event_MP_Send_response_packet (
+ Event_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ Event_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case EVENT_MP_SEND_RESPONSE:
+
+ the_packet = ( Event_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case EVENT_MP_SEND_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Event_MP_Process_packet
+ *
+ */
+
+void _Event_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Event_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+
+ the_packet = (Event_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case EVENT_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_event_send(
+ the_packet->Prefix.id,
+ the_packet->event_in
+ );
+
+ _Event_MP_Send_response_packet(
+ EVENT_MP_SEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case EVENT_MP_SEND_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Event_MP_Send_object_was_deleted
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Send_extract_proxy
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Get_packet
+ *
+ */
+
+Event_MP_Packet *_Event_MP_Get_packet ( void )
+{
+ return ( (Event_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/intr.c b/c/src/exec/rtems/src/intr.c
new file mode 100644
index 0000000000..8ec880ee99
--- /dev/null
+++ b/c/src/exec/rtems/src/intr.c
@@ -0,0 +1,65 @@
+/*
+ * Interrupt Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/intr.h>
+
+/* _Interrupt_Manager_initialization
+ *
+ * This routine initializes the interrupt manager.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Interrupt_Manager_initialization( void )
+{
+}
+
+/* rtems_interrupt_catch
+ *
+ * This directive allows a thread to specify what action to take when
+ * catching signals.
+ *
+ * Input parameters:
+ * new_isr_handler - address of interrupt service routine (isr)
+ * vector - interrupt vector number
+ * old_isr_handler - address at which to store previous ISR address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ * *old_isr_handler - previous ISR address
+ */
+
+rtems_status_code rtems_interrupt_catch(
+ rtems_isr_entry new_isr_handler,
+ rtems_vector_number vector,
+ rtems_isr_entry *old_isr_handler
+)
+{
+ if ( !_ISR_Is_vector_number_valid( vector ) )
+ return RTEMS_INVALID_NUMBER;
+
+ if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _ISR_Install_vector(
+ vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler );
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/exec/rtems/src/mp.c b/c/src/exec/rtems/src/mp.c
new file mode 100644
index 0000000000..7bc39074c6
--- /dev/null
+++ b/c/src/exec/rtems/src/mp.c
@@ -0,0 +1,42 @@
+/*
+ * Multiprocessing Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/mpci.h>
+
+/*PAGE
+ *
+ * _Multiprocessing_Manager_initialization
+ *
+ */
+
+void _Multiprocessing_Manager_initialization ( void )
+{
+}
+
+/*PAGE
+ *
+ * rtems_multiprocessing_announce
+ *
+ */
+
+void rtems_multiprocessing_announce ( void )
+{
+ _MPCI_Announce();
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c
new file mode 100644
index 0000000000..7d7c6e3025
--- /dev/null
+++ b/c/src/exec/rtems/src/msg.c
@@ -0,0 +1,714 @@
+/*
+ * Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coremsg.h>
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Message_queue_Manager_initialization
+ *
+ * This routine initializes all message queue manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_message_queues - number of message queues to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+ _Objects_Initialize_information(
+ &_Message_queue_Information,
+ OBJECTS_RTEMS_MESSAGE_QUEUES,
+ TRUE,
+ maximum_message_queues,
+ sizeof( Message_queue_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_MESSAGE_QUEUE,
+ _Message_queue_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * _Message_queue_Allocate
+ *
+ * Allocate a message queue and the space for its messages
+ *
+ * Input parameters:
+ * the_message_queue - the message queue to allocate message buffers
+ * count - maximum message and reserved buffer count
+ * max_message_size - maximum size of each message
+ *
+ * Output parameters:
+ * the_message_queue - set if successful, NULL otherwise
+ */
+
+Message_queue_Control *_Message_queue_Allocate (
+ unsigned32 count,
+ unsigned32 max_message_size
+)
+{
+ return
+ (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
+
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_create
+ *
+ * This directive creates a message queue by allocating and initializing
+ * a message queue data structure.
+ *
+ * Input parameters:
+ * name - user defined queue name
+ * count - maximum message and reserved buffer count
+ * max_message_size - maximum size of each message
+ * attribute_set - process method
+ * id - pointer to queue
+ *
+ * Output parameters:
+ * id - queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Message_queue_Control *the_message_queue;
+ CORE_message_queue_Attributes the_message_queue_attributes;
+ boolean is_global;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( (is_global = _Attributes_Is_global( attribute_set ) ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ if (count == 0)
+ return RTEMS_INVALID_NUMBER;
+
+ if (max_message_size == 0)
+ return RTEMS_INVALID_SIZE;
+
+#if 1
+ /*
+ * I am not 100% sure this should be an error.
+ * It seems reasonable to create a que with a large max size,
+ * and then just send smaller msgs from remote (or all) nodes.
+ */
+
+ if ( is_global && (_MPCI_table->maximum_packet_size < max_message_size) )
+ return RTEMS_INVALID_SIZE;
+
+#endif
+
+ _Thread_Disable_dispatch(); /* protects object pointer */
+
+ the_message_queue = _Message_queue_Allocate( count, max_message_size );
+
+ if ( !the_message_queue ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( is_global &&
+ !( _Objects_MP_Allocate_and_open( &_Message_queue_Information,
+ name, the_message_queue->Object.id, FALSE ) ) ) {
+ _Message_queue_Free( the_message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_message_queue->attribute_set = attribute_set;
+
+ if (_Attributes_Is_priority( attribute_set ) )
+ the_message_queue_attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
+ else
+ the_message_queue_attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+
+ if ( ! _CORE_message_queue_Initialize(
+ &the_message_queue->message_queue,
+ OBJECTS_RTEMS_MESSAGE_QUEUES,
+ &the_message_queue_attributes,
+ count,
+ max_message_size,
+ _Message_queue_MP_Send_extract_proxy ) ) {
+ if ( is_global )
+ _Objects_MP_Close(
+ &_Message_queue_Information, the_message_queue->Object.id);
+
+ _Message_queue_Free( the_message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ _Objects_Open(
+ &_Message_queue_Information,
+ &the_message_queue->Object,
+ &name
+ );
+
+ *id = the_message_queue->Object.id;
+
+ if ( is_global )
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
+ the_message_queue->Object.id,
+ name,
+ 0
+ );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_ident
+ *
+ * This directive returns the system ID associated with
+ * the message queue name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * node - node(s) to be searched
+ * id - pointer to message queue id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Message_queue_Information,
+ &name,
+ node,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_delete
+ *
+ * This directive allows a thread to delete the message queue specified
+ * by the given queue identifier.
+ *
+ * Input parameters:
+ * id - queue id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Message_queue_Information,
+ &the_message_queue->Object );
+
+ _CORE_message_queue_Close(
+ &the_message_queue->message_queue,
+ _Message_queue_MP_Send_object_was_deleted,
+ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
+ );
+
+ _Message_queue_Free( the_message_queue );
+
+ if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
+ _Objects_MP_Close(
+ &_Message_queue_Information,
+ the_message_queue->Object.id
+ );
+
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
+ the_message_queue->Object.id,
+ 0, /* Not used */
+ 0
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_send
+ *
+ * This routine implements the directives q_send. It sends a
+ * message to the specified message queue.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to sent urgently
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ return( _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST) );
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_urgent
+ *
+ * This routine implements the directives q_urgent. It urgents a
+ * message to the specified message queue.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to sent urgently
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ return(_Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST));
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_broadcast
+ *
+ * This directive sends a message for every thread waiting on the queue
+ * designated by id.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to broadcast
+ * count - pointer to area to store number of threads made ready
+ *
+ * Output parameters:
+ * count - number of threads made ready
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ CORE_message_queue_Status core_status;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = count;
+
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_BROADCAST_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case OBJECTS_LOCAL:
+ core_status = _CORE_message_queue_Broadcast(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support,
+ count
+ );
+
+ _Thread_Enable_dispatch();
+ return
+ _Message_queue_Translate_core_message_queue_return_code( core_status );
+
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_receive
+ *
+ * This directive dequeues a message from the designated message queue
+ * and copies it into the requesting thread's buffer.
+ *
+ * Input parameters:
+ * id - queue id
+ * buffer - pointer to message buffer
+ * size - size of message receive
+ * option_set - options on receive
+ * timeout - number of ticks to wait
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ boolean wait;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_REMOTE:
+ return _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_REQUEST,
+ id,
+ buffer,
+ size,
+ option_set,
+ timeout
+ );
+
+ case OBJECTS_LOCAL:
+ if ( _Options_Is_no_wait( option_set ) )
+ wait = FALSE;
+ else
+ wait = TRUE;
+
+ _CORE_message_queue_Seize(
+ &the_message_queue->message_queue,
+ the_message_queue->Object.id,
+ buffer,
+ size,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return( _Message_queue_Translate_core_message_queue_return_code(
+ _Thread_Executing->Wait.return_code ) );
+
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_flush
+ *
+ * This directive removes all pending messages from a queue and returns
+ * the number of messages removed. If no messages were present then
+ * a count of zero is returned.
+ *
+ * Input parameters:
+ * id - queue id
+ * count - return area for count
+ *
+ * Output parameters:
+ * count - number of messages removed ( 0 = empty queue )
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = count;
+
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_FLUSH_REQUEST,
+ id,
+ 0, /* buffer not used */
+ 0, /* size */
+ 0, /* option_set not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case OBJECTS_LOCAL:
+ *count = _CORE_message_queue_Flush( &the_message_queue->message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Submit
+ *
+ * This routine implements the directives rtems_message_queue_send
+ * and rtems_message_queue_urgent. It processes a message that is
+ * to be submitted to the designated message queue. The message will
+ * either be processed as a send 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:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size in bytes of message to send
+ * submit_type - send or urgent message
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ CORE_message_queue_Status core_status;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location )
+ {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_REMOTE:
+ switch ( submit_type ) {
+ case MESSAGE_QUEUE_SEND_REQUEST:
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_SEND_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case MESSAGE_QUEUE_URGENT_REQUEST:
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_URGENT_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ }
+
+ case OBJECTS_LOCAL:
+ switch ( submit_type ) {
+ case MESSAGE_QUEUE_SEND_REQUEST:
+ core_status = _CORE_message_queue_Send(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support
+ );
+ break;
+ case MESSAGE_QUEUE_URGENT_REQUEST:
+ core_status = _CORE_message_queue_Urgent(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support
+ );
+ break;
+ default:
+ core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ return RTEMS_INTERNAL_ERROR; /* should never get here */
+ }
+
+ _Thread_Enable_dispatch();
+ return _Message_queue_Translate_core_message_queue_return_code(
+ core_status );
+
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Translate_core_message_queue_return_code
+ *
+ * Input parameters:
+ * the_message_queue_status - message_queue status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+ unsigned32 the_message_queue_status
+)
+{
+ switch ( the_message_queue_status ) {
+ case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
+ return RTEMS_INVALID_SIZE;
+ case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
+ return RTEMS_TOO_MANY;
+ case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
+ return RTEMS_UNSATISFIED;
+ case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ _Internal_error_Occurred( /* XXX */
+ INTERNAL_ERROR_RTEMS_API,
+ TRUE,
+ the_message_queue_status
+ );
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Core_message_queue_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the message was submitted to
+ * id - id of the message queue
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Core_message_queue_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ id,
+ the_thread
+ );
+}
diff --git a/c/src/exec/rtems/src/msgmp.c b/c/src/exec/rtems/src/msgmp.c
new file mode 100644
index 0000000000..e43fc28aef
--- /dev/null
+++ b/c/src/exec/rtems/src/msgmp.c
@@ -0,0 +1,454 @@
+/*
+ * Multiprocessing Support for the Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/message.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/msgmp.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_process_packet
+ *
+ */
+
+void _Message_queue_MP_Send_process_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Message_queue_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof ( Message_queue_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == MESSAGE_QUEUE_MP_EXTRACT_PROXY )
+ node = rtems_get_node( message_queue_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Message_queue_MP_Send_request_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ void *buffer,
+ unsigned32 *size_p,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Message_queue_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof(Message_queue_MP_Packet);
+ if ( size_p )
+ the_packet->Prefix.length += *size_p;
+ the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
+
+ /*
+ * make sure message is not too big for our MPCI driver
+ * We have to check it here instead of waiting for MPCI because
+ * we are about to slam in the payload
+ */
+
+ if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->option_set = option_set;
+
+ /*
+ * Copy the data into place if needed
+ */
+
+ if (buffer) {
+ the_packet->Buffer.size = *size_p;
+ _CORE_message_queue_Copy_buffer(
+ buffer,
+ the_packet->Buffer.buffer,
+ *size_p
+ );
+ }
+
+ return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_MESSAGE);
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof(Message_queue_MP_Packet);
+ the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
+
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = MESSAGE_QUEUE_MP_RECEIVE_REQUEST;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->option_set = option_set;
+ the_packet->size = 0; /* just in case of an error */
+
+ _Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
+ _Thread_Executing->Wait.return_argument_1 = size_p;
+
+ return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_MESSAGE);
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+ break;
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_response_packet
+ *
+ */
+
+void _Message_queue_MP_Send_response_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ Thread_Control *the_thread
+)
+{
+ Message_queue_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+
+ the_packet = ( Message_queue_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ *
+ * Exception: MESSAGE_QUEUE_MP_RECEIVE_RESPONSE needs payload length
+ * added to 'length'
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ if (operation == MESSAGE_QUEUE_MP_RECEIVE_RESPONSE)
+ the_packet->Prefix.length += the_packet->size;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Message_queue_MP_Process_packet
+ *
+ */
+
+void _Message_queue_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Message_queue_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Message_queue_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Message_queue_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Message_queue_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_receive(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ &the_packet->size,
+ the_packet->option_set,
+ the_packet->Prefix.timeout
+ );
+
+ if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) {
+ *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 =
+ the_packet->size;
+
+ _CORE_message_queue_Copy_buffer(
+ the_packet->Buffer.buffer,
+ the_thread->Wait.return_argument,
+ the_packet->size
+ );
+ }
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_send(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_SEND_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_urgent(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_URGENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_broadcast(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size,
+ &the_packet->count
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_BROADCAST_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(unsigned32 *)the_thread->Wait.return_argument = the_packet->count;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_flush(
+ the_packet->Prefix.id,
+ &the_packet->count
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_FLUSH_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_object_was_deleted
+ *
+ */
+
+void _Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+)
+{
+ the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ the_proxy->Wait.id,
+ the_proxy
+ );
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_extract_proxy
+ *
+ */
+
+void _Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Get_packet
+ *
+ */
+
+Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void )
+{
+ return ( (Message_queue_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c
new file mode 100644
index 0000000000..f63ab693f1
--- /dev/null
+++ b/c/src/exec/rtems/src/part.c
@@ -0,0 +1,341 @@
+/*
+ * Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * _Partition_Manager_initialization
+ *
+ * This routine initializes all partition manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_partitions - number of partitions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+)
+{
+ _Objects_Initialize_information(
+ &_Partition_Information,
+ OBJECTS_RTEMS_PARTITIONS,
+ TRUE,
+ maximum_partitions,
+ sizeof( Partition_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_PARTITION,
+ _Partition_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_partition_create
+ *
+ * This directive creates a partiton of fixed sized buffers from the
+ * given contiguous memory area.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * starting_address - physical start address of partition
+ * length - physical length in bytes
+ * buffer_size - size of buffers in bytes
+ * attribute_set - partition attributes
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Partition_Control *the_partition;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( length == 0 || buffer_size == 0 || length < buffer_size ||
+ !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ return RTEMS_INVALID_SIZE;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_partition = _Partition_Allocate();
+
+ if ( !the_partition ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
+ the_partition->Object.id, FALSE ) ) ) {
+ _Partition_Free( the_partition );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+ the_partition->starting_address = starting_address;
+ the_partition->length = length;
+ the_partition->buffer_size = buffer_size;
+ the_partition->attribute_set = attribute_set;
+ the_partition->number_of_used_blocks = 0;
+
+ _Chain_Initialize( &the_partition->Memory, starting_address,
+ length / buffer_size, buffer_size );
+
+ _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
+
+ *id = the_partition->Object.id;
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_CREATE,
+ the_partition->Object.id,
+ name,
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_partition_ident
+ *
+ * This directive returns the system ID associated with
+ * the partition name.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * node - node(s) to be searched
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * *id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_partition_delete
+ *
+ * This directive allows a thread to delete a partition specified by
+ * the partition identifier, provided that none of its buffers are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - partition id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( the_partition->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Partition_Information, &the_partition->Object );
+ _Partition_Free( the_partition );
+ if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+
+ _Objects_MP_Close(
+ &_Partition_Information,
+ the_partition->Object.id
+ );
+
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_DELETE,
+ the_partition->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_partition_get_buffer
+ *
+ * This directive will obtain a buffer from a buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * buffer - pointer to buffer address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+ void *the_buffer;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = buffer;
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_GET_BUFFER_REQUEST,
+ id,
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ the_buffer = _Partition_Allocate_buffer( the_partition );
+ if ( the_buffer ) {
+ the_partition->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *buffer = the_buffer;
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_partition_return_buffer
+ *
+ * This directive will return the given buffer to the specified
+ * buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_RETURN_BUFFER_REQUEST,
+ id,
+ buffer
+ )
+ );
+ case OBJECTS_LOCAL:
+ if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
+ _Partition_Free_buffer( the_partition, buffer );
+ the_partition->number_of_used_blocks -= 1;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/partmp.c b/c/src/exec/rtems/src/partmp.c
new file mode 100644
index 0000000000..969bf314b5
--- /dev/null
+++ b/c/src/exec/rtems/src/partmp.c
@@ -0,0 +1,302 @@
+/*
+ * Multiprocessing Support for the Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Partition_MP_Send_process_packet
+ *
+ */
+
+void _Partition_MP_Send_process_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Partition_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+
+ the_packet = _Partition_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_PARTITION;
+ the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = partition_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == PARTITION_MP_EXTRACT_PROXY )
+ node = rtems_get_node( partition_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Partition_MP_Send_request_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ void *buffer
+)
+{
+ Partition_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+
+ the_packet = _Partition_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_PARTITION;
+ the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = partition_id;
+ the_packet->buffer = buffer;
+
+ return
+ _MPCI_Send_request_packet(
+ rtems_get_node( partition_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+
+ break;
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_response_packet
+ *
+ */
+
+void _Partition_MP_Send_response_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ Thread_Control *the_thread
+)
+{
+ Partition_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+
+ the_packet = ( Partition_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Partition_MP_Process_packet
+ *
+ */
+
+void _Partition_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Partition_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Partition_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Partition_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Partition_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_partition_get_buffer(
+ the_packet->Prefix.id,
+ &the_packet->buffer
+ );
+
+ _Partition_MP_Send_response_packet(
+ PARTITION_MP_GET_BUFFER_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(void **)the_thread->Wait.return_argument = the_packet->buffer;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_partition_return_buffer(
+ the_packet->Prefix.id,
+ the_packet->buffer
+ );
+
+ _Partition_MP_Send_response_packet(
+ PARTITION_MP_RETURN_BUFFER_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_object_was_deleted
+ *
+ * This routine is not needed by the Partition since a partition
+ * cannot be deleted when buffers are in use.
+ *
+ */
+
+/*PAGE
+ *
+ * _Partition_MP_Send_extract_proxy
+ *
+ */
+
+void _Partition_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Get_packet
+ *
+ */
+
+Partition_MP_Packet *_Partition_MP_Get_packet ( void )
+{
+ return ( (Partition_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/ratemon.c b/c/src/exec/rtems/src/ratemon.c
new file mode 100644
index 0000000000..d3524b02d6
--- /dev/null
+++ b/c/src/exec/rtems/src/ratemon.c
@@ -0,0 +1,385 @@
+/*
+ * Rate Monotonic Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * _Rate_monotonic_Manager_initialization
+ *
+ * This routine initializes all Rate Monotonic Manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_periods - number of periods timers to initialize
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: The Rate Monotonic Manager is built on top of the Watchdog
+ * Handler.
+ */
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+)
+{
+ _Objects_Initialize_information(
+ &_Rate_monotonic_Information,
+ OBJECTS_RTEMS_PERIODS,
+ FALSE,
+ maximum_periods,
+ sizeof( Rate_monotonic_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_create
+ *
+ * This directive creates a rate monotonic timer and performs
+ * some initialization.
+ *
+ * Input parameters:
+ * name - name of period
+ * id - pointer to rate monotonic id
+ *
+ * Output parameters:
+ * id - rate monotonic id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Rate_monotonic_Control *the_period;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_period = _Rate_monotonic_Allocate();
+
+ if ( !the_period ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_period->owner = _Thread_Executing;
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+
+ _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name );
+
+ *id = the_period->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_ident
+ *
+ * This directive returns the system ID associated with
+ * the rate monotonic period name.
+ *
+ * Input parameters:
+ * name - user defined period name
+ * id - pointer to period id
+ *
+ * Output parameters:
+ * *id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Rate_monotonic_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_cancel
+ *
+ * This directive allows a thread to cancel a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return RTEMS_INTERNAL_ERROR; /* should never return this */
+ case OBJECTS_LOCAL:
+ if ( !_Thread_Is_executing( the_period->owner ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ }
+ (void) _Watchdog_Remove( &the_period->Timer );
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_delete
+ *
+ * This directive allows a thread to delete a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Rate_monotonic_Information, &the_period->Object );
+ (void) _Watchdog_Remove( &the_period->Timer );
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+ _Rate_monotonic_Free( the_period );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_period
+ *
+ * This directive allows a thread to manipulate a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ * length - length of period (in ticks)
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+ rtems_status_code return_value;
+ Rate_Monotonic_Period_states local_state;
+ ISR_Level level;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( !_Thread_Is_executing( the_period->owner ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ }
+
+ if ( length == RTEMS_PERIOD_STATUS ) {
+ switch ( the_period->state ) {
+ case RATE_MONOTONIC_INACTIVE:
+ return_value = RTEMS_NOT_DEFINED;
+ break;
+ case RATE_MONOTONIC_ACTIVE:
+ return_value = RTEMS_SUCCESSFUL;
+ break;
+ case RATE_MONOTONIC_EXPIRED:
+ return_value = RTEMS_TIMEOUT;
+ break;
+ default: /* unreached -- only to remove warnings */
+ return_value = RTEMS_INTERNAL_ERROR;
+ break;
+ }
+ _Thread_Enable_dispatch();
+ return( return_value );
+ }
+
+ _ISR_Disable( level );
+ switch ( the_period->state ) {
+ case RATE_MONOTONIC_INACTIVE:
+ _ISR_Enable( level );
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _Watchdog_Initialize(
+ &the_period->Timer,
+ _Rate_monotonic_Timeout,
+ id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &the_period->Timer, length );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+
+ case RATE_MONOTONIC_ACTIVE:
+ /*
+ * This tells the _Rate_monotonic_Timeout that this task is
+ * in the process of blocking on the period.
+ */
+
+ the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING;
+ _ISR_Enable( level );
+
+ _Thread_Executing->Wait.id = the_period->Object.id;
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
+
+ /*
+ * Did the watchdog timer expire while we were actually blocking
+ * on it?
+ */
+
+ _ISR_Disable( level );
+ local_state = the_period->state;
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _ISR_Enable( level );
+
+ /*
+ * If it did, then we want to unblock ourself and continue as
+ * if nothing happen. The period was reset in the timeout routine.
+ */
+
+ if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )
+ _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ break;
+
+ case RATE_MONOTONIC_EXPIRED:
+ _ISR_Enable( level );
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _Watchdog_Insert_ticks( &the_period->Timer, length );
+ _Thread_Enable_dispatch();
+ return RTEMS_TIMEOUT;
+
+ case RATE_MONOTONIC_OWNER_IS_BLOCKING:
+ case RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING:
+ /*
+ * These should never happen.
+ */
+ break;
+ }
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Timeout
+ *
+ * This routine processes a period ending. If the owning thread
+ * is waiting for the period, that thread is unblocked and the
+ * period reinitiated. Otherwise, the period is expired.
+ * This routine is called by the watchdog handler.
+ *
+ * Input parameters:
+ * id - period id
+ *
+ * Output parameters: NONE
+ */
+
+void _Rate_monotonic_Timeout(
+ Objects_Id id,
+ void *ignored
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+ Thread_Control *the_thread;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ case OBJECTS_REMOTE: /* impossible */
+ break;
+ case OBJECTS_LOCAL:
+ the_thread = the_period->owner;
+ if ( _States_Is_waiting_for_period( the_thread->current_state ) &&
+ the_thread->Wait.id == the_period->Object.id ) {
+ _Thread_Unblock( the_thread );
+ _Watchdog_Reset( &the_period->Timer );
+ } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
+ the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
+ _Watchdog_Reset( &the_period->Timer );
+ } else
+ the_period->state = RATE_MONOTONIC_EXPIRED;
+ _Thread_Unnest_dispatch();
+ break;
+ }
+}
+
diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c
new file mode 100644
index 0000000000..5a8ad26797
--- /dev/null
+++ b/c/src/exec/rtems/src/region.c
@@ -0,0 +1,486 @@
+/*
+ * Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * _Region_Manager_initialization
+ *
+ * This routine initializes all region manager related data structures.
+ *
+ * Input parameters:
+ * maximum_regions - number of regions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+)
+{
+ _Objects_Initialize_information(
+ &_Region_Information,
+ OBJECTS_RTEMS_REGIONS,
+ FALSE,
+ maximum_regions,
+ sizeof( Region_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_REGION,
+ 0 /* XXX _Region_MP_Process_packet */
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_region_create
+ *
+ * This directive creates a region of physical contiguous memory area
+ * from which variable sized segments can be allocated.
+ *
+ * Input parameters:
+ * name - user defined region name
+ * starting_address - physical start address of region
+ * length - physical length in bytes
+ * page_size - page size in bytes
+ * attribute_set - region attributes
+ * id - address of region id to set
+ *
+ * Output parameters:
+ * id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ Region_Control *the_region;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_region = _Region_Allocate();
+
+ if ( !the_region ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_region->maximum_segment_size =
+ _Heap_Initialize(&the_region->Memory, starting_address, length, page_size);
+
+ if ( !the_region->maximum_segment_size ) {
+ _Region_Free( the_region );
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ the_region->starting_address = starting_address;
+ the_region->length = length;
+ the_region->page_size = page_size;
+ the_region->attribute_set = attribute_set;
+ the_region->number_of_used_blocks = 0;
+
+ _Thread_queue_Initialize(
+ &the_region->Wait_queue,
+ OBJECTS_RTEMS_REGIONS,
+ _Attributes_Is_priority( attribute_set ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_SEGMENT,
+ _Region_MP_Send_extract_proxy,
+ RTEMS_TIMEOUT
+ );
+
+ _Objects_Open( &_Region_Information, &the_region->Object, &name );
+
+ *id = the_region->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_region_ident
+ *
+ * This directive returns the system ID associated with
+ * the region name.
+ *
+ * Input parameters:
+ * name - user defined region name
+ * id - pointer to region id
+ *
+ * Output parameters:
+ * *id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Region_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_region_delete
+ *
+ * This directive allows a thread to delete a region specified by
+ * the region identifier, provided that none of its segments are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - region id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Region_Debug_Walk( the_region, 5 );
+ if ( the_region->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Region_Information, &the_region->Object );
+ _Region_Free( the_region );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_extend
+ *
+ * This directive attempts to grow a region of physical contiguous memory area
+ * from which variable sized segments can be allocated.
+ *
+ * Input parameters:
+ * id - id of region to grow
+ * start - starting address of memory area for extension
+ * length - physical length in bytes to grow the region
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_extend(
+ Objects_Id id,
+ void *starting_address,
+ unsigned32 length
+)
+{
+ Region_Control *the_region;
+ Objects_Locations location;
+ unsigned32 amount_extended;
+ Heap_Extend_status heap_status;
+ rtems_status_code status;
+
+ status = RTEMS_SUCCESSFUL;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ heap_status = _Heap_Extend(
+ &the_region->Memory,
+ starting_address,
+ length,
+ &amount_extended
+ );
+
+ switch ( heap_status ) {
+ case HEAP_EXTEND_SUCCESSFUL:
+ the_region->length += amount_extended;
+ the_region->maximum_segment_size += amount_extended;
+ break;
+ case HEAP_EXTEND_ERROR:
+ status = RTEMS_INVALID_ADDRESS;
+ break;
+ case HEAP_EXTEND_NOT_IMPLEMENTED:
+ status = RTEMS_NOT_IMPLEMENTED;
+ break;
+ }
+ _Thread_Enable_dispatch();
+ return( status );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_get_segment
+ *
+ * This directive will obtain a segment from the given region.
+ *
+ * Input parameters:
+ * id - region id
+ * size - segment size in bytes
+ * option_set - wait option
+ * timeout - number of ticks to wait (0 means wait forever)
+ * segment - pointer to segment address
+ *
+ * Output parameters:
+ * segment - pointer to segment address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+ Thread_Control *executing;
+ void *the_segment;
+
+ *segment = NULL;
+
+ if ( size == 0 )
+ return RTEMS_INVALID_SIZE;
+
+ executing = _Thread_Executing;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( size > the_region->maximum_segment_size ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ _Region_Debug_Walk( the_region, 1 );
+
+ the_segment = _Region_Allocate_segment( the_region, size );
+
+ _Region_Debug_Walk( the_region, 2 );
+
+ if ( the_segment ) {
+ the_region->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *segment = the_segment;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ if ( _Options_Is_no_wait( option_set ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ executing->Wait.queue = &the_region->Wait_queue;
+ executing->Wait.id = id;
+ executing->Wait.count = size;
+ executing->Wait.return_argument = (unsigned32 *) segment;
+
+ _Thread_queue_Enter_critical_section( &the_region->Wait_queue );
+
+ _Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
+
+ _Thread_Enable_dispatch();
+ return( executing->Wait.return_code );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+/*PAGE
+ *
+ * rtems_region_get_segment_size
+ *
+ * This directive will return the size of the segment indicated
+ *
+ * Input parameters:
+ * id - region id
+ * segment - segment address
+ * size - pointer to segment size in bytes
+ *
+ * Output parameters:
+ * size - segment size in bytes filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+ Thread_Control *executing;
+
+ executing = _Thread_Executing;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_return_segment
+ *
+ * This directive will return a segment to its region.
+ *
+ * Input parameters:
+ * id - region id
+ * segment - pointer to segment address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+)
+{
+ register Region_Control *the_region;
+ Thread_Control *the_thread;
+ Objects_Locations location;
+ void **the_segment;
+ int status;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ _Region_Debug_Walk( the_region, 3 );
+
+ status = _Region_Free_segment( the_region, segment );
+
+ _Region_Debug_Walk( the_region, 4 );
+
+ if ( !status ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ the_region->number_of_used_blocks -= 1;
+ for ( ; ; ) {
+ the_thread = _Thread_queue_First( &the_region->Wait_queue );
+
+ if ( the_thread == NULL )
+ break;
+
+ the_segment = _Region_Allocate_segment(
+ the_region,
+ the_thread->Wait.count
+ );
+
+ if ( the_segment == NULL )
+ break;
+
+ *(void **)the_thread->Wait.return_argument = the_segment;
+ the_region->number_of_used_blocks += 1;
+ _Thread_queue_Extract( &the_region->Wait_queue, the_thread );
+ the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/regionmp.c b/c/src/exec/rtems/src/regionmp.c
new file mode 100644
index 0000000000..57f307f826
--- /dev/null
+++ b/c/src/exec/rtems/src/regionmp.c
@@ -0,0 +1,310 @@
+/*
+ * Multiprocessing Support for the Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Region_MP_Send_process_packet
+ *
+ */
+
+void _Region_MP_Send_process_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Region_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+
+ the_packet = _Region_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_REGION;
+ the_packet->Prefix.length = sizeof ( Region_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = region_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == REGION_MP_EXTRACT_PROXY )
+ node = rtems_get_node( region_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Region_MP_Send_request_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ void *segment,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Region_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+
+ the_packet = _Region_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_REGION;
+ the_packet->Prefix.length = sizeof ( Region_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = region_id;
+ the_packet->segment = segment;
+ the_packet->size = size;
+ the_packet->option_set = option_set;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( region_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_INTERNAL_ERROR;
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_response_packet
+ *
+ */
+
+void _Region_MP_Send_response_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ Thread_Control *the_thread
+)
+{
+ Region_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+
+ the_packet = ( Region_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Region_MP_Process_packet
+ *
+ */
+
+void _Region_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Region_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Region_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case REGION_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Region_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Region_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_region_get_segment(
+ the_packet->Prefix.id,
+ the_packet->size,
+ the_packet->option_set,
+ the_packet->Prefix.timeout,
+ &the_packet->segment
+ );
+
+ _Region_MP_Send_response_packet(
+ REGION_MP_GET_SEGMENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(void **)the_thread->Wait.return_argument = the_packet->segment;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_region_return_segment(
+ the_packet->Prefix.id,
+ the_packet->segment
+ );
+
+ _Region_MP_Send_response_packet(
+ REGION_MP_RETURN_SEGMENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_object_was_deleted
+ *
+ * This routine is not needed by the Region since a region
+ * cannot be deleted when segments are in use.
+ *
+ */
+
+/*PAGE
+ *
+ * _Region_MP_Send_extract_proxy
+ *
+ */
+
+void _Region_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Region_MP_Send_process_packet(
+ REGION_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+}
+
+/*PAGE
+ *
+ * _Region_MP_Get_packet
+ *
+ */
+
+Region_MP_Packet *_Region_MP_Get_packet ( void )
+{
+ return ( (Region_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/rtclock.c b/c/src/exec/rtems/src/rtclock.c
new file mode 100644
index 0000000000..ea340ae5f4
--- /dev/null
+++ b/c/src/exec/rtems/src/rtclock.c
@@ -0,0 +1,151 @@
+/*
+ * Clock Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * rtems_clock_get
+ *
+ * This directive returns the current date and time. If the time has
+ * not been set by a tm_set then an error is returned.
+ *
+ * Input parameters:
+ * option - which value to return
+ * time_buffer - pointer to output buffer (a time and date structure
+ * or an interval)
+ *
+ * Output parameters:
+ * time_buffer - output filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+)
+{
+ ISR_Level level;
+ rtems_interval tmp;
+
+ switch ( option ) {
+ case RTEMS_CLOCK_GET_TOD:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_time_of_day *)time_buffer = _TOD_Current;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_PER_SECOND:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_per_second;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TIME_VALUE:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ _ISR_Disable( level );
+ ((rtems_clock_time_value *)time_buffer)->seconds =
+ _TOD_Seconds_since_epoch;
+ tmp = _TOD_Current.ticks;
+ _ISR_Enable( level );
+
+ tmp *= _TOD_Microseconds_per_tick;
+ ((rtems_clock_time_value *)time_buffer)->microseconds = tmp;
+
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* should never get here */
+
+}
+
+/*PAGE
+ *
+ * rtems_clock_set
+ *
+ * This directive sets the date and time for this node.
+ *
+ * Input parameters:
+ * time_buffer - pointer to the time and date structure
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+)
+{
+ rtems_interval seconds;
+
+ if ( _TOD_Validate( time_buffer ) ) {
+ seconds = _TOD_To_seconds( time_buffer );
+ _Thread_Disable_dispatch();
+ _TOD_Set( time_buffer, seconds );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_INVALID_CLOCK;
+}
+
+/*PAGE
+ *
+ * rtems_clock_tick
+ *
+ * This directive notifies the executve that a tick has occurred.
+ * When the tick occurs the time manager updates and maintains
+ * the calendar time, timeslicing, and any timeout delays.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ *
+ * NOTE: This routine only works for leap-years through 2099.
+ */
+
+rtems_status_code rtems_clock_tick( void )
+{
+ _TOD_Tickle_ticks();
+
+ _Watchdog_Tickle_ticks();
+
+ _Thread_Tickle_timeslice();
+
+ if ( _Thread_Is_context_switch_necessary() &&
+ _Thread_Is_dispatching_enabled() )
+ _Thread_Dispatch();
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c
new file mode 100644
index 0000000000..6c3005ffbe
--- /dev/null
+++ b/c/src/exec/rtems/src/rtemstimer.c
@@ -0,0 +1,349 @@
+/*
+ * Timer Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * _Timer_Manager_initialization
+ *
+ * This routine initializes all timer manager related data structures.
+ *
+ * Input parameters:
+ * maximum_timers - number of timers to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+)
+{
+ _Objects_Initialize_information(
+ &_Timer_Information,
+ OBJECTS_RTEMS_TIMERS,
+ FALSE,
+ maximum_timers,
+ sizeof( Timer_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_timer_create
+ *
+ * This directive creates a timer and performs some initialization.
+ *
+ * Input parameters:
+ * name - timer name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * id - timer id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Timer_Control *the_timer;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_timer = _Timer_Allocate();
+
+ if ( !the_timer ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_timer->the_class = TIMER_DORMANT;
+
+ _Objects_Open( &_Timer_Information, &the_timer->Object, &name );
+
+ *id = the_timer->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_timer_ident
+ *
+ * This directive returns the system ID associated with
+ * the timer name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Timer_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_timer_cancel
+ *
+ * This directive allows a thread to cancel a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( !_Timer_Is_dormant_class( the_timer->the_class ) )
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_delete
+ *
+ * This directive allows a thread to delete a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Timer_Information, &the_timer->Object );
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Timer_Free( the_timer );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_after
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * ticks - interval until routine is fired
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ if ( ticks == 0 )
+ return RTEMS_INVALID_NUMBER;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_INTERVAL;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_ticks( &the_timer->Ticker, ticks );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_when
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * wall_time - time of day to fire timer
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+ rtems_interval seconds;
+
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ if ( !_TOD_Validate( wall_time ) )
+ return RTEMS_INVALID_CLOCK;
+
+ seconds = _TOD_To_seconds( wall_time );
+ if ( seconds <= _TOD_Seconds_since_epoch )
+ return RTEMS_INVALID_CLOCK;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_TIME_OF_DAY;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_seconds(
+ &the_timer->Ticker,
+ seconds - _TOD_Seconds_since_epoch
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_reset
+ *
+ * This directive allows a thread to reset a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
+ _Watchdog_Reset( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_DEFINED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c
new file mode 100644
index 0000000000..004176f4fb
--- /dev/null
+++ b/c/src/exec/rtems/src/sem.c
@@ -0,0 +1,570 @@
+/*
+ * Semaphore Manager
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the Semaphore Manager.
+ * This manager utilizes standard Dijkstra counting semaphores to provide
+ * synchronization and mutual exclusion capabilities.
+ *
+ * Directives provided are:
+ *
+ * + create a semaphore
+ * + get an ID of a semaphore
+ * + delete a semaphore
+ * + acquire a semaphore
+ * + release a semaphore
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/interr.h>
+
+/*PAGE
+ *
+ * _Semaphore_Manager_initialization
+ *
+ * This routine initializes all semaphore manager related data structures.
+ *
+ * Input parameters:
+ * maximum_semaphores - maximum configured semaphores
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+ _Objects_Initialize_information(
+ &_Semaphore_Information,
+ OBJECTS_RTEMS_SEMAPHORES,
+ TRUE,
+ maximum_semaphores,
+ sizeof( Semaphore_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_SEMAPHORE,
+ _Semaphore_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_create
+ *
+ * This directive creates a semaphore and sets the initial value based
+ * on the given count. A semaphore id is returned.
+ *
+ * Input parameters:
+ * name - user defined semaphore name
+ * count - initial count of semaphore
+ * attribute_set - semaphore attributes
+ * priority_ceiling - semaphore's ceiling priority
+ * id - pointer to semaphore id
+ *
+ * Output parameters:
+ * id - semaphore id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ Objects_Id *id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ CORE_mutex_Attributes the_mutex_attributes;
+ CORE_semaphore_Attributes the_semaphore_attributes;
+ unsigned32 lock;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( _Attributes_Is_global( attribute_set ) ) {
+
+ if ( !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ if ( _Attributes_Is_inherit_priority( attribute_set ) )
+ return RTEMS_NOT_DEFINED;
+
+ } else if ( _Attributes_Is_inherit_priority( attribute_set ) ) {
+
+ if ( ! ( _Attributes_Is_binary_semaphore( attribute_set ) &&
+ _Attributes_Is_priority( attribute_set ) ) )
+ return RTEMS_NOT_DEFINED;
+
+ }
+
+ if ( _Attributes_Is_binary_semaphore( attribute_set ) && ( count > 1 ) )
+ return RTEMS_INVALID_NUMBER;
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_semaphore = _Semaphore_Allocate();
+
+ if ( !the_semaphore ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,
+ the_semaphore->Object.id, FALSE ) ) ) {
+ _Semaphore_Free( the_semaphore );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_semaphore->attribute_set = attribute_set;
+
+ if ( _Attributes_Is_binary_semaphore( attribute_set ) ) {
+ if ( _Attributes_Is_inherit_priority( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+ else if (_Attributes_Is_priority_ceiling( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+ else if (_Attributes_Is_priority( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY;
+ else
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
+
+ the_mutex_attributes.allow_nesting = TRUE;
+
+ /* Add priority ceiling code here ????? */
+
+ the_mutex_attributes.priority_ceiling = priority_ceiling;
+
+ if ( count == 1 )
+ lock = CORE_MUTEX_UNLOCKED;
+ else
+ lock = CORE_MUTEX_LOCKED;
+
+ _CORE_mutex_Initialize(
+ &the_semaphore->Core_control.mutex,
+ OBJECTS_RTEMS_SEMAPHORES,
+ &the_mutex_attributes,
+ lock,
+ _Semaphore_MP_Send_extract_proxy
+ );
+ }
+ else {
+ if ( _Attributes_Is_priority( attribute_set ) )
+ the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY;
+ else
+ the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
+
+ /*
+ * The following are just to make Purify happy.
+ */
+
+ the_mutex_attributes.allow_nesting = TRUE;
+ the_mutex_attributes.priority_ceiling = PRIORITY_MINIMUM;
+
+ _CORE_semaphore_Initialize(
+ &the_semaphore->Core_control.semaphore,
+ OBJECTS_RTEMS_SEMAPHORES,
+ &the_semaphore_attributes,
+ count,
+ _Semaphore_MP_Send_extract_proxy
+ );
+ }
+
+ _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
+
+ *id = the_semaphore->Object.id;
+
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_ANNOUNCE_CREATE,
+ the_semaphore->Object.id,
+ name,
+ 0 /* Not used */
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_ident
+ *
+ * This directive returns the system ID associated with
+ * the semaphore name.
+ *
+ * Input parameters:
+ * name - user defined semaphore name
+ * node - node(s) to be searched
+ * id - pointer to semaphore id
+ *
+ * Output parameters:
+ * *id - semaphore id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_delete
+ *
+ * This directive allows a thread to delete a semaphore specified by
+ * the semaphore id. The semaphore is freed back to the inactive
+ * semaphore chain.
+ *
+ * Input parameters:
+ * id - semaphore id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_delete(
+ Objects_Id id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) {
+ if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+ else
+ _CORE_mutex_Flush(
+ &the_semaphore->Core_control.mutex,
+ _Semaphore_MP_Send_object_was_deleted,
+ CORE_MUTEX_WAS_DELETED
+ );
+ }
+ else
+ _CORE_semaphore_Flush(
+ &the_semaphore->Core_control.semaphore,
+ _Semaphore_MP_Send_object_was_deleted,
+ CORE_SEMAPHORE_WAS_DELETED
+ );
+
+ _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
+
+ _Semaphore_Free( the_semaphore );
+
+ if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) {
+
+ _Objects_MP_Close( &_Semaphore_Information, the_semaphore->Object.id );
+
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_obtain
+ *
+ * This directive allows a thread to acquire a semaphore.
+ *
+ * Input parameters:
+ * id - semaphore id
+ * option_set - wait option
+ * timeout - number of ticks to wait (0 means wait forever)
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_obtain(
+ Objects_Id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+ boolean wait;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Semaphore_MP_Send_request_packet(
+ SEMAPHORE_MP_OBTAIN_REQUEST,
+ id,
+ option_set,
+ timeout
+ );
+ case OBJECTS_LOCAL:
+ if ( _Options_Is_no_wait( option_set ) )
+ wait = FALSE;
+ else
+ wait = TRUE;
+
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
+ _CORE_mutex_Seize(
+ &the_semaphore->Core_control.mutex,
+ id,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_mutex_return_code(
+ _Thread_Executing->Wait.return_code );
+ } else {
+ _CORE_semaphore_Seize(
+ &the_semaphore->Core_control.semaphore,
+ id,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_semaphore_return_code(
+ _Thread_Executing->Wait.return_code );
+ }
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_release
+ *
+ * This directive allows a thread to release a semaphore.
+ *
+ * Input parameters:
+ * id - semaphore id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_release(
+ Objects_Id id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+ CORE_mutex_Status mutex_status;
+ CORE_semaphore_Status semaphore_status;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Semaphore_MP_Send_request_packet(
+ SEMAPHORE_MP_RELEASE_REQUEST,
+ id,
+ 0, /* Not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
+ mutex_status = _CORE_mutex_Surrender(
+ &the_semaphore->Core_control.mutex,
+ id,
+ _Semaphore_Core_mutex_mp_support
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_mutex_return_code( mutex_status );
+ }
+ else
+ semaphore_status = _CORE_semaphore_Surrender(
+ &the_semaphore->Core_control.semaphore,
+ id,
+ _Semaphore_Core_semaphore_mp_support
+ );
+ _Thread_Enable_dispatch();
+ return
+ _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Translate_core_mutex_return_code
+ *
+ * Input parameters:
+ * the_mutex_status - mutex status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Semaphore_Translate_core_mutex_return_code (
+ unsigned32 the_mutex_status
+)
+{
+ switch ( the_mutex_status ) {
+ case CORE_MUTEX_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
+ return RTEMS_INTERNAL_ERROR;
+ case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ case CORE_MUTEX_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_MUTEX_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Translate_core_semaphore_return_code
+ *
+ * Input parameters:
+ * the_semaphore_status - semaphore status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
+ unsigned32 the_semaphore_status
+)
+{
+ switch ( the_semaphore_status ) {
+ case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_SEMAPHORE_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_SEMAPHORE_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Core_mutex_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the semaphore was surrendered to
+ * id - id of the surrendered semaphore
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Core_mutex_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ id,
+ the_thread
+ );
+}
+
+
+/*PAGE
+ *
+ * _Semaphore_Core_semaphore_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the semaphore was surrendered to
+ * id - id of the surrendered semaphore
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Core_semaphore_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ id,
+ the_thread
+ );
+}
diff --git a/c/src/exec/rtems/src/semmp.c b/c/src/exec/rtems/src/semmp.c
new file mode 100644
index 0000000000..7e7d59ba8e
--- /dev/null
+++ b/c/src/exec/rtems/src/semmp.c
@@ -0,0 +1,308 @@
+/*
+ * Multiprocessing Support for the Semaphore Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_process_packet
+ *
+ */
+
+void _Semaphore_MP_Send_process_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Semaphore_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+
+ the_packet = _Semaphore_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE;
+ the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = semaphore_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == SEMAPHORE_MP_EXTRACT_PROXY )
+ node = rtems_get_node( semaphore_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Semaphore_MP_Send_request_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Semaphore_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+
+ the_packet = _Semaphore_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE;
+ the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = semaphore_id;
+ the_packet->option_set = option_set;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( semaphore_id ),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_SEMAPHORE
+ );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_response_packet
+ *
+ */
+
+void _Semaphore_MP_Send_response_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+)
+{
+ Semaphore_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+
+ the_packet = ( Semaphore_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Semaphore_MP_Process_packet
+ *
+ */
+
+void _Semaphore_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Semaphore_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Semaphore_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Semaphore_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Semaphore_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_semaphore_obtain(
+ the_packet->Prefix.id,
+ the_packet->option_set,
+ the_packet->Prefix.timeout
+ );
+
+ if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_semaphore_release(
+ the_packet->Prefix.id
+ );
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_RELEASE_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_object_was_deleted
+ *
+ */
+
+void _Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+)
+{
+ the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ the_proxy->Wait.id,
+ the_proxy
+ );
+
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_extract_proxy
+ *
+ */
+
+void _Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Get_packet
+ *
+ */
+
+Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void )
+{
+ return ( (Semaphore_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/signal.c b/c/src/exec/rtems/src/signal.c
new file mode 100644
index 0000000000..10aefa391c
--- /dev/null
+++ b/c/src/exec/rtems/src/signal.c
@@ -0,0 +1,149 @@
+/*
+ * Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/asr.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/tasks.h>
+
+/*PAGE
+ *
+ * _Signal_Manager_initialization
+ *
+ * This routine initializes all signal manager related data structures.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Signal_Manager_initialization( void )
+{
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_SIGNAL,
+ _Signal_MP_Process_packet
+ );
+}
+
+/*PAGE
+ *
+ * rtems_signal_catch
+ *
+ * This directive allows a thread to specify what action to take when
+ * catching signals.
+ *
+ * Input parameters:
+ * handler - address of asynchronous signal routine (asr)
+ * ( NULL indicates asr is invalid )
+ * mode_set - mode value for asr
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry asr_handler,
+ rtems_mode mode_set
+)
+{
+ Thread_Control *executing;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+/* XXX normalize mode */
+ executing = _Thread_Executing;
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ _Thread_Disable_dispatch(); /* cannot reschedule while */
+ /* the thread is inconsistent */
+
+ if ( !_ASR_Is_null_handler( asr_handler ) ) {
+ asr->mode_set = mode_set;
+ asr->handler = asr_handler;
+ }
+ else
+ _ASR_Initialize( asr );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_signal_send
+ *
+ * This directive allows a thread to send signals to a thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * signal_set - signal set
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_signal_send(
+ Objects_Id id,
+ rtems_signal_set signal_set
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Signal_MP_Send_request_packet(
+ SIGNAL_MP_SEND_REQUEST,
+ id,
+ signal_set
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ if ( ! _ASR_Is_null_handler( asr->handler ) ) {
+ if ( asr->is_enabled ) {
+ _ASR_Post_signals( signal_set, &asr->signals_posted );
+
+ the_thread->do_post_task_switch_extension = TRUE;
+
+ if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
+ _ISR_Signals_to_thread_executing = TRUE;
+ } else {
+ _ASR_Post_signals( signal_set, &asr->signals_pending );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_DEFINED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/signalmp.c b/c/src/exec/rtems/src/signalmp.c
new file mode 100644
index 0000000000..b3a6ecf18c
--- /dev/null
+++ b/c/src/exec/rtems/src/signalmp.c
@@ -0,0 +1,189 @@
+/*
+ * Multiprocessing Support for the Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Signal_MP_Send_process_packet
+ *
+ * This subprogram is not needed since there are no process
+ * packets to be sent by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Signal_MP_Send_request_packet (
+ Signal_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_signal_set signal_in
+)
+{
+ Signal_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SIGNAL_MP_SEND_REQUEST:
+
+ the_packet = _Signal_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SIGNAL;
+ the_packet->Prefix.length = sizeof ( Signal_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->signal_in = signal_in;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( task_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case SIGNAL_MP_SEND_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_INTERNAL_ERROR;
+}
+
+/*PAGE
+ *
+ * _Signal_MP_Send_response_packet
+ *
+ */
+
+void _Signal_MP_Send_response_packet (
+ Signal_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ Signal_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SIGNAL_MP_SEND_RESPONSE:
+
+ the_packet = ( Signal_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case SIGNAL_MP_SEND_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Signal_MP_Process_packet
+ *
+ */
+
+void _Signal_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Signal_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+
+ the_packet = (Signal_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case SIGNAL_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_signal_send(
+ the_packet->Prefix.id,
+ the_packet->signal_in
+ );
+
+ _Signal_MP_Send_response_packet(
+ SIGNAL_MP_SEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case SIGNAL_MP_SEND_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Signal_MP_Send_object_was_deleted
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Send_extract_proxy
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Get_packet
+ *
+ */
+
+Signal_MP_Packet *_Signal_MP_Get_packet ( void )
+{
+ return ( (Signal_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/taskmp.c b/c/src/exec/rtems/src/taskmp.c
new file mode 100644
index 0000000000..8edccb05e9
--- /dev/null
+++ b/c/src/exec/rtems/src/taskmp.c
@@ -0,0 +1,340 @@
+/*
+ * Multiprocessing Support for the RTEMS Task Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_process_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Send_process_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_name name
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+
+ the_packet = _RTEMS_tasks_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_TASKS;
+ the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->name = name;
+
+ _MPCI_Send_process_packet( MPCI_ALL_NODES, &the_packet->Prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_task_priority new_priority,
+ unsigned32 notepad,
+ unsigned32 note
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+
+ the_packet = _RTEMS_tasks_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_TASKS;
+ the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->the_priority = new_priority;
+ the_packet->notepad = notepad;
+ the_packet->note = note;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( task_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_response_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Send_response_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+
+ the_packet = (RTEMS_tasks_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _RTEMS_tasks_MP_Process_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (RTEMS_tasks_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_RTEMS_tasks_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_RTEMS_tasks_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_suspend(
+ the_packet->Prefix.id
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SUSPEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_resume(
+ the_packet->Prefix.id
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_RESUME_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_set_priority(
+ the_packet->Prefix.id,
+ the_packet->the_priority,
+ &the_packet->the_priority
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(rtems_task_priority *)the_thread->Wait.return_argument =
+ the_packet->the_priority;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_get_note(
+ the_packet->Prefix.id,
+ the_packet->notepad,
+ &the_packet->note
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_GET_NOTE_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(unsigned32 *)the_thread->Wait.return_argument = the_packet->note;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_set_note(
+ the_packet->Prefix.id,
+ the_packet->notepad,
+ the_packet->note
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SET_NOTE_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_object_was_deleted
+ *
+ * This routine is not neededby the Tasks since a task
+ * cannot be globally deleted.
+ *
+ */
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_extract_proxy
+ *
+ * This routine is not neededby the Tasks since a task
+ * cannot be globally deleted.
+ *
+ */
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Get_packet
+ *
+ */
+
+RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void )
+{
+ return (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet();
+}
+
+/* end of file */
diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c
new file mode 100644
index 0000000000..0b30fcce69
--- /dev/null
+++ b/c/src/exec/rtems/src/tasks.c
@@ -0,0 +1,1098 @@
+/*
+ * RTEMS Task Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/object.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Create_extension
+ *
+ * XXX
+ */
+
+boolean _RTEMS_tasks_Create_extension(
+ Thread_Control *executing,
+ Thread_Control *created
+)
+{
+ RTEMS_API_Control *api;
+
+ api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
+
+ if ( !api )
+ return FALSE;
+
+ created->API_Extensions[ THREAD_API_RTEMS ] = api;
+
+ api->pending_events = EVENT_SETS_NONE_PENDING;
+ _ASR_Initialize( &api->Signal );
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Start_extension
+ *
+ * XXX
+ */
+
+User_extensions_routine _RTEMS_tasks_Start_extension(
+ Thread_Control *executing,
+ Thread_Control *started
+)
+{
+ RTEMS_API_Control *api;
+
+ api = started->API_Extensions[ THREAD_API_RTEMS ];
+
+ api->pending_events = EVENT_SETS_NONE_PENDING;
+
+ _ASR_Initialize( &api->Signal );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Delete_extension
+ *
+ * XXX
+ */
+
+User_extensions_routine _RTEMS_tasks_Delete_extension(
+ Thread_Control *executing,
+ Thread_Control *deleted
+)
+{
+ (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] );
+
+ deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Switch_extension
+ *
+ * XXX
+ */
+
+void _RTEMS_tasks_Switch_extension(
+ Thread_Control *executing
+)
+{
+ ISR_Level level;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+ rtems_signal_set signal_set;
+ Modes_Control prev_mode;
+
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ _ISR_Disable( level );
+ signal_set = asr->signals_posted;
+ asr->signals_posted = 0;
+ _ISR_Enable( level );
+
+
+ if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */
+ return;
+
+ asr->nest_level += 1;
+ rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+ (*asr->handler)( signal_set );
+
+ asr->nest_level -= 1;
+ rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+}
+
+API_extensions_Control _RTEMS_tasks_API_extensions = {
+ { NULL, NULL },
+ NULL, /* predriver */
+ _RTEMS_tasks_Initialize_user_tasks, /* postdriver */
+ _RTEMS_tasks_Switch_extension /* post switch */
+};
+
+User_extensions_Control _RTEMS_tasks_User_extensions = {
+ { NULL, NULL },
+ { _RTEMS_tasks_Create_extension, /* create */
+ _RTEMS_tasks_Start_extension, /* start */
+ _RTEMS_tasks_Start_extension, /* restart */
+ _RTEMS_tasks_Delete_extension, /* delete */
+ NULL, /* switch */
+ NULL, /* begin */
+ NULL, /* exitted */
+ NULL /* fatal */
+ }
+};
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Manager_initialization
+ *
+ * This routine initializes all Task Manager related data structures.
+ *
+ * Input parameters:
+ * maximum_tasks - number of tasks to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Manager_initialization(
+ unsigned32 maximum_tasks,
+ unsigned32 number_of_initialization_tasks,
+ rtems_initialization_tasks_table *user_tasks
+)
+{
+
+ _RTEMS_tasks_Number_of_initialization_tasks = number_of_initialization_tasks;
+ _RTEMS_tasks_User_initialization_tasks = user_tasks;
+
+ if ( user_tasks == NULL || number_of_initialization_tasks == 0 )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, RTEMS_TOO_MANY );
+
+ _Objects_Initialize_information(
+ &_RTEMS_tasks_Information,
+ OBJECTS_RTEMS_TASKS,
+ TRUE,
+ maximum_tasks,
+ sizeof( Thread_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ TRUE
+ );
+
+ /*
+ * Add all the extensions for this API
+ */
+
+ _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
+
+ _API_extensions_Add( &_RTEMS_tasks_API_extensions );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_TASKS,
+ _RTEMS_tasks_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_task_create
+ *
+ * This directive creates a thread by allocating and initializing a
+ * thread control block and a stack. The newly created thread is
+ * placed in the dormant state.
+ *
+ * Input parameters:
+ * name - user defined thread name
+ * initial_priority - thread priority
+ * stack_size - stack size in bytes
+ * initial_modes - initial thread mode
+ * attribute_set - thread attributes
+ * id - pointer to thread id
+ *
+ * Output parameters:
+ * id - thread id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_create(
+ rtems_name name,
+ rtems_task_priority initial_priority,
+ unsigned32 stack_size,
+ rtems_mode initial_modes,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_MP_Control *the_global_object = NULL;
+ boolean is_fp;
+ boolean is_global;
+ boolean status;
+ rtems_attribute the_attribute_set;
+ Priority_Control core_priority;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ /*
+ * Core Thread Initialize insures we get the minimum amount of
+ * stack space.
+ */
+
+#if 0
+ if ( !_Stack_Is_enough( stack_size ) )
+ return RTEMS_INVALID_SIZE;
+#endif
+
+ /*
+ * Validate the RTEMS API priority and convert it to the core priority range.
+ */
+
+ if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) )
+ return RTEMS_INVALID_PRIORITY;
+
+ core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority );
+
+ /*
+ * Fix the attribute set to match the attributes which
+ * this processor (1) requires and (2) is able to support.
+ * First add in the required flags for attribute_set
+ * Typically this might include FP if the platform
+ * or application required all tasks to be fp aware.
+ * Then turn off the requested bits which are not supported.
+ */
+
+ the_attribute_set = _Attributes_Set( attribute_set, ATTRIBUTES_REQUIRED );
+ the_attribute_set =
+ _Attributes_Clear( the_attribute_set, ATTRIBUTES_NOT_SUPPORTED );
+
+ if ( _Attributes_Is_floating_point( the_attribute_set ) )
+ is_fp = TRUE;
+ else
+ is_fp = FALSE;
+
+ if ( _Attributes_Is_global( the_attribute_set ) ) {
+
+ is_global = TRUE;
+
+ if ( !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ } else
+ is_global = FALSE;
+
+ /*
+ * Make sure system is MP if this task is global
+ */
+
+ /*
+ * Disable dispatch for protection
+ */
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * Allocate the thread control block and -- if the task is global --
+ * allocate a global object control block.
+ *
+ * NOTE: This routine does not use the combined allocate and open
+ * global object routine because this results in a lack of
+ * control over when memory is allocated and can be freed in
+ * the event of an error.
+ */
+
+ the_thread = _RTEMS_tasks_Allocate();
+
+ if ( !the_thread ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( is_global ) {
+ the_global_object = _Objects_MP_Allocate_global_object();
+
+ if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
+ _RTEMS_tasks_Free( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+ }
+
+ /*
+ * Initialize the core thread for this task.
+ */
+
+ status = _Thread_Initialize(
+ &_RTEMS_tasks_Information,
+ the_thread,
+ NULL,
+ stack_size,
+ is_fp,
+ core_priority,
+ _Modes_Is_preempt(initial_modes) ? TRUE : FALSE,
+ _Modes_Is_timeslice(initial_modes) ? TRUE : FALSE,
+ _Modes_Get_interrupt_level(initial_modes),
+ &name
+ );
+
+ if ( !status ) {
+ if ( is_global )
+ _Objects_MP_Free_global_object( the_global_object );
+ _RTEMS_tasks_Free( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ asr->is_enabled = _Modes_Is_asr_disabled(initial_modes) ? FALSE : TRUE;
+
+ *id = the_thread->Object.id;
+
+ if ( is_global ) {
+
+ the_thread->is_global = TRUE;
+
+ _Objects_MP_Open(
+ &_RTEMS_tasks_Information,
+ the_global_object,
+ name,
+ the_thread->Object.id
+ );
+
+ _RTEMS_tasks_MP_Send_process_packet(
+ RTEMS_TASKS_MP_ANNOUNCE_CREATE,
+ the_thread->Object.id,
+ name
+ );
+
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_ident
+ *
+ * This directive returns the system ID associated with
+ * the thread name.
+ *
+ * Input parameters:
+ * name - user defined thread name
+ * node - node(s) to be searched
+ * id - pointer to thread id
+ *
+ * Output parameters:
+ * *id - thread id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ if ( name == OBJECTS_ID_OF_SELF ) {
+ *id = _Thread_Executing->Object.id;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_task_start
+ *
+ * This directive readies the thread identified by the "id"
+ * based on its current priorty, to await execution. A thread
+ * can be started only from the dormant state.
+ *
+ * Input parameters:
+ * id - thread id
+ * entry_point - start execution address of thread
+ * argument - thread argument
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_start(
+ rtems_id id,
+ rtems_task_entry entry_point,
+ unsigned32 argument
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ if ( entry_point == NULL )
+ return RTEMS_INVALID_ADDRESS;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Thread_Start(
+ the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_restart
+ *
+ * This directive readies the specified thread. It restores
+ * the thread environment to the original values established
+ * at thread creation and start time. A thread can be restarted
+ * from any state except the dormant state.
+ *
+ * Input parameters:
+ * id - thread id
+ * argument - thread argument
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_restart(
+ Objects_Id id,
+ unsigned32 argument
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Thread_Restart( the_thread, NULL, argument ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_delete
+ *
+ * This directive allows a thread to delete itself or the thread
+ * identified in the id field. The executive halts execution
+ * of the thread and frees the thread control block.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * nothing - if id is the requesting thread (always succeeds)
+ * RTEMS_SUCCESSFUL - if successful and id is
+ * not the requesting thread
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_delete(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ _Thread_Close( &_RTEMS_tasks_Information, the_thread );
+
+ _RTEMS_tasks_Free( the_thread );
+
+ if ( the_thread->is_global ) {
+
+ _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
+
+ _RTEMS_tasks_MP_Send_process_packet(
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE,
+ the_thread->Object.id,
+ 0 /* Not used */
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_suspend
+ *
+ * This directive will place the specified thread in the "suspended"
+ * state. Note that the suspended state can be in addition to
+ * other waiting states.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_suspend(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SUSPEND_REQUEST,
+ id,
+ 0, /* Not used */
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ case OBJECTS_LOCAL:
+ if ( !_States_Is_suspended( the_thread->current_state ) ) {
+ _Thread_Set_state( the_thread, STATES_SUSPENDED );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_ALREADY_SUSPENDED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_resume
+ *
+ * This directive will remove the specified thread
+ * from the suspended state.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_resume(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_RESUME_REQUEST,
+ id,
+ 0, /* Not used */
+ 0, /* Not used */
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ if ( _States_Is_suspended( the_thread->current_state ) ) {
+ _Thread_Resume( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_set_priority
+ *
+ * This directive changes the priority of the specified thread.
+ * The specified thread can be any thread in the system including
+ * the requesting thread.
+ *
+ * Input parameters:
+ * id - thread id (0 indicates requesting thread)
+ * new_priority - thread priority (0 indicates current priority)
+ * old_priority - pointer to previous priority
+ *
+ * Output parameters:
+ * old_priority - previous priority
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_set_priority(
+ Objects_Id id,
+ rtems_task_priority new_priority,
+ rtems_task_priority *old_priority
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ if ( new_priority != RTEMS_CURRENT_PRIORITY &&
+ !_RTEMS_tasks_Priority_is_valid( new_priority ) )
+ return RTEMS_INVALID_PRIORITY;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = old_priority;
+ return(
+ _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SET_PRIORITY_REQUEST,
+ id,
+ new_priority,
+ 0, /* Not used */
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ *old_priority = the_thread->current_priority;
+ if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
+ the_thread->real_priority = new_priority;
+ if ( the_thread->resource_count == 0 ||
+ the_thread->current_priority > new_priority )
+ _Thread_Change_priority( the_thread, new_priority );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_mode
+ *
+ * This directive enables and disables several modes of
+ * execution for the requesting thread.
+ *
+ * Input parameters:
+ * mode_set - new mode
+ * mask - mask
+ * previous_mode_set - address of previous mode set
+ *
+ * Output:
+ * *previous_mode_set - previous mode set
+ * always return RTEMS_SUCCESSFUL;
+ */
+
+rtems_status_code rtems_task_mode(
+ rtems_mode mode_set,
+ rtems_mode mask,
+ rtems_mode *previous_mode_set
+)
+{
+ Thread_Control *executing;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+ boolean is_asr_enabled = FALSE;
+ boolean needs_asr_dispatching = FALSE;
+ rtems_mode old_mode;
+
+ executing = _Thread_Executing;
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ old_mode = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT;
+ old_mode |= (executing->is_timeslice) ? RTEMS_TIMESLICE : RTEMS_NO_TIMESLICE;
+ old_mode |= (asr->is_enabled) ? RTEMS_ASR : RTEMS_NO_ASR;
+ old_mode |= _ISR_Get_level();
+
+ *previous_mode_set = old_mode;
+
+ /*
+ * These are generic thread scheduling characteristics.
+ */
+
+ if ( mask & RTEMS_PREEMPT_MASK )
+ executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE;
+
+ if ( mask & RTEMS_TIMESLICE_MASK )
+ executing->is_timeslice = _Modes_Is_timeslice(mode_set) ? TRUE : FALSE;
+
+ /*
+ * Set the new interrupt level
+ */
+
+ if ( mask & RTEMS_INTERRUPT_MASK )
+ _Modes_Set_interrupt_level( mode_set );
+
+ /*
+ * This is specific to the RTEMS API
+ */
+
+ is_asr_enabled = FALSE;
+ needs_asr_dispatching = FALSE;
+
+ if ( mask & RTEMS_ASR_MASK ) {
+ is_asr_enabled = _Modes_Is_asr_disabled( mode_set ) ? FALSE : TRUE;
+ if ( is_asr_enabled != asr->is_enabled ) {
+ asr->is_enabled = is_asr_enabled;
+ _ASR_Swap_signals( asr );
+ if ( _ASR_Are_signals_pending( asr ) ) {
+ needs_asr_dispatching = TRUE;
+ executing->do_post_task_switch_extension = TRUE;
+ }
+ }
+ }
+
+ if ( _Thread_Evaluate_mode() || needs_asr_dispatching )
+ _Thread_Dispatch();
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_get_note
+ *
+ * This directive obtains the note from the specified notepad
+ * of the specified thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * notepad - notepad number
+ * note - pointer to note
+ *
+ * Output parameters:
+ * note - filled in if successful
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_get_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 *note
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ /*
+ * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would
+ * be checking an unsigned number for being negative.
+ */
+
+ if ( notepad > RTEMS_NOTEPAD_LAST )
+ return RTEMS_INVALID_NUMBER;
+
+ /*
+ * Optimize the most likely case to avoid the Thread_Dispatch.
+ */
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
+ _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+ *note = api->Notepads[ notepad ];
+ return RTEMS_SUCCESSFUL;
+ }
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = note;
+
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_GET_NOTE_REQUEST,
+ id,
+ 0, /* Not used */
+ notepad,
+ 0 /* Not used */
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ *note = api->Notepads[ notepad ];
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_set_note
+ *
+ * This directive sets the specified notepad contents to the given
+ * note.
+ *
+ * Input parameters:
+ * id - thread id
+ * notepad - notepad number
+ * note - note value
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_set_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 note
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ /*
+ * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would
+ * be checking an unsigned number for being negative.
+ */
+
+ if ( notepad > RTEMS_NOTEPAD_LAST )
+ return RTEMS_INVALID_NUMBER;
+
+ /*
+ * Optimize the most likely case to avoid the Thread_Dispatch.
+ */
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
+ _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+ api->Notepads[ notepad ] = note;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SET_NOTE_REQUEST,
+ id,
+ 0, /* Not used */
+ notepad,
+ note
+ );
+
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ api->Notepads[ notepad ] = note;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_wake_after
+ *
+ * This directive suspends the requesting thread for the given amount
+ * of ticks.
+ *
+ * Input parameters:
+ * ticks - number of ticks to wait
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always successful
+ */
+
+rtems_status_code rtems_task_wake_after(
+ rtems_interval ticks
+)
+{
+ if ( ticks == 0 ) {
+ _Thread_Yield_processor();
+ _Thread_Dispatch();
+ } else {
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended,
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
+ _Thread_Enable_dispatch();
+ }
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_wake_when
+ *
+ * This directive blocks the requesting thread until the given date and
+ * time is reached.
+ *
+ * Input parameters:
+ * time_buffer - pointer to the time and date structure
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_wake_when(
+rtems_time_of_day *time_buffer
+)
+{
+ Watchdog_Interval seconds;
+
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ time_buffer->ticks = 0;
+
+ if ( !_TOD_Validate( time_buffer ) )
+ return RTEMS_INVALID_CLOCK;
+
+ seconds = _TOD_To_seconds( time_buffer );
+
+ if ( seconds <= _TOD_Seconds_since_epoch )
+ return RTEMS_INVALID_CLOCK;
+
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended,
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_seconds(
+ &_Thread_Executing->Timer,
+ seconds - _TOD_Seconds_since_epoch
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Initialize_user_tasks
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Initialize_user_tasks( void )
+{
+ unsigned32 index;
+ unsigned32 maximum;
+ rtems_id id;
+ rtems_status_code return_value;
+ rtems_initialization_tasks_table *user_tasks;
+
+ /*
+ * NOTE: This is slightly different from the Ada implementation.
+ */
+
+ user_tasks = _RTEMS_tasks_User_initialization_tasks;
+ maximum = _RTEMS_tasks_Number_of_initialization_tasks;
+
+ for ( index=0 ; index < maximum ; index++ ) {
+ return_value = rtems_task_create(
+ user_tasks[ index ].name,
+ user_tasks[ index ].initial_priority,
+ user_tasks[ index ].stack_size,
+ user_tasks[ index ].mode_set,
+ user_tasks[ index ].attribute_set,
+ &id
+ );
+
+ if ( !rtems_is_status_successful( return_value ) )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
+
+ return_value = rtems_task_start(
+ id,
+ user_tasks[ index ].entry_point,
+ user_tasks[ index ].argument
+ );
+
+ if ( !rtems_is_status_successful( return_value ) )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
+ }
+}
+
diff --git a/c/src/exec/rtems/src/timer.c b/c/src/exec/rtems/src/timer.c
new file mode 100644
index 0000000000..6c3005ffbe
--- /dev/null
+++ b/c/src/exec/rtems/src/timer.c
@@ -0,0 +1,349 @@
+/*
+ * Timer Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * _Timer_Manager_initialization
+ *
+ * This routine initializes all timer manager related data structures.
+ *
+ * Input parameters:
+ * maximum_timers - number of timers to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+)
+{
+ _Objects_Initialize_information(
+ &_Timer_Information,
+ OBJECTS_RTEMS_TIMERS,
+ FALSE,
+ maximum_timers,
+ sizeof( Timer_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_timer_create
+ *
+ * This directive creates a timer and performs some initialization.
+ *
+ * Input parameters:
+ * name - timer name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * id - timer id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Timer_Control *the_timer;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_timer = _Timer_Allocate();
+
+ if ( !the_timer ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_timer->the_class = TIMER_DORMANT;
+
+ _Objects_Open( &_Timer_Information, &the_timer->Object, &name );
+
+ *id = the_timer->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_timer_ident
+ *
+ * This directive returns the system ID associated with
+ * the timer name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Timer_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_timer_cancel
+ *
+ * This directive allows a thread to cancel a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( !_Timer_Is_dormant_class( the_timer->the_class ) )
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_delete
+ *
+ * This directive allows a thread to delete a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Timer_Information, &the_timer->Object );
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Timer_Free( the_timer );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_after
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * ticks - interval until routine is fired
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ if ( ticks == 0 )
+ return RTEMS_INVALID_NUMBER;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_INTERVAL;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_ticks( &the_timer->Ticker, ticks );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_when
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * wall_time - time of day to fire timer
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+ rtems_interval seconds;
+
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ if ( !_TOD_Validate( wall_time ) )
+ return RTEMS_INVALID_CLOCK;
+
+ seconds = _TOD_To_seconds( wall_time );
+ if ( seconds <= _TOD_Seconds_since_epoch )
+ return RTEMS_INVALID_CLOCK;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_TIME_OF_DAY;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_seconds(
+ &the_timer->Ticker,
+ seconds - _TOD_Seconds_since_epoch
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_reset
+ *
+ * This directive allows a thread to reset a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
+ _Watchdog_Reset( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_DEFINED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/sapi/headers/confdefs.h b/c/src/exec/sapi/headers/confdefs.h
new file mode 100644
index 0000000000..83f6c3ccd1
--- /dev/null
+++ b/c/src/exec/sapi/headers/confdefs.h
@@ -0,0 +1,377 @@
+/* confdefs.h
+ *
+ * This include file contains the configuration table template that will
+ * be used by the single processor tests to define its default configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CONFIGURATION_TEMPLATE_h
+#define __CONFIGURATION_TEMPLATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern rtems_initialization_tasks_table Initialization_tasks[];
+extern rtems_driver_address_table Device_drivers[];
+extern rtems_configuration_table Configuration;
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+/*
+ * Default User Initialization Task Table. This table guarantees that
+ * one user initialization table is defined.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
+
+#ifndef CONFIGURE_INIT_TASK_NAME
+#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'U', 'I', '1', ' ' )
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
+#define CONFIGURE_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_PRIORITY
+#define CONFIGURE_INIT_TASK_PRIORITY 1
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
+#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
+#define CONFIGURE_INIT_TASK_ARGUMENTS 0
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_initialization_tasks_table Initialization_tasks[] = {
+ { CONFIGURE_INIT_TASK_NAME,
+ CONFIGURE_INIT_TASK_STACK_SIZE,
+ CONFIGURE_INIT_TASK_PRIORITY,
+ CONFIGURE_INIT_TASK_ATTRIBUTES,
+ CONFIGURE_INIT_TASK_ENTRY_POINT,
+ CONFIGURE_INIT_TASK_INITIAL_MODES,
+ CONFIGURE_INIT_TASK_ARGUMENTS
+ }
+};
+#endif
+
+#endif
+
+/*
+ * Default Device Driver Table. Each driver needed by the test is explicitly
+ * choosen by that test. There is always a null driver entry.
+ */
+
+#define NULL_DRIVER_TABLE_ENTRY \
+ { NULL, NULL, NULL, NULL, NULL, NULL }
+
+#ifdef CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+#include <timerdrv.h>
+#endif
+
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+#include <stubdrv.h>
+#endif
+
+#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
+
+#ifdef CONFIGURE_INIT
+rtems_driver_address_table Device_drivers[] = {
+#ifdef CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+ CONSOLE_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+ CLOCK_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+ STUB_DRIVER_TABLE_ENTRY,
+#endif
+ NULL_DRIVER_TABLE_ENTRY
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
+
+/*
+ * Default the number of devices per device driver. This value may be
+ * overridden by the user.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES
+
+#ifndef CONFIGURE_MAXIMUM_DEVICES
+#define CONFIGURE_MAXIMUM_DEVICES 20
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifdef CONFIGURE_MPTEST
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#ifndef CONFIGURE_MP_NODE_NUMBER
+#define CONFIGURE_MP_NODE_NUMBER NODE_NUMBER
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_NODES
+#define CONFIGURE_MP_MAXIMUM_NODES 2
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 32
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_PROXIES
+#define CONFIGURE_MP_MAXIMUM_PROXIES 32
+#endif
+
+#ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
+#include <mpci.h>
+#define CONFIGURE_MP_MPCI_TABLE_POINTER &MPCI_table
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_multiprocessing_table Multiprocessing_configuration = {
+ CONFIGURE_MP_NODE_NUMBER, /* local node number */
+ CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes in system */
+ CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS, /* maximum # global objects */
+ CONFIGURE_MP_MAXIMUM_PROXIES, /* maximum # proxies */
+ CONFIGURE_MP_MPCI_TABLE_POINTER /* pointer to MPCI config table */
+};
+#endif
+
+#define CONFIGURE_MULTIPROCESSING_TABLE &Multiprocessing_configuration
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MULTIPROCESSING_TABLE NULL
+
+#endif /* CONFIGURE_MPTEST */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_WORK_AREA
+#define CONFIGURE_EXECUTIVE_RAM_WORK_AREA NULL
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TASKS
+#define CONFIGURE_MAXIMUM_TASKS 10
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TIMERS
+#define CONFIGURE_MAXIMUM_TIMERS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_SEMAPHORES
+#define CONFIGURE_MAXIMUM_SEMAPHORES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PARTITIONS
+#define CONFIGURE_MAXIMUM_PARTITIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_REGIONS
+#define CONFIGURE_MAXIMUM_REGIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PORTS
+#define CONFIGURE_MAXIMUM_PORTS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PERIODS
+#define CONFIGURE_MAXIMUM_PERIODS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#endif
+
+#ifndef CONFIGURE_MICROSECONDS_PER_TICK
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
+#endif
+
+#ifndef CONFIGURE_TICKS_PER_TIMESLICE
+#define CONFIGURE_TICKS_PER_TIMESLICE 50
+#endif
+
+#ifndef CONFIGURE_INITIAL_EXTENSIONS
+#define CONFIGURE_INITIAL_EXTENSIONS NULL
+#endif
+
+/*
+ * Calculate the RAM size based on the maximum number of objects configured.
+ * The model is to estimate the memory required for each configured item,
+ * sum the memory requirements and insure that there is at least 32K greater
+ * than that for things not directly addressed such as:
+ *
+ * + stacks greater than minimum size
+ * + FP contexts
+ * + API areas (should be optional)
+ * + messages
+ * + object name and local pointer table overhead
+ * + per node memory requirements
+ * + executive fixed requirements (including at least internal threads
+ * and the Ready chains)
+ *
+ * NOTE: Eventually this should take into account some of the above.
+ * Basically, this is a "back of the envelope" estimate for
+ * memory requirements. It could be more accurate.
+ */
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
+
+#define CONFIGURE_OBJECT_TABLE_STUFF \
+ ( sizeof(Objects_Control *) + sizeof(rtems_name *) + sizeof(rtems_name) )
+
+#define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
+ ((_tasks) * \
+ ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
+ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \
+ CONFIGURE_OBJECT_TABLE_STUFF)) \
+ )
+
+#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
+ ((_timers) * ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
+ ((_semaphores) * \
+ ( sizeof(Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
+ ( (_queues) * \
+ ( sizeof(Message_queue_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
+ ( (_partitions) * \
+ ( sizeof(Partition_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
+ ( (_regions) * \
+ ( sizeof(Region_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
+ ( (_ports) * \
+ ( sizeof(Dual_ported_memory_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
+ ( (_periods) * \
+ ( sizeof(Rate_monotonic_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
+ ( (_extensions) * \
+ ( sizeof(Extension_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_DEVICES(_devices) \
+ (((_devices) + 1) * ( sizeof(rtems_driver_name_t) ) )
+
+#ifdef CONFIGURE_MPTEST
+
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
+ ( ((_proxies) + 1) * ( sizeof(Thread_Proxy_control) ) )
+
+#define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
+ ((_global_objects) * ( sizeof(Objects_MP_Control) ) )
+
+#define CONFIGURE_MEMORY_FOR_MP \
+ ( CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
+ CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) \
+ )
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MEMORY_FOR_MP 0
+
+#endif
+#define CONFIGURE_EXECUTIVE_RAM_SIZE \
+(( CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS) + \
+ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
+ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
+ CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
+ CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
+ CONFIGURE_MEMORY_FOR_REGIONS(CONFIGURE_MAXIMUM_REGIONS) + \
+ CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
+ CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
+ CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) + \
+ CONFIGURE_MEMORY_FOR_DEVICES(CONFIGURE_MAXIMUM_DEVICES) + \
+ CONFIGURE_MEMORY_FOR_MP + \
+ (96*1024) \
+) & 0xffff8000)
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_configuration_table Configuration = {
+ CONFIGURE_EXECUTIVE_RAM_WORK_AREA,
+ CONFIGURE_EXECUTIVE_RAM_SIZE,
+ CONFIGURE_MAXIMUM_TASKS,
+ CONFIGURE_MAXIMUM_TIMERS,
+ CONFIGURE_MAXIMUM_SEMAPHORES,
+ CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
+ CONFIGURE_MAXIMUM_PARTITIONS,
+ CONFIGURE_MAXIMUM_REGIONS,
+ CONFIGURE_MAXIMUM_PORTS,
+ CONFIGURE_MAXIMUM_PERIODS,
+ CONFIGURE_MAXIMUM_USER_EXTENSIONS,
+ CONFIGURE_MICROSECONDS_PER_TICK,
+ CONFIGURE_TICKS_PER_TIMESLICE,
+ sizeof (Initialization_tasks)/
+ sizeof(rtems_initialization_tasks_table), /* number of init tasks */
+ Initialization_tasks, /* init task(s) table */
+ sizeof (Device_drivers)/
+ sizeof(rtems_driver_address_table), /* number of device drivers */
+ CONFIGURE_MAXIMUM_DEVICES,
+ Device_drivers, /* pointer to driver table */
+ CONFIGURE_INITIAL_EXTENSIONS, /* pointer to initial extensions */
+ CONFIGURE_MULTIPROCESSING_TABLE /* ptr to MP config table */
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/config.h b/c/src/exec/sapi/headers/config.h
new file mode 100644
index 0000000000..29f6005f58
--- /dev/null
+++ b/c/src/exec/sapi/headers/config.h
@@ -0,0 +1,94 @@
+/* config.h
+ *
+ * This include file contains the table of user defined configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONFIGURATION_h
+#define __RTEMS_CONFIGURATION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+#include <rtems/extension.h>
+#include <rtems/io.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/tasks.h>
+
+/*
+ * The following records define the Multiprocessor Configuration
+ * Table. This table defines the multiprocessor system
+ * characteristics which must be known by RTEMS in a multiprocessor
+ * system.
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+ MPCI_Control *User_mpci_table; /* pointer to MPCI table */
+} rtems_multiprocessing_table;
+
+/*
+ * The following records define the Configuration Table. The
+ * information contained in this table is required in all
+ * RTEMS systems, whether single or multiprocessor. This
+ * table primarily defines the following:
+ *
+ * + location and size of the RTEMS Workspace
+ * + required number of each object type
+ * + microseconds per clock tick
+ * + clock ticks per task timeslice
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+ rtems_initialization_tasks_table *User_initialization_tasks_table;
+ unsigned32 number_of_device_drivers;
+ unsigned32 maximum_devices;
+ rtems_driver_address_table *Device_driver_table;
+ rtems_extensions_table *User_extension_table;
+ rtems_multiprocessing_table *User_multiprocessing_table;
+} rtems_configuration_table;
+
+/*
+ * The following are provided strictly for the convenience of
+ * the user. They are not used in RTEMS itself.
+ */
+
+EXTERN rtems_configuration_table *_Configuration_Table;
+EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/directives.h b/c/src/exec/sapi/headers/directives.h
new file mode 100644
index 0000000000..938cf68460
--- /dev/null
+++ b/c/src/exec/sapi/headers/directives.h
@@ -0,0 +1,120 @@
+/* directives.h
+ *
+ * The following definitions are the directive numbers used
+ * in the assembly interface.
+ *
+ * COPYRIGHT (c) 19891990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DIRECTIVES_h
+#define __RTEMS_DIRECTIVES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RTEMS_INITIALIZE_EXECUTIVE 0
+#define RTEMS_INITIALIZE_EXECUTIVE_EARLY 1
+#define RTEMS_INITIALIZE_EXECUTIVE_LATE 2
+#define RTEMS_SHUTDOWN_EXECUTIVE 3
+#define RTEMS_TASKS_CREATE 4
+#define RTEMS_TASKS_NAME_TO_ID 5
+#define RTEMS_TASKS_START 6
+#define RTEMS_TASKS_RESTART 7
+#define RTEMS_TASKS_DELETE 8
+#define RTEMS_TASKS_SUSPEND 9
+#define RTEMS_TASKS_RESUME 10
+#define RTEMS_TASKS_SET_PRIORITY 11
+#define RTEMS_TASKS_MODE 12
+#define RTEMS_TASKS_GET_NOTE 13
+#define RTEMS_TASKS_SET_NOTE 14
+#define RTEMS_TASKS_WAKE_AFTER 15
+#define RTEMS_TASKS_WAKE_WHEN 16
+#define RTEMS_INTERRUPT_CATCH 17
+#define RTEMS_CLOCK_SET 18
+#define RTEMS_CLOCK_GET 19
+#define RTEMS_CLOCK_TICK 20
+#define RTEMS_EXTENSION_CREATE 21
+#define RTEMS_EXTENSION_NAME_TO_ID 22
+#define RTEMS_EXTENSION_DELETE 23
+#define RTEMS_TIMER_CREATE 24
+#define RTEMS_TIMER_NAME_TO_ID 25
+#define RTEMS_TIMER_CANCEL 26
+#define RTEMS_TIMER_DELETE 27
+#define RTEMS_TIMER_FIRE_AFTER 28
+#define RTEMS_TIMER_FIRE_WHEN 29
+#define RTEMS_TIMER_RESET 30
+#define RTEMS_SEMAPHORE_CREATE 31
+#define RTEMS_SEMAPHORE_NAME_TO_ID 32
+#define RTEMS_SEMAPHORE_DELETE 33
+#define RTEMS_SEMAPHORE_OBTAIN 34
+#define RTEMS_SEMAPHORE_RELEASE 35
+#define RTEMS_MESSAGE_QUEUE_CREATE 36
+#define RTEMS_MESSAGE_QUEUE_NAME_TO_ID 37
+#define RTEMS_MESSAGE_QUEUE_DELETE 38
+#define RTEMS_MESSAGE_QUEUE_SEND 39
+#define RTEMS_MESSAGE_QUEUE_URGENT 40
+#define RTEMS_MESSAGE_QUEUE_BROADCAST 41
+#define RTEMS_MESSAGE_QUEUE_RECEIVE 42
+#define RTEMS_MESSAGE_QUEUE_FLUSH 43
+#define RTEMS_EVENT_SEND 44
+#define RTEMS_EVENT_RECEIVE 45
+#define RTEMS_SIGNAL_CATCH 46
+#define RTEMS_SIGNAL_SEND 47
+#define RTEMS_PARTITION_CREATE 48
+#define RTEMS_PARTITION_NAME_TO_ID 49
+#define RTEMS_PARTITION_DELETE 50
+#define RTEMS_PARTITION_GET_BUFFER 51
+#define RTEMS_PARTITION_RETURN_BUFFER 52
+#define RTEMS_REGION_CREATE 53
+#define RTEMS_REGION_EXTEND 54
+#define RTEMS_REGION_NAME_TO_ID 55
+#define RTEMS_REGION_DELETE 56
+#define RTEMS_REGION_GET_SEGMENT_SIZE 57
+#define RTEMS_REGION_GET_SEGMENT 58
+#define RTEMS_REGION_RETURN_SEGMENT 59
+#define RTEMS_DUAL_PORTED_MEMORY_CREATE 60
+#define RTEMS_DUAL_PORTED_MEMORY_NAME_TO_ID 61
+#define RTEMS_DUAL_PORTED_MEMORY_DELETE 62
+#define RTEMS_DUAL_PORTED_MEMORY_EXTERNAL_TO_INTERNAL 63
+#define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64
+#define RTEMS_IO_INITIALIZE 65
+#define RTEMS_IO_REGISTER_NAME 66
+#define RTEMS_IO_LOOKUP_NAME 67
+#define RTEMS_IO_OPEN 68
+#define RTEMS_IO_CLOSE 69
+#define RTEMS_IO_READ 70
+#define RTEMS_IO_WRITE 71
+#define RTEMS_IO_CONTROL 72
+#define RTEMS_FATAL_ERROR_OCCURRED 73
+#define RTEMS_RATE_MONOTONIC_CREATE 74
+#define RTEMS_RATE_MONOTONIC_NAME_TO_ID 75
+#define RTEMS_RATE_MONOTONIC_DELETE 76
+#define RTEMS_RATE_MONOTONIC_CANCEL 77
+#define RTEMS_RATE_MONOTONIC_PERIOD 78
+#define RTEMS_MULTIPROCESSING_ANNOUNCE 79
+#define RTEMS_DEBUG_ENABLE 80
+#define RTEMS_DEBUG_DISABLE 81
+
+#define RTEMS_NUMBER_OF_ENTRY_POINTS 82
+
+/*
+ * The jump table of entry points into RTEMS directives.
+ */
+
+extern const void *_Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of directives.h */
diff --git a/c/src/exec/sapi/headers/extension.h b/c/src/exec/sapi/headers/extension.h
new file mode 100644
index 0000000000..8f46ed80dd
--- /dev/null
+++ b/c/src/exec/sapi/headers/extension.h
@@ -0,0 +1,136 @@
+/* extension.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the User Extension Manager. This manager
+ * provides a mechanism for manipulating sets of user-defined extensions.
+ *
+ * Directives provided are:
+ *
+ * + create user extension set
+ * + get ID of user extension set
+ * + delete user extension set
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EXTENSION_MANAGER_h
+#define __RTEMS_EXTENSION_MANAGER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/userext.h>
+#include <rtems/rtems/status.h> /* XXX */
+#include <rtems/rtems/types.h> /* XXX */
+
+/*
+ * Extension related types
+ */
+
+typedef User_extensions_routine rtems_extension;
+typedef User_extensions_thread_create_extension rtems_task_create_extension;
+typedef User_extensions_thread_delete_extension rtems_task_delete_extension;
+typedef User_extensions_thread_start_extension rtems_task_start_extension;
+typedef User_extensions_thread_restart_extension rtems_task_restart_extension;
+typedef User_extensions_thread_switch_extension rtems_task_switch_extension;
+typedef User_extensions_thread_begin_extension rtems_task_begin_extension;
+typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension;
+typedef User_extensions_fatal_extension rtems_fatal_extension;
+
+typedef User_extensions_Table rtems_extensions_table;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Extension_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each extension.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ User_extensions_Control Extension;
+} Extension_Control;
+
+/*
+ * _Extension_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+);
+
+/*
+ * rtems_extension_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_create directive. The
+ * extension will have the name name. The entry points of the
+ * routines which constitute this extension set are in EXTENSION_TABLE.
+ * It returns the id of the created extension in ID.
+ */
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_ident directive.
+ * This directive returns the extension ID associated with name.
+ * If more than one extension is named name, then the extension
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_delete directive. The
+ * extension indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/extension.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/fatal.h b/c/src/exec/sapi/headers/fatal.h
new file mode 100644
index 0000000000..f61b4183f3
--- /dev/null
+++ b/c/src/exec/sapi/headers/fatal.h
@@ -0,0 +1,49 @@
+/* fatal.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Fatal Error Manager. This manager processes all fatal or
+ * irrecoverable errors.
+ *
+ * This manager provides directives to:
+ *
+ * + announce a fatal error has occurred
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_FATAL_h
+#define __RTEMS_FATAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * rtems_fatal_error_occurred
+ *
+ * DESCRIPTION:
+ *
+ * This is the routine which implements the rtems_fatal_error_occurred
+ * directive. It is invoked when the application or RTEMS
+ * determines that a fatal error has occurred.
+ */
+
+void volatile rtems_fatal_error_occurred(
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/init.h b/c/src/exec/sapi/headers/init.h
new file mode 100644
index 0000000000..e008c45ebc
--- /dev/null
+++ b/c/src/exec/sapi/headers/init.h
@@ -0,0 +1,110 @@
+/* init.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Initialization Manager. This manager is responsible for
+ * initializing RTEMS, creating and starting all configured initialization
+ * tasks, invoking the initialization routine for each user-supplied device
+ * driver, and initializing the optional multiprocessor layer.
+ *
+ * This manager provides directives to:
+ *
+ * + initialize the RTEMS executive
+ * + shutdown the RTEMS executive
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INIT_h
+#define __RTEMS_INIT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/config.h>
+#include <rtems/rtems/intr.h>
+
+/*
+ * The following defines the default Multiprocessing Configuration
+ * Table. This table is used in a single processor system.
+ */
+
+extern const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table;
+
+/*
+ * rtems_initialize_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_initialize_executive directive. This
+ * directive is invoked at system startup to initialize the RTEMS
+ * multitasking environment.
+ */
+
+void rtems_initialize_executive(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_early
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+rtems_interrupt_level rtems_initialize_executive_early(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_late
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+void rtems_initialize_executive_late(
+ rtems_interrupt_level bsp_level
+);
+
+/*
+ * rtems_shutdown_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_shutdown_executive directive. The
+ * invocation of this directive results in the RTEMS environment being
+ * shutdown and multitasking halted. From the application's perspective,
+ * invocation of this directive results in the rtems_initialize_executive
+ * directive exitting to the startup code which invoked it.
+ */
+
+void rtems_shutdown_executive(
+ unsigned32 result
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/io.h b/c/src/exec/sapi/headers/io.h
new file mode 100644
index 0000000000..a7af4df792
--- /dev/null
+++ b/c/src/exec/sapi/headers/io.h
@@ -0,0 +1,244 @@
+/* io.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Input/Output Manager. This manager provides a well defined
+ * mechanism for accessing device drivers and a structured methodology for
+ * organizing device drivers.
+ *
+ * Directives provided are:
+ *
+ * + initialize a device driver
+ * + open a device driver
+ * + close a device driver
+ * + read from a device driver
+ * + write to a device driver
+ * + special device services
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_IO_h
+#define __RTEMS_IO_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+
+/*
+ *
+ * The following defines the types for:
+ *
+ * + major and minor numbers
+ * + the return type of a device driver entry
+ * + a pointer to a device driver entry
+ * + an entry in the the Device Driver Address Table. Each entry in this
+ * table corresponds to an application provided device driver and
+ * defines the entry points for that device driver.
+ */
+
+typedef unsigned32 rtems_device_major_number;
+typedef unsigned32 rtems_device_minor_number;
+
+typedef rtems_status_code rtems_device_driver;
+
+typedef rtems_device_driver ( *rtems_device_driver_entry )(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+ );
+
+typedef struct {
+ rtems_device_driver_entry initialization; /* initialization procedure */
+ rtems_device_driver_entry open; /* open request procedure */
+ rtems_device_driver_entry close; /* close request procedure */
+ rtems_device_driver_entry read; /* read request procedure */
+ rtems_device_driver_entry write; /* write request procedure */
+ rtems_device_driver_entry control; /* special functions procedure */
+} rtems_driver_address_table;
+
+/*
+ * Table for the io device names
+ */
+
+typedef struct {
+ char *device_name;
+ unsigned32 device_name_length;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+} rtems_driver_name_t;
+
+/*
+ * This is the table of device names.
+ */
+
+/*
+ * The following declare the data required to manage the Driver
+ * Address Table and Device Name Table.
+ */
+
+EXTERN unsigned32 _IO_Number_of_drivers;
+EXTERN rtems_driver_address_table *_IO_Driver_address_table;
+EXTERN unsigned32 _IO_Number_of_devices;
+EXTERN rtems_driver_name_t *_IO_Driver_name_table;
+
+/*
+ * _IO_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+);
+
+/*
+ * rtems_io_register_name
+ *
+ * DESCRIPTION:
+ *
+ * Associate a name with a driver.
+ *
+ */
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+);
+
+
+/*
+ * rtems_io_lookup_name
+ *
+ * DESCRIPTION:
+ *
+ * Find what driver "owns" this name
+ */
+
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t **device_info
+);
+
+
+/*
+ * rtems_io_initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_initialize directive. It is invoked
+ * to initialize a device driver or an individual device.
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_open directive. It is invoked
+ * to open a device.
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_close
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_close directive. It is invoked
+ * to close a device.
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_read
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_read directive. It is invoked
+ * to read from a device.
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_write
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_write directive. It is invoked
+ * to write to a device.
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_control
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_control directive. It is invoked
+ * to perform a device specific operation on a device.
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * _IO_Initialize_all_drivers
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all of the device drivers configured
+ * in the Device Driver Address Table.
+ */
+
+void _IO_Initialize_all_drivers( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/mptables.h b/c/src/exec/sapi/headers/mptables.h
new file mode 100644
index 0000000000..b8e4c6de43
--- /dev/null
+++ b/c/src/exec/sapi/headers/mptables.h
@@ -0,0 +1,29 @@
+/* mptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used in a multiprocessor configuration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MPTABLES_h
+#define __RTEMS_MPTABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/headers/sptables.h b/c/src/exec/sapi/headers/sptables.h
new file mode 100644
index 0000000000..877019eafe
--- /dev/null
+++ b/c/src/exec/sapi/headers/sptables.h
@@ -0,0 +1,162 @@
+/* sptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used when in a single processor configuration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SPTABLES_h
+#define __RTEMS_SPTABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/config.h>
+
+#include <rtems/debug.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+/*
+ * This is the default Multiprocessing Configuration Table.
+ * It is used in single processor configurations.
+ */
+
+const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table = {
+ 1, /* local node number */
+ 1, /* maximum number nodes in system */
+ 0, /* maximum number global objects */
+ 0, /* maximum number proxies */
+ NULL, /* pointer to MPCI address table */
+};
+
+/*
+ * This is the version string.
+ */
+
+const char _RTEMS_version[] =
+ "RTEMS RELEASE V3.5.15 snapshot (" CPU_NAME "/" CPU_MODEL_NAME ")";
+
+
+/*
+ * This table is used by the single entry point code.
+ */
+
+const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ] = {
+ (void *) rtems_initialize_executive, /* 0 */
+ (void *) rtems_initialize_executive_early, /* 1 */
+ (void *) rtems_initialize_executive_late, /* 2 */
+ (void *) rtems_shutdown_executive, /* 3 */
+ (void *) rtems_task_create, /* 4 */
+ (void *) rtems_task_ident, /* 5 */
+ (void *) rtems_task_start, /* 6 */
+ (void *) rtems_task_restart, /* 7 */
+ (void *) rtems_task_delete, /* 8 */
+ (void *) rtems_task_suspend, /* 9 */
+ (void *) rtems_task_resume, /* 10 */
+ (void *) rtems_task_set_priority, /* 11 */
+ (void *) rtems_task_mode, /* 12 */
+ (void *) rtems_task_get_note, /* 13 */
+ (void *) rtems_task_set_note, /* 14 */
+ (void *) rtems_task_wake_after, /* 15 */
+ (void *) rtems_task_wake_when, /* 16 */
+ (void *) rtems_interrupt_catch, /* 17 */
+ (void *) rtems_clock_set, /* 18 */
+ (void *) rtems_clock_get, /* 19 */
+ (void *) rtems_clock_tick, /* 20 */
+ (void *) rtems_extension_create, /* 21 */
+ (void *) rtems_extension_ident, /* 22 */
+ (void *) rtems_extension_delete, /* 23 */
+ (void *) rtems_timer_create, /* 24 */
+ (void *) rtems_timer_ident, /* 25 */
+ (void *) rtems_timer_cancel, /* 26 */
+ (void *) rtems_timer_delete, /* 27 */
+ (void *) rtems_timer_fire_after, /* 28 */
+ (void *) rtems_timer_fire_when, /* 29 */
+ (void *) rtems_timer_reset, /* 30 */
+ (void *) rtems_semaphore_create, /* 31 */
+ (void *) rtems_semaphore_ident, /* 32 */
+ (void *) rtems_semaphore_delete, /* 33 */
+ (void *) rtems_semaphore_obtain, /* 34 */
+ (void *) rtems_semaphore_release, /* 35 */
+ (void *) rtems_message_queue_create, /* 36 */
+ (void *) rtems_message_queue_ident, /* 37 */
+ (void *) rtems_message_queue_delete, /* 38 */
+ (void *) rtems_message_queue_send, /* 39 */
+ (void *) rtems_message_queue_urgent, /* 40 */
+ (void *) rtems_message_queue_broadcast, /* 41 */
+ (void *) rtems_message_queue_receive, /* 42 */
+ (void *) rtems_message_queue_flush, /* 43 */
+ (void *) rtems_event_send, /* 44 */
+ (void *) rtems_event_receive, /* 45 */
+ (void *) rtems_signal_catch, /* 46 */
+ (void *) rtems_signal_send, /* 47 */
+ (void *) rtems_partition_create, /* 48 */
+ (void *) rtems_partition_ident, /* 49 */
+ (void *) rtems_partition_delete, /* 50 */
+ (void *) rtems_partition_get_buffer, /* 51 */
+ (void *) rtems_partition_return_buffer, /* 52 */
+ (void *) rtems_region_create, /* 53 */
+ (void *) rtems_region_extend, /* 54 */
+ (void *) rtems_region_ident, /* 55 */
+ (void *) rtems_region_delete, /* 56 */
+ (void *) rtems_region_get_segment, /* 57 */
+ (void *) rtems_region_get_segment_size, /* 58 */
+ (void *) rtems_region_return_segment, /* 59 */
+ (void *) rtems_port_create, /* 60 */
+ (void *) rtems_port_ident, /* 61 */
+ (void *) rtems_port_delete, /* 62 */
+ (void *) rtems_port_external_to_internal, /* 63 */
+ (void *) rtems_port_internal_to_external, /* 64 */
+ (void *) rtems_io_initialize, /* 65 */
+ (void *) rtems_io_register_name, /* 66 */
+ (void *) rtems_io_lookup_name, /* 67 */
+ (void *) rtems_io_open, /* 68 */
+ (void *) rtems_io_close, /* 69 */
+ (void *) rtems_io_read, /* 70 */
+ (void *) rtems_io_write, /* 71 */
+ (void *) rtems_io_control, /* 72 */
+ (void *) rtems_fatal_error_occurred, /* 73 */
+ (void *) rtems_rate_monotonic_create, /* 74 */
+ (void *) rtems_rate_monotonic_ident, /* 75 */
+ (void *) rtems_rate_monotonic_delete, /* 76 */
+ (void *) rtems_rate_monotonic_cancel, /* 77 */
+ (void *) rtems_rate_monotonic_period, /* 78 */
+ (void *) rtems_multiprocessing_announce, /* 79 */
+ (void *) rtems_debug_enable, /* 80 */
+ (void *) rtems_debug_disable /* 81 */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/confdefs.h b/c/src/exec/sapi/include/confdefs.h
new file mode 100644
index 0000000000..83f6c3ccd1
--- /dev/null
+++ b/c/src/exec/sapi/include/confdefs.h
@@ -0,0 +1,377 @@
+/* confdefs.h
+ *
+ * This include file contains the configuration table template that will
+ * be used by the single processor tests to define its default configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CONFIGURATION_TEMPLATE_h
+#define __CONFIGURATION_TEMPLATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern rtems_initialization_tasks_table Initialization_tasks[];
+extern rtems_driver_address_table Device_drivers[];
+extern rtems_configuration_table Configuration;
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+/*
+ * Default User Initialization Task Table. This table guarantees that
+ * one user initialization table is defined.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
+
+#ifndef CONFIGURE_INIT_TASK_NAME
+#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'U', 'I', '1', ' ' )
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
+#define CONFIGURE_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_PRIORITY
+#define CONFIGURE_INIT_TASK_PRIORITY 1
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
+#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
+#define CONFIGURE_INIT_TASK_ARGUMENTS 0
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_initialization_tasks_table Initialization_tasks[] = {
+ { CONFIGURE_INIT_TASK_NAME,
+ CONFIGURE_INIT_TASK_STACK_SIZE,
+ CONFIGURE_INIT_TASK_PRIORITY,
+ CONFIGURE_INIT_TASK_ATTRIBUTES,
+ CONFIGURE_INIT_TASK_ENTRY_POINT,
+ CONFIGURE_INIT_TASK_INITIAL_MODES,
+ CONFIGURE_INIT_TASK_ARGUMENTS
+ }
+};
+#endif
+
+#endif
+
+/*
+ * Default Device Driver Table. Each driver needed by the test is explicitly
+ * choosen by that test. There is always a null driver entry.
+ */
+
+#define NULL_DRIVER_TABLE_ENTRY \
+ { NULL, NULL, NULL, NULL, NULL, NULL }
+
+#ifdef CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+#include <timerdrv.h>
+#endif
+
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+#include <stubdrv.h>
+#endif
+
+#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
+
+#ifdef CONFIGURE_INIT
+rtems_driver_address_table Device_drivers[] = {
+#ifdef CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+ CONSOLE_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+ CLOCK_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+ STUB_DRIVER_TABLE_ENTRY,
+#endif
+ NULL_DRIVER_TABLE_ENTRY
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
+
+/*
+ * Default the number of devices per device driver. This value may be
+ * overridden by the user.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES
+
+#ifndef CONFIGURE_MAXIMUM_DEVICES
+#define CONFIGURE_MAXIMUM_DEVICES 20
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifdef CONFIGURE_MPTEST
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#ifndef CONFIGURE_MP_NODE_NUMBER
+#define CONFIGURE_MP_NODE_NUMBER NODE_NUMBER
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_NODES
+#define CONFIGURE_MP_MAXIMUM_NODES 2
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 32
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_PROXIES
+#define CONFIGURE_MP_MAXIMUM_PROXIES 32
+#endif
+
+#ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
+#include <mpci.h>
+#define CONFIGURE_MP_MPCI_TABLE_POINTER &MPCI_table
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_multiprocessing_table Multiprocessing_configuration = {
+ CONFIGURE_MP_NODE_NUMBER, /* local node number */
+ CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes in system */
+ CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS, /* maximum # global objects */
+ CONFIGURE_MP_MAXIMUM_PROXIES, /* maximum # proxies */
+ CONFIGURE_MP_MPCI_TABLE_POINTER /* pointer to MPCI config table */
+};
+#endif
+
+#define CONFIGURE_MULTIPROCESSING_TABLE &Multiprocessing_configuration
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MULTIPROCESSING_TABLE NULL
+
+#endif /* CONFIGURE_MPTEST */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_WORK_AREA
+#define CONFIGURE_EXECUTIVE_RAM_WORK_AREA NULL
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TASKS
+#define CONFIGURE_MAXIMUM_TASKS 10
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TIMERS
+#define CONFIGURE_MAXIMUM_TIMERS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_SEMAPHORES
+#define CONFIGURE_MAXIMUM_SEMAPHORES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PARTITIONS
+#define CONFIGURE_MAXIMUM_PARTITIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_REGIONS
+#define CONFIGURE_MAXIMUM_REGIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PORTS
+#define CONFIGURE_MAXIMUM_PORTS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PERIODS
+#define CONFIGURE_MAXIMUM_PERIODS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#endif
+
+#ifndef CONFIGURE_MICROSECONDS_PER_TICK
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
+#endif
+
+#ifndef CONFIGURE_TICKS_PER_TIMESLICE
+#define CONFIGURE_TICKS_PER_TIMESLICE 50
+#endif
+
+#ifndef CONFIGURE_INITIAL_EXTENSIONS
+#define CONFIGURE_INITIAL_EXTENSIONS NULL
+#endif
+
+/*
+ * Calculate the RAM size based on the maximum number of objects configured.
+ * The model is to estimate the memory required for each configured item,
+ * sum the memory requirements and insure that there is at least 32K greater
+ * than that for things not directly addressed such as:
+ *
+ * + stacks greater than minimum size
+ * + FP contexts
+ * + API areas (should be optional)
+ * + messages
+ * + object name and local pointer table overhead
+ * + per node memory requirements
+ * + executive fixed requirements (including at least internal threads
+ * and the Ready chains)
+ *
+ * NOTE: Eventually this should take into account some of the above.
+ * Basically, this is a "back of the envelope" estimate for
+ * memory requirements. It could be more accurate.
+ */
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
+
+#define CONFIGURE_OBJECT_TABLE_STUFF \
+ ( sizeof(Objects_Control *) + sizeof(rtems_name *) + sizeof(rtems_name) )
+
+#define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
+ ((_tasks) * \
+ ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
+ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \
+ CONFIGURE_OBJECT_TABLE_STUFF)) \
+ )
+
+#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
+ ((_timers) * ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
+ ((_semaphores) * \
+ ( sizeof(Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
+ ( (_queues) * \
+ ( sizeof(Message_queue_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
+ ( (_partitions) * \
+ ( sizeof(Partition_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
+ ( (_regions) * \
+ ( sizeof(Region_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
+ ( (_ports) * \
+ ( sizeof(Dual_ported_memory_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
+ ( (_periods) * \
+ ( sizeof(Rate_monotonic_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
+ ( (_extensions) * \
+ ( sizeof(Extension_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_DEVICES(_devices) \
+ (((_devices) + 1) * ( sizeof(rtems_driver_name_t) ) )
+
+#ifdef CONFIGURE_MPTEST
+
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
+ ( ((_proxies) + 1) * ( sizeof(Thread_Proxy_control) ) )
+
+#define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
+ ((_global_objects) * ( sizeof(Objects_MP_Control) ) )
+
+#define CONFIGURE_MEMORY_FOR_MP \
+ ( CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
+ CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) \
+ )
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MEMORY_FOR_MP 0
+
+#endif
+#define CONFIGURE_EXECUTIVE_RAM_SIZE \
+(( CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS) + \
+ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
+ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
+ CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
+ CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
+ CONFIGURE_MEMORY_FOR_REGIONS(CONFIGURE_MAXIMUM_REGIONS) + \
+ CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
+ CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
+ CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) + \
+ CONFIGURE_MEMORY_FOR_DEVICES(CONFIGURE_MAXIMUM_DEVICES) + \
+ CONFIGURE_MEMORY_FOR_MP + \
+ (96*1024) \
+) & 0xffff8000)
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_configuration_table Configuration = {
+ CONFIGURE_EXECUTIVE_RAM_WORK_AREA,
+ CONFIGURE_EXECUTIVE_RAM_SIZE,
+ CONFIGURE_MAXIMUM_TASKS,
+ CONFIGURE_MAXIMUM_TIMERS,
+ CONFIGURE_MAXIMUM_SEMAPHORES,
+ CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
+ CONFIGURE_MAXIMUM_PARTITIONS,
+ CONFIGURE_MAXIMUM_REGIONS,
+ CONFIGURE_MAXIMUM_PORTS,
+ CONFIGURE_MAXIMUM_PERIODS,
+ CONFIGURE_MAXIMUM_USER_EXTENSIONS,
+ CONFIGURE_MICROSECONDS_PER_TICK,
+ CONFIGURE_TICKS_PER_TIMESLICE,
+ sizeof (Initialization_tasks)/
+ sizeof(rtems_initialization_tasks_table), /* number of init tasks */
+ Initialization_tasks, /* init task(s) table */
+ sizeof (Device_drivers)/
+ sizeof(rtems_driver_address_table), /* number of device drivers */
+ CONFIGURE_MAXIMUM_DEVICES,
+ Device_drivers, /* pointer to driver table */
+ CONFIGURE_INITIAL_EXTENSIONS, /* pointer to initial extensions */
+ CONFIGURE_MULTIPROCESSING_TABLE /* ptr to MP config table */
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/config.h b/c/src/exec/sapi/include/rtems/config.h
new file mode 100644
index 0000000000..29f6005f58
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/config.h
@@ -0,0 +1,94 @@
+/* config.h
+ *
+ * This include file contains the table of user defined configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONFIGURATION_h
+#define __RTEMS_CONFIGURATION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+#include <rtems/extension.h>
+#include <rtems/io.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/tasks.h>
+
+/*
+ * The following records define the Multiprocessor Configuration
+ * Table. This table defines the multiprocessor system
+ * characteristics which must be known by RTEMS in a multiprocessor
+ * system.
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+ MPCI_Control *User_mpci_table; /* pointer to MPCI table */
+} rtems_multiprocessing_table;
+
+/*
+ * The following records define the Configuration Table. The
+ * information contained in this table is required in all
+ * RTEMS systems, whether single or multiprocessor. This
+ * table primarily defines the following:
+ *
+ * + location and size of the RTEMS Workspace
+ * + required number of each object type
+ * + microseconds per clock tick
+ * + clock ticks per task timeslice
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+ rtems_initialization_tasks_table *User_initialization_tasks_table;
+ unsigned32 number_of_device_drivers;
+ unsigned32 maximum_devices;
+ rtems_driver_address_table *Device_driver_table;
+ rtems_extensions_table *User_extension_table;
+ rtems_multiprocessing_table *User_multiprocessing_table;
+} rtems_configuration_table;
+
+/*
+ * The following are provided strictly for the convenience of
+ * the user. They are not used in RTEMS itself.
+ */
+
+EXTERN rtems_configuration_table *_Configuration_Table;
+EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/directives.h b/c/src/exec/sapi/include/rtems/directives.h
new file mode 100644
index 0000000000..938cf68460
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/directives.h
@@ -0,0 +1,120 @@
+/* directives.h
+ *
+ * The following definitions are the directive numbers used
+ * in the assembly interface.
+ *
+ * COPYRIGHT (c) 19891990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DIRECTIVES_h
+#define __RTEMS_DIRECTIVES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RTEMS_INITIALIZE_EXECUTIVE 0
+#define RTEMS_INITIALIZE_EXECUTIVE_EARLY 1
+#define RTEMS_INITIALIZE_EXECUTIVE_LATE 2
+#define RTEMS_SHUTDOWN_EXECUTIVE 3
+#define RTEMS_TASKS_CREATE 4
+#define RTEMS_TASKS_NAME_TO_ID 5
+#define RTEMS_TASKS_START 6
+#define RTEMS_TASKS_RESTART 7
+#define RTEMS_TASKS_DELETE 8
+#define RTEMS_TASKS_SUSPEND 9
+#define RTEMS_TASKS_RESUME 10
+#define RTEMS_TASKS_SET_PRIORITY 11
+#define RTEMS_TASKS_MODE 12
+#define RTEMS_TASKS_GET_NOTE 13
+#define RTEMS_TASKS_SET_NOTE 14
+#define RTEMS_TASKS_WAKE_AFTER 15
+#define RTEMS_TASKS_WAKE_WHEN 16
+#define RTEMS_INTERRUPT_CATCH 17
+#define RTEMS_CLOCK_SET 18
+#define RTEMS_CLOCK_GET 19
+#define RTEMS_CLOCK_TICK 20
+#define RTEMS_EXTENSION_CREATE 21
+#define RTEMS_EXTENSION_NAME_TO_ID 22
+#define RTEMS_EXTENSION_DELETE 23
+#define RTEMS_TIMER_CREATE 24
+#define RTEMS_TIMER_NAME_TO_ID 25
+#define RTEMS_TIMER_CANCEL 26
+#define RTEMS_TIMER_DELETE 27
+#define RTEMS_TIMER_FIRE_AFTER 28
+#define RTEMS_TIMER_FIRE_WHEN 29
+#define RTEMS_TIMER_RESET 30
+#define RTEMS_SEMAPHORE_CREATE 31
+#define RTEMS_SEMAPHORE_NAME_TO_ID 32
+#define RTEMS_SEMAPHORE_DELETE 33
+#define RTEMS_SEMAPHORE_OBTAIN 34
+#define RTEMS_SEMAPHORE_RELEASE 35
+#define RTEMS_MESSAGE_QUEUE_CREATE 36
+#define RTEMS_MESSAGE_QUEUE_NAME_TO_ID 37
+#define RTEMS_MESSAGE_QUEUE_DELETE 38
+#define RTEMS_MESSAGE_QUEUE_SEND 39
+#define RTEMS_MESSAGE_QUEUE_URGENT 40
+#define RTEMS_MESSAGE_QUEUE_BROADCAST 41
+#define RTEMS_MESSAGE_QUEUE_RECEIVE 42
+#define RTEMS_MESSAGE_QUEUE_FLUSH 43
+#define RTEMS_EVENT_SEND 44
+#define RTEMS_EVENT_RECEIVE 45
+#define RTEMS_SIGNAL_CATCH 46
+#define RTEMS_SIGNAL_SEND 47
+#define RTEMS_PARTITION_CREATE 48
+#define RTEMS_PARTITION_NAME_TO_ID 49
+#define RTEMS_PARTITION_DELETE 50
+#define RTEMS_PARTITION_GET_BUFFER 51
+#define RTEMS_PARTITION_RETURN_BUFFER 52
+#define RTEMS_REGION_CREATE 53
+#define RTEMS_REGION_EXTEND 54
+#define RTEMS_REGION_NAME_TO_ID 55
+#define RTEMS_REGION_DELETE 56
+#define RTEMS_REGION_GET_SEGMENT_SIZE 57
+#define RTEMS_REGION_GET_SEGMENT 58
+#define RTEMS_REGION_RETURN_SEGMENT 59
+#define RTEMS_DUAL_PORTED_MEMORY_CREATE 60
+#define RTEMS_DUAL_PORTED_MEMORY_NAME_TO_ID 61
+#define RTEMS_DUAL_PORTED_MEMORY_DELETE 62
+#define RTEMS_DUAL_PORTED_MEMORY_EXTERNAL_TO_INTERNAL 63
+#define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64
+#define RTEMS_IO_INITIALIZE 65
+#define RTEMS_IO_REGISTER_NAME 66
+#define RTEMS_IO_LOOKUP_NAME 67
+#define RTEMS_IO_OPEN 68
+#define RTEMS_IO_CLOSE 69
+#define RTEMS_IO_READ 70
+#define RTEMS_IO_WRITE 71
+#define RTEMS_IO_CONTROL 72
+#define RTEMS_FATAL_ERROR_OCCURRED 73
+#define RTEMS_RATE_MONOTONIC_CREATE 74
+#define RTEMS_RATE_MONOTONIC_NAME_TO_ID 75
+#define RTEMS_RATE_MONOTONIC_DELETE 76
+#define RTEMS_RATE_MONOTONIC_CANCEL 77
+#define RTEMS_RATE_MONOTONIC_PERIOD 78
+#define RTEMS_MULTIPROCESSING_ANNOUNCE 79
+#define RTEMS_DEBUG_ENABLE 80
+#define RTEMS_DEBUG_DISABLE 81
+
+#define RTEMS_NUMBER_OF_ENTRY_POINTS 82
+
+/*
+ * The jump table of entry points into RTEMS directives.
+ */
+
+extern const void *_Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of directives.h */
diff --git a/c/src/exec/sapi/include/rtems/extension.h b/c/src/exec/sapi/include/rtems/extension.h
new file mode 100644
index 0000000000..8f46ed80dd
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/extension.h
@@ -0,0 +1,136 @@
+/* extension.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the User Extension Manager. This manager
+ * provides a mechanism for manipulating sets of user-defined extensions.
+ *
+ * Directives provided are:
+ *
+ * + create user extension set
+ * + get ID of user extension set
+ * + delete user extension set
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EXTENSION_MANAGER_h
+#define __RTEMS_EXTENSION_MANAGER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/userext.h>
+#include <rtems/rtems/status.h> /* XXX */
+#include <rtems/rtems/types.h> /* XXX */
+
+/*
+ * Extension related types
+ */
+
+typedef User_extensions_routine rtems_extension;
+typedef User_extensions_thread_create_extension rtems_task_create_extension;
+typedef User_extensions_thread_delete_extension rtems_task_delete_extension;
+typedef User_extensions_thread_start_extension rtems_task_start_extension;
+typedef User_extensions_thread_restart_extension rtems_task_restart_extension;
+typedef User_extensions_thread_switch_extension rtems_task_switch_extension;
+typedef User_extensions_thread_begin_extension rtems_task_begin_extension;
+typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension;
+typedef User_extensions_fatal_extension rtems_fatal_extension;
+
+typedef User_extensions_Table rtems_extensions_table;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Extension_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each extension.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ User_extensions_Control Extension;
+} Extension_Control;
+
+/*
+ * _Extension_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+);
+
+/*
+ * rtems_extension_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_create directive. The
+ * extension will have the name name. The entry points of the
+ * routines which constitute this extension set are in EXTENSION_TABLE.
+ * It returns the id of the created extension in ID.
+ */
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_ident directive.
+ * This directive returns the extension ID associated with name.
+ * If more than one extension is named name, then the extension
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_delete directive. The
+ * extension indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/extension.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/fatal.h b/c/src/exec/sapi/include/rtems/fatal.h
new file mode 100644
index 0000000000..f61b4183f3
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/fatal.h
@@ -0,0 +1,49 @@
+/* fatal.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Fatal Error Manager. This manager processes all fatal or
+ * irrecoverable errors.
+ *
+ * This manager provides directives to:
+ *
+ * + announce a fatal error has occurred
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_FATAL_h
+#define __RTEMS_FATAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * rtems_fatal_error_occurred
+ *
+ * DESCRIPTION:
+ *
+ * This is the routine which implements the rtems_fatal_error_occurred
+ * directive. It is invoked when the application or RTEMS
+ * determines that a fatal error has occurred.
+ */
+
+void volatile rtems_fatal_error_occurred(
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/init.h b/c/src/exec/sapi/include/rtems/init.h
new file mode 100644
index 0000000000..e008c45ebc
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/init.h
@@ -0,0 +1,110 @@
+/* init.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Initialization Manager. This manager is responsible for
+ * initializing RTEMS, creating and starting all configured initialization
+ * tasks, invoking the initialization routine for each user-supplied device
+ * driver, and initializing the optional multiprocessor layer.
+ *
+ * This manager provides directives to:
+ *
+ * + initialize the RTEMS executive
+ * + shutdown the RTEMS executive
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INIT_h
+#define __RTEMS_INIT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/config.h>
+#include <rtems/rtems/intr.h>
+
+/*
+ * The following defines the default Multiprocessing Configuration
+ * Table. This table is used in a single processor system.
+ */
+
+extern const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table;
+
+/*
+ * rtems_initialize_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_initialize_executive directive. This
+ * directive is invoked at system startup to initialize the RTEMS
+ * multitasking environment.
+ */
+
+void rtems_initialize_executive(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_early
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+rtems_interrupt_level rtems_initialize_executive_early(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_late
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+void rtems_initialize_executive_late(
+ rtems_interrupt_level bsp_level
+);
+
+/*
+ * rtems_shutdown_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_shutdown_executive directive. The
+ * invocation of this directive results in the RTEMS environment being
+ * shutdown and multitasking halted. From the application's perspective,
+ * invocation of this directive results in the rtems_initialize_executive
+ * directive exitting to the startup code which invoked it.
+ */
+
+void rtems_shutdown_executive(
+ unsigned32 result
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/io.h b/c/src/exec/sapi/include/rtems/io.h
new file mode 100644
index 0000000000..a7af4df792
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/io.h
@@ -0,0 +1,244 @@
+/* io.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Input/Output Manager. This manager provides a well defined
+ * mechanism for accessing device drivers and a structured methodology for
+ * organizing device drivers.
+ *
+ * Directives provided are:
+ *
+ * + initialize a device driver
+ * + open a device driver
+ * + close a device driver
+ * + read from a device driver
+ * + write to a device driver
+ * + special device services
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_IO_h
+#define __RTEMS_IO_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+
+/*
+ *
+ * The following defines the types for:
+ *
+ * + major and minor numbers
+ * + the return type of a device driver entry
+ * + a pointer to a device driver entry
+ * + an entry in the the Device Driver Address Table. Each entry in this
+ * table corresponds to an application provided device driver and
+ * defines the entry points for that device driver.
+ */
+
+typedef unsigned32 rtems_device_major_number;
+typedef unsigned32 rtems_device_minor_number;
+
+typedef rtems_status_code rtems_device_driver;
+
+typedef rtems_device_driver ( *rtems_device_driver_entry )(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+ );
+
+typedef struct {
+ rtems_device_driver_entry initialization; /* initialization procedure */
+ rtems_device_driver_entry open; /* open request procedure */
+ rtems_device_driver_entry close; /* close request procedure */
+ rtems_device_driver_entry read; /* read request procedure */
+ rtems_device_driver_entry write; /* write request procedure */
+ rtems_device_driver_entry control; /* special functions procedure */
+} rtems_driver_address_table;
+
+/*
+ * Table for the io device names
+ */
+
+typedef struct {
+ char *device_name;
+ unsigned32 device_name_length;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+} rtems_driver_name_t;
+
+/*
+ * This is the table of device names.
+ */
+
+/*
+ * The following declare the data required to manage the Driver
+ * Address Table and Device Name Table.
+ */
+
+EXTERN unsigned32 _IO_Number_of_drivers;
+EXTERN rtems_driver_address_table *_IO_Driver_address_table;
+EXTERN unsigned32 _IO_Number_of_devices;
+EXTERN rtems_driver_name_t *_IO_Driver_name_table;
+
+/*
+ * _IO_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+);
+
+/*
+ * rtems_io_register_name
+ *
+ * DESCRIPTION:
+ *
+ * Associate a name with a driver.
+ *
+ */
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+);
+
+
+/*
+ * rtems_io_lookup_name
+ *
+ * DESCRIPTION:
+ *
+ * Find what driver "owns" this name
+ */
+
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t **device_info
+);
+
+
+/*
+ * rtems_io_initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_initialize directive. It is invoked
+ * to initialize a device driver or an individual device.
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_open directive. It is invoked
+ * to open a device.
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_close
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_close directive. It is invoked
+ * to close a device.
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_read
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_read directive. It is invoked
+ * to read from a device.
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_write
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_write directive. It is invoked
+ * to write to a device.
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_control
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_control directive. It is invoked
+ * to perform a device specific operation on a device.
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * _IO_Initialize_all_drivers
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all of the device drivers configured
+ * in the Device Driver Address Table.
+ */
+
+void _IO_Initialize_all_drivers( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/mptables.h b/c/src/exec/sapi/include/rtems/mptables.h
new file mode 100644
index 0000000000..b8e4c6de43
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/mptables.h
@@ -0,0 +1,29 @@
+/* mptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used in a multiprocessor configuration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MPTABLES_h
+#define __RTEMS_MPTABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/include/rtems/sptables.h b/c/src/exec/sapi/include/rtems/sptables.h
new file mode 100644
index 0000000000..877019eafe
--- /dev/null
+++ b/c/src/exec/sapi/include/rtems/sptables.h
@@ -0,0 +1,162 @@
+/* sptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used when in a single processor configuration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SPTABLES_h
+#define __RTEMS_SPTABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/config.h>
+
+#include <rtems/debug.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+/*
+ * This is the default Multiprocessing Configuration Table.
+ * It is used in single processor configurations.
+ */
+
+const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table = {
+ 1, /* local node number */
+ 1, /* maximum number nodes in system */
+ 0, /* maximum number global objects */
+ 0, /* maximum number proxies */
+ NULL, /* pointer to MPCI address table */
+};
+
+/*
+ * This is the version string.
+ */
+
+const char _RTEMS_version[] =
+ "RTEMS RELEASE V3.5.15 snapshot (" CPU_NAME "/" CPU_MODEL_NAME ")";
+
+
+/*
+ * This table is used by the single entry point code.
+ */
+
+const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ] = {
+ (void *) rtems_initialize_executive, /* 0 */
+ (void *) rtems_initialize_executive_early, /* 1 */
+ (void *) rtems_initialize_executive_late, /* 2 */
+ (void *) rtems_shutdown_executive, /* 3 */
+ (void *) rtems_task_create, /* 4 */
+ (void *) rtems_task_ident, /* 5 */
+ (void *) rtems_task_start, /* 6 */
+ (void *) rtems_task_restart, /* 7 */
+ (void *) rtems_task_delete, /* 8 */
+ (void *) rtems_task_suspend, /* 9 */
+ (void *) rtems_task_resume, /* 10 */
+ (void *) rtems_task_set_priority, /* 11 */
+ (void *) rtems_task_mode, /* 12 */
+ (void *) rtems_task_get_note, /* 13 */
+ (void *) rtems_task_set_note, /* 14 */
+ (void *) rtems_task_wake_after, /* 15 */
+ (void *) rtems_task_wake_when, /* 16 */
+ (void *) rtems_interrupt_catch, /* 17 */
+ (void *) rtems_clock_set, /* 18 */
+ (void *) rtems_clock_get, /* 19 */
+ (void *) rtems_clock_tick, /* 20 */
+ (void *) rtems_extension_create, /* 21 */
+ (void *) rtems_extension_ident, /* 22 */
+ (void *) rtems_extension_delete, /* 23 */
+ (void *) rtems_timer_create, /* 24 */
+ (void *) rtems_timer_ident, /* 25 */
+ (void *) rtems_timer_cancel, /* 26 */
+ (void *) rtems_timer_delete, /* 27 */
+ (void *) rtems_timer_fire_after, /* 28 */
+ (void *) rtems_timer_fire_when, /* 29 */
+ (void *) rtems_timer_reset, /* 30 */
+ (void *) rtems_semaphore_create, /* 31 */
+ (void *) rtems_semaphore_ident, /* 32 */
+ (void *) rtems_semaphore_delete, /* 33 */
+ (void *) rtems_semaphore_obtain, /* 34 */
+ (void *) rtems_semaphore_release, /* 35 */
+ (void *) rtems_message_queue_create, /* 36 */
+ (void *) rtems_message_queue_ident, /* 37 */
+ (void *) rtems_message_queue_delete, /* 38 */
+ (void *) rtems_message_queue_send, /* 39 */
+ (void *) rtems_message_queue_urgent, /* 40 */
+ (void *) rtems_message_queue_broadcast, /* 41 */
+ (void *) rtems_message_queue_receive, /* 42 */
+ (void *) rtems_message_queue_flush, /* 43 */
+ (void *) rtems_event_send, /* 44 */
+ (void *) rtems_event_receive, /* 45 */
+ (void *) rtems_signal_catch, /* 46 */
+ (void *) rtems_signal_send, /* 47 */
+ (void *) rtems_partition_create, /* 48 */
+ (void *) rtems_partition_ident, /* 49 */
+ (void *) rtems_partition_delete, /* 50 */
+ (void *) rtems_partition_get_buffer, /* 51 */
+ (void *) rtems_partition_return_buffer, /* 52 */
+ (void *) rtems_region_create, /* 53 */
+ (void *) rtems_region_extend, /* 54 */
+ (void *) rtems_region_ident, /* 55 */
+ (void *) rtems_region_delete, /* 56 */
+ (void *) rtems_region_get_segment, /* 57 */
+ (void *) rtems_region_get_segment_size, /* 58 */
+ (void *) rtems_region_return_segment, /* 59 */
+ (void *) rtems_port_create, /* 60 */
+ (void *) rtems_port_ident, /* 61 */
+ (void *) rtems_port_delete, /* 62 */
+ (void *) rtems_port_external_to_internal, /* 63 */
+ (void *) rtems_port_internal_to_external, /* 64 */
+ (void *) rtems_io_initialize, /* 65 */
+ (void *) rtems_io_register_name, /* 66 */
+ (void *) rtems_io_lookup_name, /* 67 */
+ (void *) rtems_io_open, /* 68 */
+ (void *) rtems_io_close, /* 69 */
+ (void *) rtems_io_read, /* 70 */
+ (void *) rtems_io_write, /* 71 */
+ (void *) rtems_io_control, /* 72 */
+ (void *) rtems_fatal_error_occurred, /* 73 */
+ (void *) rtems_rate_monotonic_create, /* 74 */
+ (void *) rtems_rate_monotonic_ident, /* 75 */
+ (void *) rtems_rate_monotonic_delete, /* 76 */
+ (void *) rtems_rate_monotonic_cancel, /* 77 */
+ (void *) rtems_rate_monotonic_period, /* 78 */
+ (void *) rtems_multiprocessing_announce, /* 79 */
+ (void *) rtems_debug_enable, /* 80 */
+ (void *) rtems_debug_disable /* 81 */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/inline/extension.inl b/c/src/exec/sapi/inline/extension.inl
new file mode 100644
index 0000000000..c7757ff280
--- /dev/null
+++ b/c/src/exec/sapi/inline/extension.inl
@@ -0,0 +1,91 @@
+/* extension.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_MANAGER_inl
+#define __EXTENSION_MANAGER_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a extension control block from
+ * the inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Allocate( void )
+{
+ return (Extension_Control *) _Objects_Allocate( &_Extension_Information );
+}
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a extension control block to the
+ * inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE void _Extension_Free (
+ Extension_Control *the_extension
+)
+{
+ _Objects_Free( &_Extension_Information, &the_extension->Object );
+}
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps extension IDs to extension control blocks.
+ * If ID corresponds to a local extension, then it returns
+ * the extension control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Extension_Control *)
+ _Objects_Get( &_Extension_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_extension is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Extension_Is_null (
+ Extension_Control *the_extension
+)
+{
+ return ( the_extension == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/inline/rtems/extension.inl b/c/src/exec/sapi/inline/rtems/extension.inl
new file mode 100644
index 0000000000..c7757ff280
--- /dev/null
+++ b/c/src/exec/sapi/inline/rtems/extension.inl
@@ -0,0 +1,91 @@
+/* extension.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_MANAGER_inl
+#define __EXTENSION_MANAGER_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a extension control block from
+ * the inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Allocate( void )
+{
+ return (Extension_Control *) _Objects_Allocate( &_Extension_Information );
+}
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a extension control block to the
+ * inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE void _Extension_Free (
+ Extension_Control *the_extension
+)
+{
+ _Objects_Free( &_Extension_Information, &the_extension->Object );
+}
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps extension IDs to extension control blocks.
+ * If ID corresponds to a local extension, then it returns
+ * the extension control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Extension_Control *)
+ _Objects_Get( &_Extension_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_extension is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Extension_Is_null (
+ Extension_Control *the_extension
+)
+{
+ return ( the_extension == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/macros/extension.inl b/c/src/exec/sapi/macros/extension.inl
new file mode 100644
index 0000000000..96fb9d1b3e
--- /dev/null
+++ b/c/src/exec/sapi/macros/extension.inl
@@ -0,0 +1,58 @@
+/* extension.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_inl
+#define __EXTENSION_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ */
+
+#define _Extension_Allocate() \
+ (Extension_Control *) _Objects_Allocate( &_Extension_Information )
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ */
+
+#define _Extension_Free( _the_extension ) \
+ _Objects_Free( &_Extension_Information, &(_the_extension)->Object )
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ */
+
+#define _Extension_Get( _id, _location ) \
+ (Extension_Control *) \
+ _Objects_Get( &_Extension_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ */
+
+#define _Extension_Is_null( _the_extension ) \
+ ( (_the_extension) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/macros/rtems/extension.inl b/c/src/exec/sapi/macros/rtems/extension.inl
new file mode 100644
index 0000000000..96fb9d1b3e
--- /dev/null
+++ b/c/src/exec/sapi/macros/rtems/extension.inl
@@ -0,0 +1,58 @@
+/* extension.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_inl
+#define __EXTENSION_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ */
+
+#define _Extension_Allocate() \
+ (Extension_Control *) _Objects_Allocate( &_Extension_Information )
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ */
+
+#define _Extension_Free( _the_extension ) \
+ _Objects_Free( &_Extension_Information, &(_the_extension)->Object )
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ */
+
+#define _Extension_Get( _id, _location ) \
+ (Extension_Control *) \
+ _Objects_Get( &_Extension_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ */
+
+#define _Extension_Is_null( _the_extension ) \
+ ( (_the_extension) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/sapi/optman/no-ext.c b/c/src/exec/sapi/optman/no-ext.c
new file mode 100644
index 0000000000..bd7b91039b
--- /dev/null
+++ b/c/src/exec/sapi/optman/no-ext.c
@@ -0,0 +1,67 @@
+/*
+ * Extension Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+#include <rtems/score/interr.h>
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+)
+{
+}
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/sapi/optman/no-io.c b/c/src/exec/sapi/optman/no-io.c
new file mode 100644
index 0000000000..ed75a3df87
--- /dev/null
+++ b/c/src/exec/sapi/optman/no-io.c
@@ -0,0 +1,145 @@
+/*
+ * Input/Output Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/config.h>
+#include <rtems/io.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+)
+{
+}
+
+void _IO_Initialize_all_drivers( void )
+{
+}
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_lookup_name(
+ const char *pathname,
+ rtems_driver_name_t **rnp
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/exec/sapi/src/debug.c b/c/src/exec/sapi/src/debug.c
new file mode 100644
index 0000000000..5c42fa92f6
--- /dev/null
+++ b/c/src/exec/sapi/src/debug.c
@@ -0,0 +1,62 @@
+/*
+ * Debug Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/debug.h>
+
+/*PAGE
+ *
+ * _Debug_Manager_initialization
+ */
+
+void _Debug_Manager_initialization( void )
+{
+ rtems_debug_disable( RTEMS_DEBUG_ALL_MASK );
+}
+
+/*PAGE
+ *
+ * rtems_debug_enable
+ */
+
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+)
+{
+ _Debug_Level |= to_be_enabled;
+}
+
+/*PAGE
+ *
+ * rtems_debug_disable
+ */
+
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+)
+{
+ _Debug_Level &= ~to_be_disabled;
+}
+
+/*PAGE
+ *
+ * _Debug_Is_enabled
+ */
+
+boolean _Debug_Is_enabled(
+ rtems_debug_control level
+)
+{
+ return (_Debug_Level & level);
+}
diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c
new file mode 100644
index 0000000000..2ffd9f4839
--- /dev/null
+++ b/c/src/exec/sapi/src/exinit.c
@@ -0,0 +1,285 @@
+/*
+ * Initialization Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * INIT is defined so all of the data will be included in this
+ * file.
+ */
+
+#define INIT
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/debug.h>
+#include <rtems/extension.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/apiext.h>
+#include <rtems/score/copyrt.h>
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/wkspace.h>
+
+#include <rtems/directives.h>
+#include <rtems/sptables.h>
+
+#include <rtems/rtems/rtemsapi.h>
+
+/*PAGE
+ *
+ * rtems_initialize_executive
+ *
+ * This directive initializes all the kernels data structures
+ * to the states necessary for the kernel to begin execution. All
+ * include files that contain global variable definitions should be
+ * included in this file. The system threads and initialization threads
+ * are created and started by this routine. This routine then
+ * initiates multithreading.
+ *
+ * Input parameters:
+ * configuration_table - pointer to the user's configuration table
+ * cpu_table - pointer to the user's CPU configuration table
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_initialize_executive(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+)
+{
+ rtems_interrupt_level bsp_level;
+
+ bsp_level = rtems_initialize_executive_early(configuration_table, cpu_table);
+ rtems_initialize_executive_late( bsp_level );
+}
+
+rtems_interrupt_level rtems_initialize_executive_early(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+)
+{
+ rtems_interrupt_level bsp_level;
+ rtems_multiprocessing_table *multiprocessing_table;
+
+ /*
+ * Dispatching and interrupts are disabled until the end of the
+ * initialization sequence. This prevents an inadvertent context
+ * switch before the executive is initialized.
+ */
+
+ _ISR_Disable( bsp_level );
+
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE
+ );
+
+ /*
+ * Initialize the system state based on whether this is an MP system.
+ */
+
+ multiprocessing_table = configuration_table->User_multiprocessing_table;
+
+ _System_state_Handler_initialization(
+ (multiprocessing_table) ? TRUE : FALSE
+ );
+
+ /*
+ * Provided just for user convenience.
+ */
+
+ _Configuration_Table = configuration_table;
+ _Configuration_MP_table = multiprocessing_table;
+
+ /*
+ * Internally we view single processor systems as a very restricted
+ * multiprocessor system.
+ */
+
+ if ( multiprocessing_table == NULL )
+ multiprocessing_table =
+ (void *)&_Initialization_Default_multiprocessing_table;
+
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CPU_TABLE
+ );
+
+ _CPU_Initialize( cpu_table, _Thread_Dispatch );
+
+ /*
+ * Do this as early as possible to insure no debugging output
+ * is even attempted to be printed.
+ */
+
+ _Debug_Manager_initialization();
+
+ _API_extensions_Initialization();
+
+ _Thread_Dispatch_initialization();
+
+ _User_extensions_Handler_initialization(
+ configuration_table->User_extension_table
+ );
+
+ _Workspace_Handler_initialization(
+ (void *)configuration_table->work_space_start,
+ configuration_table->work_space_size
+ );
+
+ _ISR_Handler_initialization();
+
+ _Objects_Handler_initialization(
+ multiprocessing_table->node,
+ multiprocessing_table->maximum_nodes,
+ multiprocessing_table->maximum_global_objects
+ );
+
+ _Priority_Handler_initialization();
+
+ _Watchdog_Handler_initialization();
+
+ _TOD_Handler_initialization( configuration_table->microseconds_per_tick );
+
+ _Thread_Handler_initialization(
+ configuration_table->ticks_per_timeslice,
+ configuration_table->maximum_extensions,
+ multiprocessing_table->maximum_proxies
+ );
+
+ _MPCI_Handler_initialization(
+ multiprocessing_table->User_mpci_table,
+ RTEMS_TIMEOUT
+ );
+
+/* MANAGERS */
+
+ _Extension_Manager_initialization( configuration_table->maximum_extensions );
+
+ _IO_Manager_initialization(
+ configuration_table->Device_driver_table,
+ configuration_table->number_of_device_drivers,
+ configuration_table->maximum_devices
+ );
+
+ _RTEMS_API_Initialize( configuration_table );
+
+ _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+
+ if ( cpu_table->pretasking_hook )
+ (*cpu_table->pretasking_hook)();
+
+ /*
+ * No threads should be created before this point!!!
+ *
+ * At this point all API extensions are in place. After the call to
+ * _Thread_Create_idle() _Thread_Executing will be set.
+ * and _Thread_Heir are not set yet.
+ */
+
+ _Thread_Create_idle();
+
+ _MPCI_Create_server();
+
+ /*
+ * Run the API and BSPs predriver hook.
+ */
+
+ _API_extensions_Run_predriver();
+
+ if ( _CPU_Table.predriver_hook )
+ (*_CPU_Table.predriver_hook)();
+
+ /*
+ * Initialize all the device drivers and initialize the MPCI layer.
+ *
+ * NOTE: The MPCI may be build upon a device driver.
+ */
+
+ _IO_Initialize_all_drivers();
+
+ if ( _System_state_Is_multiprocessing ) {
+ _MPCI_Initialization();
+ _MPCI_Internal_packets_Send_process_packet(
+ MPCI_PACKETS_SYSTEM_VERIFY
+ );
+ }
+
+ /*
+ * Run the APIs and BSPs postdriver hooks.
+ *
+ * The API extensions are supposed to create user initialization tasks.
+ */
+
+ _API_extensions_Run_postdriver();
+
+ if ( _CPU_Table.postdriver_hook )
+ (*_CPU_Table.postdriver_hook)();
+
+ return bsp_level;
+}
+
+void rtems_initialize_executive_late(
+ rtems_interrupt_level bsp_level
+)
+{
+
+ _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
+
+ _Thread_Start_multitasking();
+
+ /*
+ * Restore the interrupt level to what the BSP had. Technically,
+ * this is unnecessary since the BSP should have all interrupts
+ * disabled when rtems_initialize_executive is invoked. But this keeps
+ * the ISR Disable/Enable calls paired.
+ */
+
+ _ISR_Enable( bsp_level );
+}
+
+/*PAGE
+ *
+ * rtems_shutdown_executive
+ *
+ * This kernel routine shutdowns the executive. It halts multitasking
+ * and returns control to the application execution "thread" which
+ * initialially invoked the rtems_initialize_executive directive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_shutdown_executive(
+ unsigned32 result
+)
+{
+ _Thread_Stop_multitasking();
+}
diff --git a/c/src/exec/sapi/src/extension.c b/c/src/exec/sapi/src/extension.c
new file mode 100644
index 0000000000..6df116bc69
--- /dev/null
+++ b/c/src/exec/sapi/src/extension.c
@@ -0,0 +1,165 @@
+/*
+ * Extension Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+/*PAGE
+ *
+ * _Extension_Manager_initialization
+ *
+ * This routine initializes all extension manager related data structures.
+ *
+ * Input parameters:
+ * maximum_extensions - number of extensions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+)
+{
+ _Objects_Initialize_information(
+ &_Extension_Information,
+ OBJECTS_RTEMS_EXTENSIONS,
+ FALSE,
+ maximum_extensions,
+ sizeof( Extension_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_extension_create
+ *
+ * This directive creates a extension and performs some initialization.
+ *
+ * Input parameters:
+ * name - extension name
+ * extension_table - pointer to extension set information
+ * id - pointer to extension id
+ *
+ * Output parameters:
+ * id - extension id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+)
+{
+ Extension_Control *the_extension;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_extension = _Extension_Allocate();
+
+ if ( !the_extension ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ _User_extensions_Add_set( &the_extension->Extension, extension_table );
+
+ _Objects_Open( &_Extension_Information, &the_extension->Object, &name );
+
+ *id = the_extension->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_extension_ident
+ *
+ * This directive returns the system ID associated with
+ * the extension name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * id - pointer to extension id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Extension_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_extension_delete
+ *
+ * This directive allows a thread to delete a extension.
+ *
+ * Input parameters:
+ * id - extension id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+)
+{
+ Extension_Control *the_extension;
+ Objects_Locations location;
+
+ the_extension = _Extension_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INVALID_ID;
+ case OBJECTS_LOCAL:
+ _User_extensions_Remove_set( &the_extension->Extension );
+ _Objects_Close( &_Extension_Information, &the_extension->Object );
+ _Extension_Free( the_extension );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/sapi/src/fatal.c b/c/src/exec/sapi/src/fatal.c
new file mode 100644
index 0000000000..b2599e3ae2
--- /dev/null
+++ b/c/src/exec/sapi/src/fatal.c
@@ -0,0 +1,38 @@
+/*
+ * Fatal Error Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/fatal.h>
+#include <rtems/score/interr.h>
+
+/*PAGE
+ *
+ * rtems_fatal_error_occurred
+ *
+ * This directive will invoke the internal fatal error handler.
+ *
+ * Input parameters:
+ * the_error - fatal error status code
+ *
+ * Output parameters: NONE
+ */
+
+void volatile rtems_fatal_error_occurred(
+ unsigned32 the_error
+)
+{
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, FALSE, the_error );
+
+/* will not return from this routine */
+}
diff --git a/c/src/exec/sapi/src/io.c b/c/src/exec/sapi/src/io.c
new file mode 100644
index 0000000000..b326a96987
--- /dev/null
+++ b/c/src/exec/sapi/src/io.c
@@ -0,0 +1,345 @@
+/*
+ * Input/Output Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/io.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+
+#include <string.h>
+
+/*PAGE
+ *
+ * _IO_Manager_initialization
+ *
+ */
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+)
+{
+ void *tmp;
+ unsigned32 index;
+ rtems_driver_name_t *np;
+
+ _IO_Driver_address_table = driver_table;
+ _IO_Number_of_drivers = number_of_drivers;
+ _IO_Number_of_devices = number_of_devices;
+
+ tmp = _Workspace_Allocate_or_fatal_error(
+ sizeof( rtems_driver_name_t ) * ( number_of_devices + 1 )
+ );
+
+ _IO_Driver_name_table = (rtems_driver_name_t *) tmp;
+
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ ) {
+ np->device_name = 0;
+ np->device_name_length = 0;
+ np->major = 0;
+ np->minor = 0;
+ }
+}
+
+/*PAGE
+ *
+ * _IO_Initialize_all_drivers
+ *
+ * This routine initializes all device drivers
+ *
+ * Input Paramters: NONE
+ *
+ * Output Parameters: NONE
+ */
+
+void _IO_Initialize_all_drivers( void )
+{
+ rtems_device_major_number major;
+
+ for ( major=0 ; major < _IO_Number_of_drivers ; major ++ )
+ (void) rtems_io_initialize( major, 0, NULL);
+}
+
+/*PAGE
+ *
+ * rtems_io_register_name
+ *
+ * Associate a name with a driver
+ *
+ * Input Paramters:
+ * device_name - pointer to name string to associate with device
+ * major - device major number to receive name
+ * minor - device minor number to receive name
+ *
+ * Output Parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+ )
+{
+ rtems_driver_name_t *np;
+ unsigned32 level;
+ unsigned32 index;
+
+ /* find an empty slot */
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
+ {
+
+ _ISR_Disable(level);
+ if (np->device_name == 0)
+ {
+ np->device_name = device_name;
+ np->device_name_length = strlen(device_name);
+ np->major = major;
+ np->minor = minor;
+ _ISR_Enable(level);
+
+ return RTEMS_SUCCESSFUL;
+ }
+ _ISR_Enable(level);
+ }
+
+ return RTEMS_TOO_MANY;
+}
+
+/*PAGE
+ *
+ * rtems_io_lookup_name
+ *
+ * Find what driver "owns" this name
+ *
+ * Input Paramters:
+ * name - name to lookup the associated device
+ *
+ * Output Parameters:
+ * device_info - device associate with name
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t **device_info
+)
+{
+ rtems_driver_name_t *np;
+ unsigned32 index;
+
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
+ if (np->device_name)
+ if (strncmp(np->device_name, name, np->device_name_length) == 0)
+ {
+ *device_info = np;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ *device_info = 0;
+ return RTEMS_UNSATISFIED;
+}
+
+
+/*PAGE
+ *
+ * rtems_io_initialize
+ *
+ * This routine is the initialization directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].initialization;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_open
+ *
+ * This routine is the open directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].open;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_close
+ *
+ * This routine is the close directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].close;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_read
+ *
+ * This routine is the read directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].read;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_write
+ *
+ * This routine is the write directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].write;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_control
+ *
+ * This routine is the control directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].control;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/exec/sapi/src/rtemsapi.c b/c/src/exec/sapi/src/rtemsapi.c
new file mode 100644
index 0000000000..b6ecb6c37c
--- /dev/null
+++ b/c/src/exec/sapi/src/rtemsapi.c
@@ -0,0 +1,89 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/rtemsapi.h>
+
+#define INIT
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+)
+{
+ _Attributes_Handler_initialization();
+
+ _Interrupt_Manager_initialization();
+
+ _Multiprocessing_Manager_initialization();
+
+ _RTEMS_tasks_Manager_initialization(
+ configuration_table->maximum_tasks,
+ configuration_table->number_of_initialization_tasks,
+ configuration_table->User_initialization_tasks_table
+ );
+
+ _Timer_Manager_initialization( configuration_table->maximum_timers );
+
+ _Signal_Manager_initialization();
+
+ _Event_Manager_initialization();
+
+ _Message_queue_Manager_initialization(
+ configuration_table->maximum_message_queues
+ );
+
+ _Semaphore_Manager_initialization(
+ configuration_table->maximum_semaphores
+ );
+
+ _Partition_Manager_initialization(
+ configuration_table->maximum_partitions
+ );
+
+ _Region_Manager_initialization( configuration_table->maximum_regions );
+
+ _Dual_ported_memory_Manager_initialization(
+ configuration_table->maximum_ports
+ );
+
+ _Rate_monotonic_Manager_initialization(
+ configuration_table->maximum_periods
+ );
+}
+
+/* end of file */
diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.c b/c/src/exec/score/cpu/hppa1.1/cpu.c
new file mode 100644
index 0000000000..89bb8a8447
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/cpu.c
@@ -0,0 +1,189 @@
+/*
+ * HP PA-RISC Dependent Source
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+void hppa_cpu_halt(unsigned32 the_error);
+
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ /*
+ * This is unsupported. For HPPA this function is handled by BSP
+ */
+
+ _CPU_Fatal_halt( 0xdeaddead );
+}
+
+
+
+/*
+ * This is the default handler which is called if
+ * _CPU_ISR_install_vector() has not been called for the
+ * specified vector. It simply forwards onto the spurious
+ * handler defined in the cpu-table.
+ */
+
+static ISR_Handler
+hppa_interrupt_report_spurious(ISR_Vector_number vector,
+ void* rtems_isr_frame) /* HPPA extension */
+{
+
+ /*
+ * If the CPU table defines a spurious_handler, then
+ * call it. If the handler returns halt.
+ */
+ if ( _CPU_Table.spurious_handler )
+ _CPU_Table.spurious_handler(vector, rtems_isr_frame);
+
+ hppa_cpu_halt(vector);
+}
+
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level(void)
+{
+ int level;
+ HPPA_ASM_SSM(0, level); /* change no bits; just get copy */
+ if (level & HPPA_PSW_I)
+ return 0;
+ return 1;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector. The handler is a C callable routine.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[vector];
+
+ _ISR_Vector_table[vector] = new_handler;
+}
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ register unsigned8 *fp_context;
+ int i;
+ proc_ptr old_handler;
+
+ /*
+ * XXX; need to setup fpsr smarter perhaps
+ */
+
+ fp_context = (unsigned8*) &_CPU_Null_fp_context;
+ for (i=0 ; i<sizeof(Context_Control_fp); i++)
+ *fp_context++ = 0;
+
+ /*
+ * Set _CPU_Default_gr27 here so it will hopefully be the correct
+ * global data pointer for the entire system.
+ */
+
+ asm volatile( "stw %%r27,%0" : "=m" (_CPU_Default_gr27): );
+
+ /*
+ * Init the 2nd level interrupt handlers
+ */
+
+ for (i=0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++)
+ _CPU_ISR_install_vector(i,
+ hppa_interrupt_report_spurious,
+ &old_handler);
+
+ _CPU_Table = *cpu_table;
+
+}
+
+
+/*
+ * Halt the system.
+ * Called by the _CPU_Fatal_halt macro
+ *
+ * XXX
+ * Later on, this will allow us to return to the prom.
+ * For now, we just ignore 'type_of_halt'
+ *
+ * XXX
+ * NOTE: for gcc, this function must be at the bottom
+ * of the file, that is because if it is at the top
+ * of the file, gcc will inline it's calls. Since
+ * the function uses the HPPA_ASM_LABEL() macro, when
+ * gcc inlines it, you get two definitions of the same
+ * label name, which is an assembly error.
+ */
+
+
+void
+hppa_cpu_halt(unsigned32 the_error)
+{
+ unsigned32 isrlevel;
+
+ _CPU_ISR_Disable(isrlevel);
+
+ /*
+ * XXXXX NOTE: This label is only needed that that when
+ * the simulator stops, it shows the label name specified
+ */
+ HPPA_ASM_LABEL("_hppa_cpu_halt");
+ HPPA_ASM_BREAK(0, 0);
+}
+
diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.h b/c/src/exec/score/cpu/hppa1.1/cpu.h
new file mode 100644
index 0000000000..eca314f7af
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/cpu.h
@@ -0,0 +1,599 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the HP
+ * PA-RISC processor (Level 1.1).
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ *
+ * Note:
+ * This file is included by both C and assembler code ( -DASM )
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/hppa.h> /* pick up machine definitions */
+#ifndef ASM
+#include <rtems/score/hppatypes.h>
+#endif
+
+/* conditional compilation parameters */
+
+#define CPU_INLINE_ENABLE_DISPATCH FALSE
+#define CPU_UNROLL_ENQUEUE_PRIORITY TRUE
+
+/*
+ * RTEMS manages an interrupt stack in software for the HPPA.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * HPPA has hardware FP, it is assumed to exist by GCC so all tasks
+ * may implicitly use it (especially for integer multiplies). Because
+ * the FP context is technically part of the basic integer context
+ * on this CPU, we cannot use the deferred FP context switch algorithm.
+ */
+
+#define CPU_HARDWARE_FP TRUE
+#define CPU_ALL_TASKS_ARE_FP TRUE
+#define CPU_IDLE_TASK_IS_FP FALSE
+#define CPU_USE_DEFERRED_FP_SWITCH FALSE
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#define CPU_STACK_GROWS_UP TRUE
+#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((__aligned__ (32)))
+
+/* constants */
+
+#define CPU_MODES_INTERRUPT_LEVEL 0x00000001 /* interrupt level in mode */
+#define CPU_MODES_INTERRUPT_MASK 0x00000001 /* interrupt level in mode */
+
+/*
+ * PSW contstants
+ */
+
+#define CPU_PSW_BASE (HPPA_PSW_C | HPPA_PSW_Q | HPPA_PSW_P | HPPA_PSW_D)
+#define CPU_PSW_INTERRUPTS_ON (CPU_PSW_BASE | HPPA_PSW_I)
+#define CPU_PSW_INTERRUPTS_OFF (CPU_PSW_BASE)
+
+#define CPU_PSW_DEFAULT CPU_PSW_BASE
+
+
+#ifndef ASM
+
+/*
+ * Contexts
+ *
+ * This means we have the following context items:
+ * 1. task level context stuff:: Context_Control
+ * 2. floating point task stuff:: Context_Control_fp
+ *
+ * The PA-RISC is very fast so the expense of saving an extra register
+ * or two is not of great concern at the present. So we are not making
+ * a distinction between what is saved during a task switch and what is
+ * saved at each interrupt. Plus saving the entire context should make
+ * it easier to make gdb aware of RTEMS tasks.
+ */
+
+typedef struct {
+ unsigned32 flags; /* whatever */
+ unsigned32 gr1; /* scratch -- caller saves */
+ unsigned32 gr2; /* RP -- return pointer */
+ unsigned32 gr3; /* scratch -- callee saves */
+ unsigned32 gr4; /* scratch -- callee saves */
+ unsigned32 gr5; /* scratch -- callee saves */
+ unsigned32 gr6; /* scratch -- callee saves */
+ unsigned32 gr7; /* scratch -- callee saves */
+ unsigned32 gr8; /* scratch -- callee saves */
+ unsigned32 gr9; /* scratch -- callee saves */
+ unsigned32 gr10; /* scratch -- callee saves */
+ unsigned32 gr11; /* scratch -- callee saves */
+ unsigned32 gr12; /* scratch -- callee saves */
+ unsigned32 gr13; /* scratch -- callee saves */
+ unsigned32 gr14; /* scratch -- callee saves */
+ unsigned32 gr15; /* scratch -- callee saves */
+ unsigned32 gr16; /* scratch -- callee saves */
+ unsigned32 gr17; /* scratch -- callee saves */
+ unsigned32 gr18; /* scratch -- callee saves */
+ unsigned32 gr19; /* scratch -- caller saves */
+ unsigned32 gr20; /* scratch -- caller saves */
+ unsigned32 gr21; /* scratch -- caller saves */
+ unsigned32 gr22; /* scratch -- caller saves */
+ unsigned32 gr23; /* argument 3 */
+ unsigned32 gr24; /* argument 2 */
+ unsigned32 gr25; /* argument 1 */
+ unsigned32 gr26; /* argument 0 */
+ unsigned32 gr27; /* DP -- global data pointer */
+ unsigned32 gr28; /* return values -- caller saves */
+ unsigned32 gr29; /* return values -- caller saves */
+ unsigned32 sp; /* gr30 */
+ unsigned32 gr31;
+
+ /* Various control registers */
+
+ unsigned32 sar; /* cr11 */
+ unsigned32 ipsw; /* cr22; full 32 bits of psw */
+ unsigned32 iir; /* cr19; interrupt instruction register */
+ unsigned32 ior; /* cr21; interrupt offset register */
+ unsigned32 isr; /* cr20; interrupt space register (not used) */
+ unsigned32 pcoqfront; /* cr18; front que offset */
+ unsigned32 pcoqback; /* cr18; back que offset */
+ unsigned32 pcsqfront; /* cr17; front que space (not used) */
+ unsigned32 pcsqback; /* cr17; back que space (not used) */
+ unsigned32 itimer; /* cr16; itimer value */
+
+} Context_Control;
+
+
+/* Must be double word aligned.
+ * This will be ok since our allocator returns 8 byte aligned chunks
+ */
+
+typedef struct {
+ double fr0; /* status */
+ double fr1; /* exception information */
+ double fr2; /* exception information */
+ double fr3; /* exception information */
+ double fr4; /* argument */
+ double fr5; /* argument */
+ double fr6; /* argument */
+ double fr7; /* argument */
+ double fr8; /* scratch -- caller saves */
+ double fr9; /* scratch -- caller saves */
+ double fr10; /* scratch -- caller saves */
+ double fr11; /* scratch -- caller saves */
+ double fr12; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr13; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr14; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr15; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr16; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr17; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr18; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr19; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr20; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr21; /* callee saves -- (PA-RISC 1.1 CPUs) */
+ double fr22; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr23; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr24; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr25; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr26; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr27; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr28; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr29; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr30; /* caller saves -- (PA-RISC 1.1 CPUs) */
+ double fr31; /* caller saves -- (PA-RISC 1.1 CPUs) */
+} Context_Control_fp;
+
+/*
+ * The following structure defines the set of information saved
+ * on the current stack by RTEMS upon receipt of each interrupt.
+ */
+
+typedef struct {
+ Context_Control Integer;
+ Context_Control_fp Floating_Point;
+} CPU_Interrupt_frame;
+
+/*
+ * Our interrupt handlers take a 2nd argument:
+ * a pointer to a CPU_Interrupt_frame
+ * So we use our own prototype instead of rtems_isr_entry
+ */
+
+typedef void ( *hppa_rtems_isr_entry )(
+ unsigned32,
+ CPU_Interrupt_frame *
+ );
+
+/*
+ * The following table contains the information required to configure
+ * the HPPA specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void * );
+ /* end of fields required on all CPUs */
+
+ hppa_rtems_isr_entry spurious_handler;
+
+ unsigned32 itimer_clicks_per_microsecond; /* for use by Clock driver */
+} rtems_cpu_table;
+
+/* variables */
+
+EXTERN Context_Control_fp _CPU_Null_fp_context;
+EXTERN unsigned32 _CPU_Default_gr27;
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+#endif /* ! ASM */
+
+/*
+ * context sizes
+ */
+
+#ifndef ASM
+#define CPU_CONTEXT_SIZE sizeof( Context_Control )
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+#endif
+
+/*
+ * size of a frame on the stack
+ */
+
+#define CPU_FRAME_SIZE (16 * 4)
+
+/*
+ * (Optional) # of bytes for libmisc/stackchk to check
+ * If not specifed, then it defaults to something reasonable
+ * for most architectures.
+ */
+
+#define CPU_STACK_CHECK_SIZE (CPU_FRAME_SIZE * 2)
+
+/*
+ * extra stack required by the MPCI receive server thread
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
+
+/*
+ * HPPA has 32 interrupts, then 32 external interrupts
+ * Rtems (_ISR_Vector_Table) is aware ONLY of the first 32
+ * The BSP is aware of the external interrupts and possibly more.
+ *
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS (HPPA_INTERNAL_INTERRUPTS)
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Don't be chintzy here; we don't want to debug these problems
+ * Some of the tests eat almost 4k.
+ * Plus, the HPPA always allocates chunks of 64 bytes for stack
+ * growth.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE (8 * 1024)
+
+/*
+ * HPPA double's must be on 8 byte boundary
+ */
+
+#define CPU_ALIGNMENT 8
+
+/*
+ * just follow the basic HPPA alignment for the heap and partition
+ */
+
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * HPPA stack is best when 64 byte aligned.
+ */
+
+#define CPU_STACK_ALIGNMENT 64
+
+#ifndef ASM
+
+/* macros */
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + disable all maskable CPU interrupts
+ * + restore previous interrupt level (enable)
+ * + temporarily restore interrupts (flash)
+ * + set a particular level
+ */
+
+/* Disable interrupts; returning previous level in _level */
+#define _CPU_ISR_Disable( _isr_cookie ) \
+ do { \
+ HPPA_ASM_RSM(HPPA_PSW_I, _isr_cookie); \
+ } while(0)
+
+/* Enable interrupts to previous level from _CPU_ISR_Disable
+ * does not change 'level' */
+#define _CPU_ISR_Enable( _isr_cookie ) \
+ { \
+ HPPA_ASM_MTSM( _isr_cookie ); \
+ }
+
+/* restore, then disable interrupts; does not change level */
+#define _CPU_ISR_Flash( _isr_cookie ) \
+ { \
+ register int _ignore; \
+ _CPU_ISR_Enable( _isr_cookie ); \
+ _CPU_ISR_Disable( _ignore ); \
+ }
+
+/*
+ * Interrupt task levels
+ *
+ * Future scheme proposal
+ * level will be an index into a array.
+ * Each entry of array will be the interrupt bits
+ * enabled for that level. There will be 32 bits of external
+ * interrupts (to be placed in EIEM) and some (optional) bsp
+ * specific bits
+ *
+ * For pixel flow this *may* mean something like:
+ * level 0: all interrupts enabled (external + rhino)
+ * level 1: rhino disabled
+ * level 2: all io interrupts disabled (timer still enabled)
+ * level 7: *ALL* disabled (timer disabled)
+ */
+
+/* set interrupts on or off; does not return new level */
+#define _CPU_ISR_Set_level( new_level ) \
+ { \
+ volatile int ignore; \
+ if ( new_level ) HPPA_ASM_RSM(HPPA_PSW_I, ignore); \
+ else HPPA_ASM_SSM(HPPA_PSW_I, ignore); \
+ }
+
+/* return current level */
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/*
+ * Context handler macros
+ *
+ * These macros perform the following functions:
+ * + initialize a context area
+ * + restart the current thread
+ * + calculate the initial pointer into a FP context area
+ * + initialize an FP context area
+ *
+ * HPPA port adds two macros which hide the "indirectness" of the
+ * pointer passed the save/restore FP context assembly routines.
+ */
+
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _new_level, _entry_point, _is_fp ) \
+ do { \
+ unsigned32 _stack; \
+ \
+ (_the_context)->flags = 0xfeedf00d; \
+ (_the_context)->pcoqfront = (unsigned32)(_entry_point); \
+ (_the_context)->pcoqback = (unsigned32)(_entry_point) + 4; \
+ (_the_context)->pcsqfront = 0; \
+ (_the_context)->pcsqback = 0; \
+ if ( (_new_level) ) \
+ (_the_context)->ipsw = CPU_PSW_INTERRUPTS_OFF; \
+ else \
+ (_the_context)->ipsw = CPU_PSW_INTERRUPTS_ON; \
+ \
+ _stack = ((unsigned32)(_stack_base) + (CPU_STACK_ALIGNMENT - 1)); \
+ _stack &= ~(CPU_STACK_ALIGNMENT - 1); \
+ if ((_stack - (unsigned32) (_stack_base)) < CPU_FRAME_SIZE) \
+ _stack += CPU_FRAME_SIZE; \
+ \
+ (_the_context)->sp = (_stack); \
+ (_the_context)->gr27 = _CPU_Default_gr27; \
+ } while (0)
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ do { \
+ _CPU_Context_restore( (_the_context) ); \
+ } while (0)
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) (_base) + (_offset) )
+
+#define _CPU_Context_Initialize_fp( _destination ) \
+ do { \
+ *((Context_Control_fp *) *((void **) _destination)) = _CPU_Null_fp_context;\
+ } while(0)
+
+#define _CPU_Context_save_fp( _fp_context ) \
+ _CPU_Save_float_context( *(Context_Control_fp **)(_fp_context) )
+
+#define _CPU_Context_restore_fp( _fp_context ) \
+ _CPU_Restore_float_context( *(Context_Control_fp **)(_fp_context) )
+
+/* end of Context handler macros */
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+void hppa_cpu_halt(unsigned32 the_error);
+#define _CPU_Fatal_halt( _error ) \
+ hppa_cpu_halt(_error)
+
+/* end of Fatal Error manager macros */
+
+/*
+ * Bitfield handler macros
+ *
+ * These macros perform the following functions:
+ * + scan for the highest numbered (MSB) set in a 16 bit bitfield
+ *
+ * NOTE:
+ *
+ * The HPPA does not have a scan instruction. This functionality
+ * is implemented in software.
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
+#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
+
+int hppa_rtems_ffs(unsigned int value);
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ _output = hppa_rtems_ffs(_value)
+
+/* end of Bitfield handler macros */
+
+/*
+ * Priority handler macros
+ *
+ * These macros perform the following functions:
+ * + return a mask with the bit for this major/minor portion of
+ * of thread priority set.
+ * + translate the bit number returned by "Bitfield_find_first_bit"
+ * into an index into the thread ready chain bit maps
+ *
+ * Note: 255 is the lowest priority
+ */
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 1 << (_bit_number) )
+
+#define _CPU_Priority_bits_index( _priority ) \
+ (_priority)
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generally used only to restart self in an
+ * efficient manner and avoid stack conflicts.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Save_float_context
+ *
+ * This routine saves the floating point context passed to it.
+ *
+ * NOTE: _CPU_Context_save_fp is implemented as a macro on the HPPA
+ * which dereferences the pointer before calling this.
+ */
+
+void _CPU_Save_float_context(
+ Context_Control_fp *fp_context
+);
+
+/*
+ * _CPU_Restore_float_context
+ *
+ * This routine restores the floating point context passed to it.
+ *
+ * NOTE: _CPU_Context_save_fp is implemented as a macro on the HPPA
+ * which dereferences the pointer before calling this.
+ */
+
+void _CPU_Restore_float_context(
+ Context_Control_fp *fp_context
+);
+
+
+/* The following routine swaps the endian format of an unsigned int.
+ * It must be static so it can be referenced indirectly.
+ */
+
+static inline unsigned int
+CPU_swap_u32(unsigned32 value)
+{
+ unsigned32 swapped;
+
+ HPPA_ASM_SWAPBYTES(value, swapped);
+
+ return( swapped );
+}
+
+/*
+ * Unused; I think it should go away
+ */
+
+#if 0
+#define enable_tracing()
+#endif
+
+#endif /* ! ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __CPU_h */
diff --git a/c/src/exec/score/cpu/hppa1.1/cpu_asm.h b/c/src/exec/score/cpu/hppa1.1/cpu_asm.h
new file mode 100644
index 0000000000..951f80dcf0
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/cpu_asm.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1990,1991 The University of Utah and
+ * the Center for Software Science (CSS). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the Center
+ * for Software Science at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSS requests users of this software to return to css-dist@cs.utah.edu any
+ * improvements that they make and grant CSS redistribution rights.
+ *
+ * Utah $Hdr: asm.h 1.6 91/12/03$
+ *
+ * $Id$
+ */
+
+/*
+ * Hardware Space Registers
+ */
+sr0 .reg %sr0
+sr1 .reg %sr1
+sr2 .reg %sr2
+sr3 .reg %sr3
+sr4 .reg %sr4
+sr5 .reg %sr5
+sr6 .reg %sr6
+sr7 .reg %sr7
+
+/*
+ * Control register aliases
+ */
+
+rctr .reg %cr0
+pidr1 .reg %cr8
+pidr2 .reg %cr9
+ccr .reg %cr10
+sar .reg %cr11
+pidr3 .reg %cr12
+pidr4 .reg %cr13
+iva .reg %cr14
+eiem .reg %cr15
+itmr .reg %cr16
+pcsq .reg %cr17
+pcoq .reg %cr18
+iir .reg %cr19
+isr .reg %cr20
+ior .reg %cr21
+ipsw .reg %cr22
+eirr .reg %cr23
+
+/*
+ * Calling Convention
+ */
+rp .reg %r2
+arg3 .reg %r23
+arg2 .reg %r24
+arg1 .reg %r25
+arg0 .reg %r26
+dp .reg %r27
+ret0 .reg %r28
+ret1 .reg %r29
+sl .reg %r29
+sp .reg %r30
+
+
diff --git a/c/src/exec/score/cpu/hppa1.1/cpu_asm.s b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s
new file mode 100644
index 0000000000..12814eda6e
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s
@@ -0,0 +1,702 @@
+#
+# TODO:
+# Context_switch needs to only save callee save registers
+# I think this means can skip: r1, r2, r19-29, r31
+# Ref: p 3-2 of Procedure Calling Conventions Manual
+# This should be #ifndef DEBUG so that debugger has
+# accurate visibility into all registers
+#
+# This file contains the assembly code for the HPPA implementation
+# of RTEMS.
+#
+# COPYRIGHT (c) 1994,95 by Division Incorporated
+#
+# To anyone who acknowledges that this file is provided "AS IS"
+# without any express or implied warranty:
+# permission to use, copy, modify, and distribute this file
+# for any purpose is hereby granted without fee, provided that
+# the above copyright notice and this notice appears in all
+# copies, and that the name of Division Incorporated not be
+# used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# Division Incorporated makes no representations about the
+# suitability of this software for any purpose.
+#
+# $Id$
+#
+
+#include <rtems/score/hppa.h>
+#include <rtems/score/cpu_asm.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/offsets.h>
+
+ .SPACE $PRIVATE$
+ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
+ .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
+ .SPACE $TEXT$
+ .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
+ .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+ .SPACE $TEXT$
+ .SUBSPA $CODE$
+
+#
+# Special register usage for context switch and interrupts
+# Stay away from %cr28 which is used for TLB misses on 72000
+#
+
+isr_arg0 .reg %cr24
+isr_r9 .reg %cr25
+isr_r8 .reg %cr26
+
+#
+# Interrupt stack frame looks like this
+#
+# offset item
+# -----------------------------------------------------------------
+# INTEGER_CONTEXT_OFFSET Context_Control
+# FP_CONTEXT_OFFSET Context_Control_fp
+#
+# It is padded out to a multiple of 64
+#
+
+
+# PAGE^L
+# void _Generic_ISR_Handler()
+#
+# This routine provides the RTEMS interrupt management.
+#
+# We jump here from the interrupt vector.
+# The HPPA hardware has done some stuff for us:
+# PSW saved in IPSW
+# PSW set to 0
+# PSW[E] set to default (0)
+# PSW[M] set to 1 iff this is HPMC
+#
+# IIA queue is frozen (since PSW[Q] is now 0)
+# privilege level promoted to 0
+# IIR, ISR, IOR potentially updated if PSW[Q] was 1 at trap
+# registers GR 1,8,9,16,17,24,25 copied to shadow regs
+# SHR 0 1 2 3 4 5 6
+#
+# Our vector stub (in the BSP) MUST have done the following:
+#
+# a) Saved the original %r9 into %isr_r9 (%cr25)
+# b) Placed the vector number in %r9
+# c) Was allowed to also destroy $isr_r8 (%cr26),
+# but the stub was NOT allowed to destroy any other registers.
+#
+# The typical stub sequence (in the BSP) should look like this:
+#
+# a) mtctl %r9,isr_r9 ; (save r9 in cr25)
+# b) ldi vector,%r9 ; (load constant vector number in r9)
+# c) mtctl %r8,isr_r8 ; (save r8 in cr26)
+# d) ldil L%MY_BSP_first_level_interrupt_handler,%r8
+# e) ldo R%MY_BSP_first_level_interrupt_handler(%r8),%r8
+# ; (point to BSP raw handler table)
+# f) ldwx,s %r9(%r8),%r8 ; (load value from raw handler table)
+# g) bv 0(%r8) ; (call raw handler: _Generic_ISR_Handler)
+# h) mfctl isr_r8,%r8 ; (restore r8 from cr26 in delay slot)
+#
+# Optionally, steps (c) thru (h) _could_ be replaced with a single
+# bl,n _Generic_ISR_Handler,%r0
+#
+#
+#
+ .EXPORT _Generic_ISR_Handler,ENTRY,PRIV_LEV=0
+_Generic_ISR_Handler:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+
+ mtctl arg0, isr_arg0
+
+# save interrupt state
+ mfctl ipsw, arg0
+ stw arg0, IPSW_OFFSET(sp)
+
+ mfctl iir, arg0
+ stw arg0, IIR_OFFSET(sp)
+
+ mfctl ior, arg0
+ stw arg0, IOR_OFFSET(sp)
+
+ mfctl pcoq, arg0
+ stw arg0, PCOQFRONT_OFFSET(sp)
+
+ mtctl %r0, pcoq
+ mfctl pcoq, arg0
+ stw arg0, PCOQBACK_OFFSET(sp)
+
+ mfctl %sar, arg0
+ stw arg0, SAR_OFFSET(sp)
+
+#
+# Build an interrupt frame to hold the contexts we will need.
+# We have already saved the interrupt items on the stack
+
+# At this point the following registers are damaged wrt the interrupt
+# reg current value saved value
+# ------------------------------------------------
+# arg0 scratch isr_arg0 (cr24)
+# r9 vector number isr_r9 (cr25)
+#
+# Point to beginning of integer context and
+# save the integer context
+ stw %r1,R1_OFFSET(sp)
+ stw %r2,R2_OFFSET(sp)
+ stw %r3,R3_OFFSET(sp)
+ stw %r4,R4_OFFSET(sp)
+ stw %r5,R5_OFFSET(sp)
+ stw %r6,R6_OFFSET(sp)
+ stw %r7,R7_OFFSET(sp)
+ stw %r8,R8_OFFSET(sp)
+# skip r9
+ stw %r10,R10_OFFSET(sp)
+ stw %r11,R11_OFFSET(sp)
+ stw %r12,R12_OFFSET(sp)
+ stw %r13,R13_OFFSET(sp)
+ stw %r14,R14_OFFSET(sp)
+ stw %r15,R15_OFFSET(sp)
+ stw %r16,R16_OFFSET(sp)
+ stw %r17,R17_OFFSET(sp)
+ stw %r18,R18_OFFSET(sp)
+ stw %r19,R19_OFFSET(sp)
+ stw %r20,R20_OFFSET(sp)
+ stw %r21,R21_OFFSET(sp)
+ stw %r22,R22_OFFSET(sp)
+ stw %r23,R23_OFFSET(sp)
+ stw %r24,R24_OFFSET(sp)
+ stw %r25,R25_OFFSET(sp)
+# skip arg0
+ stw %r27,R27_OFFSET(sp)
+ stw %r28,R28_OFFSET(sp)
+ stw %r29,R29_OFFSET(sp)
+ stw %r30,R30_OFFSET(sp)
+ stw %r31,R31_OFFSET(sp)
+
+# Now most registers are available since they have been saved
+#
+# The following items are currently wrong in the integer context
+# reg current value saved value
+# ------------------------------------------------
+# arg0 scratch isr_arg0 (cr24)
+# r9 vector number isr_r9 (cr25)
+#
+# Fix them
+
+ mfctl isr_arg0,%r3
+ stw %r3,ARG0_OFFSET(sp)
+
+ mfctl isr_r9,%r3
+ stw %r3,R9_OFFSET(sp)
+
+#
+# At this point we are done with isr_arg0, and isr_r9 control registers
+#
+# Prepare to re-enter virtual mode
+# We need Q in case the interrupt handler enables interrupts
+#
+
+ ldil L%CPU_PSW_DEFAULT, arg0
+ ldo R%CPU_PSW_DEFAULT(arg0), arg0
+ mtctl arg0, ipsw
+
+# Now jump to "rest_of_isr_handler" with the rfi
+# We are assuming the space queues are all correct already
+
+ ldil L%rest_of_isr_handler, arg0
+ ldo R%rest_of_isr_handler(arg0), arg0
+ mtctl arg0, pcoq
+ ldo 4(arg0), arg0
+ mtctl arg0, pcoq
+
+ rfi
+ nop
+
+# At this point we are back in virtual mode and all our
+# normal addressing is once again ok.
+#
+# It is now ok to take an exception or trap
+#
+
+rest_of_isr_handler:
+
+# Point to beginning of float context and
+# save the floating point context -- doing whatever patches are necessary
+ .call ARGW0=GR
+ bl _CPU_Save_float_context,%r2
+ ldo FP_CONTEXT_OFFSET(sp),arg0
+
+# save the ptr to interrupt frame as an argument for the interrupt handler
+ copy sp, arg1
+
+# Advance the frame to point beyond all interrupt contexts (integer & float)
+# this also includes the pad to align to 64byte stack boundary
+ ldo CPU_INTERRUPT_FRAME_SIZE(sp), sp
+
+# r3 -- &_ISR_Nest_level
+# r5 -- value _ISR_Nest_level
+# r4 -- &_Thread_Dispatch_disable_level
+# r6 -- value _Thread_Dispatch_disable_level
+# r9 -- vector number
+
+ .import _ISR_Nest_level,data
+ ldil L%_ISR_Nest_level,%r3
+ ldo R%_ISR_Nest_level(%r3),%r3
+ ldw 0(%r3),%r5
+
+ .import _Thread_Dispatch_disable_level,data
+ ldil L%_Thread_Dispatch_disable_level,%r4
+ ldo R%_Thread_Dispatch_disable_level(%r4),%r4
+ ldw 0(%r4),%r6
+
+# increment interrupt nest level counter. If outermost interrupt
+# switch the stack and squirrel away the previous sp.
+ addi 1,%r5,%r5
+ stw %r5, 0(%r3)
+
+# compute and save new stack (with frame)
+# just in case we are nested -- simpler this way
+ comibf,= 1,%r5,stack_done
+ ldo 128(sp),%r7
+
+#
+# Switch to interrupt stack allocated by the interrupt manager (intr.c)
+#
+ .import _CPU_Interrupt_stack_low,data
+ ldil L%_CPU_Interrupt_stack_low,%r7
+ ldw R%_CPU_Interrupt_stack_low(%r7),%r7
+ ldo 128(%r7),%r7
+
+stack_done:
+# save our current stack pointer where the "old sp" is supposed to be
+ stw sp, -4(%r7)
+# and switch stacks (or advance old stack in nested case)
+ copy %r7, sp
+
+# increment the dispatch disable level counter.
+ addi 1,%r6,%r6
+ stw %r6, 0(%r4)
+
+# load address of user handler
+# Note: No error checking is done, it is assumed that the
+# vector table contains a valid address or a stub
+# spurious handler.
+ .import _ISR_Vector_table,data
+ ldil L%_ISR_Vector_table,%r8
+ ldo R%_ISR_Vector_table(%r8),%r8
+ ldwx,s %r9(%r8),%r8
+
+# invoke user interrupt handler
+# Interrupts are currently disabled, as per RTEMS convention
+# The handler has the option of re-enabling interrupts
+# NOTE: can not use 'bl' since it uses "pc-relative" addressing
+# and we are using a hard coded address from a table
+# So... we fudge r2 ourselves (ala dynacall)
+# arg0 = vector number, arg1 = ptr to rtems_interrupt_frame
+ copy %r9, %r26
+ .call ARGW0=GR, ARGW1=GR
+ blr %r0, rp
+ bv,n 0(%r8)
+
+post_user_interrupt_handler:
+
+# Back from user handler(s)
+# Disable external interrupts (since the interrupt handler could
+# have turned them on) and return to the interrupted task stack (assuming
+# (_ISR_Nest_level == 0)
+
+ rsm HPPA_PSW_I + HPPA_PSW_R, %r0
+ ldw -4(sp), sp
+
+# r3 -- (most of) &_ISR_Nest_level
+# r5 -- value _ISR_Nest_level
+# r4 -- (most of) &_Thread_Dispatch_disable_level
+# r6 -- value _Thread_Dispatch_disable_level
+# r7 -- (most of) &_ISR_Signals_to_thread_executing
+# r8 -- value _ISR_Signals_to_thread_executing
+
+ .import _ISR_Nest_level,data
+ ldil L%_ISR_Nest_level,%r3
+ ldw R%_ISR_Nest_level(%r3),%r5
+
+ .import _Thread_Dispatch_disable_level,data
+ ldil L%_Thread_Dispatch_disable_level,%r4
+ ldw R%_Thread_Dispatch_disable_level(%r4),%r6
+
+ .import _ISR_Signals_to_thread_executing,data
+ ldil L%_ISR_Signals_to_thread_executing,%r7
+
+# decrement isr nest level
+ addi -1, %r5, %r5
+ stw %r5, R%_ISR_Nest_level(%r3)
+
+# decrement dispatch disable level counter and, if not 0, go on
+ addi -1,%r6,%r6
+ comibf,= 0,%r6,isr_restore
+ stw %r6, R%_Thread_Dispatch_disable_level(%r4)
+
+# check whether or not a context switch is necessary
+ .import _Context_Switch_necessary,data
+ ldil L%_Context_Switch_necessary,%r8
+ ldw R%_Context_Switch_necessary(%r8),%r8
+ comibf,=,n 0,%r8,ISR_dispatch
+
+# check whether or not a context switch is necessary because an ISR
+# sent signals to the interrupted task
+ ldw R%_ISR_Signals_to_thread_executing(%r7),%r8
+ comibt,=,n 0,%r8,isr_restore
+
+
+# OK, something happened while in ISR and we need to switch to a task
+# other than the one which was interrupted or the
+# ISR_Signals_to_thread_executing case
+# We also turn on interrupts, since the interrupted task had them
+# on (obviously :-) and Thread_Dispatch is happy to leave ints on.
+#
+
+ISR_dispatch:
+ stw %r0, R%_ISR_Signals_to_thread_executing(%r7)
+
+ ssm HPPA_PSW_I, %r0
+
+ .import _Thread_Dispatch,code
+ .call
+ bl _Thread_Dispatch,%r2
+ ldo 128(sp),sp
+
+ ldo -128(sp),sp
+
+isr_restore:
+
+# enable interrupts during most of restore
+ ssm HPPA_PSW_I, %r0
+
+# Get a pointer to beginning of our stack frame
+ ldo -CPU_INTERRUPT_FRAME_SIZE(sp), %arg1
+
+# restore float
+ .call ARGW0=GR
+ bl _CPU_Restore_float_context,%r2
+ ldo FP_CONTEXT_OFFSET(%arg1), arg0
+
+ copy %arg1, %arg0
+
+# ********** FALL THRU **********
+
+# Jump here from bottom of Context_Switch
+# Also called directly by _CPU_Context_Restart_self via _Thread_Restart_self
+# restore interrupt state
+#
+
+ .EXPORT _CPU_Context_restore
+_CPU_Context_restore:
+
+#
+# restore integer state
+#
+ ldw R1_OFFSET(arg0),%r1
+ ldw R2_OFFSET(arg0),%r2
+ ldw R3_OFFSET(arg0),%r3
+ ldw R4_OFFSET(arg0),%r4
+ ldw R5_OFFSET(arg0),%r5
+ ldw R6_OFFSET(arg0),%r6
+ ldw R7_OFFSET(arg0),%r7
+ ldw R8_OFFSET(arg0),%r8
+ ldw R9_OFFSET(arg0),%r9
+ ldw R10_OFFSET(arg0),%r10
+ ldw R11_OFFSET(arg0),%r11
+ ldw R12_OFFSET(arg0),%r12
+ ldw R13_OFFSET(arg0),%r13
+ ldw R14_OFFSET(arg0),%r14
+ ldw R15_OFFSET(arg0),%r15
+ ldw R16_OFFSET(arg0),%r16
+ ldw R17_OFFSET(arg0),%r17
+ ldw R18_OFFSET(arg0),%r18
+ ldw R19_OFFSET(arg0),%r19
+ ldw R20_OFFSET(arg0),%r20
+ ldw R21_OFFSET(arg0),%r21
+ ldw R22_OFFSET(arg0),%r22
+ ldw R23_OFFSET(arg0),%r23
+ ldw R24_OFFSET(arg0),%r24
+# skipping r25; used as scratch register below
+# skipping r26 (arg0) until we are done with it
+ ldw R27_OFFSET(arg0),%r27
+ ldw R28_OFFSET(arg0),%r28
+ ldw R29_OFFSET(arg0),%r29
+ ldw R30_OFFSET(arg0),%r30
+ ldw R31_OFFSET(arg0),%r31
+
+# Turn off Q & R & I so we can write interrupt control registers
+ rsm HPPA_PSW_Q + HPPA_PSW_R + HPPA_PSW_I, %r0
+
+ ldw IPSW_OFFSET(arg0), %r25
+ mtctl %r25, ipsw
+
+ ldw SAR_OFFSET(arg0), %r25
+ mtctl %r25, sar
+
+ ldw PCOQFRONT_OFFSET(arg0), %r25
+ mtctl %r25, pcoq
+
+ ldw PCOQBACK_OFFSET(arg0), %r25
+ mtctl %r25, pcoq
+
+# Load r25 with interrupts off
+ ldw R25_OFFSET(arg0),%r25
+# Must load r26 (arg0) last
+ ldw R26_OFFSET(arg0),%r26
+
+isr_exit:
+ rfi
+ .EXIT
+ .PROCEND
+
+#
+# This section is used to context switch floating point registers.
+# Ref: 6-35 of Architecture 1.1
+#
+# NOTE: since integer multiply uses the floating point unit,
+# we have to save/restore fp on every trap. We cannot
+# just try to keep track of fp usage.
+
+ .align 32
+ .EXPORT _CPU_Save_float_context,ENTRY,PRIV_LEV=0
+_CPU_Save_float_context:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+ fstds,ma %fr0,8(%arg0)
+ fstds,ma %fr1,8(%arg0)
+ fstds,ma %fr2,8(%arg0)
+ fstds,ma %fr3,8(%arg0)
+ fstds,ma %fr4,8(%arg0)
+ fstds,ma %fr5,8(%arg0)
+ fstds,ma %fr6,8(%arg0)
+ fstds,ma %fr7,8(%arg0)
+ fstds,ma %fr8,8(%arg0)
+ fstds,ma %fr9,8(%arg0)
+ fstds,ma %fr10,8(%arg0)
+ fstds,ma %fr11,8(%arg0)
+ fstds,ma %fr12,8(%arg0)
+ fstds,ma %fr13,8(%arg0)
+ fstds,ma %fr14,8(%arg0)
+ fstds,ma %fr15,8(%arg0)
+ fstds,ma %fr16,8(%arg0)
+ fstds,ma %fr17,8(%arg0)
+ fstds,ma %fr18,8(%arg0)
+ fstds,ma %fr19,8(%arg0)
+ fstds,ma %fr20,8(%arg0)
+ fstds,ma %fr21,8(%arg0)
+ fstds,ma %fr22,8(%arg0)
+ fstds,ma %fr23,8(%arg0)
+ fstds,ma %fr24,8(%arg0)
+ fstds,ma %fr25,8(%arg0)
+ fstds,ma %fr26,8(%arg0)
+ fstds,ma %fr27,8(%arg0)
+ fstds,ma %fr28,8(%arg0)
+ fstds,ma %fr29,8(%arg0)
+ fstds,ma %fr30,8(%arg0)
+ fstds %fr31,0(%arg0)
+ bv 0(%r2)
+ addi -(31*8), %arg0, %arg0 ; restore arg0 just for fun
+ .EXIT
+ .PROCEND
+
+ .align 32
+ .EXPORT _CPU_Restore_float_context,ENTRY,PRIV_LEV=0
+_CPU_Restore_float_context:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+ addi (31*8), %arg0, %arg0 ; point at last double
+ fldds 0(%arg0),%fr31
+ fldds,mb -8(%arg0),%fr30
+ fldds,mb -8(%arg0),%fr29
+ fldds,mb -8(%arg0),%fr28
+ fldds,mb -8(%arg0),%fr27
+ fldds,mb -8(%arg0),%fr26
+ fldds,mb -8(%arg0),%fr25
+ fldds,mb -8(%arg0),%fr24
+ fldds,mb -8(%arg0),%fr23
+ fldds,mb -8(%arg0),%fr22
+ fldds,mb -8(%arg0),%fr21
+ fldds,mb -8(%arg0),%fr20
+ fldds,mb -8(%arg0),%fr19
+ fldds,mb -8(%arg0),%fr18
+ fldds,mb -8(%arg0),%fr17
+ fldds,mb -8(%arg0),%fr16
+ fldds,mb -8(%arg0),%fr15
+ fldds,mb -8(%arg0),%fr14
+ fldds,mb -8(%arg0),%fr13
+ fldds,mb -8(%arg0),%fr12
+ fldds,mb -8(%arg0),%fr11
+ fldds,mb -8(%arg0),%fr10
+ fldds,mb -8(%arg0),%fr9
+ fldds,mb -8(%arg0),%fr8
+ fldds,mb -8(%arg0),%fr7
+ fldds,mb -8(%arg0),%fr6
+ fldds,mb -8(%arg0),%fr5
+ fldds,mb -8(%arg0),%fr4
+ fldds,mb -8(%arg0),%fr3
+ fldds,mb -8(%arg0),%fr2
+ fldds,mb -8(%arg0),%fr1
+ bv 0(%r2)
+ fldds,mb -8(%arg0),%fr0
+ .EXIT
+ .PROCEND
+
+#
+# These 2 small routines are unused right now.
+# Normally we just go thru _CPU_Save_float_context (and Restore)
+#
+# Here we just deref the ptr and jump up, letting _CPU_Save_float_context
+# do the return for us.
+#
+ .EXPORT _CPU_Context_save_fp,ENTRY,PRIV_LEV=0
+_CPU_Context_save_fp:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+ bl _CPU_Save_float_context, %r0
+ ldw 0(%arg0), %arg0
+ .EXIT
+ .PROCEND
+
+ .EXPORT _CPU_Context_restore_fp,ENTRY,PRIV_LEV=0
+_CPU_Context_restore_fp:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+ bl _CPU_Restore_float_context, %r0
+ ldw 0(%arg0), %arg0
+ .EXIT
+ .PROCEND
+
+
+# void _CPU_Context_switch( run_context, heir_context )
+#
+# This routine performs a normal non-FP context switch.
+#
+
+ .align 32
+ .EXPORT _CPU_Context_switch,ENTRY,PRIV_LEV=0,ARGW0=GR,ARGW1=GR
+_CPU_Context_switch:
+ .PROC
+ .CALLINFO FRAME=64
+ .ENTRY
+
+# Save the integer context
+ stw %r1,R1_OFFSET(arg0)
+ stw %r2,R2_OFFSET(arg0)
+ stw %r3,R3_OFFSET(arg0)
+ stw %r4,R4_OFFSET(arg0)
+ stw %r5,R5_OFFSET(arg0)
+ stw %r6,R6_OFFSET(arg0)
+ stw %r7,R7_OFFSET(arg0)
+ stw %r8,R8_OFFSET(arg0)
+ stw %r9,R9_OFFSET(arg0)
+ stw %r10,R10_OFFSET(arg0)
+ stw %r11,R11_OFFSET(arg0)
+ stw %r12,R12_OFFSET(arg0)
+ stw %r13,R13_OFFSET(arg0)
+ stw %r14,R14_OFFSET(arg0)
+ stw %r15,R15_OFFSET(arg0)
+ stw %r16,R16_OFFSET(arg0)
+ stw %r17,R17_OFFSET(arg0)
+ stw %r18,R18_OFFSET(arg0)
+ stw %r19,R19_OFFSET(arg0)
+ stw %r20,R20_OFFSET(arg0)
+ stw %r21,R21_OFFSET(arg0)
+ stw %r22,R22_OFFSET(arg0)
+ stw %r23,R23_OFFSET(arg0)
+ stw %r24,R24_OFFSET(arg0)
+ stw %r25,R25_OFFSET(arg0)
+ stw %r26,R26_OFFSET(arg0)
+ stw %r27,R27_OFFSET(arg0)
+ stw %r28,R28_OFFSET(arg0)
+ stw %r29,R29_OFFSET(arg0)
+ stw %r30,R30_OFFSET(arg0)
+ stw %r31,R31_OFFSET(arg0)
+
+# fill in interrupt context section
+ stw %r2, PCOQFRONT_OFFSET(%arg0)
+ ldo 4(%r2), %r2
+ stw %r2, PCOQBACK_OFFSET(%arg0)
+
+# Generate a suitable IPSW by using the system default psw
+# with the current low bits added in.
+
+ ldil L%CPU_PSW_DEFAULT, %r2
+ ldo R%CPU_PSW_DEFAULT(%r2), %r2
+ ssm 0, %arg2
+ dep %arg2, 31, 8, %r2
+ stw %r2, IPSW_OFFSET(%arg0)
+
+# at this point, the running task context is completely saved
+# Now jump to the bottom of the interrupt handler to load the
+# heirs context
+
+ b _CPU_Context_restore
+ copy %arg1, %arg0
+
+ .EXIT
+ .PROCEND
+
+
+/*
+ * Find first bit
+ * NOTE:
+ * This is used (and written) only for the ready chain code and
+ * priority bit maps.
+ * Any other use constitutes fraud.
+ * Returns first bit from the least significant side.
+ * Eg: if input is 0x8001
+ * output will indicate the '1' bit and return 0.
+ * This is counter to HPPA bit numbering which calls this
+ * bit 31. This way simplifies the macros _CPU_Priority_Mask
+ * and _CPU_Priority_Bits_index.
+ *
+ * NOTE:
+ * We just use 16 bit version
+ * does not handle zero case
+ *
+ * Based on the UTAH Mach libc version of ffs.
+ */
+
+ .align 32
+ .EXPORT hppa_rtems_ffs,ENTRY,PRIV_LEV=0,ARGW0=GR
+hppa_rtems_ffs:
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+
+#ifdef RETURN_ERROR_ON_ZERO
+ comb,= %arg0,%r0,ffsdone ; If arg0 is 0
+ ldi -1,%ret0 ; return -1
+#endif
+
+#if BITFIELD_SIZE == 32
+ ldi 31,%ret0 ; Set return to high bit
+ extru,= %arg0,31,16,%r0 ; If low 16 bits are non-zero
+ addi,tr -16,%ret0,%ret0 ; subtract 16 from bitpos
+ shd %r0,%arg0,16,%arg0 ; else shift right 16 bits
+#else
+ ldi 15,%ret0 ; Set return to high bit
+#endif
+ extru,= %arg0,31,8,%r0 ; If low 8 bits are non-zero
+ addi,tr -8,%ret0,%ret0 ; subtract 8 from bitpos
+ shd %r0,%arg0,8,%arg0 ; else shift right 8 bits
+ extru,= %arg0,31,4,%r0 ; If low 4 bits are non-zero
+ addi,tr -4,%ret0,%ret0 ; subtract 4 from bitpos
+ shd %r0,%arg0,4,%arg0 ; else shift right 4 bits
+ extru,= %arg0,31,2,%r0 ; If low 2 bits are non-zero
+ addi,tr -2,%ret0,%ret0 ; subtract 2 from bitpos
+ shd %r0,%arg0,2,%arg0 ; else shift right 2 bits
+ extru,= %arg0,31,1,%r0 ; If low bit is non-zero
+ addi -1,%ret0,%ret0 ; subtract 1 from bitpos
+ffsdone:
+ bv,n 0(%r2)
+ nop
+ .EXIT
+ .PROCEND
diff --git a/c/src/exec/score/cpu/hppa1.1/hppa.h b/c/src/exec/score/cpu/hppa1.1/hppa.h
new file mode 100644
index 0000000000..4ca7fd0a14
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/hppa.h
@@ -0,0 +1,719 @@
+/*
+ * Description:
+ *
+ * Definitions for HP PA Risc
+ * ref: PA RISC 1.1 Architecture and Instruction Set Reference Manual
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ *
+ * Note:
+ * This file is included by both C and assembler code ( -DASM )
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_HPPA_H
+#define _INCLUDE_HPPA_H
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef hppa1_1
+#undef hppa1_1
+#endif
+#define hppa1_1
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This section contains the information required to build
+ * RTEMS for a particular member of the Hewlett Packard
+ * PA-RISC family. It does this by setting variables to
+ * indicate which implementation dependent features are
+ * present in a particular member of the family.
+ */
+
+#if !defined(CPU_MODEL_NAME)
+
+#if defined(hppa7100)
+
+#define CPU_MODEL_NAME "hppa 7100"
+
+#elif defined(hppa7200)
+
+#define CPU_MODEL_NAME "hppa 7200"
+
+#else
+
+#define CPU_MODEL_NAME Unsupported CPU Model /* cause an error on usage */
+
+#endif
+
+#endif /* !defined(CPU_MODEL_NAME) */
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#if !defined(CPU_NAME)
+#define CPU_NAME "HP PA-RISC 1.1"
+#endif
+
+/*
+ * Processor Status Word (PSW) Masks
+ */
+
+#define HPPA_PSW_Y 0x80000000 /* Data Debug Trap Disable */
+#define HPPA_PSW_Z 0x40000000 /* Instruction Debug Trap Disable */
+#define HPPA_PSW_r2 0x20000000 /* reserved */
+#define HPPA_PSW_r3 0x10000000 /* reserved */
+#define HPPA_PSW_r4 0x08000000 /* reserved */
+#define HPPA_PSW_E 0x04000000 /* Little Endian on Memory References */
+#define HPPA_PSW_S 0x02000000 /* Secure Interval Timer */
+#define HPPA_PSW_T 0x01000000 /* Taken Branch Trap Enable */
+#define HPPA_PSW_H 0x00800000 /* Higher-Privilege Transfer Trap Enable*/
+#define HPPA_PSW_L 0x00400000 /* Lower-Privilege Transfer Trap Enable */
+#define HPPA_PSW_N 0x00200000 /* PC Queue Front Instruction Nullified */
+#define HPPA_PSW_X 0x00100000 /* Data Memory Break Disable */
+#define HPPA_PSW_B 0x00080000 /* Taken Branch in Previous Cycle */
+#define HPPA_PSW_C 0x00040000 /* Code Address Translation Enable */
+#define HPPA_PSW_V 0x00020000 /* Divide Step Correction */
+#define HPPA_PSW_M 0x00010000 /* High-Priority Machine Check Disable */
+#define HPPA_PSW_CB 0x0000ff00 /* Carry/Borrow Bits */
+#define HPPA_PSW_r24 0x00000080 /* reserved */
+#define HPPA_PSW_G 0x00000040 /* Debug trap Enable */
+#define HPPA_PSW_F 0x00000020 /* Performance monitor interrupt unmask */
+#define HPPA_PSW_R 0x00000010 /* Recovery Counter Enable */
+#define HPPA_PSW_Q 0x00000008 /* Interruption State Collection Enable */
+#define HPPA_PSW_P 0x00000004 /* Protection ID Validation Enable */
+#define HPPA_PSW_D 0x00000002 /* Data Address Translation Enable */
+#define HPPA_PSW_I 0x00000001 /* External, Power Failure, */
+ /* Low-Priority Machine Check */
+ /* Interruption Enable */
+
+/*
+ * HPPA traps and interrupts
+ * basic layout. Note numbers do not denote priority
+ *
+ * 0-31 basic traps and interrupts defined by HPPA architecture
+ * 32-63 32 external interrupts
+ * 64-... bsp defined
+ */
+
+#define HPPA_INTERRUPT_NON_EXISTENT 0
+/* group 1 */
+#define HPPA_INTERRUPT_HIGH_PRIORITY_MACHINE_CHECK 1
+/* group 2 */
+#define HPPA_INTERRUPT_POWER_FAIL 2
+#define HPPA_INTERRUPT_RECOVERY_COUNTER 3
+#define HPPA_INTERRUPT_EXTERNAL_INTERRUPT 4
+#define HPPA_INTERRUPT_LOW_PRIORITY_MACHINE_CHECK 5
+#define HPPA_INTERRUPT_PERFORMANCE_MONITOR 29
+/* group 3 */
+#define HPPA_INTERRUPT_INSTRUCTION_TLB_MISS 6
+#define HPPA_INTERRUPT_INSTRUCTION_MEMORY_PROTECTION 7
+#define HPPA_INTERRUPT_INSTRUCTION_DEBUG 30
+#define HPPA_INTERRUPT_ILLEGAL_INSTRUCTION 8
+#define HPPA_INTERRUPT_BREAK_INSTRUCTION 9
+#define HPPA_INTERRUPT_PRIVILEGED_OPERATION 10
+#define HPPA_INTERRUPT_PRIVILEGED_REGISTER 11
+#define HPPA_INTERRUPT_OVERFLOW 12
+#define HPPA_INTERRUPT_CONDITIONAL 13
+#define HPPA_INTERRUPT_ASSIST_EXCEPTION 14
+#define HPPA_INTERRUPT_DATA_TLB_MISS 15
+#define HPPA_INTERRUPT_NON_ACCESS_INSTRUCTION_TLB_MISS 16
+#define HPPA_INTERRUPT_NON_ACCESS_DATA_TLB_MISS 17
+#define HPPA_INTERRUPT_DATA_MEMORY_ACCESS_RIGHTS 26
+#define HPPA_INTERRUPT_DATA_MEMORY_PROTECTION_ID 27
+#define HPPA_INTERRUPT_UNALIGNED_DATA_REFERENCE 28
+#define HPPA_INTERRUPT_DATA_MEMORY_PROTECTION 18
+#define HPPA_INTERRUPT_DATA_MEMORY_BREAK 19
+#define HPPA_INTERRUPT_TLB_DIRTY_BIT 20
+#define HPPA_INTERRUPT_PAGE_REFERENCE 21
+#define HPPA_INTERRUPT_DATA_DEBUG 31
+#define HPPA_INTERRUPT_ASSIST_EMULATION 22
+/* group 4 */
+#define HPPA_INTERRUPT_HIGHER_PRIVILEGE_TRANSFER 23
+#define HPPA_INTERRUPT_LOWER_PRIVILEGE_TRANSFER 24
+#define HPPA_INTERRUPT_TAKEN_BRANCH 25
+
+#define HPPA_INTERRUPT_ON_CHIP_MAX 31
+
+/* External Interrupts via interrupt 4 */
+
+#define HPPA_INTERRUPT_EXTERNAL_BASE 32
+
+#define HPPA_INTERRUPT_EXTERNAL_0 32
+#define HPPA_INTERRUPT_EXTERNAL_1 33
+#define HPPA_INTERRUPT_EXTERNAL_2 34
+#define HPPA_INTERRUPT_EXTERNAL_3 35
+#define HPPA_INTERRUPT_EXTERNAL_4 36
+#define HPPA_INTERRUPT_EXTERNAL_5 37
+#define HPPA_INTERRUPT_EXTERNAL_6 38
+#define HPPA_INTERRUPT_EXTERNAL_7 39
+#define HPPA_INTERRUPT_EXTERNAL_8 40
+#define HPPA_INTERRUPT_EXTERNAL_9 41
+#define HPPA_INTERRUPT_EXTERNAL_10 42
+#define HPPA_INTERRUPT_EXTERNAL_11 43
+#define HPPA_INTERRUPT_EXTERNAL_12 44
+#define HPPA_INTERRUPT_EXTERNAL_13 45
+#define HPPA_INTERRUPT_EXTERNAL_14 46
+#define HPPA_INTERRUPT_EXTERNAL_15 47
+#define HPPA_INTERRUPT_EXTERNAL_16 48
+#define HPPA_INTERRUPT_EXTERNAL_17 49
+#define HPPA_INTERRUPT_EXTERNAL_18 50
+#define HPPA_INTERRUPT_EXTERNAL_19 51
+#define HPPA_INTERRUPT_EXTERNAL_20 52
+#define HPPA_INTERRUPT_EXTERNAL_21 53
+#define HPPA_INTERRUPT_EXTERNAL_22 54
+#define HPPA_INTERRUPT_EXTERNAL_23 55
+#define HPPA_INTERRUPT_EXTERNAL_24 56
+#define HPPA_INTERRUPT_EXTERNAL_25 57
+#define HPPA_INTERRUPT_EXTERNAL_26 58
+#define HPPA_INTERRUPT_EXTERNAL_27 59
+#define HPPA_INTERRUPT_EXTERNAL_28 60
+#define HPPA_INTERRUPT_EXTERNAL_29 61
+#define HPPA_INTERRUPT_EXTERNAL_30 62
+#define HPPA_INTERRUPT_EXTERNAL_31 63
+
+#define HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER HPPA_INTERRUPT_EXTERNAL_0
+#define HPPA_EXTERNAL_INTERRUPTS 32
+#define HPPA_INTERNAL_INTERRUPTS 32
+
+/* BSP defined interrupts begin here */
+
+#define HPPA_INTERRUPT_MAX 64
+
+/*
+ * Cache characteristics
+ */
+
+#define HPPA_CACHELINE_SIZE 32
+#define HPPA_CACHELINE_MASK (HPPA_CACHELINE_SIZE - 1)
+
+
+/*
+ * TLB characteristics
+ *
+ * Flags and Access Control layout for using TLB protection insertion
+ *
+ * 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |?|?|T|D|B|type |PL1|Pl2|U| access id |?|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ */
+
+/*
+ * Access rights (type + PL1 + PL2)
+ */
+#define HPPA_PROT_R 0x00c00000 /* Read Only, no Write, no Execute */
+#define HPPA_PROT_RW 0x01c00000 /* Read & Write Only, no Execute */
+#define HPPA_PROT_RX 0x02c00000 /* Read & Execute Only, no Write */
+#define HPPA_PROT_RWX 0x03c00000 /* Read, Write, Execute */
+#define HPPA_PROT_X0 0x04c00000 /* Execute Only, Promote to Level 0 */
+#define HPPA_PROT_X1 0x05c00000 /* Execute Only, Promote to Level 1 */
+#define HPPA_PROT_X2 0x06c00000 /* Execute Only, Promote to Level 2 */
+#define HPPA_PROT_X3 0x07c00000 /* Execute Only, Promote to Level 3 */
+
+
+/*
+ * Inline macros for misc. interesting opcodes
+ */
+
+/* generate a global label */
+#define HPPA_ASM_LABEL(label) \
+ asm(".export " label ", ! .label " label);
+
+/* Return From Interrupt RFI */
+#define HPPA_ASM_RFI() asm volatile ("rfi")
+
+/* Set System Mask SSM i,t */
+#define HPPA_ASM_SSM(i,gr) asm volatile ("ssm %1, %0" \
+ : "=r" (gr) \
+ : "i" (i))
+/* Reset System Mask RSM i,t */
+#define HPPA_ASM_RSM(i,gr) asm volatile ("rsm %1, %0" \
+ : "=r" (gr) \
+ : "i" (i))
+/* Move To System Mask MTSM r */
+#define HPPA_ASM_MTSM(gr) asm volatile ("mtsm %0" \
+ : : "r" (gr))
+
+/* Load Space Identifier LDSID (s,b),t */
+#define HPPA_ASM_LDSID(sr,grb,grt) asm volatile ("ldsid (%1,%2),%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (grb))
+
+/*
+ * Gcc extended asm doesn't really allow for treatment of space registers
+ * as "registers", so we have to use "i" format.
+ * Unfortunately this means that the "=" constraint is not available.
+ */
+
+/* Move To Space Register MTSP r,sr */
+#define HPPA_ASM_MTSP(gr,sr) asm volatile ("mtsp %1,%0" \
+ : : "i" (sr), \
+ "r" (gr))
+
+/* Move From Space Register MFSP sr,t */
+#define HPPA_ASM_MFSP(sr,gr) asm volatile ("mfsp %1,%0" \
+ : "=r" (gr) \
+ : "i" (sr))
+
+/* Move To Control register MTCTL r,t */
+#define HPPA_ASM_MTCTL(gr,cr) asm volatile ("mtctl %1,%0" \
+ : : "i" (cr), \
+ "r" (gr))
+
+/* Move From Control register MFCTL r,t */
+#define HPPA_ASM_MFCTL(cr,gr) asm volatile ("mfctl %1,%0" \
+ : "=r" (gr) \
+ : "i" (cr))
+
+/* Synchronize caches SYNC */
+#define HPPA_ASM_SYNC() asm volatile ("sync")
+
+/* Probe Read Access PROBER (s,b),r,t */
+#define HPPA_ASM_PROBER(sr,groff,gracc,grt) \
+ asm volatile ("prober (%1,%2),%3,%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (groff), \
+ "r" (gracc))
+
+/* Probe Read Access Immediate PROBERI (s,b),i,t*/
+#define HPPA_ASM_PROBERI(sr,groff,iacc,grt) \
+ asm volatile ("proberi (%1,%2),%3,%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (groff), \
+ "i" (iacc))
+
+/* Probe Write Access PROBEW (s,b),r,t */
+#define HPPA_ASM_PROBEW(sr,groff,gracc,grt) \
+ asm volatile ("probew (%1,%2),%3,%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (groff), \
+ "r" (gracc))
+
+/* Probe Write Access Immediate PROBEWI (s,b),i,t */
+#define HPPA_ASM_PROBEWI(sr,groff,iacc,grt) \
+ asm volatile ("probewi (%1,%2),%3,%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (groff), \
+ "i" (iacc))
+
+/* Load Physical Address LPA x(s,b),t */
+#define HPPA_ASM_LPA(sr,grb,grt) asm volatile ("lpa %%r0(%1,%2),%0" \
+ : "=r" (grt) \
+ : "i" (sr), \
+ "r" (grb))
+
+/* Load Coherence Index LCI x(s,b),t */
+/* AKA: Load Hash Address LHA x(s,b),t */
+#define HPPA_ASM_LCI(grx,sr,grb,grt) asm volatile ("lha %1(%2,%3),%0" \
+ : "=r" (grt) \
+ : "r" (grx),\
+ "i" (sr), \
+ "r" (grb))
+#define HPPA_ASM_LHA(grx,sr,grb,grt) HPPA_ASM_LCI(grx,sr,grb,grt)
+
+/* Purge Data Tlb PDTLB x(s,b) */
+#define HPPA_ASM_PDTLB(grx,sr,grb) asm volatile ("pdtlb %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Purge Instruction Tlb PITLB x(s,b) */
+#define HPPA_ASM_PITLB(grx,sr,grb) asm volatile ("pitlb %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Purge Data Tlb Entry PDTLBE x(s,b) */
+#define HPPA_ASM_PDTLBE(grx,sr,grb) asm volatile ("pdtlbe %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Purge Instruction Tlb Entry PITLBE x(s,b) */
+#define HPPA_ASM_PITLBE(grx,sr,grb) asm volatile ("pitlbe %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+
+/* Insert Data TLB Address IDTLBA r,(s,b) */
+#define HPPA_ASM_IDTLBA(gr,sr,grb) asm volatile ("idtlba %0,(%1,%2)" \
+ : : "r" (gr), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Insert Instruction TLB Address IITLBA r,(s,b) */
+#define HPPA_ASM_IITLBA(gr,sr,grb) asm volatile ("iitlba %0,(%1,%2)" \
+ : : "r" (gr), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Insert Data TLB Protection IDTLBP r,(s,b) */
+#define HPPA_ASM_IDTLBP(gr,sr,grb) asm volatile ("idtlbp %0,(%1,%2)" \
+ : : "r" (gr), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Insert Instruction TLB Protection IITLBP r,(s,b) */
+#define HPPA_ASM_IITLBP(gr,sr,grb) asm volatile ("iitlbp %0,(%1,%2)" \
+ : : "r" (gr), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Purge Data Cache PDC x(s,b) */
+#define HPPA_ASM_PDC(grx,sr,grb) asm volatile ("pdc %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Flush Data Cache FDC x(s,b) */
+#define HPPA_ASM_FDC(grx,sr,grb) asm volatile ("fdc %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Flush Instruction Cache FDC x(s,b) */
+#define HPPA_ASM_FIC(grx,sr,grb) asm volatile ("fic %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Flush Data Cache Entry FDCE x(s,b) */
+#define HPPA_ASM_FDCE(grx,sr,grb) asm volatile ("fdce %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Flush Instruction Cache Entry FICE x(s,b) */
+#define HPPA_ASM_FICE(grx,sr,grb) asm volatile ("fice %0(%1,%2)" \
+ : : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Break BREAK i5,i13 */
+#define HPPA_ASM_BREAK(i5,i13) asm volatile ("break %0,%1" \
+ : : "i" (i5), \
+ "i" (i13))
+
+/* Load and Clear Word Short LDCWS d(s,b),t */
+#define HPPA_ASM_LDCWS(i,sr,grb,grt) asm volatile ("ldcws %1(%2,%3),%0" \
+ : "=r" (grt) \
+ : "i" (i), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Load and Clear Word Indexed LDCWX x(s,b),t */
+#define HPPA_ASM_LDCWX(grx,sr,grb,grt) asm volatile ("ldcwx %1(%2,%3),%0" \
+ : "=r" (grt) \
+ : "r" (grx), \
+ "i" (sr), \
+ "r" (grb))
+
+/* Load Word Absolute Short LDWAS d(b),t */
+/* NOTE: "short" here means "short displacement" */
+#define HPPA_ASM_LDWAS(disp,grbase,gr) asm volatile("ldwas %1(%2),%0" \
+ : "=r" (gr) \
+ : "i" (disp), \
+ "r" (grbase))
+
+/* Store Word Absolute Short STWAS r,d(b) */
+/* NOTE: "short" here means "short displacement" */
+#define HPPA_ASM_STWAS(gr,disp,grbase) asm volatile("stwas %0,%1(%2)" \
+ : : "r" (gr), \
+ "i" (disp), \
+ "r" (grbase))
+
+/*
+ * Swap bytes
+ * REFERENCE: PA72000 TRM -- Appendix C
+ */
+#define HPPA_ASM_SWAPBYTES(value, swapped) asm volatile( \
+ " shd %1,%1,16,%0 \n\
+ dep %0,15,8,%0 \n\
+ shd %1,%0,8,%0" \
+ : "=r" (swapped) \
+ : "r" (value) \
+ )
+
+
+/* 72000 Diagnose instructions follow
+ * These macros assume gas knows about these instructions.
+ * gas2.2.u1 did not.
+ * I added them to my copy and installed it locally.
+ *
+ * There are *very* special requirements for these guys
+ * ref: TRM 6.1.3 Programming Constraints
+ *
+ * The macros below handle the following rules
+ *
+ * Except for WIT, WDT, WDD, WIDO, WIDE, all DIAGNOSE must be doubled.
+ * Must never be nullified (hence the leading nop)
+ * NOP must preced every RDD,RDT,WDD,WDT,RDTLB
+ * Instruction preceeding GR_SHDW must not set any of the GR's saved
+ *
+ * The macros do *NOT* deal with the following problems
+ * doubled DIAGNOSE instructions must not straddle a page boundary
+ * if code translation enabled. (since 2nd could trap on ITLB)
+ * If you care about DHIT and DPE bits of DR0, then
+ * No store instruction in the 2 insn window before RDD
+ */
+
+
+/* Move To CPU/DIAG register MTCPU r,t */
+#define HPPA_ASM_MTCPU(gr,dr) asm volatile (" nop \n" \
+ " mtcpu %1,%0 \n" \
+ " mtcpu %1,%0" \
+ : : "i" (dr), \
+ "r" (gr))
+
+/* Move From CPU/DIAG register MFCPU r,t */
+#define HPPA_ASM_MFCPU(dr,gr) asm volatile (" nop \n" \
+ " mfcpu %1,%0\n" \
+ " mfcpu %1,%0" \
+ : "=r" (gr) \
+ : "i" (dr))
+
+/* Transfer of Control Enable TOC_EN */
+#define HPPA_ASM_TOC_EN() asm volatile (" tocen \n" \
+ " tocen")
+
+/* Transfer of Control Disable TOC_DIS */
+#define HPPA_ASM_TOC_DIS() asm volatile (" tocdis \n" \
+ " tocdis")
+
+/* Shadow Registers to General Register SHDW_GR */
+#define HPPA_ASM_SHDW_GR() asm volatile (" shdwgr \n" \
+ " shdwgr" \
+ ::: "r1" "r8" "r9" "r16" \
+ "r17" "r24" "r25")
+
+/* General Registers to Shadow Register GR_SHDW */
+#define HPPA_ASM_GR_SHDW() asm volatile (" nop \n" \
+ " grshdw \n" \
+ " grshdw")
+
+/*
+ * Definitions of special registers for use by the above macros.
+ */
+
+/* Hardware Space Registers */
+#define HPPA_SR0 0
+#define HPPA_SR1 1
+#define HPPA_SR2 2
+#define HPPA_SR3 3
+#define HPPA_SR4 4
+#define HPPA_SR5 5
+#define HPPA_SR6 6
+#define HPPA_SR7 7
+
+/* Hardware Control Registers */
+#define HPPA_CR0 0
+#define HPPA_RCTR 0 /* Recovery Counter Register */
+
+#define HPPA_CR8 8 /* Protection ID 1 */
+#define HPPA_PIDR1 8
+
+#define HPPA_CR9 9 /* Protection ID 2 */
+#define HPPA_PIDR2 9
+
+#define HPPA_CR10 10
+#define HPPA_CCR 10 /* Coprocessor Confiquration Register */
+
+#define HPPA_CR11 11
+#define HPPA_SAR 11 /* Shift Amount Register */
+
+#define HPPA_CR12 12
+#define HPPA_PIDR3 12 /* Protection ID 3 */
+
+#define HPPA_CR13 13
+#define HPPA_PIDR4 13 /* Protection ID 4 */
+
+#define HPPA_CR14 14
+#define HPPA_IVA 14 /* Interrupt Vector Address */
+
+#define HPPA_CR15 15
+#define HPPA_EIEM 15 /* External Interrupt Enable Mask */
+
+#define HPPA_CR16 16
+#define HPPA_ITMR 16 /* Interval Timer */
+
+#define HPPA_CR17 17
+#define HPPA_PCSQ 17 /* Program Counter Space queue */
+
+#define HPPA_CR18 18
+#define HPPA_PCOQ 18 /* Program Counter Offset queue */
+
+#define HPPA_CR19 19
+#define HPPA_IIR 19 /* Interruption Instruction Register */
+
+#define HPPA_CR20 20
+#define HPPA_ISR 20 /* Interruption Space Register */
+
+#define HPPA_CR21 21
+#define HPPA_IOR 21 /* Interruption Offset Register */
+
+#define HPPA_CR22 22
+#define HPPA_IPSW 22 /* Interrpution Processor Status Word */
+
+#define HPPA_CR23 23
+#define HPPA_EIRR 23 /* External Interrupt Request */
+
+#define HPPA_CR24 24
+#define HPPA_PPDA 24 /* Physcial Page Directory Address */
+#define HPPA_TR0 24 /* Temporary register 0 */
+
+#define HPPA_CR25 25
+#define HPPA_HTA 25 /* Hash Table Address */
+#define HPPA_TR1 25 /* Temporary register 1 */
+
+#define HPPA_CR26 26
+#define HPPA_TR2 26 /* Temporary register 2 */
+
+#define HPPA_CR27 27
+#define HPPA_TR3 27 /* Temporary register 3 */
+
+#define HPPA_CR28 28
+#define HPPA_TR4 28 /* Temporary register 4 */
+
+#define HPPA_CR29 29
+#define HPPA_TR5 29 /* Temporary register 5 */
+
+#define HPPA_CR30 30
+#define HPPA_TR6 30 /* Temporary register 6 */
+
+#define HPPA_CR31 31
+#define HPPA_CPUID 31 /* MP identifier */
+
+/*
+ * Diagnose registers
+ */
+
+#define HPPA_DR0 0
+#define HPPA_DR1 1
+#define HPPA_DR8 8
+#define HPPA_DR24 24
+#define HPPA_DR25 25
+
+/*
+ * Tear apart a break instruction to find its type.
+ */
+#define HPPA_BREAK5(x) ((x) & 0x1F)
+#define HPPA_BREAK13(x) (((x) >> 13) & 0x1FFF)
+
+/* assemble a break instruction */
+#define HPPA_BREAK(i5,i13) (((i5) & 0x1F) | (((i13) & 0x1FFF) << 13))
+
+
+/*
+ * this won't work in ASM or non-GNU compilers
+ */
+
+#if !defined(ASM) && defined(__GNUC__)
+
+/*
+ * static inline utility functions to get at control registers
+ */
+
+#define EMIT_GET_CONTROL(name, reg) \
+static __inline__ unsigned int \
+get_ ## name (void) \
+{ \
+ unsigned int value; \
+ HPPA_ASM_MFCTL(reg, value); \
+ return value; \
+}
+
+#define EMIT_SET_CONTROL(name, reg) \
+static __inline__ void \
+set_ ## name (unsigned int new_value) \
+{ \
+ HPPA_ASM_MTCTL(new_value, reg); \
+}
+
+#define EMIT_CONTROLS(name, reg) \
+ EMIT_GET_CONTROL(name, reg) \
+ EMIT_SET_CONTROL(name, reg)
+
+EMIT_CONTROLS(recovery, HPPA_RCTR); /* CR0 */
+EMIT_CONTROLS(pid1, HPPA_PIDR1); /* CR8 */
+EMIT_CONTROLS(pid2, HPPA_PIDR2); /* CR9 */
+EMIT_CONTROLS(ccr, HPPA_CCR); /* CR10; CCR and SCR share CR10 */
+EMIT_CONTROLS(scr, HPPA_CCR); /* CR10; CCR and SCR share CR10 */
+EMIT_CONTROLS(sar, HPPA_SAR); /* CR11 */
+EMIT_CONTROLS(pid3, HPPA_PIDR3); /* CR12 */
+EMIT_CONTROLS(pid4, HPPA_PIDR4); /* CR13 */
+EMIT_CONTROLS(iva, HPPA_IVA); /* CR14 */
+EMIT_CONTROLS(eiem, HPPA_EIEM); /* CR15 */
+EMIT_CONTROLS(itimer, HPPA_ITMR); /* CR16 */
+EMIT_CONTROLS(pcsq, HPPA_PCSQ); /* CR17 */
+EMIT_CONTROLS(pcoq, HPPA_PCOQ); /* CR18 */
+EMIT_CONTROLS(iir, HPPA_IIR); /* CR19 */
+EMIT_CONTROLS(isr, HPPA_ISR); /* CR20 */
+EMIT_CONTROLS(ior, HPPA_IOR); /* CR21 */
+EMIT_CONTROLS(ipsw, HPPA_IPSW); /* CR22 */
+EMIT_CONTROLS(eirr, HPPA_EIRR); /* CR23 */
+EMIT_CONTROLS(tr0, HPPA_TR0); /* CR24 */
+EMIT_CONTROLS(tr1, HPPA_TR1); /* CR25 */
+EMIT_CONTROLS(tr2, HPPA_TR2); /* CR26 */
+EMIT_CONTROLS(tr3, HPPA_TR3); /* CR27 */
+EMIT_CONTROLS(tr4, HPPA_TR4); /* CR28 */
+EMIT_CONTROLS(tr5, HPPA_TR5); /* CR29 */
+EMIT_CONTROLS(tr6, HPPA_TR6); /* CR30 */
+EMIT_CONTROLS(tr7, HPPA_CR31); /* CR31 */
+
+#endif /* ASM and GNU */
+
+/*
+ * If and How to invoke the debugger (a ROM debugger generally)
+ */
+#define CPU_INVOKE_DEBUGGER \
+ do { \
+ HPPA_ASM_BREAK(1,1); \
+ } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_HPPA_H */
+
diff --git a/c/src/exec/score/cpu/hppa1.1/hppatypes.h b/c/src/exec/score/cpu/hppa1.1/hppatypes.h
new file mode 100644
index 0000000000..512323819b
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/hppatypes.h
@@ -0,0 +1,46 @@
+/* hppatypes.h
+ *
+ * This include file contains type definitions pertaining to the Hewlett
+ * Packard PA-RISC processor family.
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_HPPATYPES_H
+#define _INCLUDE_HPPATYPES_H
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* 8-bit unsigned integer */
+typedef unsigned short unsigned16; /* 16-bit unsigned integer */
+typedef unsigned int unsigned32; /* 32-bit unsigned integer */
+typedef unsigned long long unsigned64; /* 64-bit unsigned integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif /* _INCLUDE_HPPATYPES_H */
+/* end of include file */
diff --git a/c/src/exec/score/cpu/hppa1.1/rtems.s b/c/src/exec/score/cpu/hppa1.1/rtems.s
new file mode 100644
index 0000000000..06de39dddf
--- /dev/null
+++ b/c/src/exec/score/cpu/hppa1.1/rtems.s
@@ -0,0 +1,53 @@
+/* rtems.S
+ *
+ * This file contains the single entry point code for
+ * the HPPA implementation of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/score/hppa.h>
+#include <rtems/score/cpu_asm.h>
+
+ .SPACE $PRIVATE$
+ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
+ .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
+ .SPACE $TEXT$
+ .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
+ .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+ .SPACE $TEXT$
+ .SUBSPA $CODE$
+
+ .align 32
+ .EXPORT cpu_jump_to_directive,ENTRY,PRIV_LEV=0
+cpu_jump_to_directive
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+
+# invoke user interrupt handler
+
+# XXX: look at register usage and code
+# XXX: this is not necessarily right!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# r9 = directive number
+
+ .import _Entry_points,data
+ ldil L%_Entry_points,%r8
+ ldo R%_Entry_points(%r8),%r8
+ ldwx,s %r9(%r8),%r8
+
+ .call ARGW0=GR
+ bv,n 0(%r8)
+ nop
+
+ .EXIT
+ .PROCEND
+
diff --git a/c/src/exec/score/cpu/i386/asm.h b/c/src/exec/score/cpu/i386/asm.h
new file mode 100644
index 0000000000..e317161043
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/asm.h
@@ -0,0 +1,140 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __i386_ASM_h
+#define __i386_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/i386.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/*
+ * Go32 suffers the same bug as __REGISTER_PREFIX__
+ */
+
+#if __GO32__
+#undef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+/*
+ * Looks like there is a bug in gcc 2.6.2 where this is not
+ * defined correctly when configured as i386-coff and
+ * i386-aout.
+ */
+
+#undef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__ %
+
+/*
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+*/
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define eax REG (eax)
+#define ebx REG (ebx)
+#define ecx REG (ecx)
+#define edx REG (edx)
+#define esi REG (esi)
+#define edi REG (edi)
+#define esp REG (esp)
+#define ebp REG (ebp)
+
+#define ax REG (ax)
+#define bx REG (bx)
+#define cx REG (cx)
+#define dx REG (dx)
+#define si REG (si)
+#define di REG (di)
+#define sp REG (sp)
+#define bp REG (bp)
+
+#define ah REG (ah)
+#define al REG (al)
+
+#define cs REG (cs)
+#define ds REG (ds)
+#define es REG (es)
+#define fs REG (fs)
+#define gs REG (gs)
+#define ss REG (ss)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/c/src/exec/score/cpu/i386/cpu.c b/c/src/exec/score/cpu/i386/cpu.c
new file mode 100644
index 0000000000..ad9c56e20a
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/cpu.c
@@ -0,0 +1,177 @@
+/*
+ * Intel i386 Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ register unsigned16 fp_status asm ("ax");
+ register void *fp_context;
+
+ _CPU_Table = *cpu_table;
+
+ /*
+ * The following code saves a NULL i387 context which is given
+ * to each task at start and restart time. The following code
+ * is based upon that provided in the i386 Programmer's
+ * Manual and should work on any coprocessor greater than
+ * the i80287.
+ *
+ * NOTE: The NO RTEMS_WAIT form of the coprocessor instructions
+ * MUST be used in case there is not a coprocessor
+ * to wait for.
+ */
+
+ fp_status = 0xa5a5;
+ asm volatile( "fninit" );
+ asm volatile( "fnstsw %0" : "=a" (fp_status) : "0" (fp_status) );
+
+ if ( fp_status == 0 ) {
+
+ fp_context = &_CPU_Null_fp_context;
+
+ asm volatile( "fsave (%0)" : "=r" (fp_context)
+ : "0" (fp_context)
+ );
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ i386_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+#if __GO32__
+#include <go32.h>
+#include <dpmi.h>
+#endif /* __GO32__ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+#if __GO32__
+ _go32_dpmi_seginfo handler_info;
+
+ /* get the address of the old handler */
+ _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info);
+
+ /* Notice how we're failing to save the pm_segment portion of the */
+ /* structure here? That means we might crash the system if we */
+ /* try to restore the ISR. Can't fix this until i386_isr is */
+ /* redefined. XXX [BHC]. */
+ *old_handler = (proc_ptr *) handler_info.pm_offset;
+
+ handler_info.pm_offset = (u_long) new_handler;
+ handler_info.pm_selector = _go32_my_cs();
+
+ /* install the IDT entry */
+ _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info );
+#else
+ i386_IDT_slot idt;
+ unsigned32 handler;
+
+ *old_handler = 0; /* XXX not supported */
+
+ handler = (unsigned32) new_handler;
+
+ /* build the IDT entry */
+ idt.offset_0_15 = handler & 0xffff;
+ idt.segment_selector = i386_get_cs();
+ idt.reserved = 0x00;
+ idt.p_dpl = 0x8e; /* present, ISR */
+ idt.offset_16_31 = handler >> 16;
+
+ /* install the IDT entry */
+ i386_Install_idt(
+ (unsigned32) &idt,
+ _CPU_Table.interrupt_table_segment,
+ (unsigned32) _CPU_Table.interrupt_table_offset + (8 * vector)
+ );
+#endif
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _ISR_Handler_0(), _ISR_Handler_1();
+
+#define PER_ISR_ENTRY \
+ (((unsigned32) _ISR_Handler_1 - (unsigned32) _ISR_Handler_0))
+
+#define _Interrupt_Handler_entry( _vector ) \
+ (((unsigned32)_ISR_Handler_0) + ((_vector) * PER_ISR_ENTRY))
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+ unsigned32 unique_handler;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /* calculate the unique entry point for this vector */
+ unique_handler = _Interrupt_Handler_entry( vector );
+
+ _CPU_ISR_install_raw_handler( vector, (void *)unique_handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
diff --git a/c/src/exec/score/cpu/i386/cpu.h b/c/src/exec/score/cpu/i386/cpu.h
new file mode 100644
index 0000000000..85042fce66
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/cpu.h
@@ -0,0 +1,390 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the Intel
+ * i386 processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ASM
+#include <rtems/score/i386types.h>
+#endif
+#include <rtems/score/i386.h>
+
+/* conditional compilation parameters */
+
+#define CPU_INLINE_ENABLE_DISPATCH TRUE
+#define CPU_UNROLL_ENQUEUE_PRIORITY FALSE
+
+/*
+ * i386 has an RTEMS allocated and managed interrupt stack.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * Some family members have no FP, some have an FPU such as the i387
+ * for the i386, others have it built in (i486DX, Pentium).
+ */
+
+#if ( I386_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE /* i387 for i386 */
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+#define CPU_IDLE_TASK_IS_FP FALSE
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#define CPU_STACK_GROWS_UP FALSE
+#define CPU_STRUCTURE_ALIGNMENT
+
+/* structures */
+
+/*
+ * Basic integer context for the i386 family.
+ */
+
+typedef struct {
+ unsigned32 eflags; /* extended flags register */
+ void *esp; /* extended stack pointer register */
+ void *ebp; /* extended base pointer register */
+ unsigned32 ebx; /* extended bx register */
+ unsigned32 esi; /* extended source index register */
+ unsigned32 edi; /* extended destination index flags register */
+} Context_Control;
+
+/*
+ * FP context save area for the i387 numeric coprocessors.
+ */
+
+typedef struct {
+ unsigned8 fp_save_area[108]; /* context size area for I80387 */
+ /* 28 bytes for environment */
+} Context_Control_fp;
+
+/*
+ * The following structure defines the set of information saved
+ * on the current stack by RTEMS upon receipt of each interrupt.
+ */
+
+typedef struct {
+ unsigned32 TBD; /* XXX Fix for this CPU */
+} CPU_Interrupt_frame;
+
+/*
+ * The following table contains the information required to configure
+ * the i386 specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+ unsigned32 interrupt_table_segment;
+ void *interrupt_table_offset;
+} rtems_cpu_table;
+
+/*
+ * context size area for floating point
+ *
+ * NOTE: This is out of place on the i386 to avoid a forward reference.
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/* variables */
+
+EXTERN Context_Control_fp _CPU_Null_fp_context;
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+/* constants */
+
+/*
+ * This defines the number of levels and the mask used to pick those
+ * bits out of a thread mode.
+ */
+
+#define CPU_MODES_INTERRUPT_LEVEL 0x00000001 /* interrupt level in mode */
+#define CPU_MODES_INTERRUPT_MASK 0x00000001 /* interrupt level in mode */
+
+/*
+ * extra stack required by the MPCI receive server thread
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024
+
+/*
+ * i386 family supports 256 distinct vectors.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Minimum size of a thread's stack.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE 1024
+
+/*
+ * i386 is pretty tolerant of alignment. Just put things on 4 byte boundaries.
+ */
+
+#define CPU_ALIGNMENT 4
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * On i386 thread stacks require no further alignment after allocation
+ * from the Workspace.
+ */
+
+#define CPU_STACK_ALIGNMENT 0
+
+/* macros */
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + disable all maskable CPU interrupts
+ * + restore previous interrupt level (enable)
+ * + temporarily restore interrupts (flash)
+ * + set a particular level
+ */
+
+#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )
+
+#define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level )
+
+#define _CPU_ISR_Flash( _level ) i386_flash_interrupts( _level )
+
+#define _CPU_ISR_Set_level( _new_level ) \
+ { \
+ if ( _new_level ) asm volatile ( "cli" ); \
+ else asm volatile ( "sti" ); \
+ }
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/*
+ * Context handler macros
+ *
+ * These macros perform the following functions:
+ * + initialize a context area
+ * + restart the current thread
+ * + calculate the initial pointer into a FP context area
+ * + initialize an FP context area
+ */
+
+#define CPU_EFLAGS_INTERRUPTS_ON 0x00003202
+#define CPU_EFLAGS_INTERRUPTS_OFF 0x00003002
+
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point, _is_fp ) \
+ do { \
+ unsigned32 _stack; \
+ \
+ if ( (_isr) ) (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_OFF; \
+ else (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_ON; \
+ \
+ _stack = ((unsigned32)(_stack_base)) + (_size) - 4; \
+ \
+ *((proc_ptr *)(_stack)) = (_entry_point); \
+ (_the_context)->ebp = (void *) _stack; \
+ (_the_context)->esp = (void *) _stack; \
+ } while (0)
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
+
+#define _CPU_Context_Initialize_fp( _fp_area ) \
+ { \
+ unsigned32 *_source = (unsigned32 *) &_CPU_Null_fp_context; \
+ unsigned32 *_destination = *(_fp_area); \
+ unsigned32 _index; \
+ \
+ for ( _index=0 ; _index < CPU_CONTEXT_FP_SIZE/4 ; _index++ ) \
+ *_destination++ = *_source++; \
+ }
+
+/* end of Context handler macros */
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ { \
+ asm volatile ( "cli ; \
+ movl %0,%%eax ; \
+ hlt" \
+ : "=r" ((_error)) : "0" ((_error)) \
+ ); \
+ }
+
+/* end of Fatal Error manager macros */
+
+/*
+ * Bitfield handler macros
+ *
+ * These macros perform the following functions:
+ * + scan for the highest numbered (MSB) set in a 16 bit bitfield
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
+#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
+
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ register unsigned16 __value_in_register = (_value); \
+ \
+ _output = 0; \
+ \
+ asm volatile ( "bsfw %0,%1 " \
+ : "=r" (__value_in_register), "=r" (_output) \
+ : "0" (__value_in_register), "1" (_output) \
+ ); \
+ }
+
+/* end of Bitfield handler macros */
+
+/*
+ * Priority handler macros
+ *
+ * These macros perform the following functions:
+ * + return a mask with the bit for this major/minor portion of
+ * of thread priority set.
+ * + translate the bit number returned by "Bitfield_find_first_bit"
+ * into an index into the thread ready chain bit maps
+ */
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 1 << (_bit_number) )
+
+#define _CPU_Priority_bits_index( _priority ) \
+ (_priority)
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner and avoid stack conflicts.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i386/cpu_asm.s b/c/src/exec/score/cpu/i386/cpu_asm.s
new file mode 100644
index 0000000000..7030361d46
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/cpu_asm.s
@@ -0,0 +1,660 @@
+/* cpu_asm.s
+ *
+ * This file contains all assembly code for the Intel i386 implementation
+ * of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+
+/*
+ * Format of i386 Register structure
+ */
+
+.set REG_EFLAGS, 0
+.set REG_ESP, REG_EFLAGS + 4
+.set REG_EBP, REG_ESP + 4
+.set REG_EBX, REG_EBP + 4
+.set REG_ESI, REG_EBX + 4
+.set REG_EDI, REG_ESI + 4
+.set SIZE_REGS, REG_EDI + 4
+
+ BEGIN_CODE
+
+/*
+ * void _CPU_Context_switch( run_context, heir_context )
+ *
+ * This routine performs a normal non-FP context.
+ */
+
+ .align 2
+ PUBLIC (_CPU_Context_switch)
+
+.set RUNCONTEXT_ARG, 4 # save context argument
+.set HEIRCONTEXT_ARG, 8 # restore context argument
+
+SYM (_CPU_Context_switch):
+ movl RUNCONTEXT_ARG(esp),eax # eax = running threads context
+ pushf # push eflags
+ popl REG_EFLAGS(eax) # save eflags
+ movl esp,REG_ESP(eax) # save stack pointer
+ movl ebp,REG_EBP(eax) # save base pointer
+ movl ebx,REG_EBX(eax) # save ebx
+ movl esi,REG_ESI(eax) # save source register
+ movl edi,REG_EDI(eax) # save destination register
+
+ movl HEIRCONTEXT_ARG(esp),eax # eax = heir threads context
+
+restore:
+ pushl REG_EFLAGS(eax) # push eflags
+ popf # restore eflags
+ movl REG_ESP(eax),esp # restore stack pointer
+ movl REG_EBP(eax),ebp # restore base pointer
+ movl REG_EBX(eax),ebx # restore ebx
+ movl REG_ESI(eax),esi # restore source register
+ movl REG_EDI(eax),edi # restore destination register
+ ret
+
+/*
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+/*
+ * void _CPU_Context_restore( new_context )
+ *
+ * This routine performs a normal non-FP context.
+ */
+
+ PUBLIC (_CPU_Context_restore)
+
+.set NEWCONTEXT_ARG, 4 # context to restore argument
+
+SYM (_CPU_Context_restore):
+
+ movl NEWCONTEXT_ARG(esp),eax # eax = running threads context
+ jmp restore
+
+/*PAGE
+ * void _CPU_Context_save_fp_context( &fp_context_ptr )
+ * void _CPU_Context_restore_fp_context( &fp_context_ptr )
+ *
+ * This section is used to context switch an i80287, i80387,
+ * the built-in coprocessor or the i80486 or compatible.
+ */
+
+.set FPCONTEXT_ARG, 4 # FP context argument
+
+ .align 2
+ PUBLIC (_CPU_Context_save_fp)
+SYM (_CPU_Context_save_fp):
+ movl FPCONTEXT_ARG(esp),eax # eax = &ptr to FP context area
+ movl (eax),eax # eax = FP context area
+ fsave (eax) # save FP context
+ ret
+
+ .align 2
+ PUBLIC (_CPU_Context_restore_fp)
+SYM (_CPU_Context_restore_fp):
+ movl FPCONTEXT_ARG(esp),eax # eax = &ptr to FP context area
+ movl (eax),eax # eax = FP context area
+ frstor (eax) # restore FP context
+ ret
+
+/*PAGE
+ * void _ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ * NOTE:
+ * Upon entry, the stack will contain a stack frame back to the
+ * interrupted task. If dispatching is enabled, this is the
+ * outer most interrupt, and (a context switch is necessary or
+ * the current task has signals), then set up the stack to
+ * transfer control to the interrupt dispatcher.
+ */
+
+.set SET_SEGMENT_REGISTERS_IN_INTERRUPT, 0
+
+.set SAVED_REGS , 32 # space consumed by saved regs
+.set EIP_OFFSET , SAVED_REGS # offset of tasks eip
+.set CS_OFFSET , EIP_OFFSET+4 # offset of tasks code segment
+.set EFLAGS_OFFSET , CS_OFFSET+4 # offset of tasks eflags
+
+ .align 2
+ PUBLIC (_ISR_Handler)
+
+SYM (_ISR_Handler):
+ /*
+ * Before this was point is reached the vectors unique
+ * entry point did the following:
+ *
+ * 1. saved all registers with a "pusha"
+ * 2. put the vector number in eax.
+ *
+ * BEGINNING OF ESTABLISH SEGMENTS
+ *
+ * WARNING: If an interrupt can occur when the segments are
+ * not correct, then this is where we should establish
+ * the segments. In addition to establishing the
+ * segments, it may be necessary to establish a stack
+ * in the current data area on the outermost interrupt.
+ *
+ * NOTE: If the previous values of the segment registers are
+ * pushed, do not forget to adjust SAVED_REGS.
+ *
+ * NOTE: Make sure the exit code which restores these
+ * when this type of code is needed.
+ */
+
+ /***** ESTABLISH SEGMENTS CODE GOES HERE ******/
+
+ /*
+ * END OF ESTABLISH SEGMENTS
+ */
+
+ /*
+ * Now switch stacks if necessary
+ */
+
+ movl esp, edx # edx = previous stack pointer
+ cmpl $0, SYM (_ISR_Nest_level) # is this the outermost interrupt?
+ jne nested # No, then continue
+ movl SYM (_CPU_Interrupt_stack_high), esp
+
+ /*
+ * We want to insure that the old stack pointer is on the
+ * stack we will be on at the end of the ISR when we restore it.
+ * By saving it on every interrupt, all we have to do is pop it
+ * near the end of every interrupt.
+ */
+
+nested:
+ pushl edx # save the previous stack pointer
+ incl SYM (_ISR_Nest_level) # one nest level deeper
+ incl SYM (_Thread_Dispatch_disable_level) # disable multitasking
+
+ # EAX is preloaded with the vector number.
+ push eax # push vector number
+ mov SYM (_ISR_Vector_table) (,eax,4),eax
+ # eax = Users handler
+ call eax # invoke user ISR
+ pop eax # eax = vector number
+
+ decl SYM (_ISR_Nest_level) # one less ISR nest level
+ # If interrupts are nested,
+ # then dispatching is disabled
+
+ decl SYM (_Thread_Dispatch_disable_level)
+ # unnest multitasking
+ # Is dispatch disabled
+ jne exit # Yes, then exit
+
+ cmpl $0, SYM (_Context_Switch_necessary)
+ # Is task switch necessary?
+ jne bframe # Yes, then build stack
+
+ cmpl $0, SYM (_ISR_Signals_to_thread_executing)
+ # signals sent to Run_thread
+ # while in interrupt handler?
+ je exit # No, exit
+
+bframe:
+ cli # DISABLE INTERRUPTS!!
+ popl esp # restore the stack pointer
+ movl $0, SYM (_ISR_Signals_to_thread_executing)
+ # push the isf for Isr_dispatch
+ push EFLAGS_OFFSET(esp) # push tasks eflags
+ push cs # cs of Isr_dispatch
+ push $ SYM (_ISR_Dispatch) # entry point
+ iret
+
+exit:
+ cli # DISABLE INTERRUPTS!!
+ popl esp # restore the stack pointer
+
+ /*
+ * BEGINNING OF DE-ESTABLISH SEGMENTS
+ *
+ * NOTE: Make sure there is code here if code is added to
+ * load the segment registers.
+ *
+ */
+
+ /******* DE-ESTABLISH SEGMENTS CODE GOES HERE ********/
+
+ /*
+ * END OF DE-ESTABLISH SEGMENTS
+ */
+
+ popa # restore general registers
+ iret
+
+/*PAGE
+ * Distinct Interrupt Entry Points
+ *
+ * The following macro and the 256 instantiations of the macro
+ * are necessary to determine which interrupt vector occurred.
+ * The following macro allows a unique entry point to be defined
+ * for each vector.
+ *
+ * NOTE: There are not spaces around the vector number argument
+ * to the DISTINCT_INTERRUPT_ENTRY macro because m4 will
+ * undesirably generate the symbol "_Isr_handler_ N"
+ * instead of "_Isr_handler_N" like we want.
+ */
+
+#define DISTINCT_INTERRUPT_ENTRY(_vector) \
+ .align 16 ; \
+ PUBLIC (_ISR_Handler_ ## _vector ) ; \
+SYM (_ISR_Handler_ ## _vector ): \
+ pusha ; \
+ xor eax, eax ; \
+ movb $ ## _vector, al ; \
+ jmp SYM (_ISR_Handler) ;
+
+DISTINCT_INTERRUPT_ENTRY(0)
+DISTINCT_INTERRUPT_ENTRY(1)
+DISTINCT_INTERRUPT_ENTRY(2)
+DISTINCT_INTERRUPT_ENTRY(3)
+DISTINCT_INTERRUPT_ENTRY(4)
+DISTINCT_INTERRUPT_ENTRY(5)
+DISTINCT_INTERRUPT_ENTRY(6)
+DISTINCT_INTERRUPT_ENTRY(7)
+DISTINCT_INTERRUPT_ENTRY(8)
+DISTINCT_INTERRUPT_ENTRY(9)
+DISTINCT_INTERRUPT_ENTRY(10)
+DISTINCT_INTERRUPT_ENTRY(11)
+DISTINCT_INTERRUPT_ENTRY(12)
+DISTINCT_INTERRUPT_ENTRY(13)
+DISTINCT_INTERRUPT_ENTRY(14)
+DISTINCT_INTERRUPT_ENTRY(15)
+DISTINCT_INTERRUPT_ENTRY(16)
+DISTINCT_INTERRUPT_ENTRY(17)
+DISTINCT_INTERRUPT_ENTRY(18)
+DISTINCT_INTERRUPT_ENTRY(19)
+DISTINCT_INTERRUPT_ENTRY(20)
+DISTINCT_INTERRUPT_ENTRY(21)
+DISTINCT_INTERRUPT_ENTRY(22)
+DISTINCT_INTERRUPT_ENTRY(23)
+DISTINCT_INTERRUPT_ENTRY(24)
+DISTINCT_INTERRUPT_ENTRY(25)
+DISTINCT_INTERRUPT_ENTRY(26)
+DISTINCT_INTERRUPT_ENTRY(27)
+DISTINCT_INTERRUPT_ENTRY(28)
+DISTINCT_INTERRUPT_ENTRY(29)
+DISTINCT_INTERRUPT_ENTRY(30)
+DISTINCT_INTERRUPT_ENTRY(31)
+DISTINCT_INTERRUPT_ENTRY(32)
+DISTINCT_INTERRUPT_ENTRY(33)
+DISTINCT_INTERRUPT_ENTRY(34)
+DISTINCT_INTERRUPT_ENTRY(35)
+DISTINCT_INTERRUPT_ENTRY(36)
+DISTINCT_INTERRUPT_ENTRY(37)
+DISTINCT_INTERRUPT_ENTRY(38)
+DISTINCT_INTERRUPT_ENTRY(39)
+DISTINCT_INTERRUPT_ENTRY(40)
+DISTINCT_INTERRUPT_ENTRY(41)
+DISTINCT_INTERRUPT_ENTRY(42)
+DISTINCT_INTERRUPT_ENTRY(43)
+DISTINCT_INTERRUPT_ENTRY(44)
+DISTINCT_INTERRUPT_ENTRY(45)
+DISTINCT_INTERRUPT_ENTRY(46)
+DISTINCT_INTERRUPT_ENTRY(47)
+DISTINCT_INTERRUPT_ENTRY(48)
+DISTINCT_INTERRUPT_ENTRY(49)
+DISTINCT_INTERRUPT_ENTRY(50)
+DISTINCT_INTERRUPT_ENTRY(51)
+DISTINCT_INTERRUPT_ENTRY(52)
+DISTINCT_INTERRUPT_ENTRY(53)
+DISTINCT_INTERRUPT_ENTRY(54)
+DISTINCT_INTERRUPT_ENTRY(55)
+DISTINCT_INTERRUPT_ENTRY(56)
+DISTINCT_INTERRUPT_ENTRY(57)
+DISTINCT_INTERRUPT_ENTRY(58)
+DISTINCT_INTERRUPT_ENTRY(59)
+DISTINCT_INTERRUPT_ENTRY(60)
+DISTINCT_INTERRUPT_ENTRY(61)
+DISTINCT_INTERRUPT_ENTRY(62)
+DISTINCT_INTERRUPT_ENTRY(63)
+DISTINCT_INTERRUPT_ENTRY(64)
+DISTINCT_INTERRUPT_ENTRY(65)
+DISTINCT_INTERRUPT_ENTRY(66)
+DISTINCT_INTERRUPT_ENTRY(67)
+DISTINCT_INTERRUPT_ENTRY(68)
+DISTINCT_INTERRUPT_ENTRY(69)
+DISTINCT_INTERRUPT_ENTRY(70)
+DISTINCT_INTERRUPT_ENTRY(71)
+DISTINCT_INTERRUPT_ENTRY(72)
+DISTINCT_INTERRUPT_ENTRY(73)
+DISTINCT_INTERRUPT_ENTRY(74)
+DISTINCT_INTERRUPT_ENTRY(75)
+DISTINCT_INTERRUPT_ENTRY(76)
+DISTINCT_INTERRUPT_ENTRY(77)
+DISTINCT_INTERRUPT_ENTRY(78)
+DISTINCT_INTERRUPT_ENTRY(79)
+DISTINCT_INTERRUPT_ENTRY(80)
+DISTINCT_INTERRUPT_ENTRY(81)
+DISTINCT_INTERRUPT_ENTRY(82)
+DISTINCT_INTERRUPT_ENTRY(83)
+DISTINCT_INTERRUPT_ENTRY(84)
+DISTINCT_INTERRUPT_ENTRY(85)
+DISTINCT_INTERRUPT_ENTRY(86)
+DISTINCT_INTERRUPT_ENTRY(87)
+DISTINCT_INTERRUPT_ENTRY(88)
+DISTINCT_INTERRUPT_ENTRY(89)
+DISTINCT_INTERRUPT_ENTRY(90)
+DISTINCT_INTERRUPT_ENTRY(91)
+DISTINCT_INTERRUPT_ENTRY(92)
+DISTINCT_INTERRUPT_ENTRY(93)
+DISTINCT_INTERRUPT_ENTRY(94)
+DISTINCT_INTERRUPT_ENTRY(95)
+DISTINCT_INTERRUPT_ENTRY(96)
+DISTINCT_INTERRUPT_ENTRY(97)
+DISTINCT_INTERRUPT_ENTRY(98)
+DISTINCT_INTERRUPT_ENTRY(99)
+DISTINCT_INTERRUPT_ENTRY(100)
+DISTINCT_INTERRUPT_ENTRY(101)
+DISTINCT_INTERRUPT_ENTRY(102)
+DISTINCT_INTERRUPT_ENTRY(103)
+DISTINCT_INTERRUPT_ENTRY(104)
+DISTINCT_INTERRUPT_ENTRY(105)
+DISTINCT_INTERRUPT_ENTRY(106)
+DISTINCT_INTERRUPT_ENTRY(107)
+DISTINCT_INTERRUPT_ENTRY(108)
+DISTINCT_INTERRUPT_ENTRY(109)
+DISTINCT_INTERRUPT_ENTRY(110)
+DISTINCT_INTERRUPT_ENTRY(111)
+DISTINCT_INTERRUPT_ENTRY(112)
+DISTINCT_INTERRUPT_ENTRY(113)
+DISTINCT_INTERRUPT_ENTRY(114)
+DISTINCT_INTERRUPT_ENTRY(115)
+DISTINCT_INTERRUPT_ENTRY(116)
+DISTINCT_INTERRUPT_ENTRY(117)
+DISTINCT_INTERRUPT_ENTRY(118)
+DISTINCT_INTERRUPT_ENTRY(119)
+DISTINCT_INTERRUPT_ENTRY(120)
+DISTINCT_INTERRUPT_ENTRY(121)
+DISTINCT_INTERRUPT_ENTRY(122)
+DISTINCT_INTERRUPT_ENTRY(123)
+DISTINCT_INTERRUPT_ENTRY(124)
+DISTINCT_INTERRUPT_ENTRY(125)
+DISTINCT_INTERRUPT_ENTRY(126)
+DISTINCT_INTERRUPT_ENTRY(127)
+DISTINCT_INTERRUPT_ENTRY(128)
+DISTINCT_INTERRUPT_ENTRY(129)
+DISTINCT_INTERRUPT_ENTRY(130)
+DISTINCT_INTERRUPT_ENTRY(131)
+DISTINCT_INTERRUPT_ENTRY(132)
+DISTINCT_INTERRUPT_ENTRY(133)
+DISTINCT_INTERRUPT_ENTRY(134)
+DISTINCT_INTERRUPT_ENTRY(135)
+DISTINCT_INTERRUPT_ENTRY(136)
+DISTINCT_INTERRUPT_ENTRY(137)
+DISTINCT_INTERRUPT_ENTRY(138)
+DISTINCT_INTERRUPT_ENTRY(139)
+DISTINCT_INTERRUPT_ENTRY(140)
+DISTINCT_INTERRUPT_ENTRY(141)
+DISTINCT_INTERRUPT_ENTRY(142)
+DISTINCT_INTERRUPT_ENTRY(143)
+DISTINCT_INTERRUPT_ENTRY(144)
+DISTINCT_INTERRUPT_ENTRY(145)
+DISTINCT_INTERRUPT_ENTRY(146)
+DISTINCT_INTERRUPT_ENTRY(147)
+DISTINCT_INTERRUPT_ENTRY(148)
+DISTINCT_INTERRUPT_ENTRY(149)
+DISTINCT_INTERRUPT_ENTRY(150)
+DISTINCT_INTERRUPT_ENTRY(151)
+DISTINCT_INTERRUPT_ENTRY(152)
+DISTINCT_INTERRUPT_ENTRY(153)
+DISTINCT_INTERRUPT_ENTRY(154)
+DISTINCT_INTERRUPT_ENTRY(155)
+DISTINCT_INTERRUPT_ENTRY(156)
+DISTINCT_INTERRUPT_ENTRY(157)
+DISTINCT_INTERRUPT_ENTRY(158)
+DISTINCT_INTERRUPT_ENTRY(159)
+DISTINCT_INTERRUPT_ENTRY(160)
+DISTINCT_INTERRUPT_ENTRY(161)
+DISTINCT_INTERRUPT_ENTRY(162)
+DISTINCT_INTERRUPT_ENTRY(163)
+DISTINCT_INTERRUPT_ENTRY(164)
+DISTINCT_INTERRUPT_ENTRY(165)
+DISTINCT_INTERRUPT_ENTRY(166)
+DISTINCT_INTERRUPT_ENTRY(167)
+DISTINCT_INTERRUPT_ENTRY(168)
+DISTINCT_INTERRUPT_ENTRY(169)
+DISTINCT_INTERRUPT_ENTRY(170)
+DISTINCT_INTERRUPT_ENTRY(171)
+DISTINCT_INTERRUPT_ENTRY(172)
+DISTINCT_INTERRUPT_ENTRY(173)
+DISTINCT_INTERRUPT_ENTRY(174)
+DISTINCT_INTERRUPT_ENTRY(175)
+DISTINCT_INTERRUPT_ENTRY(176)
+DISTINCT_INTERRUPT_ENTRY(177)
+DISTINCT_INTERRUPT_ENTRY(178)
+DISTINCT_INTERRUPT_ENTRY(179)
+DISTINCT_INTERRUPT_ENTRY(180)
+DISTINCT_INTERRUPT_ENTRY(181)
+DISTINCT_INTERRUPT_ENTRY(182)
+DISTINCT_INTERRUPT_ENTRY(183)
+DISTINCT_INTERRUPT_ENTRY(184)
+DISTINCT_INTERRUPT_ENTRY(185)
+DISTINCT_INTERRUPT_ENTRY(186)
+DISTINCT_INTERRUPT_ENTRY(187)
+DISTINCT_INTERRUPT_ENTRY(188)
+DISTINCT_INTERRUPT_ENTRY(189)
+DISTINCT_INTERRUPT_ENTRY(190)
+DISTINCT_INTERRUPT_ENTRY(191)
+DISTINCT_INTERRUPT_ENTRY(192)
+DISTINCT_INTERRUPT_ENTRY(193)
+DISTINCT_INTERRUPT_ENTRY(194)
+DISTINCT_INTERRUPT_ENTRY(195)
+DISTINCT_INTERRUPT_ENTRY(196)
+DISTINCT_INTERRUPT_ENTRY(197)
+DISTINCT_INTERRUPT_ENTRY(198)
+DISTINCT_INTERRUPT_ENTRY(199)
+DISTINCT_INTERRUPT_ENTRY(200)
+DISTINCT_INTERRUPT_ENTRY(201)
+DISTINCT_INTERRUPT_ENTRY(202)
+DISTINCT_INTERRUPT_ENTRY(203)
+DISTINCT_INTERRUPT_ENTRY(204)
+DISTINCT_INTERRUPT_ENTRY(205)
+DISTINCT_INTERRUPT_ENTRY(206)
+DISTINCT_INTERRUPT_ENTRY(207)
+DISTINCT_INTERRUPT_ENTRY(208)
+DISTINCT_INTERRUPT_ENTRY(209)
+DISTINCT_INTERRUPT_ENTRY(210)
+DISTINCT_INTERRUPT_ENTRY(211)
+DISTINCT_INTERRUPT_ENTRY(212)
+DISTINCT_INTERRUPT_ENTRY(213)
+DISTINCT_INTERRUPT_ENTRY(214)
+DISTINCT_INTERRUPT_ENTRY(215)
+DISTINCT_INTERRUPT_ENTRY(216)
+DISTINCT_INTERRUPT_ENTRY(217)
+DISTINCT_INTERRUPT_ENTRY(218)
+DISTINCT_INTERRUPT_ENTRY(219)
+DISTINCT_INTERRUPT_ENTRY(220)
+DISTINCT_INTERRUPT_ENTRY(221)
+DISTINCT_INTERRUPT_ENTRY(222)
+DISTINCT_INTERRUPT_ENTRY(223)
+DISTINCT_INTERRUPT_ENTRY(224)
+DISTINCT_INTERRUPT_ENTRY(225)
+DISTINCT_INTERRUPT_ENTRY(226)
+DISTINCT_INTERRUPT_ENTRY(227)
+DISTINCT_INTERRUPT_ENTRY(228)
+DISTINCT_INTERRUPT_ENTRY(229)
+DISTINCT_INTERRUPT_ENTRY(230)
+DISTINCT_INTERRUPT_ENTRY(231)
+DISTINCT_INTERRUPT_ENTRY(232)
+DISTINCT_INTERRUPT_ENTRY(233)
+DISTINCT_INTERRUPT_ENTRY(234)
+DISTINCT_INTERRUPT_ENTRY(235)
+DISTINCT_INTERRUPT_ENTRY(236)
+DISTINCT_INTERRUPT_ENTRY(237)
+DISTINCT_INTERRUPT_ENTRY(238)
+DISTINCT_INTERRUPT_ENTRY(239)
+DISTINCT_INTERRUPT_ENTRY(240)
+DISTINCT_INTERRUPT_ENTRY(241)
+DISTINCT_INTERRUPT_ENTRY(242)
+DISTINCT_INTERRUPT_ENTRY(243)
+DISTINCT_INTERRUPT_ENTRY(244)
+DISTINCT_INTERRUPT_ENTRY(245)
+DISTINCT_INTERRUPT_ENTRY(246)
+DISTINCT_INTERRUPT_ENTRY(247)
+DISTINCT_INTERRUPT_ENTRY(248)
+DISTINCT_INTERRUPT_ENTRY(249)
+DISTINCT_INTERRUPT_ENTRY(250)
+DISTINCT_INTERRUPT_ENTRY(251)
+DISTINCT_INTERRUPT_ENTRY(252)
+DISTINCT_INTERRUPT_ENTRY(253)
+DISTINCT_INTERRUPT_ENTRY(254)
+DISTINCT_INTERRUPT_ENTRY(255)
+
+/*PAGE
+ * void _ISR_Dispatch()
+ *
+ * Entry point from the outermost interrupt service routine exit.
+ * The current stack is the supervisor mode stack.
+ */
+
+ PUBLIC (_ISR_Dispatch)
+SYM (_ISR_Dispatch):
+
+ call SYM (_Thread_Dispatch) # invoke Dispatcher
+
+ /*
+ * BEGINNING OF DE-ESTABLISH SEGMENTS
+ *
+ * NOTE: Make sure there is code here if code is added to
+ * load the segment registers.
+ *
+ */
+
+ /***** DE-ESTABLISH SEGMENTS CODE GOES HERE ****/
+
+ /*
+ * END OF DE-ESTABLISH SEGMENTS
+ */
+
+ popa # restore general registers
+ iret # return to interrupted thread
+
+/*
+ * GO32 does not require these segment related routines.
+ */
+
+#ifndef __GO32__
+/*PAGE
+ *
+ * void i386_Install_idt(
+ * unsigned32 source_offset,
+ * unsigned16 destination_segment,
+ * unsigned32 destination_offset
+ * );
+ */
+
+ .align 2
+ PUBLIC (i386_Install_idt)
+
+.set INSTALL_IDT_SAVED_REGS, 8
+
+.set SOURCE_OFFSET_ARG, INSTALL_IDT_SAVED_REGS + 4
+.set DESTINATION_SEGMENT_ARG, INSTALL_IDT_SAVED_REGS + 8
+.set DESTINATION_OFFSET_ARG, INSTALL_IDT_SAVED_REGS + 12
+
+SYM (i386_Install_idt):
+ push esi
+ push edi
+
+ movl SOURCE_OFFSET_ARG(esp),esi
+ movl DESTINATION_OFFSET_ARG(esp),edi
+
+ pushf # save flags
+ cli # DISABLE INTERRUPTS!!!
+
+ movw DESTINATION_SEGMENT_ARG+4(esp),ax
+ push es # save es
+ movw ax,es
+ movsl # copy 1st half of IDT entry
+ movsl # copy 2nd half of IDT entry
+ pop es # restore es
+
+ popf # ENABLE INTERRUPTS!!!
+
+ pop edi
+ pop esi
+ ret
+
+/*
+ * void *i386_Logical_to_physical(
+ * rtems_unsigned16 segment,
+ * void *address
+ * );
+ *
+ * Returns thirty-two bit physical address for segment:address.
+ */
+
+.set SEGMENT_ARG, 4
+.set ADDRESS_ARG, 8
+
+ PUBLIC (i386_Logical_to_physical)
+
+SYM (i386_Logical_to_physical):
+
+ xorl eax,eax # clear eax
+ movzwl SEGMENT_ARG(esp),ecx # ecx = segment value
+ movl $ SYM (_Global_descriptor_table),edx
+ # edx = address of our GDT
+ addl ecx,edx # edx = address of desired entry
+ movb 7(edx),ah # ah = base 31:24
+ movb 4(edx),al # al = base 23:16
+ shll $16,eax # move ax into correct bits
+ movw 2(edx),ax # ax = base 0:15
+ movl ADDRESS_ARG(esp),ecx # ecx = address to convert
+ addl eax,ecx # ecx = physical address equivalent
+ movl ecx,eax # eax = ecx
+ ret
+
+/*
+ * void *i386_Physical_to_logical(
+ * rtems_unsigned16 segment,
+ * void *address
+ * );
+ *
+ * Returns thirty-two bit physical address for segment:address.
+ */
+
+/*
+ *.set SEGMENT_ARG, 4
+ *.set ADDRESS_ARG, 8 -- use sets from above
+ */
+
+ PUBLIC (i386_Physical_to_logical)
+
+SYM (i386_Physical_to_logical):
+ xorl eax,eax # clear eax
+ movzwl SEGMENT_ARG(esp),ecx # ecx = segment value
+ movl $ SYM (_Global_descriptor_table),edx
+ # edx = address of our GDT
+ addl ecx,edx # edx = address of desired entry
+ movb 7(edx),ah # ah = base 31:24
+ movb 4(edx),al # al = base 23:16
+ shll $16,eax # move ax into correct bits
+ movw 2(edx),ax # ax = base 0:15
+ movl ADDRESS_ARG(esp),ecx # ecx = address to convert
+ subl eax,ecx # ecx = logical address equivalent
+ movl ecx,eax # eax = ecx
+ ret
+#endif /* __GO32__ */
+
+END_CODE
+
+END
diff --git a/c/src/exec/score/cpu/i386/i386.h b/c/src/exec/score/cpu/i386/i386.h
new file mode 100644
index 0000000000..8cb246aa91
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/i386.h
@@ -0,0 +1,496 @@
+/* i386.h
+ *
+ * This include file contains information pertaining to the Intel
+ * i386 processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __i386_h
+#define __i386_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef i386
+#undef i386
+#endif
+#define i386 1
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This section contains the information required to build
+ * RTEMS for a particular member of the Intel i386
+ * family when executing in protected mode. It does
+ * this by setting variables to indicate which implementation
+ * dependent features are present in a particular member
+ * of the family.
+ *
+ * Currently recognized:
+ * i386_fp (i386 DX or SX w/i387)
+ * i386_fp (i386 DX or SX w/o i387)
+ * i486dx
+ * i486sx
+ * pentium
+ *
+ * Floating point is the only feature which currently varies. Eventually
+ * the i486-plus level instruction for endian swapping should be added
+ * to this feature list.
+ */
+
+#if defined(i386_fp)
+
+#define CPU_MODEL_NAME "i386 with i387"
+#define I386_HAS_FPU 1
+
+#elif defined(i386_nofp)
+
+#define CPU_MODEL_NAME "i386 w/o i387"
+#define I386_HAS_FPU 1
+
+#elif defined(i486dx)
+
+#define CPU_MODEL_NAME "i486dx"
+#define I386_HAS_FPU 1
+
+#elif defined(i486sx)
+
+#define CPU_MODEL_NAME "i486sx"
+#define I386_HAS_FPU 0
+
+#elif defined(pentium)
+
+#define CPU_MODEL_NAME "Pentium"
+#define I386_HAS_FPU 1
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "Intel i386"
+
+#ifndef ASM
+
+/*
+ * Structure which makes it easier to deal with LxDT and SxDT instructions.
+ */
+
+typedef struct {
+ unsigned short limit;
+ unsigned short physical_address[ 2 ];
+} i386_DTR_load_save_format;
+
+/* See Chapter 5 - Memory Management in i386 manual */
+
+typedef struct {
+ unsigned short limit_0_15;
+ unsigned short base_0_15;
+ unsigned char base_16_23;
+ unsigned char type_dt_dpl_p;
+ unsigned char limit_16_19_granularity;
+ unsigned char base_24_31;
+} i386_GDT_slot;
+
+/* See Chapter 9 - Exceptions and Interrupts in i386 manual
+ *
+ * NOTE: This is the IDT entry for interrupt gates ONLY.
+ */
+
+typedef struct {
+ unsigned short offset_0_15;
+ unsigned short segment_selector;
+ unsigned char reserved;
+ unsigned char p_dpl;
+ unsigned short offset_16_31;
+} i386_IDT_slot;
+
+/*
+ * Interrupt Level Macros
+ */
+
+#define i386_disable_interrupts( _level ) \
+ { \
+ _level = 0; /* avoids warnings */ \
+ asm volatile ( "pushf ; \
+ cli ; \
+ pop %0" \
+ : "=r" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+
+#define i386_enable_interrupts( _level ) \
+ { \
+ asm volatile ( "push %0 ; \
+ popf" \
+ : "=r" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+
+#define i386_flash_interrupts( _level ) \
+ { \
+ asm volatile ( "push %0 ; \
+ popf ; \
+ cli" \
+ : "=r" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+
+#define i386_get_interrupt_level( _level ) \
+ do { \
+ register unsigned32 _eflags = 0; \
+ \
+ asm volatile ( "pushf ; \
+ pop %0" \
+ : "=r" ((_eflags)) : "0" ((_eflags)) \
+ ); \
+ \
+ _level = (_eflags & 0x0200) ? 0 : 1; \
+ } while (0)
+
+/*
+ * The following routine swaps the endian format of an unsigned int.
+ * It must be static so it can be referenced indirectly.
+ */
+
+static inline unsigned int i386_swap_U32(
+ unsigned int value
+)
+{
+ asm volatile( "rorw $8,%%ax;"
+ "rorl $16,%0;"
+ "rorw $8,%%ax" : "=a" (value) : "0" (value) );
+ return( value );
+}
+
+/*
+ * Segment Access Routines
+ *
+ * NOTE: Unfortunately, these are still static inlines even when the
+ * "macro" implementation of the generic code is used.
+ */
+
+static inline unsigned short i386_get_cs()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%cs,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+static inline unsigned short i386_get_ds()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%ds,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+static inline unsigned short i386_get_es()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%es,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+static inline unsigned short i386_get_ss()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%ss,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+static inline unsigned short i386_get_fs()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%fs,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+static inline unsigned short i386_get_gs()
+{
+ register unsigned short segment = 0;
+
+ asm volatile ( "movw %%gs,%0" : "=r" (segment) : "0" (segment) );
+
+ return segment;
+}
+
+/*
+ * IO Port Access Routines
+ */
+
+#define i386_outport_byte( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned char __value = _value; \
+ \
+ asm volatile ( "outb %0,%1" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ }
+
+#define i386_outport_word( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned short __value = _value; \
+ \
+ asm volatile ( "outw %0,%1" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ }
+
+#define i386_outport_long( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned int __value = _value; \
+ \
+ asm volatile ( "outl %0,%1" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ }
+
+#define i386_inport_byte( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned char __value = 0; \
+ \
+ asm volatile ( "inb %1,%0" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ _value = __value; \
+ }
+
+#define i386_inport_word( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned short __value = 0; \
+ \
+ asm volatile ( "inw %1,%0" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ _value = __value; \
+ }
+
+#define i386_inport_long( _port, _value ) \
+ { register unsigned short __port = _port; \
+ register unsigned int __value = 0; \
+ \
+ asm volatile ( "inl %1,%0" : "=a" (__value), "=d" (__port) \
+ : "0" (__value), "1" (__port) \
+ ); \
+ _value = __value; \
+ }
+
+/*
+ * Descriptor Table helper routines
+ */
+
+
+#define i386_get_GDTR( _gdtr_address ) \
+ { \
+ void *_gdtr = (_gdtr_address); \
+ \
+ asm volatile( "sgdt (%0)" : "=r" (_gdtr) : "0" (_gdtr) ); \
+ }
+
+#define i386_get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+ { \
+ register unsigned int _gdt_slot = (_gdtr_base) + (_segment); \
+ register volatile void *_slot = (_slot_address); \
+ register unsigned int _temporary = 0; \
+ \
+ asm volatile( "movl %%gs:(%0),%1 ; \
+ movl %1,(%2) ; \
+ movl %%gs:4(%0),%1 ; \
+ movl %1,4(%2)" \
+ : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
+ : "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
+ ); \
+ }
+
+#define i386_set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+ { \
+ register unsigned int _gdt_slot = (_gdtr_base) + (_segment); \
+ register volatile void *_slot = (_slot_address); \
+ register unsigned int _temporary = 0; \
+ \
+ asm volatile( "movl (%2),%1 ; \
+ movl %1,%%gs:(%0) ; \
+ movl 4(%2),%1 ; \
+ movl %1,%%gs:4(%0) \
+ " \
+ : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
+ : "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
+ ); \
+ }
+
+static inline void i386_set_segment(
+ unsigned short segment,
+ unsigned int base,
+ unsigned int limit
+)
+{
+ i386_DTR_load_save_format gdtr;
+ volatile i386_GDT_slot Gdt_slot;
+ volatile i386_GDT_slot *gdt_slot = &Gdt_slot;
+ unsigned short tmp_segment = 0;
+ unsigned int limit_adjusted;
+
+ /* load physical address of the GDT */
+
+ i386_get_GDTR( &gdtr );
+
+ gdt_slot->type_dt_dpl_p = 0x92; /* present, dpl=0, */
+ /* application=1, */
+ /* type=data read/write */
+ gdt_slot->limit_16_19_granularity = 0x40; /* 32 bit segment */
+
+ limit_adjusted = limit;
+ if ( limit > 4095 ) {
+ gdt_slot->limit_16_19_granularity |= 0x80; /* set granularity bit */
+ limit_adjusted /= 4096;
+ }
+
+ gdt_slot->limit_16_19_granularity |= (limit_adjusted >> 16) & 0xff;
+ gdt_slot->limit_0_15 = limit_adjusted & 0xffff;
+
+ gdt_slot->base_0_15 = base & 0xffff;
+ gdt_slot->base_16_23 = (base >> 16) & 0xff;
+ gdt_slot->base_24_31 = (base >> 24);
+
+ i386_set_GDT_slot(
+ gdtr.physical_address[0] + (gdtr.physical_address[1] << 16),
+ segment,
+ gdt_slot
+ );
+
+ /* Now, reload all segment registers so the limit takes effect. */
+
+ asm volatile( "movw %%ds,%0 ; movw %0,%%ds
+ movw %%es,%0 ; movw %0,%%es
+ movw %%fs,%0 ; movw %0,%%fs
+ movw %%gs,%0 ; movw %0,%%gs
+ movw %%ss,%0 ; movw %0,%%ss"
+ : "=r" (tmp_segment)
+ : "0" (tmp_segment)
+ );
+
+}
+
+/* routines */
+
+/*
+ * i386_Logical_to_physical
+ *
+ * Converts logical address to physical address.
+ */
+
+void *i386_Logical_to_physical(
+ unsigned short segment,
+ void *address
+);
+
+/*
+ * i386_Physical_to_logical
+ *
+ * Converts physical address to logical address.
+ */
+
+void *i386_Physical_to_logical(
+ unsigned short segment,
+ void *address
+);
+
+/*
+ * i386_Install_idt
+ *
+ * This routine installs an IDT entry.
+ */
+
+void i386_Install_idt(
+ unsigned int source_offset,
+ unsigned short destination_segment,
+ unsigned int destination_offset
+);
+
+/*
+ * "Simpler" names for a lot of the things defined in this file
+ */
+
+/* segment access routines */
+
+#define get_cs() i386_get_cs()
+#define get_ds() i386_get_ds()
+#define get_es() i386_get_es()
+#define get_ss() i386_get_ss()
+#define get_fs() i386_get_fs()
+#define get_gs() i386_get_gs()
+
+#define CPU_swap_u32( _value ) i386_swap_U32( _value )
+
+/* i80x86 I/O instructions */
+
+#define outport_byte( _port, _value ) i386_outport_byte( _port, _value )
+#define outport_word( _port, _value ) i386_outport_word( _port, _value )
+#define outport_long( _port, _value ) i386_outport_long( _port, _value )
+#define inport_byte( _port, _value ) i386_inport_byte( _port, _value )
+#define inport_word( _port, _value ) i386_inport_word( _port, _value )
+#define inport_long( _port, _value ) i386_inport_long( _port, _value )
+
+/* complicated static inline functions */
+
+#define get_GDTR( _gdtr_address ) \
+ i386_get_GDTR( _gdtr_address )
+
+#define get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+ i386_get_GDT_slot( _gdtr_base, _segment, _slot_address )
+
+#define set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+ i386_set_GDT_slot( _gdtr_base, _segment, _slot_address )
+
+#define set_segment( _segment, _base, _limit ) \
+ i386_set_segment( _segment, _base, _limit )
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i386/i386types.h b/c/src/exec/score/cpu/i386/i386types.h
new file mode 100644
index 0000000000..e70d80bd42
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/i386types.h
@@ -0,0 +1,58 @@
+/* i386types.h
+ *
+ * This include file contains type definitions pertaining to the Intel
+ * i386 processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __i386_TYPES_h
+#define __i386_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void i386_isr;
+
+typedef i386_isr ( *i386_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i386/rtems.s b/c/src/exec/score/cpu/i386/rtems.s
new file mode 100644
index 0000000000..df65600e15
--- /dev/null
+++ b/c/src/exec/score/cpu/i386/rtems.s
@@ -0,0 +1,31 @@
+/* rtems.s
+ *
+ * This file contains the single entry point code for
+ * the i386 implementation of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+
+ EXTERN (_Entry_points)
+
+ BEGIN_CODE
+
+ .align 2
+ PUBLIC (RTEMS)
+
+SYM (RTEMS):
+ jmpl SYM (_Entry_points)(,eax,4)
+
+ END_CODE
+
+END
diff --git a/c/src/exec/score/cpu/i960/asm.h b/c/src/exec/score/cpu/i960/asm.h
new file mode 100644
index 0000000000..803f42f649
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/asm.h
@@ -0,0 +1,107 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __i960_ASM_h
+#define __i960_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/i960.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define g0 REG (g0)
+#define g1 REG (g1)
+#define g2 REG (g2)
+#define g3 REG (g3)
+#define g4 REG (g4)
+#define g5 REG (g5)
+#define g6 REG (g6)
+#define g7 REG (g7)
+#define g8 REG (g8)
+#define g9 REG (g9)
+#define g10 REG (g10)
+#define g11 REG (g11)
+#define g12 REG (g12)
+#define g13 REG (g13)
+#define g14 REG (g14)
+#define g15 REG (g15)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i960/cpu.c b/c/src/exec/score/cpu/i960/cpu.c
new file mode 100644
index 0000000000..e55a400c40
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/cpu.c
@@ -0,0 +1,155 @@
+/*
+ * Intel i960CA Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
+#else
+#warning "*** ENTIRE FILE IMPLEMENTED & TESTED FOR CA ONLY ***"
+#warning "*** THIS FILE WILL NOT COMPILE ON ANOTHER FAMILY MEMBER ***"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ * OUTPUT PARAMETERS: NONE
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+
+ _CPU_Table = *cpu_table;
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ i960_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+#define _Is_vector_caching_enabled( _prcb ) \
+ ((_prcb)->control_tbl->icon & 0x2000)
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ i960ca_PRCB *prcb = _CPU_Table.Prcb;
+ proc_ptr *cached_intr_tbl = NULL;
+
+ /* The i80960CA does not support vectors 0-7. The first 9 entries
+ * in the Interrupt Table are used to manage pending interrupts.
+ * Thus vector 8, the first valid vector number, is actually in
+ * slot 9 in the table.
+ */
+
+ *old_handler = prcb->intr_tbl[ vector + 1 ];
+
+ prcb->intr_tbl[ vector + 1 ] = new_handler;
+
+ if ( _Is_vector_caching_enabled( prcb ) )
+ if ( (vector & 0xf) == 0x2 ) /* cacheable? */
+ cached_intr_tbl[ vector >> 4 ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU__ISR_install_vector
+ *
+ * Install the RTEMS vector wrapper in the CPU's interrupt table.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+#define soft_reset( prcb ) \
+ { register i960ca_PRCB *_prcb = (prcb); \
+ register unsigned32 *_next=0; \
+ register unsigned32 _cmd = 0x30000; \
+ asm volatile( "lda next,%1; \
+ sysctl %0,%1,%2; \
+ next: mov g0,g0" \
+ : "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
+ : "0" (_cmd), "1" (_next), "2" (_prcb) ); \
+ }
+
+void _CPU_Install_interrupt_stack( void )
+{
+ i960ca_PRCB *prcb = _CPU_Table.Prcb;
+ unsigned32 level;
+
+ /*
+ * Set the Interrupt Stack in the PRCB and force a reload of it.
+ * Interrupts are disabled for safety.
+ */
+
+ _CPU_ISR_Disable( level );
+
+ prcb->intr_stack = _CPU_Interrupt_stack_low;
+
+ soft_reset( prcb );
+
+ _CPU_ISR_Enable( level );
+}
diff --git a/c/src/exec/score/cpu/i960/cpu.h b/c/src/exec/score/cpu/i960/cpu.h
new file mode 100644
index 0000000000..683d84659b
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/cpu.h
@@ -0,0 +1,447 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the Intel
+ * i960 processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma align 4 /* for GNU C structure alignment */
+
+#include <rtems/score/i960.h>
+#ifndef ASM
+#include <rtems/score/i960types.h>
+#endif
+
+#define CPU_INLINE_ENABLE_DISPATCH FALSE
+#define CPU_UNROLL_ENQUEUE_PRIORITY FALSE
+
+/*
+ * Use the i960's hardware interrupt stack support and have the
+ * interrupt manager allocate the memory for it.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK TRUE
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * Some family members have no FP (SA/KA/CA/CF), others have it built in
+ * (KB/MC/MX). There does not appear to be an external coprocessor
+ * for this family.
+ */
+
+#if ( I960_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE
+#error "Floating point support for i960 family has been implemented!!!"
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+#define CPU_IDLE_TASK_IS_FP FALSE
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#define CPU_STACK_GROWS_UP TRUE
+#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16)))
+
+/* structures */
+
+/*
+ * Basic integer context for the i960 family.
+ */
+
+typedef struct {
+ void *r0_pfp; /* (r0) Previous Frame Pointer */
+ void *r1_sp; /* (r1) Stack Pointer */
+ unsigned32 pc; /* (pc) Processor Control */
+ void *g8; /* (g8) Global Register 8 */
+ void *g9; /* (g9) Global Register 9 */
+ void *g10; /* (g10) Global Register 10 */
+ void *g11; /* (g11) Global Register 11 */
+ void *g12; /* (g12) Global Register 12 */
+ void *g13; /* (g13) Global Register 13 */
+ unsigned32 g14; /* (g14) Global Register 14 */
+ void *g15_fp; /* (g15) Frame Pointer */
+} Context_Control;
+
+/*
+ * FP context save area for the i960 Numeric Extension
+ */
+
+typedef struct {
+ unsigned32 fp0_1; /* (fp0) first word */
+ unsigned32 fp0_2; /* (fp0) second word */
+ unsigned32 fp0_3; /* (fp0) third word */
+ unsigned32 fp1_1; /* (fp1) first word */
+ unsigned32 fp1_2; /* (fp1) second word */
+ unsigned32 fp1_3; /* (fp1) third word */
+ unsigned32 fp2_1; /* (fp2) first word */
+ unsigned32 fp2_2; /* (fp2) second word */
+ unsigned32 fp2_3; /* (fp2) third word */
+ unsigned32 fp3_1; /* (fp3) first word */
+ unsigned32 fp3_2; /* (fp3) second word */
+ unsigned32 fp3_3; /* (fp3) third word */
+} Context_Control_fp;
+
+/*
+ * The following structure defines the set of information saved
+ * on the current stack by RTEMS upon receipt of each interrupt.
+ */
+
+typedef struct {
+ unsigned32 TBD; /* XXX Fix for this CPU */
+} CPU_Interrupt_frame;
+
+/*
+ * Call frame for the i960 family.
+ */
+
+typedef struct {
+ void *r0_pfp; /* (r0) Previous Frame Pointer */
+ void *r1_sp; /* (r1) Stack Pointer */
+ void *r2_rip; /* (r2) Return Instruction Pointer */
+ void *r3; /* (r3) Local Register 3 */
+ void *r4; /* (r4) Local Register 4 */
+ void *r5; /* (r5) Local Register 5 */
+ void *r6; /* (r6) Local Register 6 */
+ void *r7; /* (r7) Local Register 7 */
+ void *r8; /* (r8) Local Register 8 */
+ void *r9; /* (r9) Local Register 9 */
+ void *r10; /* (r10) Local Register 10 */
+ void *r11; /* (r11) Local Register 11 */
+ void *r12; /* (r12) Local Register 12 */
+ void *r13; /* (r13) Local Register 13 */
+ void *r14; /* (r14) Local Register 14 */
+ void *r15; /* (r15) Local Register 15 */
+ /* XXX Looks like sometimes there is FP stuff here (MC manual)? */
+} CPU_Call_frame;
+
+/*
+ * The following table contains the information required to configure
+ * the i960 specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
+ i960ca_PRCB *Prcb;
+#endif
+} rtems_cpu_table;
+
+/* variables */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+/* constants */
+
+/*
+ * This defines the number of levels and the mask used to pick those
+ * bits out of a thread mode.
+ */
+
+#define CPU_MODES_INTERRUPT_LEVEL 0x0000001f /* interrupt level in mode */
+#define CPU_MODES_INTERRUPT_MASK 0x0000001f /* interrupt level in mode */
+
+/*
+ * context size area for floating point
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/*
+ * extra stack required by the MPCI receive server thread
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK (CPU_STACK_MINIMUM_SIZE)
+
+/*
+ * i960 family supports 256 distinct vectors.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Minimum size of a thread's stack.
+ *
+ * NOTE: See CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK
+ */
+
+#define CPU_STACK_MINIMUM_SIZE 2048
+
+/*
+ * i960 is pretty tolerant of alignment. Just put things on 4 byte boundaries.
+ */
+
+#define CPU_ALIGNMENT 4
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * i960ca stack requires 16 byte alignment
+ *
+ * NOTE: This factor may need to be family member dependent.
+ */
+
+#define CPU_STACK_ALIGNMENT 16
+
+/* macros */
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + disable all maskable CPU interrupts
+ * + restore previous interrupt level (enable)
+ * + temporarily restore interrupts (flash)
+ * + set a particular level
+ */
+
+#define _CPU_ISR_Disable( _level ) i960_disable_interrupts( _level )
+#define _CPU_ISR_Enable( _level ) i960_enable_interrupts( _level )
+#define _CPU_ISR_Flash( _level ) i960_flash_interrupts( _level )
+
+#define _CPU_ISR_Set_level( newlevel ) \
+ { \
+ unsigned32 _mask, _level=(newlevel); \
+ \
+ __asm__ volatile ( "ldconst 0x1f0000,%0; \
+ modpc 0,%0,%1" : "=d" (_mask), "=d" (_level) \
+ : "0" (_mask), "1" (_level) \
+ ); \
+ }
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* ISR handler section macros */
+
+/*
+ * Context handler macros
+ *
+ * These macros perform the following functions:
+ * + initialize a context area
+ * + restart the current thread
+ * + calculate the initial pointer into a FP context area
+ * + initialize an FP context area
+ */
+
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry, _is_fp ) \
+ { CPU_Call_frame *_texit_frame; \
+ unsigned32 _mask; \
+ unsigned32 _base_pc; \
+ unsigned32 _stack_tmp; \
+ void *_stack; \
+ \
+ _stack_tmp = (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT; \
+ _stack_tmp &= ~(CPU_STACK_ALIGNMENT - 1); \
+ _stack = (void *) _stack_tmp; \
+ \
+ __asm__ volatile ( "flushreg" : : ); /* flush register cache */ \
+ \
+ (_the_context)->r0_pfp = _stack; \
+ (_the_context)->g15_fp = _stack + (1 * sizeof(CPU_Call_frame)); \
+ (_the_context)->r1_sp = _stack + (2 * sizeof(CPU_Call_frame)); \
+ __asm__ volatile ( "ldconst 0x1f0000,%0 ; " \
+ "modpc 0,0,%1 ; " \
+ "andnot %0,%1,%1 ; " \
+ : "=d" (_mask), "=d" (_base_pc) : ); \
+ (_the_context)->pc = _base_pc | ((_isr) << 16); \
+ (_the_context)->g14 = 0; \
+ \
+ _texit_frame = (CPU_Call_frame *)_stack; \
+ _texit_frame->r0_pfp = NULL; \
+ _texit_frame->r1_sp = (_the_context)->g15_fp; \
+ _texit_frame->r2_rip = (_entry); \
+ }
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+#define _CPU_Context_Fp_start( _base, _offset ) NULL
+
+#define _CPU_Context_Initialize_fp( _fp_area )
+
+/* end of Context handler macros */
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+#define _CPU_Fatal_halt( _errorcode ) \
+ { unsigned32 _mask, _level; \
+ unsigned32 _error = (_errorcode); \
+ \
+ __asm__ volatile ( "ldconst 0x1f0000,%0 ; \
+ mov %0,%1 ; \
+ modpc 0,%0,%1 ; \
+ mov %2,g0 ; \
+ self: b self " \
+ : "=d" (_mask), "=d" (_level), "=d" (_error) : ); \
+ }
+
+/* end of Fatal Error Manager macros */
+
+/*
+ * Bitfield handler macros
+ *
+ * These macros perform the following functions:
+ * + scan for the highest numbered (MSB) set in a 16 bit bitfield
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
+#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
+
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { unsigned32 _search = (_value); \
+ \
+ __asm__ volatile ( "scanbit %0,%1 " \
+ : "=d" (_search), "=d" (_output) \
+ : "0" (_search), "1" (_output) ); \
+ }
+
+/* end of Bitfield handler macros */
+
+/*
+ * Priority handler macros
+ *
+ * These macros perform the following functions:
+ * + return a mask with the bit for this major/minor portion of
+ * of thread priority set.
+ * + translate the bit number returned by "Bitfield_find_first_bit"
+ * into an index into the thread ready chain bit maps
+ */
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 0x8000 >> (_bit_number) )
+
+#define _CPU_Priority_bits_index( _priority ) \
+ ( 15 - (_priority) )
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Install_interrupt_stack
+ *
+ * This routine installs the hardware interrupt stack pointer.
+ */
+
+void _CPU_Install_interrupt_stack( void );
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner and avoid stack conflicts.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i960/cpu_asm.s b/c/src/exec/score/cpu/i960/cpu_asm.s
new file mode 100644
index 0000000000..eb11e14760
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/cpu_asm.s
@@ -0,0 +1,199 @@
+/* cpu_asm.s
+ *
+ * This file contains all assembly code for the i960CA implementation
+ * of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+ .text
+/*
+ * Format of i960ca Register structure
+ */
+
+.set REG_R0_PFP , 0 # (r0) Previous Frame Pointer
+.set REG_R1_SP , REG_R0_PFP+4 # (r1) Stack Pointer
+.set REG_PC , REG_R1_SP+4 # (pc) Processor Controls
+.set REG_G8 , REG_PC+4 # (g8) Global Register 8
+.set REG_G9 , REG_G8+4 # (g9) Global Register 9
+.set REG_G10 , REG_G9+4 # (g10) Global Register 10
+.set REG_G11 , REG_G10+4 # (g11) Global Register 11
+.set REG_G12 , REG_G11+4 # (g12) Global Register 12
+.set REG_G13 , REG_G12+4 # (g13) Global Register 13
+.set REG_G14 , REG_G13+4 # (g14) Global Register 14
+.set REG_G15_FP , REG_G14+4 # (g15) Global Register 15
+.set SIZE_REGS , REG_G15_FP+4 # size of cpu_context_registers
+ # structure
+
+/*
+ * void _CPU_Context_switch( run_context, heir_context )
+ *
+ * This routine performs a normal non-FP context.
+ */
+ .align 4
+ .globl __CPU_Context_switch
+
+__CPU_Context_switch:
+ modpc 0,0,g2 # get old intr level (PC)
+ st g2,REG_PC(g0) # save pc
+ stq g8,REG_G8(g0) # save g8-g11
+ stq g12,REG_G12(g0) # save g12-g15
+ stl pfp,REG_R0_PFP(g0) # save pfp, sp
+
+restore: flushreg # flush register cache
+ ldconst 0x001f0000,g2 # g2 = PC mask
+ ld REG_PC(g1),g3 # thread->Regs.pc = pc;
+ ldq REG_G12(g1),g12 # restore g12-g15
+ ldl REG_R0_PFP(g1),pfp # restore pfp, sp
+ ldq REG_G8(g1),g8 # restore g8-g11
+ modpc 0,g2,g3 # restore PC register
+ ret
+
+/*
+ * void _CPU_Context_restore( new_context )
+ *
+ * This routine performs a normal non-FP context.
+ */
+
+ .globl __CPU_Context_restore
+__CPU_Context_restore:
+ mov g0,g1 # g0 = _Thread_executing
+ b restore
+
+/*PAGE
+ * void _CPU_Context_save_fp_context( &fp_context_ptr )
+ * void _CPU_Context_restore_fp_context( &fp_context_ptr )
+ *
+ * There is currently no hardware floating point for the i960.
+ */
+
+ .globl __CPU_Context_save_fp
+ .globl __CPU_Context_restore_fp
+__CPU_Context_save_fp:
+__CPU_Context_restore_fp:
+#if ( I960_HAS_FPU == 1 )
+#error "Floating point support for i960 family has been implemented!!!"
+#endif
+ ret
+
+/*PAGE
+ * void __ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE:
+ * Upon entry, the supervisor stack will contain a stack frame
+ * back to the interrupted thread and the interrupt stack will contain
+ * an interrupt stack frame. If dispatching is enabled, this
+ * is the outer most interrupt, and (a context switch is necessary or
+ * the current thread has signals), then set up the supervisor stack to
+ * transfer control to the interrupt dispatcher.
+ */
+
+ .globl __ISR_Handler
+__ISR_Handler:
+ #ldconst 1,r8
+ #modpc 0,r8,r8 # enable tracing
+
+ # r4 = &_Thread_Dispatch_disable_level
+ ld __Thread_Dispatch_disable_level,r4
+ movl g0,r8 # save g0-g1
+
+ ld -16+8(fp),g0 # g0 = vector number
+ movl g2,r10 # save g2-g3
+
+ ld __ISR_Nest_level,r5 # r5 = &_Isr_nest_level
+ mov g14,r7 # save g14
+
+ lda 0,g14 # NOT Branch and Link
+ movl g4,r12 # save g4-g5
+
+ lda 1(r4),r4 # increment dispatch disable level
+ movl g6,r14 # save g6-g7
+
+ ld __ISR_Vector_table[g0*4],g1 # g1 = Users handler
+ addo 1,r5,r5 # increment ISR level
+
+ st r4,__Thread_Dispatch_disable_level
+ # one ISR nest level deeper
+ subo 1,r4,r4 # decrement dispatch disable level
+
+ st r5,__ISR_Nest_level # disable multitasking
+ subo 1,r5,r5 # decrement ISR nest level
+
+ callx (g1) # invoke user ISR
+
+ st r4,__Thread_Dispatch_disable_level
+ # unnest multitasking
+ st r5,__ISR_Nest_level # one less ISR nest level
+ cmpobne.f 0,r4,exit # If dispatch disabled, exit
+ ldl -16(fp),g0 # g0 = threads PC reg
+ # g1 = threads AC reg
+ ld __Context_Switch_necessary,r6
+ # r6 = Is thread switch necessary?
+ bbs.f 13,g0,exit # not outer level, then exit
+ cmpobne.f 0,r6,bframe # Switch necessary?
+
+ ld __ISR_Signals_to_thread_executing,g2
+ # signals sent to Run_thread
+ # while in interrupt handler?
+ cmpobe.f 0,g2,exit # No, then exit
+
+bframe: mov 0,g2
+ st g2,__ISR_Signals_to_thread_executing
+
+ ldconst 0x1f0000,g2 # g2 = intr disable mask
+ mov g2,g3 # g3 = new intr level
+ modpc 0,g2,g3 # set new level
+
+ andnot 7,pfp,r4 # r4 = pfp without ret type
+ flushreg # flush registers
+ # push _Isr_dispatch ret frame
+ # build ISF in r4-r6
+ ldconst 64,g2 # g2 = size of stack frame
+ ld 4(r4),g3 # g3 = previous sp
+ addo g2,g3,r5 # r5 = _Isr_dispatch SP
+ lda __ISR_Dispatch,r6 # r6 = _Isr_dispatch entry
+ stt r4,(g3) # set _Isr_dispatch ret info
+ st g1,16(g3) # set r4 = AC for ISR disp
+ or 7,g3,pfp # pfp to _Isr_dispatch
+
+exit: mov r7,g14 # restore g14
+ movq r8,g0 # restore g0-g3
+ movq r12,g4 # restore g4-g7
+ ret
+
+
+/*PAGE
+ *
+ * void __ISR_Dispatch()
+ *
+ * Entry point from the outermost interrupt service routine exit.
+ * The current stack is the supervisor mode stack.
+ */
+
+__ISR_Dispatch:
+ mov g14,r7
+ mov 0,g14
+ movq g0,r8
+ movq g4,r12
+ call __Thread_Dispatch
+
+ ldconst -1,r5 # r5 = reload mask
+ modac r5,r4,r4 # restore threads AC register
+ mov r7,g14
+ movq r8,g0
+ movq r12,g4
+ ret
diff --git a/c/src/exec/score/cpu/i960/i960.h b/c/src/exec/score/cpu/i960/i960.h
new file mode 100644
index 0000000000..5c8a570736
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/i960.h
@@ -0,0 +1,287 @@
+/* i960.h
+ *
+ * This include file contains information pertaining to the Intel
+ * i960 processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __i960_h
+#define __i960_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef i960
+#undef i960
+#endif
+#define i960
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This file contains the information required to build
+ * RTEMS for a particular member of the Intel i960
+ * family. It does this by setting variables to indicate
+ * which implementation dependent features are present
+ * in a particular member of the family.
+ *
+ * NOTE: For now i960 is really the i960ca. eventually need
+ * to put in at least support for FPU.
+ */
+
+#if defined(i960ca)
+
+#define CPU_MODEL_NAME "i960ca"
+#define I960_HAS_FPU 0
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "Intel i960"
+
+#ifndef ASM
+
+/*
+ * XXX should have an ifdef here and have stuff for the other
+ * XXX family members...
+ */
+
+#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
+
+/* i960CA control structures */
+
+/* Intel i960CA Control Table */
+
+typedef struct {
+ /* Control Group 0 */
+ unsigned int ipb0; /* IP breakpoint 0 */
+ unsigned int ipb1; /* IP breakpoint 1 */
+ unsigned int dab0; /* data address breakpoint 0 */
+ unsigned int dab1; /* data address breakpoint 1 */
+ /* Control Group 1 */
+ unsigned int imap0; /* interrupt map 0 */
+ unsigned int imap1; /* interrupt map 1 */
+ unsigned int imap2; /* interrupt map 2 */
+ unsigned int icon; /* interrupt control */
+ /* Control Group 2 */
+ unsigned int mcon0; /* memory region 0 configuration */
+ unsigned int mcon1; /* memory region 1 configuration */
+ unsigned int mcon2; /* memory region 2 configuration */
+ unsigned int mcon3; /* memory region 3 configuration */
+ /* Control Group 3 */
+ unsigned int mcon4; /* memory region 4 configuration */
+ unsigned int mcon5; /* memory region 5 configuration */
+ unsigned int mcon6; /* memory region 6 configuration */
+ unsigned int mcon7; /* memory region 7 configuration */
+ /* Control Group 4 */
+ unsigned int mcon8; /* memory region 8 configuration */
+ unsigned int mcon9; /* memory region 9 configuration */
+ unsigned int mcon10; /* memory region 10 configuration */
+ unsigned int mcon11; /* memory region 11 configuration */
+ /* Control Group 5 */
+ unsigned int mcon12; /* memory region 12 configuration */
+ unsigned int mcon13; /* memory region 13 configuration */
+ unsigned int mcon14; /* memory region 14 configuration */
+ unsigned int mcon15; /* memory region 15 configuration */
+ /* Control Group 6 */
+ unsigned int bpcon; /* breakpoint control */
+ unsigned int tc; /* trace control */
+ unsigned int bcon; /* bus configuration control */
+ unsigned int reserved; /* reserved */
+} i960ca_control_table;
+
+/* Intel i960CA Processor Control Block */
+
+typedef struct {
+ unsigned int *fault_tbl; /* fault table base address */
+ i960ca_control_table
+ *control_tbl; /* control table base address */
+ unsigned int initial_ac; /* AC register initial value */
+ unsigned int fault_config; /* fault configuration word */
+ void **intr_tbl; /* interrupt table base address */
+ void *sys_proc_tbl; /* system procedure table
+ base address */
+ unsigned int reserved; /* reserved */
+ unsigned int *intr_stack; /* interrupt stack pointer */
+ unsigned int ins_cache_cfg; /* instruction cache
+ configuration word */
+ unsigned int reg_cache_cfg; /* register cache configuration word */
+} i960ca_PRCB;
+
+#endif
+
+/*
+ * Interrupt Level Routines
+ */
+
+#define i960_disable_interrupts( oldlevel ) \
+ { (oldlevel) = 0x1f0000; \
+ asm volatile ( "modpc 0,%1,%1" \
+ : "=d" ((oldlevel)) \
+ : "0" ((oldlevel)) ); \
+ }
+
+#define i960_enable_interrupts( oldlevel ) \
+ { unsigned int _mask = 0x1f0000; \
+ asm volatile ( "modpc 0,%0,%1" \
+ : "=d" (_mask), "=d" ((oldlevel)) \
+ : "0" (_mask), "1" ((oldlevel)) ); \
+ }
+
+#define i960_flash_interrupts( oldlevel ) \
+ { unsigned int _mask = 0x1f0000; \
+ asm volatile ( "modpc 0,%0,%1 ; \
+ mov %0,%1 ; \
+ modpc 0,%0,%1" \
+ : "=d" (_mask), "=d" ((oldlevel)) \
+ : "0" (_mask), "1" ((oldlevel)) ); \
+ }
+
+#define i960_get_interrupt_level( _level ) \
+ { \
+ i960_disable_interrupts( _level ); \
+ i960_enable_interrupts( _level ); \
+ (_level) = ((_level) & 0x1f0000) >> 16; \
+ } while ( 0 )
+
+#define i960_atomic_modify( mask, addr, prev ) \
+ { register unsigned int _mask = (mask); \
+ register unsigned int *_addr = (unsigned int *)(addr); \
+ asm volatile( "atmod %0,%1,%1" \
+ : "=d" (_addr), "=d" (_mask) \
+ : "0" (_addr), "1" (_mask) ); \
+ (prev) = _mask; \
+ }
+
+
+#define atomic_modify( _mask, _address, _previous ) \
+ i960_atomic_modify( _mask, _address, _previous )
+
+#define i960_enable_tracing() \
+ { register unsigned int _pc = 0x1; \
+ asm volatile( "modpc 0,%0,%0" : "=d" (_pc) : "0" (_pc) ); \
+ }
+
+#define i960_unmask_intr( xint ) \
+ { register unsigned int _mask= (1<<(xint)); \
+ asm volatile( "or sf1,%0,sf1" : "=d" (_mask) : "0" (_mask) ); \
+ }
+
+#define i960_mask_intr( xint ) \
+ { register unsigned int _mask= (1<<(xint)); \
+ asm volatile( "andnot %0,sf1,sf1" : "=d" (_mask) : "0" (_mask) ); \
+ }
+
+#define i960_clear_intr( xint ) \
+ { register unsigned int _xint=(xint); \
+asm volatile( "loop_til_cleared: clrbit %0,sf0,sf0 ; \
+ bbs %0,sf0, loop_til_cleared" \
+ : "=d" (_xint) : "0" (_xint) ); \
+ }
+
+#define i960_reload_ctl_group( group ) \
+ { register int _cmd = ((group)|0x400) ; \
+ asm volatile( "sysctl %0,%0,%0" : "=d" (_cmd) : "0" (_cmd) ); \
+ }
+
+#define i960_cause_intr( intr ) \
+ { register int _intr = (intr); \
+ asm volatile( "sysctl %0,%0,%0" : "=d" (_intr) : "0" (_intr) ); \
+ }
+
+#define i960_soft_reset( prcb ) \
+ { register i960ca_PRCB *_prcb = (prcb); \
+ register unsigned int *_next=0; \
+ register unsigned int _cmd = 0x30000; \
+ asm volatile( "lda next,%1; \
+ sysctl %0,%1,%2; \
+ next: mov g0,g0" \
+ : "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
+ : "0" (_cmd), "1" (_next), "2" (_prcb) ); \
+ }
+
+static inline unsigned int i960_pend_intrs()
+{ register unsigned int _intr=0;
+ asm volatile( "mov sf0,%0" : "=d" (_intr) : "0" (_intr) );
+ return ( _intr );
+}
+
+static inline unsigned int i960_mask_intrs()
+{ register unsigned int _intr=0;
+ asm volatile( "mov sf1,%0" : "=d" (_intr) : "0" (_intr) );
+ return( _intr );
+}
+
+static inline unsigned int i960_get_fp()
+{ register unsigned int _fp=0;
+ asm volatile( "mov fp,%0" : "=d" (_fp) : "0" (_fp) );
+ return ( _fp );
+}
+
+/*
+ * The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ *
+ * This version is based on code presented in Vol. 4, No. 4 of
+ * Insight 960. It is certainly something you wouldn't think
+ * of on your own.
+ */
+
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+)
+{
+ register unsigned int to_swap = value;
+ register unsigned int temp = 0xFF00FF00;
+ register unsigned int swapped = 0;
+
+ /* to_swap swapped */
+ asm volatile ( "rotate 16,%0,%2 ;" /* 0x12345678 0x56781234 */
+ "modify %1,%0,%2 ;" /* 0x12345678 0x12785634 */
+ "rotate 8,%2,%2" /* 0x12345678 0x78563412 */
+ : "=r" (to_swap), "=r" (temp), "=r" (swapped)
+ : "0" (to_swap), "1" (temp), "2" (swapped)
+ );
+ return( swapped );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i960/i960types.h b/c/src/exec/score/cpu/i960/i960types.h
new file mode 100644
index 0000000000..281230928b
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/i960types.h
@@ -0,0 +1,58 @@
+/* i960types.h
+ *
+ * This include file contains type definitions pertaining to the Intel
+ * i960 processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __i960_TYPES_h
+#define __i960_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned32 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void i960_isr;
+
+typedef void ( *i960_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/i960/rtems.s b/c/src/exec/score/cpu/i960/rtems.s
new file mode 100644
index 0000000000..8abf47a276
--- /dev/null
+++ b/c/src/exec/score/cpu/i960/rtems.s
@@ -0,0 +1,25 @@
+/* rtems.s
+ *
+ * This file contains the single entry point code for
+ * the i960 implementation of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+ .text
+
+ .align 4
+ .globl RTEMS
+
+RTEMS:
+ ld __Entry_points[g7*4],r4
+ bx (r4)
+
diff --git a/c/src/exec/score/cpu/m68k/asm.h b/c/src/exec/score/cpu/m68k/asm.h
new file mode 100644
index 0000000000..4c53980d51
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/asm.h
@@ -0,0 +1,129 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __M68k_ASM_h
+#define __M68k_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/m68k.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define d0 REG (d0)
+#define d1 REG (d1)
+#define d2 REG (d2)
+#define d3 REG (d3)
+#define d4 REG (d4)
+#define d5 REG (d5)
+#define d6 REG (d6)
+#define d7 REG (d7)
+#define a0 REG (a0)
+#define a1 REG (a1)
+#define a2 REG (a2)
+#define a3 REG (a3)
+#define a4 REG (a4)
+#define a5 REG (a5)
+#define a6 REG (a6)
+#define a7 REG (a7)
+
+#define msp REG (msp)
+#define usp REG (usp)
+#define isp REG (isp)
+#define sr REG (sr)
+#define vbr REG (vbr)
+#define dfc REG (dfc)
+
+#define fp0 REG (fp0)
+#define fp1 REG (fp1)
+#define fp2 REG (fp2)
+#define fp3 REG (fp3)
+#define fp4 REG (fp4)
+#define fp5 REG (fp5)
+#define fp6 REG (fp6)
+#define fp7 REG (fp7)
+
+#define fpc REG (fpc)
+#define fpi REG (fpi)
+#define fps REG (fps)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/c/src/exec/score/cpu/m68k/cpu.c b/c/src/exec/score/cpu/m68k/cpu.c
new file mode 100644
index 0000000000..f57fae6685
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/cpu.c
@@ -0,0 +1,144 @@
+/*
+ * Motorola MC68xxx Dependent Source
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - entry pointer to thread dispatcher
+ *
+ * OUTPUT PARAMETERS: NONE
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ _CPU_Table = *cpu_table;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ m68k_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr *interrupt_table = NULL;
+
+ m68k_get_vbr( interrupt_table );
+
+#if ( M68K_HAS_VBR == 1)
+ *old_handler = interrupt_table[ vector ];
+ interrupt_table[ vector ] = new_handler;
+#else
+ *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10);
+ *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler;
+#endif /* M68K_HAS_VBR */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * new_handler - replacement ISR for this vector number
+ * old_handler - former ISR for this vector number
+ *
+ * Output parameters: NONE
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ void *isp = _CPU_Interrupt_stack_high;
+
+ asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) );
+#else
+#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!"
+#endif
+}
+
+#if ( M68K_HAS_BFFFO != 1 )
+/*
+ * Returns table for duplication of the BFFFO instruction (16 bits only)
+ */
+const unsigned char __BFFFOtable[256] = {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
diff --git a/c/src/exec/score/cpu/m68k/cpu.h b/c/src/exec/score/cpu/m68k/cpu.h
new file mode 100644
index 0000000000..b0bf094cee
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/cpu.h
@@ -0,0 +1,484 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the Motorola
+ * m68xxx processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * If defined, this causes some of the macros to initialize their
+ * variables to zero before doing inline assembly. This gets rid
+ * of compile time warnings at the cost of a little execution time
+ * in some time critical routines.
+ */
+
+#define NO_UNINITIALIZED_WARNINGS
+
+#include <rtems/score/m68k.h>
+#ifndef ASM
+#include <rtems/score/m68ktypes.h>
+#endif
+
+/* conditional compilation parameters */
+
+#define CPU_INLINE_ENABLE_DISPATCH TRUE
+#define CPU_UNROLL_ENQUEUE_PRIORITY FALSE
+
+/*
+ * Use the m68k's hardware interrupt stack support and have the
+ * interrupt manager allocate the memory for it.
+ *
+ * NOTE: The definitions when M68K_HAS_SEPARATE_STACKS is 0 should
+ * change when the software interrupt stack support is implemented.
+ */
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1)
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK TRUE
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+#else
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
+#define CPU_ALLOCATE_INTERRUPT_STACK FALSE
+#endif
+
+/*
+ * Some family members have no FP, some have an FPU such as the
+ * MC68881/MC68882 for the MC68020, others have it built in (MC68030, 040).
+ */
+
+#if ( M68K_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+/*
+ * All tasks are not by default floating point tasks on this CPU.
+ * The IDLE task does not have a floating point context on this CPU.
+ * It is safe to use the deferred floating point context switch
+ * algorithm on this CPU.
+ */
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+#define CPU_IDLE_TASK_IS_FP FALSE
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#define CPU_STACK_GROWS_UP FALSE
+#define CPU_STRUCTURE_ALIGNMENT
+
+/* structures */
+
+/*
+ * Basic integer context for the m68k family.
+ */
+
+typedef struct {
+ unsigned32 sr; /* (sr) status register */
+ unsigned32 d2; /* (d2) data register 2 */
+ unsigned32 d3; /* (d3) data register 3 */
+ unsigned32 d4; /* (d4) data register 4 */
+ unsigned32 d5; /* (d5) data register 5 */
+ unsigned32 d6; /* (d6) data register 6 */
+ unsigned32 d7; /* (d7) data register 7 */
+ void *a2; /* (a2) address register 2 */
+ void *a3; /* (a3) address register 3 */
+ void *a4; /* (a4) address register 4 */
+ void *a5; /* (a5) address register 5 */
+ void *a6; /* (a6) address register 6 */
+ void *a7_msp; /* (a7) master stack pointer */
+} Context_Control;
+
+/*
+ * FP context save area for the M68881/M68882 numeric coprocessors.
+ */
+
+typedef struct {
+ unsigned8 fp_save_area[332]; /* 216 bytes for FSAVE/FRESTORE */
+ /* 96 bytes for FMOVEM FP0-7 */
+ /* 12 bytes for FMOVEM CREGS */
+ /* 4 bytes for non-null flag */
+} Context_Control_fp;
+
+/*
+ * The following structure defines the set of information saved
+ * on the current stack by RTEMS upon receipt of each interrupt.
+ */
+
+typedef struct {
+ unsigned32 TBD; /* XXX Fix for this CPU */
+} CPU_Interrupt_frame;
+
+/*
+ * The following table contains the information required to configure
+ * the m68k specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+ m68k_isr *interrupt_vector_table;
+} rtems_cpu_table;
+
+/* variables */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+ /* points to jsr-exception-table in targets wo/ VBR register */
+extern char _VBR[];
+
+/* constants */
+
+/*
+ * This defines the number of levels and the mask used to pick those
+ * bits out of a thread mode.
+ */
+
+#define CPU_MODES_INTERRUPT_LEVEL 0x00000007 /* interrupt level in mode */
+#define CPU_MODES_INTERRUPT_MASK 0x00000007 /* interrupt level in mode */
+
+/*
+ * context size area for floating point
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/*
+ * extra stack required by the MPCI receive server thread
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024
+
+/*
+ * m68k family supports 256 distinct vectors.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Minimum size of a thread's stack.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE 2048
+
+/*
+ * m68k is pretty tolerant of alignment. Just put things on 4 byte boundaries.
+ */
+
+#define CPU_ALIGNMENT 4
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * On m68k thread stacks require no further alignment after allocation
+ * from the Workspace.
+ */
+
+#define CPU_STACK_ALIGNMENT 0
+
+/* macros */
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + disable all maskable CPU interrupts
+ * + restore previous interrupt level (enable)
+ * + temporarily restore interrupts (flash)
+ * + set a particular level
+ */
+
+#define _CPU_ISR_Disable( _level ) \
+ m68k_disable_interrupts( _level )
+
+#define _CPU_ISR_Enable( _level ) \
+ m68k_enable_interrupts( _level )
+
+#define _CPU_ISR_Flash( _level ) \
+ m68k_flash_interrupts( _level )
+
+#define _CPU_ISR_Set_level( _newlevel ) \
+ m68k_set_interrupt_level( _newlevel )
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/*
+ * Context handler macros
+ *
+ * These macros perform the following functions:
+ * + initialize a context area
+ * + restart the current thread
+ * + calculate the initial pointer into a FP context area
+ * + initialize an FP context area
+ */
+
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point, _is_fp ) \
+ do { \
+ void *_stack; \
+ \
+ (_the_context)->sr = 0x3000 | ((_isr) << 8); \
+ _stack = (void *)(_stack_base) + (_size) - 4; \
+ (_the_context)->a7_msp = _stack; \
+ *(void **)_stack = (_entry_point); \
+ } while ( 0 )
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ { asm volatile( "movew %0,%%sr ; " \
+ "moval %1,%%a7 ; " \
+ "rts" \
+ : "=d" ((_the_context)->sr), "=d" ((_the_context)->a7_msp) \
+ : "0" ((_the_context)->sr), "1" ((_the_context)->a7_msp) ); \
+ }
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ((void *) \
+ _Addresses_Add_offset( \
+ (_base), \
+ (_offset) + CPU_CONTEXT_FP_SIZE - 4 \
+ ) \
+ )
+
+#define _CPU_Context_Initialize_fp( _fp_area ) \
+ { unsigned32 *_fp_context = (unsigned32 *)*(_fp_area); \
+ \
+ *(--(_fp_context)) = 0; \
+ *(_fp_area) = (unsigned8 *)(_fp_context); \
+ }
+
+/* end of Context handler macros */
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ { asm volatile( "movl %0,%%d0; " \
+ "orw #0x0700,%%sr; " \
+ "stop #0x2700" : "=d" ((_error)) : "0" ((_error)) ); \
+ }
+
+/* end of Fatal Error manager macros */
+
+/*
+ * Bitfield handler macros
+ *
+ * These macros perform the following functions:
+ * + scan for the highest numbered (MSB) set in a 16 bit bitfield
+ *
+ * NOTE:
+ *
+ * It appears that on the M68020 bitfield are always 32 bits wide
+ * when in a register. This code forces the bitfield to be in
+ * memory (it really always is anyway). This allows us to
+ * have a real 16 bit wide bitfield which operates "correctly."
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
+#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
+
+#if ( M68K_HAS_BFFFO == 1 )
+#ifdef NO_UNINITIALIZED_WARNINGS
+
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ register void *__base = (void *)&(_value); \
+ \
+ (_output) = 0; /* avoids warnings */ \
+ asm volatile( "bfffo (%0),#0,#16,%1" \
+ : "=a" (__base), "=d" ((_output)) \
+ : "0" (__base), "1" ((_output)) ) ; \
+ }
+#else
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ register void *__base = (void *)&(_value); \
+ \
+ asm volatile( "bfffo (%0),#0,#16,%1" \
+ : "=a" (__base), "=d" ((_output)) \
+ : "0" (__base), "1" ((_output)) ) ; \
+ }
+#endif
+
+#else
+
+/* duplicates BFFFO results for 16 bits (i.e., 15-(_priority) in
+ _CPU_Priority_bits_index is not needed), handles the 0 case, and
+ does not molest _value -- jsg */
+#if ( M68K_HAS_EXTB_L == 1 )
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ extern const unsigned char __BFFFOtable[256]; \
+ register int dumby; \
+ \
+ asm volatile ( " move.w %2,%1\n" \
+ " lsr.w #8,%1\n" \
+ " beq.s 1f\n" \
+ " move.b (%3,%1.w),%0\n" \
+ " extb.l %0\n" \
+ " bra.s 0f\n" \
+ "1: moveq.l #8,%0\n" \
+ " add.b (%3,%2.w),%0\n" \
+ "0:\n" \
+ : "=&d" ((_output)), "=&d" ((dumby)) \
+ : "d" ((_value)), "ao" ((__BFFFOtable)) \
+ : "cc" ) ; \
+ }
+#else
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ extern const unsigned char __BFFFOtable[256]; \
+ register int dumby; \
+ \
+ asm volatile ( " move.w %2,%1\n" \
+ " lsr.w #8,%1\n" \
+ " beq.s 1f\n" \
+ " move.b (%3,%1.w),%0\n" \
+ " and.l #0x000000ff,%0\n"\
+ " bra.s 0f\n" \
+ "1: moveq.l #8,%0\n" \
+ " add.b (%3,%2.w),%0\n" \
+ "0:\n" \
+ : "=&d" ((_output)), "=&d" ((dumby)) \
+ : "d" ((_value)), "ao" ((__BFFFOtable)) \
+ : "cc" ) ; \
+ }
+#endif /* M68K_HAS_EXTB_L */
+
+#endif
+
+/* end of Bitfield handler macros */
+
+/*
+ * Priority handler macros
+ *
+ * These macros perform the following functions:
+ * + return a mask with the bit for this major/minor portion of
+ * of thread priority set.
+ * + translate the bit number returned by "Bitfield_find_first_bit"
+ * into an index into the thread ready chain bit maps
+ */
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 0x8000 >> (_bit_number) )
+
+#define _CPU_Priority_bits_index( _priority ) \
+ (_priority)
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Install_interrupt_stack
+ *
+ * This routine installs the hardware interrupt stack pointer.
+ */
+
+void _CPU_Install_interrupt_stack( void );
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/m68k/cpu_asm.s b/c/src/exec/score/cpu/m68k/cpu_asm.s
new file mode 100644
index 0000000000..8cce6e5ca5
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/cpu_asm.s
@@ -0,0 +1,243 @@
+/* cpu_asm.s
+ *
+ * This file contains all assembly code for the MC68020 implementation
+ * of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <asm.h>
+
+ .text
+
+/* void _CPU_Context_switch( run_context, heir_context )
+ *
+ * This routine performs a normal non-FP context.
+ */
+
+ .align 4
+ .global SYM (_CPU_Context_switch)
+
+.set RUNCONTEXT_ARG, 4 | save context argument
+.set HEIRCONTEXT_ARG, 8 | restore context argument
+
+SYM (_CPU_Context_switch):
+ moval a7@(RUNCONTEXT_ARG),a0| a0 = running thread context
+ movw sr,d1 | d1 = status register
+ movml d1-d7/a2-a7,a0@ | save context
+
+ moval a7@(HEIRCONTEXT_ARG),a0| a0 = heir thread context
+restore: movml a0@,d1-d7/a2-a7 | restore context
+ movw d1,sr | restore status register
+ rts
+
+/*PAGE
+ * void __CPU_Context_save_fp_context( &fp_context_ptr )
+ * void __CPU_Context_restore_fp_context( &fp_context_ptr )
+ *
+ * These routines are used to context switch a MC68881 or MC68882.
+ *
+ * NOTE: Context save and restore code is based upon the code shown
+ * on page 6-38 of the MC68881/68882 Users Manual (rev 1).
+ *
+ * CPU_FP_CONTEXT_SIZE is higher than expected to account for the
+ * -1 pushed at end of this sequence.
+ */
+
+.set FPCONTEXT_ARG, 4 | save FP context argument
+
+ .align 4
+ .global SYM (_CPU_Context_save_fp)
+SYM (_CPU_Context_save_fp):
+#if ( M68K_HAS_FPU == 1 )
+ moval a7@(FPCONTEXT_ARG),a1 | a1 = &ptr to context area
+ moval a1@,a0 | a0 = Save context area
+ fsave a0@- | save 68881/68882 state frame
+ tstb a0@ | check for a null frame
+ beq nosv | Yes, skip save of user model
+ fmovem fp0-fp7,a0@- | save data registers (fp0-fp7)
+ fmovem fpc/fps/fpi,a0@- | and save control registers
+ movl #-1,a0@- | place not-null flag on stack
+nosv: movl a0,a1@ | save pointer to saved context
+#endif
+ rts
+
+ .align 4
+ .global SYM (_CPU_Context_restore_fp)
+SYM (_CPU_Context_restore_fp):
+#if ( M68K_HAS_FPU == 1 )
+ moval a7@(FPCONTEXT_ARG),a1 | a1 = &ptr to context area
+ moval a1@,a0 | a0 = address of saved context
+ tstb a0@ | Null context frame?
+ beq norst | Yes, skip fp restore
+ addql #4,a0 | throwaway non-null flag
+ fmovem a0@+,fpc/fps/fpi | restore control registers
+ fmovem a0@+,fp0-fp7 | restore data regs (fp0-fp7)
+norst: frestore a0@+ | restore the fp state frame
+ movl a0,a1@ | save pointer to saved context
+#endif
+ rts
+
+/*PAGE
+ * void _ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ * NOTE:
+ * Upon entry, the master stack will contain an interrupt stack frame
+ * back to the interrupted thread and the interrupt stack will contain
+ * a throwaway interrupt stack frame. If dispatching is enabled, this
+ * is the outer most interrupt, and (a context switch is necessary or
+ * the current thread has signals), then set up the master stack to
+ * transfer control to the interrupt dispatcher.
+ */
+
+/* m68000 notes:
+ *
+ * with this approach, lower interrupts (1-5 for efi68k) may
+ * execute twice if a higher priority interrupt is
+ * acknowledged before _Thread_Dispatch_disable is
+ * increamented and the higher priority interrupt
+ * preforms a context switch after executing. The lower
+ * priority intterrupt will execute (1) at the end of the
+ * higher priority interrupt in the new context if
+ * permitted by the new interrupt level mask, and (2) when
+ * the original context regains the cpu.
+ *
+ * XXX: Code for switching to a software maintained interrupt stack is
+ * not in place.
+ */
+
+#if ( M68K_HAS_VBR == 1)
+.set SR_OFFSET, 0 | Status register offset
+.set PC_OFFSET, 2 | Program Counter offset
+.set FVO_OFFSET, 6 | Format/vector offset
+#else
+.set JSR_OFFSET, 0 | return address from jsr table
+.set SR_OFFSET, 4
+.set PC_OFFSET, 6
+#endif /* M68K_HAS_VBR */
+
+.set SAVED, 16 | space for saved registers
+
+ .align 4
+ .global SYM (_ISR_Handler)
+
+SYM (_ISR_Handler):
+ addql #1,SYM (_ISR_Nest_level) | one nest level deeper
+ addql #1,SYM (_Thread_Dispatch_disable_level) | disable multitasking
+ moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1
+
+/*
+ * NOTE FOR CPUs WITHOUT HARDWARE INTERRUPT STACK:
+ *
+ * After the interrupted codes registers have been saved, it is save
+ * to switch to the software maintained interrupt stack.
+ */
+
+#if ( M68K_HAS_VBR == 0)
+ movel a7@(SAVED+JSR_OFFSET),d0 | assume the exception table at 0x0000
+ addql #6,d0 | points to a jump table (jsr) in RAM
+ subl #_VBR,d0 | VBR is the location of the jump table
+ divs #3,d0
+ lsll #1,d0
+ extl d0
+#else
+ movew a7@(SAVED+FVO_OFFSET),d0 | d0 = F/VO
+ andl #0x0fff,d0 | d0 = vector offset in vbr
+#endif
+
+#if ( M68K_HAS_PREINDEXING == 1 )
+ movel @( SYM (_ISR_Vector_table),d0:w:1),a0| fetch the ISR
+#else
+ movel # SYM (_ISR_Vector_table),a0 | a0 = base of RTEMS table
+ addal d0,a0 | a0 = address of vector
+ movel (a0),a0 | a0 = address of user routine
+#endif
+
+ lsrl #2,d0 | d0 = vector number
+ movel d0,a7@- | push vector number
+ jbsr a0@ | invoke the user ISR
+ addql #4,a7 | remove vector number
+
+/*
+ * The following entry should be unnecessary once the support is
+ * in place to know what vector we got on a 68000 core.
+ */
+
+ subql #1,SYM (_ISR_Nest_level) | one less nest level
+ subql #1,SYM (_Thread_Dispatch_disable_level)
+ | unnest multitasking
+ bne exit | If dispatch disabled, exit
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ movew #0xf000,d0 | isolate format nibble
+ andw a7@(SAVED+FVO_OFFSET),d0 | get F/VO
+ cmpiw #0x1000,d0 | is it a throwaway isf?
+ bne exit | NOT outer level, so branch
+#endif
+
+ tstl SYM (_Context_Switch_necessary)
+ | Is thread switch necessary?
+ bne bframe | Yes, invoke dispatcher
+
+ tstl SYM (_ISR_Signals_to_thread_executing)
+ | signals sent to Run_thread
+ | while in interrupt handler?
+ beq exit | No, then exit
+
+
+bframe: clrl SYM (_ISR_Signals_to_thread_executing)
+ | If sent, will be processed
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ movec msp,a0 | a0 = master stack pointer
+ movew #0,a0@- | push format word
+ movel # SYM (_ISR_Dispatch),a0@- | push return addr
+ movew a0@(6+SR_OFFSET),a0@- | push thread sr
+ movec a0,msp | set master stack pointer
+#else
+
+ movew a7@(16+SR_OFFSET),sr
+ jsr SYM (_Thread_Dispatch)
+
+#endif
+
+exit: moveml a7@+,d0-d1/a0-a1 | restore d0-d1,a0-a1
+#if ( M68K_HAS_VBR == 0)
+ addql #4,a7 | pop vector address
+#endif /* M68K_HAS_VBR */
+ rte | return to thread
+ | OR _Isr_dispatch
+
+/*PAGE
+ * void _ISR_Dispatch()
+ *
+ * Entry point from the outermost interrupt service routine exit.
+ * The current stack is the supervisor mode stack if this processor
+ * has separate stacks.
+ *
+ * 1. save all registers not preserved across C calls.
+ * 2. invoke the _Thread_Dispatch routine to switch tasks
+ * or a signal to the currently executing task.
+ * 3. restore all registers not preserved across C calls.
+ * 4. return from interrupt
+ */
+
+ .global SYM (_ISR_Dispatch)
+SYM (_ISR_Dispatch):
+ movml d0-d1/a0-a1,a7@-
+ jsr SYM (_Thread_Dispatch)
+ movml a7@+,d0-d1/a0-a1
+#if ( M68K_HAS_VBR == 0)
+ addql #4,a7 | pop vector address
+#endif /* M68K_HAS_VBR */
+ rte
diff --git a/c/src/exec/score/cpu/m68k/m68302.h b/c/src/exec/score/cpu/m68k/m68302.h
new file mode 100644
index 0000000000..da96478cf3
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/m68302.h
@@ -0,0 +1,608 @@
+/*
+ *------------------------------------------------------------------
+ *
+ * m68302.h - Definitions for Motorola MC68302 processor.
+ *
+ * Section references in this file refer to revision 2 of Motorola's
+ * "MC68302 Integrated Multiprotocol Processor User's Manual".
+ * (Motorola document MC68302UM/AD REV 2.)
+ *
+ * Based on Don Meyer's cpu68302.h that was posted in comp.sys.m68k
+ * on 17 February, 1993.
+ *
+ * Copyright 1995 David W. Glessner.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *
+ * $Id$
+ *
+ *------------------------------------------------------------------
+ */
+
+#ifndef __MOTOROLA_MC68302_DEFINITIONS_h
+#define __MOTOROLA_MC68302_DEFINITIONS_h
+
+/*
+ * BAR - Base Address Register
+ * Section 2.7
+ */
+#define M302_BAR (*((volatile rtems_unsigned16 *) 0xf2))
+
+/*
+ * SCR - System Control Register
+ * Section 3.8.1
+ */
+#define M302_SCR (*((volatile rtems_unsigned32 *) 0xf4))
+/*
+ * SCR bits
+ */
+#define RBIT_SCR_IPA 0x08000000
+#define RBIT_SCR_HWT 0x04000000
+#define RBIT_SCR_WPV 0x02000000
+#define RBIT_SCR_ADC 0x01000000
+
+#define RBIT_SCR_ERRE 0x00400000
+#define RBIT_SCR_VGE 0x00200000
+#define RBIT_SCR_WPVE 0x00100000
+#define RBIT_SCR_RMCST 0x00080000
+#define RBIT_SCR_EMWS 0x00040000
+#define RBIT_SCR_ADCE 0x00020000
+#define RBIT_SCR_BCLM 0x00010000
+
+#define RBIT_SCR_FRZW 0x00008000
+#define RBIT_SCR_FRZ2 0x00004000
+#define RBIT_SCR_FRZ1 0x00002000
+#define RBIT_SCR_SAM 0x00001000
+#define RBIT_SCR_HWDEN 0x00000800
+#define RBIT_SCR_HWDCN2 0x00000400
+#define RBIT_SCR_HWDCN1 0x00000200
+#define RBIT_SCR_HWDCN0 0x00000100
+
+#define RBIT_SCR_LPREC 0x00000080
+#define RBIT_SCR_LPP16 0x00000040
+#define RBIT_SCR_LPEN 0x00000020
+#define RBIT_SCR_LPCLKDIV 0x0000001f
+
+
+/*
+ * 68000 interrupt and trap vector numbers
+ */
+#define M68K_IVEC_BUS_ERROR 2
+#define M68K_IVEC_ADDRESS_ERROR 3
+#define M68K_IVEC_ILLEGAL_OPCODE 4
+#define M68K_IVEC_ZERO_DIVIDE 5
+#define M68K_IVEC_CHK 6
+#define M68K_IVEC_TRAPV 7
+#define M68K_IVEC_PRIVILEGE 8
+#define M68K_IVEC_TRACE 9
+#define M68K_IVEC_LINE_A 10
+#define M68K_IVEC_LINE_F 11
+/* Unassigned, Reserved 12-14 */
+#define M68K_IVEC_UNINITIALIZED_INT 15
+/* Unassigned, Reserved 16-23 */
+#define M68K_IVEC_SPURIOUS_INT 24
+
+#define M68K_IVEC_LEVEL1_AUTOVECTOR 25
+#define M68K_IVEC_LEVEL2_AUTOVECTOR 26
+#define M68K_IVEC_LEVEL3_AUTOVECTOR 27
+#define M68K_IVEC_LEVEL4_AUTOVECTOR 28
+#define M68K_IVEC_LEVEL5_AUTOVECTOR 29
+#define M68K_IVEC_LEVEL6_AUTOVECTOR 30
+#define M68K_IVEC_LEVEL7_AUTOVECTOR 31
+
+#define M68K_IVEC_TRAP0 32
+#define M68K_IVEC_TRAP1 33
+#define M68K_IVEC_TRAP2 34
+#define M68K_IVEC_TRAP3 35
+#define M68K_IVEC_TRAP4 36
+#define M68K_IVEC_TRAP5 37
+#define M68K_IVEC_TRAP6 38
+#define M68K_IVEC_TRAP7 39
+#define M68K_IVEC_TRAP8 40
+#define M68K_IVEC_TRAP9 41
+#define M68K_IVEC_TRAP10 42
+#define M68K_IVEC_TRAP11 43
+#define M68K_IVEC_TRAP12 44
+#define M68K_IVEC_TRAP13 45
+#define M68K_IVEC_TRAP14 46
+#define M68K_IVEC_TRAP15 47
+/*
+ * Unassigned, Reserved 48-59
+ *
+ * Note: Vectors 60-63 are used by the MC68302 (e.g. BAR, SCR).
+ */
+
+/*
+ * MC68302 Interrupt Vectors
+ * Section 3.2
+ */
+enum m68302_ivec_e {
+ M302_IVEC_ERR =0,
+ M302_IVEC_PB8 =1, /* General-Purpose Interrupt 0 */
+ M302_IVEC_SMC2 =2,
+ M302_IVEC_SMC1 =3,
+ M302_IVEC_TIMER3 =4,
+ M302_IVEC_SCP =5,
+ M302_IVEC_TIMER2 =6,
+ M302_IVEC_PB9 =7, /* General-Purpose Interrupt 1 */
+ M302_IVEC_SCC3 =8,
+ M302_IVEC_TIMER1 =9,
+ M302_IVEC_SCC2 =10,
+ M302_IVEC_IDMA =11,
+ M302_IVEC_SDMA =12, /* SDMA Channels Bus Error */
+ M302_IVEC_SCC1 =13,
+ M302_IVEC_PB10 =14, /* General-Purpose Interrupt 2 */
+ M302_IVEC_PB11 =15, /* General-Purpose Interrupt 3 */
+ M302_IVEC_IRQ1 =17, /* External Device */
+ M302_IVEC_IRQ6 =22, /* External Device */
+ M302_IVEC_IRQ7 =23 /* External Device */
+};
+
+
+/*
+ * GIMR - Global Interrupt Mode Register
+ * Section 3.2.5.1
+ */
+#define RBIT_GIMR_MOD (1<<15)
+#define RBIT_GIMR_IV7 (1<<14)
+#define RBIT_GIMR_IV6 (1<<13)
+#define RBIT_GIMR_IV1 (1<<12)
+#define RBIT_GIMR_ET7 (1<<10)
+#define RBIT_GIMR_ET6 (1<<9)
+#define RBIT_GIMR_ET1 (1<<8)
+#define RBIT_GIMR_VECTOR (7<<5)
+
+/*
+ * IPR - Interrupt Pending Register (Section 3.2.5.2)
+ * IMR - Interrupt Mask Register (Section 3.2.5.3)
+ * ISR - Interrupt In-Service Register (Section 3.2.5.4)
+ */
+#define RBIT_IPR_PB11 (1<<15)
+#define RBIT_IPR_PB10 (1<<14)
+#define RBIT_IPR_SCC1 (1<<13)
+#define RBIT_IPR_SDMA (1<<12)
+#define RBIT_IPR_IDMA (1<<11)
+#define RBIT_IPR_SCC2 (1<<10)
+#define RBIT_IPR_TIMER1 (1<<9)
+#define RBIT_IPR_SCC3 (1<<8)
+#define RBIT_IPR_PB9 (1<<7)
+#define RBIT_IPR_TIMER2 (1<<6)
+#define RBIT_IPR_SCP (1<<5)
+#define RBIT_IPR_TIMER3 (1<<4)
+#define RBIT_IPR_SMC1 (1<<3)
+#define RBIT_IPR_SMC2 (1<<2)
+#define RBIT_IPR_PB8 (1<<1)
+#define RBIT_IPR_ERR (1<<0)
+
+#define RBIT_ISR_PB11 (1<<15)
+#define RBIT_ISR_PB10 (1<<14)
+#define RBIT_ISR_SCC1 (1<<13)
+#define RBIT_ISR_SDMA (1<<12)
+#define RBIT_ISR_IDMA (1<<11)
+#define RBIT_ISR_SCC2 (1<<10)
+#define RBIT_ISR_TIMER1 (1<<9)
+#define RBIT_ISR_SCC3 (1<<8)
+#define RBIT_ISR_PB9 (1<<7)
+#define RBIT_ISR_TIMER2 (1<<6)
+#define RBIT_ISR_SCP (1<<5)
+#define RBIT_ISR_TIMER3 (1<<4)
+#define RBIT_ISR_SMC1 (1<<3)
+#define RBIT_ISR_SMC2 (1<<2)
+#define RBIT_ISR_PB8 (1<<1)
+
+#define RBIT_IMR_PB11 (1<<15) /* PB11 Interrupt Mask */
+#define RBIT_IMR_PB10 (1<<14) /* PB10 Interrupt Mask */
+#define RBIT_IMR_SCC1 (1<<13) /* SCC1 Interrupt Mask */
+#define RBIT_IMR_SDMA (1<<12) /* SDMA Interrupt Mask */
+#define RBIT_IMR_IDMA (1<<11) /* IDMA Interrupt Mask */
+#define RBIT_IMR_SCC2 (1<<10) /* SCC2 Interrupt Mask */
+#define RBIT_IMR_TIMER1 (1<<9) /* TIMER1 Interrupt Mask */
+#define RBIT_IMR_SCC3 (1<<8) /* SCC3 Interrupt Mask */
+#define RBIT_IMR_PB9 (1<<7) /* PB9 Interrupt Mask */
+#define RBIT_IMR_TIMER2 (1<<6) /* TIMER2 Interrupt Mask */
+#define RBIT_IMR_SCP (1<<5) /* SCP Interrupt Mask */
+#define RBIT_IMR_TIMER3 (1<<4) /* TIMER3 Interrupt Mask */
+#define RBIT_IMR_SMC1 (1<<3) /* SMC1 Interrupt Mask */
+#define RBIT_IMR_SMC2 (1<<2) /* SMC2 Interrupt Mask */
+#define RBIT_IMR_PB8 (1<<1) /* PB8 Interrupt Mask */
+
+
+/*
+ * DRAM Refresh
+ * Section 3.9
+ *
+ * The DRAM refresh memory map replaces the SCC2 Tx BD 6 and Tx BD 7
+ * structures in the parameter RAM.
+ *
+ * Access to the DRAM registers can be accomplished by
+ * the following approach:
+ *
+ * volatile m302_DRAM_refresh_t *dram;
+ * dram = (volatile m302_DRAM_refresh_t *) &m302.scc2.bd.tx[6];
+ *
+ * Then simply use pointer references (e.g. dram->count = 3).
+ */
+typedef struct {
+ rtems_unsigned16 dram_high; /* DRAM high address and FC */
+ rtems_unsigned16 dram_low; /* DRAM low address */
+ rtems_unsigned16 increment; /* increment step (bytes/row) */
+ rtems_unsigned16 count; /* RAM refresh cycle count (#rows) */
+ rtems_unsigned16 t_ptr_h; /* temporary refresh high addr & FC */
+ rtems_unsigned16 t_ptr_l; /* temporary refresh low address */
+ rtems_unsigned16 t_count; /* temporary refresh cycles count */
+ rtems_unsigned16 res; /* reserved */
+} m302_DRAM_refresh_t;
+
+
+/*
+ * TMR - Timer Mode Register (for timers 1 and 2)
+ * Section 3.5.2.1
+ */
+#define RBIT_TMR_ICLK_STOP (0<<1)
+#define RBIT_TMR_ICLK_MASTER (1<<1)
+#define RBIT_TMR_ICLK_MASTER16 (2<<1)
+#define RBIT_TMR_ICLK_TIN (3<<1)
+
+#define RBIT_TMR_OM (1<<5)
+#define RBIT_TMR_ORI (1<<4)
+#define RBIT_TMR_FRR (1<<3)
+#define RBIT_TMR_RST (1<<0)
+
+
+/*
+ * TER - Timer Event Register (for timers 1 and 2)
+ * Section 3.5.2.5
+ */
+#define RBIT_TER_REF (1<<1) /* Output Reference Event */
+#define RBIT_TER_CAP (1<<0) /* Capture Event */
+
+
+/*
+ * SCC Buffer Descriptors and Buffer Descriptors Table
+ * Section 4.5.5
+ */
+typedef struct m302_SCC_bd {
+ rtems_unsigned16 status; /* status and control */
+ rtems_unsigned16 length; /* data length */
+ rtems_unsigned8 *buffer; /* data buffer pointer */
+} m302_SCC_bd_t;
+
+typedef struct {
+ m302_SCC_bd_t rx[8]; /* receive buffer descriptors */
+ m302_SCC_bd_t tx[8]; /* transmit buffer descriptors */
+} m302_SCC_bd_table_t;
+
+
+/*
+ * SCC Parameter RAM (offset 0x080 from an SCC Base)
+ * Section 4.5.6
+ *
+ * Each SCC parameter RAM area begins at offset 0x80 from each SCC base
+ * area (0x400, 0x500, or 0x600 from the dual-port RAM base).
+ *
+ * Offsets 0x9c-0xbf from each SCC base area compose the protocol-specific
+ * portion of the SCC parameter RAM.
+ */
+typedef struct {
+ rtems_unsigned8 rfcr; /* Rx Function Code */
+ rtems_unsigned8 tfcr; /* Tx Function Code */
+ rtems_unsigned16 mrblr; /* Maximum Rx Buffer Length */
+ rtems_unsigned16 _rstate; /* Rx Internal State */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 rbd; /* Rx Internal Buffer Number */
+ rtems_unsigned32 _rdptr; /* Rx Internal Data Pointer */
+ rtems_unsigned16 _rcount; /* Rx Internal Byte Count */
+ rtems_unsigned16 _rtmp; /* Rx Temp */
+ rtems_unsigned16 _tstate; /* Tx Internal State */
+ rtems_unsigned8 res7;
+ rtems_unsigned8 tbd; /* Tx Internal Buffer Number */
+ rtems_unsigned32 _tdptr; /* Tx Internal Data Pointer */
+ rtems_unsigned16 _tcount; /* Tx Internal Byte Count */
+ rtems_unsigned16 _ttmp; /* Tx Temp */
+} m302_SCC_parameters_t;
+
+/*
+ * UART-Specific SCC Parameter RAM
+ * Section 4.5.11.3
+ */
+typedef struct {
+ rtems_unsigned16 max_idl; /* Maximum IDLE Characters (rx) */
+ rtems_unsigned16 idlc; /* Temporary rx IDLE counter */
+ rtems_unsigned16 brkcr; /* Break Count Register (tx) */
+ rtems_unsigned16 parec; /* Receive Parity Error Counter */
+ rtems_unsigned16 frmec; /* Receive Framing Error Counter */
+ rtems_unsigned16 nosec; /* Receive Noise Counter */
+ rtems_unsigned16 brkec; /* Receive Break Condition Counter */
+ rtems_unsigned16 uaddr1; /* UART ADDRESS Character 1 */
+ rtems_unsigned16 uaddr2; /* UART ADDRESS Character 2 */
+ rtems_unsigned16 rccr; /* Receive Control Character Register */
+ rtems_unsigned16 character[8]; /* Control Characters 1 through 8*/
+} m302_SCC_UartSpecific_t;
+/*
+ * This definition allows for the checking of receive buffers
+ * for errors.
+ */
+
+#define RCV_ERR 0x003F
+
+/*
+ * UART receive buffer descriptor bit definitions.
+ * Section 4.5.11.14
+ */
+#define RBIT_UART_CTRL (1<<11) /* buffer contains a control char */
+#define RBIT_UART_ADDR (1<<10) /* first byte contains an address */
+#define RBIT_UART_MATCH (1<<9) /* indicates which addr char matched */
+#define RBIT_UART_IDLE (1<<8) /* buffer closed due to IDLE sequence */
+#define RBIT_UART_BR (1<<5) /* break sequence was received */
+#define RBIT_UART_FR (1<<4) /* framing error was received */
+#define RBIT_UART_PR (1<<3) /* parity error was received */
+#define RBIT_UART_OV (1<<1) /* receiver overrun occurred */
+#define RBIT_UART_CD (1<<0) /* carrier detect lost */
+#define RBIT_UART_STATUS 0x003B /* all status bits */
+
+/*
+ * UART transmit buffer descriptor bit definitions.
+ * Section 4.5.11.15
+ */
+#define RBIT_UART_CR (1<<11) /* clear-to-send report
+ * this results in two idle bits
+ * between back-to-back frames
+ */
+#define RBIT_UART_A (1<<10) /* buffer contains address characters
+ * only valid in multidrop mode (UM0=1)
+ */
+#define RBIT_UART_PREAMBLE (1<<9) /* send preamble before data */
+#define RBIT_UART_CTS_LOST (1<<0) /* CTS lost */
+
+/*
+ * UART event register
+ * Section 4.5.11.16
+ */
+#define M302_UART_EV_CTS (1<<7) /* CTS status changed */
+#define M302_UART_EV_CD (1<<6) /* carrier detect status changed */
+#define M302_UART_EV_IDL (1<<5) /* IDLE sequence status changed */
+#define M302_UART_EV_BRK (1<<4) /* break character was received */
+#define M302_UART_EV_CCR (1<<3) /* control character received */
+#define M302_UART_EV_TX (1<<1) /* buffer has been transmitted */
+#define M302_UART_EV_RX (1<<0) /* buffer has been received */
+
+
+/*
+ * HDLC-Specific SCC Parameter RAM
+ * Section 4.5.12.3
+ *
+ * c_mask_l should be 0xF0B8 for 16-bit CRC, 0xdebb for 32-bit CRC
+ * c_mask_h is a don't care for 16-bit CRC, 0x20E2 for 32-bit CRC
+ */
+typedef struct {
+ rtems_unsigned16 rcrc_l; /* Temp Receive CRC Low */
+ rtems_unsigned16 rcrc_h; /* Temp Receive CRC High */
+ rtems_unsigned16 c_mask_l; /* CRC Mask Low */
+ rtems_unsigned16 c_mask_h; /* CRC Mask High */
+ rtems_unsigned16 tcrc_l; /* Temp Transmit CRC Low */
+ rtems_unsigned16 tcrc_h; /* Temp Transmit CRC High */
+
+ rtems_unsigned16 disfc; /* Discard Frame Counter */
+ rtems_unsigned16 crcec; /* CRC Error Counter */
+ rtems_unsigned16 abtsc; /* Abort Sequence Counter */
+ rtems_unsigned16 nmarc; /* Nonmatching Address Received Cntr */
+ rtems_unsigned16 retrc; /* Frame Retransmission Counter */
+
+ rtems_unsigned16 mflr; /* Maximum Frame Length Register */
+ rtems_unsigned16 max_cnt; /* Maximum_Length Counter */
+
+ rtems_unsigned16 hmask; /* User Defined Frame Address Mask */
+ rtems_unsigned16 haddr1; /* User Defined Frame Address */
+ rtems_unsigned16 haddr2; /* " */
+ rtems_unsigned16 haddr3; /* " */
+ rtems_unsigned16 haddr4; /* " */
+} m302_SCC_HdlcSpecific_t;
+/*
+ * HDLC receiver buffer descriptor bit definitions
+ * Section 4.5.12.10
+ */
+#define RBIT_HDLC_EMPTY_BIT 0x8000 /* buffer associated with BD is empty */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in a frame */
+#define RBIT_HDLC_FIRST_BIT 0x0400 /* buffer is first in a frame */
+#define RBIT_HDLC_FRAME_LEN 0x0020 /* receiver frame length violation */
+#define RBIT_HDLC_NONOCT_Rx 0x0010 /* received non-octet aligned frame */
+#define RBIT_HDLC_ABORT_SEQ 0x0008 /* received abort sequence */
+#define RBIT_HDLC_CRC_ERROR 0x0004 /* frame contains a CRC error */
+#define RBIT_HDLC_OVERRUN 0x0002 /* receiver overrun occurred */
+#define RBIT_HDLC_CD_LOST 0x0001 /* carrier detect lost */
+
+/*
+ * HDLC transmit buffer descriptor bit definitions
+ * Section 4.5.12.11
+ */
+#define RBIT_HDLC_READY_BIT 0x8000 /* buffer is ready to transmit */
+#define RBIT_HDLC_EXT_BUFFER 0x4000 /* buffer is in external memory */
+#define RBIT_HDLC_WRAP_BIT 0x2000 /* last buffer in bd table, so wrap */
+#define RBIT_HDLC_WAKE_UP 0x1000 /* interrupt when buffer serviced */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in the frame */
+#define RBIT_HDLC_TxCRC_BIT 0x0400 /* transmit a CRC sequence */
+#define RBIT_HDLC_UNDERRUN 0x0002 /* transmitter underrun */
+#define RBIT_HDLC_CTS_LOST 0x0001 /* CTS lost */
+
+/*
+ * HDLC event register bit definitions
+ * Section 4.5.12.12
+ */
+#define RBIT_HDLC_CTS 0x80 /* CTS status changed */
+#define RBIT_HDLC_CD 0x40 /* carrier detect status changed */
+#define RBIT_HDLC_IDL 0x20 /* IDLE sequence status changed */
+#define RBIT_HDLC_TXE 0x10 /* transmit error */
+#define RBIT_HDLC_RXF 0x08 /* received frame */
+#define RBIT_HDLC_BSY 0x04 /* frame rcvd and discarded due to
+ * lack of buffers
+ */
+#define RBIT_HDLC_TXB 0x02 /* buffer has been transmitted */
+#define RBIT_HDLC_RXB 0x01 /* received buffer */
+
+
+
+typedef struct {
+ m302_SCC_bd_table_t bd; /* +000 Buffer Descriptor Table */
+ m302_SCC_parameters_t parm; /* +080 Common Parameter RAM */
+ union { /* +09C Protocol-Specific Parm RAM */
+ m302_SCC_UartSpecific_t uart;
+ m302_SCC_HdlcSpecific_t hdlc;
+ } prot;
+ rtems_unsigned8 res[0x040]; /* +0C0 reserved, (not implemented) */
+} m302_SCC_t;
+
+
+/*
+ * Common SCC Registers
+ */
+typedef struct {
+ rtems_unsigned16 res1;
+ rtems_unsigned16 scon; /* SCC Configuration Register 4.5.2 */
+ rtems_unsigned16 scm; /* SCC Mode Register 4.5.3 */
+ rtems_unsigned16 dsr; /* SCC Data Synchronization Register 4.5.4 */
+ rtems_unsigned8 scce; /* SCC Event Register 4.5.8.1 */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 sccm; /* SCC Mask Register 4.5.8.2 */
+ rtems_unsigned8 res3;
+ rtems_unsigned8 sccs; /* SCC Status Register 4.5.8.3 */
+ rtems_unsigned8 res4;
+ rtems_unsigned16 res5;
+} m302_SCC_Registers_t;
+
+/*
+ * SCON - SCC Configuration Register
+ * Section 4.5.2
+ */
+#define RBIT_SCON_WOMS (1<<15) /* Wired-OR Mode Select (NMSI mode only)
+ * When set, the TXD driver is an
+ * open-drain output */
+#define RBIT_SCON_EXTC (1<<14) /* External Clock Source */
+#define RBIT_SCON_TCS (1<<13) /* Transmit Clock Source */
+#define RBIT_SCON_RCS (1<<12) /* Receive Clock Source */
+
+/*
+ * SCM - SCC Mode Register bit definitions
+ * Section 4.5.3
+ * The parameter-specific mode bits occupy bits 15 through 6.
+ */
+#define RBIT_SCM_ENR (1<<3) /* Enable receiver */
+#define RBIT_SCM_ENT (1<<2) /* Enable transmitter */
+
+
+/*
+ * Internal MC68302 Registers
+ * starts at offset 0x800 from dual-port RAM base
+ * Section 2.8
+ */
+typedef struct {
+ /* offset +800 */
+ rtems_unsigned16 res0;
+ rtems_unsigned16 cmr; /* IDMA Channel Mode Register */
+ rtems_unsigned32 sapr; /* IDMA Source Address Pointer */
+ rtems_unsigned32 dapr; /* IDMA Destination Address Pointer */
+ rtems_unsigned16 bcr; /* IDMA Byte Count Register */
+ rtems_unsigned8 csr; /* IDMA Channel Status Register */
+ rtems_unsigned8 res1;
+ rtems_unsigned8 fcr; /* IDMA Function Code Register */
+ rtems_unsigned8 res2;
+
+ /* offset +812 */
+ rtems_unsigned16 gimr; /* Global Interrupt Mode Register */
+ rtems_unsigned16 ipr; /* Interrupt Pending Register */
+ rtems_unsigned16 imr; /* Interrupt Mask Register */
+ rtems_unsigned16 isr; /* Interrupt In-Service Register */
+ rtems_unsigned16 res3;
+ rtems_unsigned16 res4;
+
+ /* offset +81e */
+ rtems_unsigned16 pacnt; /* Port A Control Register */
+ rtems_unsigned16 paddr; /* Port A Data Direction Register */
+ rtems_unsigned16 padat; /* Port A Data Register */
+ rtems_unsigned16 pbcnt; /* Port B Control Register */
+ rtems_unsigned16 pbddr; /* Port B Data Direction Register */
+ rtems_unsigned16 pbdat; /* Port B Data Register */
+ rtems_unsigned16 res5;
+
+ /* offset +82c */
+ rtems_unsigned16 res6;
+ rtems_unsigned16 res7;
+ rtems_unsigned16 br0; /* Base Register (CS0) */
+ rtems_unsigned16 or0; /* Option Register (CS0) */
+ rtems_unsigned16 br1; /* Base Register (CS1) */
+ rtems_unsigned16 or1; /* Option Register (CS1) */
+ rtems_unsigned16 br2; /* Base Register (CS2) */
+ rtems_unsigned16 or2; /* Option Register (CS2) */
+ rtems_unsigned16 br3; /* Base Register (CS3) */
+ rtems_unsigned16 or3; /* Option Register (CS3) */
+
+ /* offset +840 */
+ rtems_unsigned16 tmr1; /* Timer Unit 1 Mode Register */
+ rtems_unsigned16 trr1; /* Timer Unit 1 Reference Register */
+ rtems_unsigned16 tcr1; /* Timer Unit 1 Capture Register */
+ rtems_unsigned16 tcn1; /* Timer Unit 1 Counter */
+ rtems_unsigned8 res8;
+ rtems_unsigned8 ter1; /* Timer Unit 1 Event Register */
+ rtems_unsigned16 wrr; /* Watchdog Reference Register */
+ rtems_unsigned16 wcn; /* Watchdog Counter */
+ rtems_unsigned16 res9;
+ rtems_unsigned16 tmr2; /* Timer Unit 2 Mode Register */
+ rtems_unsigned16 trr2; /* Timer Unit 2 Reference Register */
+ rtems_unsigned16 tcr2; /* Timer Unit 2 Capture Register */
+ rtems_unsigned16 tcn2; /* Timer Unit 2 Counter */
+ rtems_unsigned8 resa;
+ rtems_unsigned8 ter2; /* Timer Unit 2 Event Register */
+ rtems_unsigned16 resb;
+ rtems_unsigned16 resc;
+ rtems_unsigned16 resd;
+
+ /* offset +860 */
+ rtems_unsigned8 cr; /* Command Register */
+ rtems_unsigned8 rese[0x1f];
+
+ /* offset +880, +890, +8a0 */
+ m302_SCC_Registers_t scc[3]; /* SCC1, SCC2, SCC3 Registers */
+
+ /* offset +8b0 */
+ rtems_unsigned16 spmode; /* SCP,SMC Mode and Clock Cntrl Reg */
+ rtems_unsigned16 simask; /* Serial Interface Mask Register */
+ rtems_unsigned16 simode; /* Serial Interface Mode Register */
+} m302_internalReg_t ;
+
+
+/*
+ * MC68302 dual-port RAM structure.
+ * (Includes System RAM, Parameter RAM, and Internal Registers).
+ * Section 2.8
+ */
+typedef struct {
+ rtems_unsigned8 mem[0x240]; /* +000 User Data Memory */
+ rtems_unsigned8 res1[0x1c0]; /* +240 reserved, (not implemented) */
+ m302_SCC_t scc1; /* +400 SCC1 */
+ m302_SCC_t scc2; /* +500 SCC2 */
+ m302_SCC_t scc3; /* +600 SCC3 */
+ rtems_unsigned8 res2[0x100]; /* +700 reserved, (not implemented) */
+ m302_internalReg_t reg; /* +800 68302 Internal Registers */
+} m302_dualPortRAM_t;
+
+
+/*
+ * Declare the variable that's used to reference the variables in
+ * the dual-port RAM.
+ */
+extern volatile m302_dualPortRAM_t m302;
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/m68k/m68360.h b/c/src/exec/score/cpu/m68k/m68360.h
new file mode 100644
index 0000000000..84687c49fa
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/m68360.h
@@ -0,0 +1,880 @@
+/*
+ **************************************************************************
+ **************************************************************************
+ ** **
+ ** MOTOROLA MC68360 QUAD INTEGRATED COMMUNICATIONS CONTROLLER (QUICC) **
+ ** **
+ ** HARDWARE DECLARATIONS **
+ ** **
+ ** **
+ ** Submitted By: **
+ ** **
+ ** W. Eric Norum **
+ ** Saskatchewan Accelerator Laboratory **
+ ** University of Saskatchewan **
+ ** 107 North Road **
+ ** Saskatoon, Saskatchewan, CANADA **
+ ** S7N 5C6 **
+ ** **
+ ** eric@skatter.usask.ca **
+ ** **
+ ** $Id$ **
+ ** **
+ **************************************************************************
+ **************************************************************************
+ */
+
+#ifndef __MC68360_h
+#define __MC68360_h
+
+/*
+ *************************************************************************
+ * REGISTER SUBBLOCKS *
+ *************************************************************************
+ */
+
+/*
+ * Memory controller registers
+ */
+typedef struct m360MEMCRegisters_ {
+ rtems_unsigned32 br;
+ rtems_unsigned32 or;
+ rtems_unsigned32 _pad[2];
+} m360MEMCRegisters_t;
+
+/*
+ * Serial Communications Controller registers
+ */
+typedef struct m360SCCRegisters_ {
+ rtems_unsigned32 gsmr_l;
+ rtems_unsigned32 gsmr_h;
+ rtems_unsigned16 psmr;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 todr;
+ rtems_unsigned16 dsr;
+ rtems_unsigned16 scce;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned16 sccm;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned8 sccs;
+ rtems_unsigned32 _pad3[2];
+} m360SCCRegisters_t;
+
+/*
+ * Serial Management Controller registers
+ */
+typedef struct m360SMCRegisters_ {
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 smcmr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned8 smce;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned16 _pad3;
+ rtems_unsigned8 smcm;
+ rtems_unsigned8 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SMCRegisters_t;
+
+
+/*
+ *************************************************************************
+ * Miscellaneous Parameters *
+ *************************************************************************
+ */
+typedef struct m360MiscParms_ {
+ rtems_unsigned16 rev_num;
+ rtems_unsigned16 _res1;
+ rtems_unsigned32 _res2;
+ rtems_unsigned32 _res3;
+} m360MiscParms_t;
+
+/*
+ *************************************************************************
+ * RISC Timers *
+ *************************************************************************
+ */
+typedef struct m360TimerParms_ {
+ rtems_unsigned16 tm_base;
+ rtems_unsigned16 _tm_ptr;
+ rtems_unsigned16 _r_tmr;
+ rtems_unsigned16 _r_tmv;
+ rtems_unsigned32 tm_cmd;
+ rtems_unsigned32 tm_cnt;
+} m360TimerParms_t;
+
+/*
+ * RISC Controller Configuration Register (RCCR)
+ * All other bits in this register are either reserved or
+ * used only with a Motorola-supplied RAM microcode packge.
+ */
+#define M360_RCCR_TIME (1<<15) /* Enable timer */
+#define M360_RCCR_TIMEP(x) ((x)<<8) /* Timer period */
+
+/*
+ * Command register
+ * Set up this register before issuing a M360_CR_OP_SET_TIMER command.
+ */
+#define M360_TM_CMD_V (1<<31) /* Set to enable timer */
+#define M360_TM_CMD_R (1<<30) /* Set for automatic restart */
+#define M360_TM_CMD_TIMER(x) ((x)<<16) /* Select timer */
+#define M360_TM_CMD_PERIOD(x) (x) /* Timer period (16 bits) */
+
+/*
+ *************************************************************************
+ * DMA Controllers *
+ *************************************************************************
+ */
+typedef struct m360IDMAparms_ {
+ rtems_unsigned16 ibase;
+ rtems_unsigned16 ibptr;
+ rtems_unsigned32 _istate;
+ rtems_unsigned32 _itemp;
+} m360IDMAparms_t;
+
+/*
+ *************************************************************************
+ * Serial Communication Controllers *
+ *************************************************************************
+ */
+typedef struct m360SCCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ } un;
+} m360SCCparms_t;
+
+typedef struct m360SCCENparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ struct {
+ rtems_unsigned32 c_pres;
+ rtems_unsigned32 c_mask;
+ rtems_unsigned32 crcec;
+ rtems_unsigned32 alec;
+ rtems_unsigned32 disfc;
+ rtems_unsigned16 pads;
+ rtems_unsigned16 ret_lim;
+ rtems_unsigned16 _ret_cnt;
+ rtems_unsigned16 mflr;
+ rtems_unsigned16 minflr;
+ rtems_unsigned16 maxd1;
+ rtems_unsigned16 maxd2;
+ rtems_unsigned16 _maxd;
+ rtems_unsigned16 dma_cnt;
+ rtems_unsigned16 _max_b;
+ rtems_unsigned16 gaddr1;
+ rtems_unsigned16 gaddr2;
+ rtems_unsigned16 gaddr3;
+ rtems_unsigned16 gaddr4;
+ rtems_unsigned32 _tbuf0data0;
+ rtems_unsigned32 _tbuf0data1;
+ rtems_unsigned32 _tbuf0rba0;
+ rtems_unsigned32 _tbuf0crc;
+ rtems_unsigned16 _tbuf0bcnt;
+ rtems_unsigned16 paddr_h;
+ rtems_unsigned16 paddr_m;
+ rtems_unsigned16 paddr_l;
+ rtems_unsigned16 p_per;
+ rtems_unsigned16 _rfbd_ptr;
+ rtems_unsigned16 _tfbd_ptr;
+ rtems_unsigned16 _tlbd_ptr;
+ rtems_unsigned32 _tbuf1data0;
+ rtems_unsigned32 _tbuf1data1;
+ rtems_unsigned32 _tbuf1rba0;
+ rtems_unsigned32 _tbuf1crc;
+ rtems_unsigned16 _tbuf1bcnt;
+ rtems_unsigned16 _tx_len;
+ rtems_unsigned16 iaddr1;
+ rtems_unsigned16 iaddr2;
+ rtems_unsigned16 iaddr3;
+ rtems_unsigned16 iaddr4;
+ rtems_unsigned16 _boff_cnt;
+ rtems_unsigned16 taddr_l;
+ rtems_unsigned16 taddr_m;
+ rtems_unsigned16 taddr_h;
+ } ethernet;
+ } un;
+} m360SCCENparms_t;
+
+/*
+ * Receive and transmit function code register bits
+ * These apply to the function code registers of all devices, not just SCC.
+ */
+#define M360_RFCR_MOT (1<<4)
+#define M360_RFCR_DMA_SPACE 0x8
+#define M360_TFCR_MOT (1<<4)
+#define M360_TFCR_DMA_SPACE 0x8
+
+/*
+ *************************************************************************
+ * Serial Management Controllers *
+ *************************************************************************
+ */
+typedef struct m360SMCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ union {
+ struct {
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 _r_mask;
+ } uart;
+ struct {
+ rtems_unsigned16 _pad0[5];
+ } transparent;
+ } un;
+} m360SMCparms_t;
+
+/*
+ * Mode register
+ */
+#define M360_SMCMR_CLEN(x) ((x)<<11) /* Character length */
+#define M360_SMCMR_2STOP (1<<10) /* 2 stop bits */
+#define M360_SMCMR_PARITY (1<<9) /* Enable parity */
+#define M360_SMCMR_EVEN (1<<8) /* Even parity */
+#define M360_SMCMR_SM_GCI (0<<4) /* GCI Mode */
+#define M360_SMCMR_SM_UART (2<<4) /* UART Mode */
+#define M360_SMCMR_SM_TRANSPARENT (3<<4) /* Transparent Mode */
+#define M360_SMCMR_DM_LOOPBACK (1<<2) /* Local loopback mode */
+#define M360_SMCMR_DM_ECHO (2<<2) /* Echo mode */
+#define M360_SMCMR_TEN (1<<1) /* Enable transmitter */
+#define M360_SMCMR_REN (1<<0) /* Enable receiver */
+
+/*
+ * Event and mask registers (SMCE, SMCM)
+ */
+#define M360_SMCE_BRK (1<<4)
+#define M360_SMCE_BSY (1<<2)
+#define M360_SMCE_TX (1<<1)
+#define M360_SMCE_RX (1<<0)
+
+/*
+ *************************************************************************
+ * Serial Peripheral Interface *
+ *************************************************************************
+ */
+typedef struct m360SPIparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SPIparms_t;
+
+/*
+ * Mode register (SPMODE)
+ */
+#define M360_SPMODE_LOOP (1<<14) /* Local loopback mode */
+#define M360_SPMODE_CI (1<<13) /* Clock invert */
+#define M360_SPMODE_CP (1<<12) /* Clock phase */
+#define M360_SPMODE_DIV16 (1<<11) /* Divide BRGCLK by 16 */
+#define M360_SPMODE_REV (1<<10) /* Reverse data */
+#define M360_SPMODE_MASTER (1<<9) /* SPI is master */
+#define M360_SPMODE_EN (1<<8) /* Enable SPI */
+#define M360_SPMODE_CLEN(x) ((x)<<4) /* Character length */
+#define M360_SPMODE_PM(x) (x) /* Prescaler modulus */
+
+/*
+ * Mode register (SPCOM)
+ */
+#define M360_SPCOM_STR (1<<7) /* Start transmit */
+
+/*
+ * Event and mask registers (SPIE, SPIM)
+ */
+#define M360_SPIE_MME (1<<5) /* Multi-master error */
+#define M360_SPIE_TXE (1<<4) /* Tx error */
+#define M360_SPIE_BSY (1<<2) /* Busy condition*/
+#define M360_SPIE_TXB (1<<1) /* Tx buffer */
+#define M360_SPIE_RXB (1<<0) /* Rx buffer */
+
+/*
+ *************************************************************************
+ * SDMA (SCC, SMC, SPI) Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360BufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 length;
+ volatile void *buffer;
+} m360BufferDescriptor_t;
+
+/*
+ * Bits in receive buffer descriptor status word
+ */
+#define M360_BD_EMPTY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_WRAP (1<<13) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_INTERRUPT (1<<12) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_LAST (1<<11) /* Ethernet, SPI */
+#define M360_BD_CONTROL_CHAR (1<<11) /* SCC UART */
+#define M360_BD_FIRST_IN_FRAME (1<<10) /* Ethernet */
+#define M360_BD_ADDRESS (1<<10) /* SCC UART */
+#define M360_BD_CONTINUOUS (1<<9) /* SCC UART, SMC UART, SPI */
+#define M360_BD_MISS (1<<8) /* Ethernet */
+#define M360_BD_IDLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_ADDRSS_MATCH (1<<7) /* SCC UART */
+#define M360_BD_LONG (1<<5) /* Ethernet */
+#define M360_BD_BREAK (1<<5) /* SCC UART, SMC UART */
+#define M360_BD_NONALIGNED (1<<4) /* Ethernet */
+#define M360_BD_FRAMING_ERROR (1<<4) /* SCC UART, SMC UART */
+#define M360_BD_SHORT (1<<3) /* Ethernet */
+#define M360_BD_PARITY_ERROR (1<<3) /* SCC UART, SMC UART */
+#define M360_BD_CRC_ERROR (1<<2) /* Ethernet */
+#define M360_BD_OVERRUN (1<<1) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_COLLISION (1<<0) /* Ethernet */
+#define M360_BD_CARRIER_LOST (1<<0) /* SCC UART */
+#define M360_BD_MASTER_ERROR (1<<0) /* SPI */
+
+/*
+ * Bits in transmit buffer descriptor status word
+ * Many bits have the same meaning as those in receiver buffer descriptors.
+ */
+#define M360_BD_READY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_PAD (1<<14) /* Ethernet */
+#define M360_BD_CTS_REPORT (1<<11) /* SCC UART */
+#define M360_BD_TX_CRC (1<<10) /* Ethernet */
+#define M360_BD_DEFER (1<<9) /* Ethernet */
+#define M360_BD_HEARTBEAT (1<<8) /* Ethernet */
+#define M360_BD_PREAMBLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_LATE_COLLISION (1<<7) /* Ethernet */
+#define M360_BD_NO_STOP_BIT (1<<7) /* SCC UART */
+#define M360_BD_RETRY_LIMIT (1<<6) /* Ethernet */
+#define M360_BD_RETRY_COUNT(x) (((x)&0x3C)>>2) /* Ethernet */
+#define M360_BD_UNDERRUN (1<<1) /* Ethernet, SPI */
+#define M360_BD_CARRIER_LOST (1<<0) /* Ethernet */
+#define M360_BD_CTS_LOST (1<<0) /* SCC UART */
+
+/*
+ *************************************************************************
+ * IDMA Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360IDMABufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 _pad;
+ rtems_unsigned32 length;
+ void *source;
+ void *destination;
+} m360IDMABufferDescriptor_t;
+
+/*
+ *************************************************************************
+ * RISC Communication Processor Module Command Register (CR) *
+ *************************************************************************
+ */
+#define M360_CR_RST (1<<15) /* Reset communication processor */
+#define M360_CR_OP_INIT_RX_TX (0<<8) /* SCC, SMC UART, SMC GCI, SPI */
+#define M360_CR_OP_INIT_RX (1<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_TX (2<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_HUNT (3<<8) /* SCC, SMC UART */
+#define M360_CR_OP_STOP_TX (4<<8) /* SCC, SMC UART */
+#define M360_CR_OP_GR_STOP_TX (5<<8) /* SCC */
+#define M360_CR_OP_INIT_IDMA (5<<8) /* IDMA */
+#define M360_CR_OP_RESTART_TX (6<<8) /* SCC, SMC UART */
+#define M360_CR_OP_CLOSE_RX_BD (7<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_SET_GRP_ADDR (8<<8) /* SCC */
+#define M360_CR_OP_SET_TIMER (8<<8) /* Timer */
+#define M360_CR_OP_GCI_TIMEOUT (9<<8) /* SMC GCI */
+#define M360_CR_OP_RESERT_BCS (10<<8) /* SCC */
+#define M360_CR_OP_GCI_ABORT (10<<8) /* SMC GCI */
+#define M360_CR_CHAN_SCC1 (0<<4) /* Channel selection */
+#define M360_CR_CHAN_SCC2 (4<<4)
+#define M360_CR_CHAN_SPI (5<<4)
+#define M360_CR_CHAN_TIMER (5<<4)
+#define M360_CR_CHAN_SCC3 (8<<4)
+#define M360_CR_CHAN_SMC1 (9<<4)
+#define M360_CR_CHAN_IDMA1 (9<<4)
+#define M360_CR_CHAN_SCC4 (12<<4)
+#define M360_CR_CHAN_SMC2 (13<<4)
+#define M360_CR_CHAN_IDMA2 (13<<4)
+#define M360_CR_FLG (1<<0) /* Command flag */
+
+/*
+ *************************************************************************
+ * System Protection Control Register (SYPCR) *
+ *************************************************************************
+ */
+#define M360_SYPCR_SWE (1<<7) /* Software watchdog enable */
+#define M360_SYPCR_SWRI (1<<6) /* Software watchdog reset select */
+#define M360_SYPCR_SWT1 (1<<5) /* Software watchdog timing bit 1 */
+#define M360_SYPCR_SWT0 (1<<4) /* Software watchdog timing bit 0 */
+#define M360_SYPCR_DBFE (1<<3) /* Double bus fault monitor enable */
+#define M360_SYPCR_BME (1<<2) /* Bus monitor external enable */
+#define M360_SYPCR_BMT1 (1<<1) /* Bus monitor timing bit 1 */
+#define M360_SYPCR_BMT0 (1<<0) /* Bus monitor timing bit 0 */
+
+/*
+ *************************************************************************
+ * Memory Control Registers *
+ *************************************************************************
+ */
+#define M360_GMR_RCNT(x) ((x)<<24) /* Refresh count */
+#define M360_GMR_RFEN (1<<23) /* Refresh enable */
+#define M360_GMR_RCYC(x) ((x)<<21) /* Refresh cycle length */
+#define M360_GMR_PGS(x) ((x)<<18) /* Page size */
+#define M360_GMR_DPS_32BIT (0<<16) /* DRAM port size */
+#define M360_GMR_DPS_16BIT (1<<16)
+#define M360_GMR_DPS_8BIT (2<<16)
+#define M360_GMR_DPS_DSACK (3<<16)
+#define M360_GMR_WBT40 (1<<15) /* Wait between 040 transfers */
+#define M360_GMR_WBTQ (1<<14) /* Wait between 360 transfers */
+#define M360_GMR_SYNC (1<<13) /* Synchronous external access */
+#define M360_GMR_EMWS (1<<12) /* External master wait state */
+#define M360_GMR_OPAR (1<<11) /* Odd parity */
+#define M360_GMR_PBEE (1<<10) /* Parity bus error enable */
+#define M360_GMR_TSS40 (1<<9) /* TS* sample for 040 */
+#define M360_GMR_NCS (1<<8) /* No CPU space */
+#define M360_GMR_DWQ (1<<7) /* Delay write for 360 */
+#define M360_GMR_DW40 (1<<6) /* Delay write for 040 */
+#define M360_GMR_GAMX (1<<5) /* Global address mux enable */
+
+#define M360_MEMC_BR_FC(x) ((x)<<7) /* Function code limit */
+#define M360_MEMC_BR_TRLXQ (1<<6) /* Relax timing requirements */
+#define M360_MEMC_BR_BACK40 (1<<5) /* Burst acknowledge to 040 */
+#define M360_MEMC_BR_CSNT40 (1<<4) /* CS* negate timing for 040 */
+#define M360_MEMC_BR_CSNTQ (1<<3) /* CS* negate timing for 360 */
+#define M360_MEMC_BR_PAREN (1<<2) /* Enable parity checking */
+#define M360_MEMC_BR_WP (1<<1) /* Write Protect */
+#define M360_MEMC_BR_V (1<<0) /* Base/Option register are valid */
+
+#define M360_MEMC_OR_TCYC(x) ((x)<<28) /* Cycle length (clocks) */
+#define M360_MEMC_OR_WAITS(x) M360_MEMC_OR_TCYC((x)+1)
+#define M360_MEMC_OR_2KB 0x0FFFF800 /* Address range */
+#define M360_MEMC_OR_4KB 0x0FFFF000
+#define M360_MEMC_OR_8KB 0x0FFFE000
+#define M360_MEMC_OR_16KB 0x0FFFC000
+#define M360_MEMC_OR_32KB 0x0FFF8000
+#define M360_MEMC_OR_64KB 0x0FFF0000
+#define M360_MEMC_OR_128KB 0x0FFE0000
+#define M360_MEMC_OR_256KB 0x0FFC0000
+#define M360_MEMC_OR_512KB 0x0FF80000
+#define M360_MEMC_OR_1MB 0x0FF00000
+#define M360_MEMC_OR_2MB 0x0FE00000
+#define M360_MEMC_OR_4MB 0x0FC00000
+#define M360_MEMC_OR_8MB 0x0F800000
+#define M360_MEMC_OR_16MB 0x0F000000
+#define M360_MEMC_OR_32MB 0x0E000000
+#define M360_MEMC_OR_64MB 0x0C000000
+#define M360_MEMC_OR_128MB 0x08000000
+#define M360_MEMC_OR_256MB 0x00000000
+#define M360_MEMC_OR_FCMC(x) ((x)<<7) /* Function code mask */
+#define M360_MEMC_OR_BCYC(x) ((x)<<5) /* Burst cycle length (clocks) */
+#define M360_MEMC_OR_PGME (1<<3) /* Page mode enable */
+#define M360_MEMC_OR_32BIT (0<<1) /* Port size */
+#define M360_MEMC_OR_16BIT (1<<1)
+#define M360_MEMC_OR_8BIT (2<<1)
+#define M360_MEMC_OR_DSACK (3<<1)
+#define M360_MEMC_OR_DRAM (1<<0) /* Dynamic RAM select */
+
+/*
+ *************************************************************************
+ * SI Mode Register (SIMODE) *
+ *************************************************************************
+ */
+#define M360_SI_SMC2_BITS 0xFFFF0000 /* All SMC2 bits */
+#define M360_SI_SMC2_TDM (1<<31) /* Multiplexed SMC2 */
+#define M360_SI_SMC2_BRG1 (0<<28) /* SMC2 clock souce */
+#define M360_SI_SMC2_BRG2 (1<<28)
+#define M360_SI_SMC2_BRG3 (2<<28)
+#define M360_SI_SMC2_BRG4 (3<<28)
+#define M360_SI_SMC2_CLK5 (0<<28)
+#define M360_SI_SMC2_CLK6 (1<<28)
+#define M360_SI_SMC2_CLK7 (2<<28)
+#define M360_SI_SMC2_CLK8 (3<<28)
+#define M360_SI_SMC1_BITS 0x0000FFFF /* All SMC1 bits */
+#define M360_SI_SMC1_TDM (1<<15) /* Multiplexed SMC1 */
+#define M360_SI_SMC1_BRG1 (0<<12) /* SMC1 clock souce */
+#define M360_SI_SMC1_BRG2 (1<<12)
+#define M360_SI_SMC1_BRG3 (2<<12)
+#define M360_SI_SMC1_BRG4 (3<<12)
+#define M360_SI_SMC1_CLK1 (0<<12)
+#define M360_SI_SMC1_CLK2 (1<<12)
+#define M360_SI_SMC1_CLK3 (2<<12)
+#define M360_SI_SMC1_CLK4 (3<<12)
+
+/*
+ *************************************************************************
+ * SDMA Configuration Register (SDMA) *
+ *************************************************************************
+ */
+#define M360_SDMA_FREEZE (2<<13) /* Freeze on next bus cycle */
+#define M360_SDMA_SISM_7 (7<<8) /* Normal interrupt service mask */
+#define M360_SDMA_SAID_4 (4<<4) /* Normal arbitration ID */
+#define M360_SDMA_INTE (1<<1) /* SBER interrupt enable */
+#define M360_SDMA_INTB (1<<0) /* SBKP interrupt enable */
+
+/*
+ *************************************************************************
+ * Baud (sic) Rate Generators *
+ *************************************************************************
+ */
+#define M360_BRG_RST (1<<17) /* Reset generator */
+#define M360_BRG_EN (1<<16) /* Enable generator */
+#define M360_BRG_EXTC_BRGCLK (0<<14) /* Source is BRGCLK */
+#define M360_BRG_EXTC_CLK2 (1<<14) /* Source is CLK2 pin */
+#define M360_BRG_EXTC_CLK6 (2<<14) /* Source is CLK6 pin */
+#define M360_BRG_ATB (1<<13) /* Autobaud */
+#define M360_BRG_115200 (13<<1) /* Assume 25 MHz clock */
+#define M360_BRG_57600 (26<<1)
+#define M360_BRG_38400 (40<<1)
+#define M360_BRG_19200 (80<<1)
+#define M360_BRG_9600 (162<<1)
+#define M360_BRG_4800 (324<<1)
+#define M360_BRG_2400 (650<<1)
+#define M360_BRG_1200 (1301<<1)
+#define M360_BRG_600 (2603<<1)
+#define M360_BRG_300 ((324<<1) | 1)
+#define M360_BRG_150 ((650<<1) | 1)
+#define M360_BRG_75 ((1301<<1) | 1)
+
+/*
+ *************************************************************************
+ * MC68360 DUAL-PORT RAM AND REGISTERS *
+ *************************************************************************
+ */
+typedef struct m360_ {
+ /*
+ * Dual-port RAM
+ */
+ rtems_unsigned8 dpram0[0x400]; /* Microcode program */
+ rtems_unsigned8 dpram1[0x200];
+ rtems_unsigned8 dpram2[0x100]; /* Microcode scratch */
+ rtems_unsigned8 dpram3[0x100]; /* Not on REV A or B masks */
+ rtems_unsigned8 _rsv0[0xC00-0x800];
+ m360SCCENparms_t scc1p;
+ rtems_unsigned8 _rsv1[0xCB0-0xC00-sizeof(m360SCCENparms_t)];
+ m360MiscParms_t miscp;
+ rtems_unsigned8 _rsv2[0xD00-0xCB0-sizeof(m360MiscParms_t)];
+ m360SCCparms_t scc2p;
+ rtems_unsigned8 _rsv3[0xD80-0xD00-sizeof(m360SCCparms_t)];
+ m360SPIparms_t spip;
+ rtems_unsigned8 _rsv4[0xDB0-0xD80-sizeof(m360SPIparms_t)];
+ m360TimerParms_t tmp;
+ rtems_unsigned8 _rsv5[0xE00-0xDB0-sizeof(m360TimerParms_t)];
+ m360SCCparms_t scc3p;
+ rtems_unsigned8 _rsv6[0xE70-0xE00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma1p;
+ rtems_unsigned8 _rsv7[0xE80-0xE70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc1p;
+ rtems_unsigned8 _rsv8[0xF00-0xE80-sizeof(m360SMCparms_t)];
+ m360SCCparms_t scc4p;
+ rtems_unsigned8 _rsv9[0xF70-0xF00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma2p;
+ rtems_unsigned8 _rsv10[0xF80-0xF70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc2p;
+ rtems_unsigned8 _rsv11[0x1000-0xF80-sizeof(m360SMCparms_t)];
+
+ /*
+ * SIM Block
+ */
+ rtems_unsigned32 mcr;
+ rtems_unsigned32 _pad00;
+ rtems_unsigned8 avr;
+ rtems_unsigned8 rsr;
+ rtems_unsigned16 _pad01;
+ rtems_unsigned8 clkocr;
+ rtems_unsigned8 _pad02;
+ rtems_unsigned16 _pad03;
+ rtems_unsigned16 pllcr;
+ rtems_unsigned16 _pad04;
+ rtems_unsigned16 cdvcr;
+ rtems_unsigned16 pepar;
+ rtems_unsigned32 _pad05[2];
+ rtems_unsigned16 _pad06;
+ rtems_unsigned8 sypcr;
+ rtems_unsigned8 swiv;
+ rtems_unsigned16 _pad07;
+ rtems_unsigned16 picr;
+ rtems_unsigned16 _pad08;
+ rtems_unsigned16 pitr;
+ rtems_unsigned16 _pad09;
+ rtems_unsigned8 _pad10;
+ rtems_unsigned8 swsr;
+ rtems_unsigned32 bkar;
+ rtems_unsigned32 bcar;
+ rtems_unsigned32 _pad11[2];
+
+ /*
+ * MEMC Block
+ */
+ rtems_unsigned32 gmr;
+ rtems_unsigned16 mstat;
+ rtems_unsigned16 _pad12;
+ rtems_unsigned32 _pad13[2];
+ m360MEMCRegisters_t memc[8];
+ rtems_unsigned8 _pad14[0xF0-0xD0];
+ rtems_unsigned8 _pad15[0x100-0xF0];
+ rtems_unsigned8 _pad16[0x500-0x100];
+
+ /*
+ * IDMA1 Block
+ */
+ rtems_unsigned16 iccr;
+ rtems_unsigned16 _pad17;
+ rtems_unsigned16 cmr1;
+ rtems_unsigned16 _pad18;
+ rtems_unsigned32 sapr1;
+ rtems_unsigned32 dapr1;
+ rtems_unsigned32 bcr1;
+ rtems_unsigned8 fcr1;
+ rtems_unsigned8 _pad19;
+ rtems_unsigned8 cmar1;
+ rtems_unsigned8 _pad20;
+ rtems_unsigned8 csr1;
+ rtems_unsigned8 _pad21;
+ rtems_unsigned16 _pad22;
+
+ /*
+ * SDMA Block
+ */
+ rtems_unsigned8 sdsr;
+ rtems_unsigned8 _pad23;
+ rtems_unsigned16 sdcr;
+ rtems_unsigned32 sdar;
+
+ /*
+ * IDMA2 Block
+ */
+ rtems_unsigned16 _pad24;
+ rtems_unsigned16 cmr2;
+ rtems_unsigned32 sapr2;
+ rtems_unsigned32 dapr2;
+ rtems_unsigned32 bcr2;
+ rtems_unsigned8 fcr2;
+ rtems_unsigned8 _pad26;
+ rtems_unsigned8 cmar2;
+ rtems_unsigned8 _pad27;
+ rtems_unsigned8 csr2;
+ rtems_unsigned8 _pad28;
+ rtems_unsigned16 _pad29;
+ rtems_unsigned32 _pad30;
+
+ /*
+ * CPIC Block
+ */
+ rtems_unsigned32 cicr;
+ rtems_unsigned32 cipr;
+ rtems_unsigned32 cimr;
+ rtems_unsigned32 cisr;
+
+ /*
+ * Parallel I/O Block
+ */
+ rtems_unsigned16 padir;
+ rtems_unsigned16 papar;
+ rtems_unsigned16 paodr;
+ rtems_unsigned16 padat;
+ rtems_unsigned32 _pad31[2];
+ rtems_unsigned16 pcdir;
+ rtems_unsigned16 pcpar;
+ rtems_unsigned16 pcso;
+ rtems_unsigned16 pcdat;
+ rtems_unsigned16 pcint;
+ rtems_unsigned16 _pad32;
+ rtems_unsigned32 _pad33[5];
+
+ /*
+ * TIMER Block
+ */
+ rtems_unsigned16 tgcr;
+ rtems_unsigned16 _pad34;
+ rtems_unsigned32 _pad35[3];
+ rtems_unsigned16 tmr1;
+ rtems_unsigned16 tmr2;
+ rtems_unsigned16 trr1;
+ rtems_unsigned16 trr2;
+ rtems_unsigned16 tcr1;
+ rtems_unsigned16 tcr2;
+ rtems_unsigned16 tcn1;
+ rtems_unsigned16 tcn2;
+ rtems_unsigned16 tmr3;
+ rtems_unsigned16 tmr4;
+ rtems_unsigned16 trr3;
+ rtems_unsigned16 trr4;
+ rtems_unsigned16 tcr3;
+ rtems_unsigned16 tcr4;
+ rtems_unsigned16 tcn3;
+ rtems_unsigned16 tcn4;
+ rtems_unsigned16 ter1;
+ rtems_unsigned16 ter2;
+ rtems_unsigned16 ter3;
+ rtems_unsigned16 ter4;
+ rtems_unsigned32 _pad36[2];
+
+ /*
+ * CP Block
+ */
+ rtems_unsigned16 cr;
+ rtems_unsigned16 _pad37;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 _pad38;
+ rtems_unsigned32 _pad39[3];
+ rtems_unsigned16 _pad40;
+ rtems_unsigned16 rter;
+ rtems_unsigned16 _pad41;
+ rtems_unsigned16 rtmr;
+ rtems_unsigned32 _pad42[5];
+
+ /*
+ * BRG Block
+ */
+ rtems_unsigned32 brgc1;
+ rtems_unsigned32 brgc2;
+ rtems_unsigned32 brgc3;
+ rtems_unsigned32 brgc4;
+
+ /*
+ * SCC Block
+ */
+ m360SCCRegisters_t scc1;
+ m360SCCRegisters_t scc2;
+ m360SCCRegisters_t scc3;
+ m360SCCRegisters_t scc4;
+
+ /*
+ * SMC Block
+ */
+ m360SMCRegisters_t smc1;
+ m360SMCRegisters_t smc2;
+
+ /*
+ * SPI Block
+ */
+ rtems_unsigned16 spmode;
+ rtems_unsigned16 _pad43[2];
+ rtems_unsigned8 spie;
+ rtems_unsigned8 _pad44;
+ rtems_unsigned16 _pad45;
+ rtems_unsigned8 spim;
+ rtems_unsigned8 _pad46[2];
+ rtems_unsigned8 spcom;
+ rtems_unsigned16 _pad47[2];
+
+ /*
+ * PIP Block
+ */
+ rtems_unsigned16 pipc;
+ rtems_unsigned16 _pad48;
+ rtems_unsigned16 ptpr;
+ rtems_unsigned32 pbdir;
+ rtems_unsigned32 pbpar;
+ rtems_unsigned16 _pad49;
+ rtems_unsigned16 pbodr;
+ rtems_unsigned32 pbdat;
+ rtems_unsigned32 _pad50[6];
+
+ /*
+ * SI Block
+ */
+ rtems_unsigned32 simode;
+ rtems_unsigned8 sigmr;
+ rtems_unsigned8 _pad51;
+ rtems_unsigned8 sistr;
+ rtems_unsigned8 sicmr;
+ rtems_unsigned32 _pad52;
+ rtems_unsigned32 sicr;
+ rtems_unsigned16 _pad53;
+ rtems_unsigned16 sirp[2];
+ rtems_unsigned16 _pad54;
+ rtems_unsigned32 _pad55[2];
+ rtems_unsigned8 siram[256];
+} m360_t;
+
+extern volatile m360_t m360;
+
+#endif /* __MC68360_h */
diff --git a/c/src/exec/score/cpu/m68k/m68k.h b/c/src/exec/score/cpu/m68k/m68k.h
new file mode 100644
index 0000000000..8ac881628b
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/m68k.h
@@ -0,0 +1,325 @@
+/* m68k.h
+ *
+ * This include file contains information pertaining to the Motorola
+ * m68xxx processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __M68k_h
+#define __M68k_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef m68k
+#undef m68k
+#endif
+#define m68k
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This section contains the information required to build
+ * RTEMS for a particular member of the Motorola MC68xxx
+ * family. It does this by setting variables to indicate
+ * which implementation dependent features are present in
+ * a particular member of the family.
+ *
+ * Currently recognized:
+ * m68000 (no FP)
+ * m68020 (implies FP)
+ * m68020_nofp (no FP)
+ * m68030 (implies FP)
+ * m68040 (implies FP)
+ * m68lc040 (no FP)
+ * m68ec040 (no FP)
+ * m68302 (no FP)
+ * mcpu32 (no FP) (includes m68360)
+ *
+ * Primary difference (for RTEMS) between m68040, m680lc040, and
+ * m68ec040 is the presence or absence of the FPU.
+ *
+ * Here is some information on the 040 variants (courtesy of Doug McBride,
+ * mcbride@rodin.colorado.edu):
+ *
+ * "The 68040 is a superset of the 68EC040 and the 68LC040. The
+ * 68EC040 and 68LC040 do not have FPU's. The 68LC040 and the
+ * 68EC040 have renamed the DLE pin as JS0 which must be tied to
+ * Gnd or Vcc. The 68EC040 has renamed the MDIS pin as JS1. The
+ * 68EC040 has access control units instead of memory management units.
+ * The 68EC040 should not have the PFLUSH or PTEST instructions executed
+ * (cause an indeterminate result). The 68EC040 and 68LC040 do not
+ * implement the DLE or multiplexed bus modes. The 68EC040 does not
+ * implement the output buffer impedance selection mode of operation."
+ *
+ * M68K_HAS_EXTB_L is used to enable/disable usage of the extb.l instruction
+ * which is not available for 68000 or 68ec000 cores (68000, 68001, 68008,
+ * 68010, 68302, 68306, 68307). This instruction is available on the 68020
+ * up and the cpu32 based models.
+ *
+ * NOTE:
+ * Eventually it would be nice to evaluate doing a lot of this section
+ * by having each model specigy which core it uses and then go from there.
+ */
+
+#if defined(m68000)
+
+#define CPU_MODEL_NAME "m68000"
+#define M68K_HAS_VBR 0
+#define M68K_HAS_SEPARATE_STACKS 0
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 0
+#define M68K_HAS_PREINDEXING 0
+#define M68K_HAS_EXTB_L 0
+
+#elif defined(m68020)
+
+#define CPU_MODEL_NAME "m68020"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 1
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68020_nofp)
+
+#define CPU_MODEL_NAME "m68020 w/o fp"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68030)
+
+#define CPU_MODEL_NAME "m68030"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 1
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68040)
+
+#define CPU_MODEL_NAME "m68040"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 1
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68lc040)
+
+#define CPU_MODEL_NAME "m68lc040"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68ec040)
+
+#define CPU_MODEL_NAME "m68ec040"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 1
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 1
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(m68302)
+ /* essentially a m68000 with onboard peripherals */
+#define CPU_MODEL_NAME "m68302"
+#define M68K_HAS_VBR 0
+#define M68K_HAS_SEPARATE_STACKS 0
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 0
+#define M68K_HAS_PREINDEXING 0
+#define M68K_HAS_EXTB_L 0
+
+#elif defined(m68332)
+
+#define CPU_MODEL_NAME "m68332"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 0
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 0
+#define M68K_HAS_PREINDEXING 0
+#define M68K_HAS_EXTB_L 1
+
+#elif defined(mcpu32)
+
+#define CPU_MODEL_NAME "mcpu32"
+#define M68K_HAS_VBR 1
+#define M68K_HAS_SEPARATE_STACKS 0
+#define M68K_HAS_FPU 0
+#define M68K_HAS_BFFFO 0
+#define M68K_HAS_PREINDEXING 1
+#define M68K_HAS_EXTB_L 1
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * If defined, this causes some of the macros to initialize their
+ * variables to zero before doing inline assembly. This gets rid
+ * of compile time warnings at the cost of a little execution time
+ * in some time critical routines.
+ */
+
+#define NO_UNINITIALIZED_WARNINGS
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "Motorola MC68xxx"
+
+#ifndef ASM
+
+#ifdef NO_UNINITIALIZED_WARNINGS
+#define m68k_disable_interrupts( _level ) \
+ { \
+ (_level) = 0; /* avoids warnings */ \
+ asm volatile ( "movew %%sr,%0 ; \
+ orw #0x0700,%%sr" \
+ : "=d" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+#else
+#define m68k_disable_interrupts( _level ) \
+ { \
+ asm volatile ( "movew %%sr,%0 ; \
+ orw #0x0700,%%sr" \
+ : "=d" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+#endif
+
+#define m68k_enable_interrupts( _level ) \
+ { \
+ asm volatile ( "movew %0,%%sr " \
+ : "=d" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+
+#define m68k_flash_interrupts( _level ) \
+ { \
+ asm volatile ( "movew %0,%%sr ; \
+ orw #0x0700,%%sr" \
+ : "=d" ((_level)) : "0" ((_level)) \
+ ); \
+ }
+
+#define m68k_get_interrupt_level( _level ) \
+ do { \
+ register unsigned32 _tmpsr = 0; \
+ \
+ asm volatile( "movw %%sr,%0" \
+ : "=d" (_tmpsr) : "0" (_tmpsr) \
+ ); \
+ \
+ _level = (_tmpsr & 0x0700) >> 8; \
+ } while (0)
+
+#define m68k_set_interrupt_level( _newlevel ) \
+ { \
+ register unsigned32 _tmpsr = 0; \
+ \
+ asm volatile( "movw %%sr,%0" \
+ : "=d" (_tmpsr) : "0" (_tmpsr) \
+ ); \
+ \
+ _tmpsr = (_tmpsr & 0xf8ff) | ((_newlevel) << 8); \
+ \
+ asm volatile( "movw %0,%%sr" \
+ : "=d" (_tmpsr) : "0" (_tmpsr) \
+ ); \
+ }
+
+#if ( M68K_HAS_VBR == 1 )
+#define m68k_get_vbr( vbr ) \
+ { (vbr) = 0; \
+ asm volatile ( "movec %%vbr,%0 " \
+ : "=r" (vbr) : "0" (vbr) ); \
+ }
+
+#define m68k_set_vbr( vbr ) \
+ { register m68k_isr *_vbr= (m68k_isr *)(vbr); \
+ asm volatile ( "movec %0,%%vbr " \
+ : "=a" (_vbr) : "0" (_vbr) ); \
+ }
+#else
+#define m68k_get_vbr( _vbr ) _vbr = (void *)_VBR
+#define m68k_set_vbr( _vbr )
+#endif
+
+/*
+ * The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ */
+
+static inline unsigned int m68k_swap_u32(
+ unsigned int value
+)
+{
+ unsigned int swapped = value;
+
+ asm volatile( "rorw #8,%0" : "=d" (swapped) : "0" (swapped) );
+ asm volatile( "swap %0" : "=d" (swapped) : "0" (swapped) );
+ asm volatile( "rorw #8,%0" : "=d" (swapped) : "0" (swapped) );
+
+ return( swapped );
+}
+
+/* XXX this is only valid for some m68k family members and should be fixed */
+
+#define m68k_enable_caching() \
+ { register unsigned32 _ctl=0x01; \
+ asm volatile ( "movec %0,%%cacr" \
+ : "=d" (_ctl) : "0" (_ctl) ); \
+ }
+
+#define CPU_swap_u32( value ) m68k_swap_u32( value )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/m68k/m68ktypes.h b/c/src/exec/score/cpu/m68k/m68ktypes.h
new file mode 100644
index 0000000000..5e9e0d451f
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/m68ktypes.h
@@ -0,0 +1,58 @@
+/* m68ktypes.h
+ *
+ * This include file contains type definitions pertaining to the Motorola
+ * m68xxx processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __M68k_TYPES_h
+#define __M68k_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void m68k_isr;
+
+typedef void ( *m68k_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/m68k/qsm.h b/c/src/exec/score/cpu/m68k/qsm.h
new file mode 100644
index 0000000000..e1bf33bc12
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/qsm.h
@@ -0,0 +1,209 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * QSM -- Queued Serial Module
+ *
+ * The QSM contains two serial interfaces: (a) the queued serial
+ * peripheral interface (QSPI) and the serial communication interface
+ * (SCI). The QSPI provides peripheral expansion and/or interprocessor
+ * communication through a full-duplex, synchronous, three-wire bus. A
+ * self contained RAM queue permits serial data transfers without CPU
+ * intervention and automatic continuous sampling. The SCI provides a
+ * standard non-return to zero mark/space format with wakeup functions
+ * to allow the CPU to run uninterrupted until woken
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family Queued Serial Module Reference Manual" (Motorola document
+ * QSMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _QSM_H_
+#define _QSM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+/* QSM_CRB (QSM Control Register Block) base address of the QSM
+ control registers */
+#if SIM_MM == 0
+#define QSM_CRB 0x7ffc00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define QSM_CRB 0xfffc00
+#endif
+
+
+#define QSMCR (volatile unsigned short int * const)(0x00 + QSM_CRB)
+ /* QSM Configuration Register */
+#define STOP 0x8000 /* Stop Enable */
+#define FRZ 0x6000 /* Freeze Control */
+#define SUPV 0x0080 /* Supervisor/Unrestricted */
+#define IARB 0x000f /* Inerrupt Arbitration */
+
+
+#define QTEST (volatile unsigned short int * const)(0x02 + QSM_CRB)
+ /* QSM Test Register */
+/* Used only for factor testing */
+
+
+#define QILR (volatile unsigned char * const)(0x04 + QSM_CRB)
+ /* QSM Interrupt Level Register */
+#define ILQSPI 0x38 /* Interrupt Level for QSPI */
+#define ILSCI 0x07 /* Interrupt Level for SCI */
+
+
+#define QIVR (volatile unsigned char * const)(0x05 + QSM_CRB)
+ /* QSM Interrupt Vector Register */
+#define INTV 0xff /* Interrupt Vector Number */
+
+
+#define SCCR0 (volatile unsigned short int * const)(0x08 + QSM_CRB)
+ /* SCI Control Register 0 */
+#define SCBR 0x1fff /* SCI Baud Rate */
+
+
+#define SCCR1 (volatile unsigned short int * const)(0x0a + QSM_CRB)
+ /* SCI Control Register 1 */
+#define LOOPS 0x4000 /* Loop Mode */
+#define WOMS 0x2000 /* Wired-OR Mode for SCI Pins */
+#define ILT 0x1000 /* Idle-Line Detect Type */
+#define PT 0x0800 /* Parity Type */
+#define PE 0x0400 /* Parity Enable */
+#define M 0x0200 /* Mode Select */
+#define WAKE 0x0100 /* Wakeup by Address Mark */
+#define TIE 0x0080 /* Transmit Complete Interrupt Enable */
+#define TCIE 0x0040 /* Transmit Complete Interrupt Enable */
+#define RIE 0x0020 /* Receiver Interrupt Enable */
+#define ILIE 0x0010 /* Idle-Line Interrupt Enable */
+#define TE 0x0008 /* Transmitter Enable */
+#define RE 0x0004 /* Receiver Enable */
+#define RWU 0x0002 /* Receiver Wakeup */
+#define SBK 0x0001 /* Send Break */
+
+
+#define SCSR (volatile unsigned short int * const)(0x0c + QSM_CRB)
+ /* SCI Status Register */
+#define TDRE 0x0100 /* Transmit Data Register Empty */
+#define TC 0x0080 /* Transmit Complete */
+#define RDRF 0x0040 /* Receive Data Register Full */
+#define RAF 0x0020 /* Receiver Active */
+#define IDLE 0x0010 /* Idle-Line Detected */
+#define OR 0x0008 /* Overrun Error */
+#define NF 0x0004 /* Noise Error Flag */
+#define FE 0x0002 /* Framing Error */
+#define PF 0x0001 /* Parity Error */
+
+
+#define SCDR (volatile unsigned short int * const)(0x0e + QSM_CRB)
+ /* SCI Data Register */
+
+
+#define PORTQS (volatile unsigned char * const)(0x15 + QSM_CRB)
+ /* Port QS Data Register */
+
+#define PQSPAR (volatile unsigned char * const)(0x16 + QSM_CRB)
+ /* PORT QS Pin Assignment Rgister */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a QSPI
+ signal. */
+/* note: PQS2 is a digital I/O pin unless the SPI is enabled in which
+ case it becomes the SPI serial clock SCK. */
+/* note: PQS7 is a digital I/O pin unless the SCI transmitter is
+ enabled in which case it becomes the SCI serial output TxD. */
+#define QSMFun 0x0
+#define QSMDis 0x1
+/*
+ * PQSPAR Field | QSM Function | Discrete I/O pin
+ *------------------+--------------+------------------ */
+#define PQSPA0 0 /* MISO | PQS0 */
+#define PQSPA1 1 /* MOSI | PQS1 */
+#define PQSPA2 2 /* SCK | PQS2 (see note)*/
+#define PQSPA3 3 /* PCSO/!SS | PQS3 */
+#define PQSPA4 4 /* PCS1 | PQS4 */
+#define PQSPA5 5 /* PCS2 | PQS5 */
+#define PQSPA6 6 /* PCS3 | PQS6 */
+#define PQSPA7 7 /* TxD | PQS7 (see note)*/
+
+
+#define DDRQS (volatile unsigned char * const)(0x17 + QSM_CRB)
+ /* PORT QS Data Direction Register */
+/* Clearing a bit makes the corresponding pin an input; setting a bit
+ makes the pin an output. */
+
+
+#define SPCR0 (volatile unsigned short int * const)(0x18 + QSM_CRB)
+ /* QSPI Control Register 0 */
+#define MSTR 0x8000 /* Master/Slave Mode Select */
+#define WOMQ 0x4000 /* Wired-OR Mode for QSPI Pins */
+#define BITS 0x3c00 /* Bits Per Transfer */
+#define CPOL 0x0200 /* Clock Polarity */
+#define CPHA 0x0100 /* Clock Phase */
+#define SPBR 0x00ff /* Serial Clock Baud Rate */
+
+
+#define SPCR1 (volatile unsigned short int * const)(0x1a + QSM_CRB)
+ /* QSPI Control Register 1 */
+#define SPE 0x8000 /* QSPI Enable */
+#define DSCKL 0x7f00 /* Delay before SCK */
+#define DTL 0x00ff /* Length of Delay after Transfer */
+
+
+#define SPCR2 (volatile unsigned short int * const)(0x1c + QSM_CRB)
+ /* QSPI Control Register 2 */
+#define SPIFIE 0x8000 /* SPI Finished Interrupt Enable */
+#define WREN 0x4000 /* Wrap Enable */
+#define WRTO 0x2000 /* Wrap To */
+#define ENDQP 0x0f00 /* Ending Queue Pointer */
+#define NEWQP 0x000f /* New Queue Pointer Value */
+
+
+#define SPCR3 (volatile unsigned char * const)(0x1e + QSM_CRB)
+ /* QSPI Control Register 3 */
+#define LOOPQ 0x0400 /* QSPI Loop Mode */
+#define HMIE 0x0200 /* HALTA and MODF Interrupt Enable */
+#define HALT 0x0100 /* Halt */
+
+
+#define SPSR (volatile unsigned char * const)(0x1f + QSM_CRB)
+ /* QSPI Status Register */
+#define SPIF 0x0080 /* QSPI Finished Flag */
+#define MODF 0x0040 /* Mode Fault Flag */
+#define HALTA 0x0020 /* Halt Acknowlwdge Flag */
+#define CPTQP x0000f /* Completed Queue Pointer */
+
+#define QSPIRR (volatile unsigned char * const)(0x100 + QSM_CRB)
+ /* QSPI Receive Data RAM */
+#define QSPITR (volatile unsigned char * const)(0x120 + QSM_CRB)
+ /* QSPI Transmit Data RAM */
+#define QSPIcR (volatile unsigned char * const)(0x140 + QSM_CRB)
+ /* QSPI Command RAM */
+
+#endif /* _QSM_H_ */
diff --git a/c/src/exec/score/cpu/m68k/rtems.s b/c/src/exec/score/cpu/m68k/rtems.s
new file mode 100644
index 0000000000..faae97e487
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/rtems.s
@@ -0,0 +1,46 @@
+/* rtems.s
+ *
+ * This file contains the single entry point code for
+ * the m68k implementation of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <asm.h>
+
+/*
+ * There seems to be no reason to have two versions of this.
+ * The following version should work across the entire family.
+ * The worst assumption is that gcc will put entry in a scratch
+ * register and not screw up the stack.
+ *
+ * NOTE: This is a 68020 version:
+ *
+ * jmpl @(%%d0:l:4)@(__Entry_points)
+ */
+
+ EXTERN (_Entry_points)
+
+ BEGIN_CODE
+
+ .align 4
+ .global SYM (RTEMS)
+
+SYM (RTEMS):
+ moveal SYM (_Entry_points), a0
+ lsll #2, d0
+ addal d0, a0
+ moveal @(a0),a0
+ jmpl @(a0)
+
+ END_CODE
+END
diff --git a/c/src/exec/score/cpu/m68k/sim.h b/c/src/exec/score/cpu/m68k/sim.h
new file mode 100644
index 0000000000..fae7fe8783
--- /dev/null
+++ b/c/src/exec/score/cpu/m68k/sim.h
@@ -0,0 +1,328 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * SIM -- System Integration Module
+ *
+ * The system integration module (SIM) is used on many Motorola 16-
+ * and 32-bit MCUs for the following functions:
+ *
+ * () System configuration and protection. Bus and software watchdog
+ * monitors are provided in addition to periodic interrupt generators.
+ *
+ * () Clock signal generation for other intermodule bus (IMB) members
+ * and external devices.
+ *
+ * () The generation of chip-select signals that simplify external
+ * circuitry interface.
+ *
+ * () Data ports that are available for general purpose input and
+ * output.
+ *
+ * () A system test block that is intended only for factory tests.
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family System Integration Module Reference Manual" (Motorola document
+ * SIMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _SIM_H_
+#define _SIM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+
+/* SIM_CRB (SIM Control Register Block) base address of the SIM
+ control registers */
+/* not included in ram_init.h */
+#if SIM_MM == 0
+#define SIM_CRB 0x7ffa00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define SIM_CRB 0xfffa00
+#endif
+/* end not included in ram_init.h */
+
+
+
+#define SIMCR (volatile unsigned short int * const)(0x00 + SIM_CRB)
+ /* Module Configuration Register */
+#define EXOFF 0x8000 /* External Clock Off */
+#define FRZSW 0x4000 /* Freeze Software Enable */
+#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */
+#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/
+#define SHEN 0x0300 /* Show Cycle Enable */
+#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */
+#define MM 0x0040 /* Module Mapping */
+#define IARB 0x000f /* Interrupt Arbitration Field */
+
+
+
+#define SIMTR (volatile unsigned short int * const)(0x02 + SIM_CRB)
+ /* SIM Test Register */
+/* Used only for factor testing */
+
+
+
+#define SYNCR (volatile unsigned short int * const)(0x04 + SIM_CRB)
+ /* Clock Synthesizer Control Register */
+#define W 0x8000 /* Frequency Control (VCO) */
+#define X 0x4000 /* Frequency Control Bit (Prescale) */
+#define Y 0x3f00 /* Frequency Control Counter */
+#define EDIV 0x0080 /* ECLK Divide Rate */
+#define SLIMP 0x0010 /* Limp Mode Status */
+#define SLOCK 0x0008 /* Synthesizer Lock */
+#define RSTEN 0x0004 /* Reset Enable */
+#define STSIM 0x0002 /* Stop Mode SIM Clock */
+#define STEXT 0x0001 /* Stop Mode External Clock */
+
+
+
+#define RSR (volatile unsigned char * const)(0x07 + SIM_CRB)
+ /* Reset Status Register */
+#define EXT 0x0080 /* External Reset */
+#define POW 0x0040 /* Power-On Reset */
+#define SW 0x0020 /* Software Watchdog Reset */
+#define DBF 0x0010 /* Double Bus Fault Reset */
+#define LOC 0x0004 /* Loss of Clock Reset */
+#define SYS 0x0002 /* System Reset */
+#define TST 0x0001 /* Test Submodule Reset */
+
+
+
+#define SIMTRE (volatile unsigned short int * const)(0x08 + SIM_CRB)
+ /* System Integration Test Register */
+/* Used only for factor testing */
+
+
+
+#define PORTE0 (volatile unsigned char * const)(0x11 + SIM_CRB)
+#define PORTE1 (volatile unsigned char * const)(0x13 + SIM_CRB)
+ /* Port E Data Register */
+#define DDRE (volatile unsigned char * const)(0x15 + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PEPAR (volatile unsigned char * const)(0x17 + SIM_CRB)
+ /* Port E Pin Assignment Register */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define PORTF0 (volatile unsigned char * const)(0x19 + SIM_CRB)
+#define PORTF1 (volatile unsigned char * const)(0x1b + SIM_CRB)
+ /* Port F Data Register */
+#define DDRF (volatile unsigned char * const)(0x1d + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PFPAR (volatile unsigned char * const)(0x1f + SIM_CRB)
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define SYPCR (volatile unsigned char * const)(0x21 + SIM_CRB)
+/* !!! can write to only once after reset !!! */
+ /* System Protection Control Register */
+#define SWE 0x80 /* Software Watch Enable */
+#define SWP 0x40 /* Software Watchdog Prescale */
+#define SWT 0x30 /* Software Watchdog Timing */
+#define HME 0x08 /* Halt Monitor Enable */
+#define BME 0x04 /* Bus Monitor External Enable */
+#define BMT 0x03 /* Bus Monitor Timing */
+
+
+
+#define PICR (volatile unsigned short int * const)(0x22 + SIM_CRB)
+ /* Periodic Interrupt Control Reg. */
+#define PIRQL 0x0700 /* Periodic Interrupt Request Level */
+#define PIV 0x00ff /* Periodic Interrupt Level */
+
+
+
+#define PITR (volatile unsigned short int * const)(0x24 + SIM_CRB)
+ /* Periodic Interrupt Timer Register */
+#define PTP 0x0100 /* Periodic Timer Prescaler Control */
+#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */
+
+
+
+#define SWSR (volatile unsigned char * const)(0x27 + SIM_CRB)
+ /* Software Service Register */
+/* write 0x55 then 0xaa to service the software watchdog */
+
+
+
+#define TSTMSRA (volatile unsigned short int * const)(0x30 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTMSRB (volatile unsigned short int * const)(0x32 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTSC (volatile unsigned short int * const)(0x34 + SIM_CRB)
+ /* Test Module Shift Count */
+#define TSTRC (volatile unsigned short int * const)(0x36 + SIM_CRB)
+ /* Test Module Repetition Counter */
+#define CREG (volatile unsigned short int * const)(0x38 + SIM_CRB)
+ /* Test Module Control */
+#define DREG (volatile unsigned short int * const)(0x3a + SIM_CRB)
+ /* Test Module Distributed */
+/* Used only for factor testing */
+
+
+
+#define PORTC (volatile unsigned char * const)(0x41 + SIM_CRB)
+ /* Port C Data */
+
+
+
+#define CSPAR0 (volatile unsigned short int * const)(0x44 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Resgister 0 */
+/* CSPAR0 contains seven two-bit fields that determine the functions
+ of corresponding chip-select pins. CSPAR0[15:14] are not
+ used. These bits always read zero; write have no effect. CSPAR0 bit
+ 1 always reads one; writes to CSPAR0 bit 1 have no effect. */
+#define CSPAR1 (volatile unsigned short int * const)(0x46 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Register 1 */
+/* CSPAR1 contains five two-bit fields that determine the finctions of
+ corresponding chip-select pins. CSPAR1[15:10] are not used. These
+ bits always read zero; writes have no effect. */
+/*
+ *
+ * Bit Field | Description
+ * ------------+---------------
+ * 00 | Discrete Output
+ * 01 | Alternate Function
+ * 10 | Chip Select (8-bit port)
+ * 11 | Chip Select (16-bit port)
+ */
+#define DisOut 0x0
+#define AltFun 0x1
+#define CS8bit 0x2
+#define CS16bit 0x3
+/*
+ *
+ * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output
+ *-----------------+--------------------+--------------------+---------------*/
+#define CS_5 12 /* !CS5 | FC2 | PC2 */
+#define CS_4 10 /* !CS4 | FC1 | PC1 */
+#define CS_3 8 /* !CS3 | FC0 | PC0 */
+#define CS_2 6 /* !CS2 | !BGACK | */
+#define CS_1 4 /* !CS1 | !BG | */
+#define CS_0 2 /* !CS0 | !BR | */
+#define CSBOOT 0 /* !CSBOOT | | */
+/* | | | */
+#define CS_10 8 /* !CS10 | ADDR23 | ECLK */
+#define CS_9 6 /* !CS9 | ADDR22 | PC6 */
+#define CS_8 4 /* !CS8 | ADDR21 | PC5 */
+#define CS_7 2 /* !CS7 | ADDR20 | PC4 */
+#define CS_6 0 /* !CS6 | ADDR19 | PC3 */
+
+#define BS_2K 0x0
+#define BS_8K 0x1
+#define BS_16K 0x2
+#define BS_64K 0x3
+#define BS_128K 0x4
+#define BS_256K 0x5
+#define BS_512K 0x6
+#define BS_1M 0x7
+
+#define CSBARBT (volatile unsigned short int * const)(0x48 + SIM_CRB)
+#define CSBAR0 (volatile unsigned short int * const)(0x4c + SIM_CRB)
+#define CSBAR1 (volatile unsigned short int * const)(0x50 + SIM_CRB)
+#define CSBAR2 (volatile unsigned short int * const)(0x54 + SIM_CRB)
+#define CSBAR3 (volatile unsigned short int * const)(0x58 + SIM_CRB)
+#define CSBAR4 (volatile unsigned short int * const)(0x5c + SIM_CRB)
+#define CSBAR5 (volatile unsigned short int * const)(0x60 + SIM_CRB)
+#define CSBAR6 (volatile unsigned short int * const)(0x64 + SIM_CRB)
+#define CSBAR7 (volatile unsigned short int * const)(0x68 + SIM_CRB)
+#define CSBAR8 (volatile unsigned short int * const)(0x6c + SIM_CRB)
+#define CSBAR9 (volatile unsigned short int * const)(0x70 + SIM_CRB)
+#define CSBAR10 (volatile unsigned short int * const)(0x74 + SIM_CRB)
+
+#define MODE 0x8000
+#define Disable 0
+#define LowerByte 0x2000
+#define UpperByte 0x4000
+#define BothBytes 0x6000
+#define ReadOnly 0x0800
+#define WriteOnly 0x1000
+#define ReadWrite 0x1800
+#define SyncAS 0x0
+#define SyncDS 0x0400
+
+#define WaitStates_0 (0x0 << 6)
+#define WaitStates_1 (0x1 << 6)
+#define WaitStates_2 (0x2 << 6)
+#define WaitStates_3 (0x3 << 6)
+#define WaitStates_4 (0x4 << 6)
+#define WaitStates_5 (0x5 << 6)
+#define WaitStates_6 (0x6 << 6)
+#define WaitStates_7 (0x7 << 6)
+#define WaitStates_8 (0x8 << 6)
+#define WaitStates_9 (0x9 << 6)
+#define WaitStates_10 (0xa << 6)
+#define WaitStates_11 (0xb << 6)
+#define WaitStates_12 (0xc << 6)
+#define WaitStates_13 (0xd << 6)
+#define FastTerm (0xe << 6)
+#define External (0xf << 6)
+
+#define CPUSpace (0x0 << 4)
+#define UserSpace (0x1 << 4)
+#define SupSpace (0x2 << 4)
+#define UserSupSpace (0x3 << 4)
+
+#define IPLevel_any 0x0
+#define IPLevel_1 0x2
+#define IPLevel_2 0x4
+#define IPLevel_3 0x6
+#define IPLevel_4 0x8
+#define IPLevel_5 0xa
+#define IPLevel_6 0xc
+#define IPLevel_7 0xe
+
+#define AVEC 1
+
+#define CSORBT (volatile unsigned short int * const)(0x4a + SIM_CRB)
+#define CSOR0 (volatile unsigned short int * const)(0x4e + SIM_CRB)
+#define CSOR1 (volatile unsigned short int * const)(0x52 + SIM_CRB)
+#define CSOR2 (volatile unsigned short int * const)(0x56 + SIM_CRB)
+#define CSOR3 (volatile unsigned short int * const)(0x5a + SIM_CRB)
+#define CSOR4 (volatile unsigned short int * const)(0x5e + SIM_CRB)
+#define CSOR5 (volatile unsigned short int * const)(0x62 + SIM_CRB)
+#define CSOR6 (volatile unsigned short int * const)(0x66 + SIM_CRB)
+#define CSOR7 (volatile unsigned short int * const)(0x6a + SIM_CRB)
+#define CSOR8 (volatile unsigned short int * const)(0x6e + SIM_CRB)
+#define CSOR9 (volatile unsigned short int * const)(0x72 + SIM_CRB)
+#define CSOR10 (volatile unsigned short int * const)(0x76 + SIM_CRB)
+
+#endif /* _SIM_h_ */
diff --git a/c/src/exec/score/cpu/no_cpu/asm.h b/c/src/exec/score/cpu/no_cpu/asm.h
new file mode 100644
index 0000000000..66d98be652
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/asm.h
@@ -0,0 +1,98 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __NO_CPU_ASM_h
+#define __NO_CPU_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/no_cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/c/src/exec/score/cpu/no_cpu/cpu.c b/c/src/exec/score/cpu/no_cpu/cpu.c
new file mode 100644
index 0000000000..ba533324ac
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/cpu.c
@@ -0,0 +1,160 @@
+/*
+ * XXX CPU Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/wkspace.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ /*
+ * The thread_dispatch argument is the address of the entry point
+ * for the routine called at the end of an ISR once it has been
+ * decided a context switch is necessary. On some compilation
+ * systems it is difficult to call a high-level language routine
+ * from assembly. This allows us to trick these systems.
+ *
+ * If you encounter this problem save the entry point in a CPU
+ * dependent variable.
+ */
+
+ _CPU_Thread_dispatch_pointer = thread_dispatch;
+
+ /*
+ * If there is not an easy way to initialize the FP context
+ * during Context_Initialize, then it is usually easier to
+ * save an "uninitialized" FP context here and copy it to
+ * the task's during Context_Initialize.
+ */
+
+ /* FP context initialization support goes here */
+
+ _CPU_Table = *cpu_table;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ /*
+ * This routine returns the current interrupt level.
+ */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ /*
+ * This is where we install the interrupt handler into the "raw" interrupt
+ * table used by the CPU to dispatch interrupt handlers.
+ */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * NOTES:
+ *
+ * 1. This is the same as the regular CPU independent algorithm.
+ *
+ * 2. If you implement this using a "halt", "idle", or "shutdown"
+ * instruction, then don't forget to put it in an infinite loop.
+ *
+ * 3. Be warned. Some processors with onboard DMA have been known
+ * to stop the DMA if the CPU were put in IDLE mode. This might
+ * also be a problem with other on-chip peripherals. So use this
+ * hook with caution.
+ */
+
+void _CPU_Thread_Idle_body( void )
+{
+
+ for( ; ; )
+ /* insert your "halt" instruction here */ ;
+}
diff --git a/c/src/exec/score/cpu/no_cpu/cpu.h b/c/src/exec/score/cpu/no_cpu/cpu.h
new file mode 100644
index 0000000000..7e80e3c018
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/cpu.h
@@ -0,0 +1,853 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the XXX
+ * processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/no_cpu.h> /* pick up machine definitions */
+#ifndef ASM
+#include <rtems/score/no_cputypes.h>
+#endif
+
+/* conditional compilation parameters */
+
+/*
+ * Should the calls to _Thread_Enable_dispatch be inlined?
+ *
+ * If TRUE, then they are inlined.
+ * If FALSE, then a subroutine call is made.
+ *
+ * Basically this is an example of the classic trade-off of size
+ * versus speed. Inlining the call (TRUE) typically increases the
+ * size of RTEMS while speeding up the enabling of dispatching.
+ * [NOTE: In general, the _Thread_Dispatch_disable_level will
+ * only be 0 or 1 unless you are in an interrupt handler and that
+ * interrupt handler invokes the executive.] When not inlined
+ * something calls _Thread_Enable_dispatch which in turns calls
+ * _Thread_Dispatch. If the enable dispatch is inlined, then
+ * one subroutine call is avoided entirely.]
+ */
+
+#define CPU_INLINE_ENABLE_DISPATCH FALSE
+
+/*
+ * Should the body of the search loops in _Thread_queue_Enqueue_priority
+ * be unrolled one time? In unrolled each iteration of the loop examines
+ * two "nodes" on the chain being searched. Otherwise, only one node
+ * is examined per iteration.
+ *
+ * If TRUE, then the loops are unrolled.
+ * If FALSE, then the loops are not unrolled.
+ *
+ * The primary factor in making this decision is the cost of disabling
+ * and enabling interrupts (_ISR_Flash) versus the cost of rest of the
+ * body of the loop. On some CPUs, the flash is more expensive than
+ * one iteration of the loop body. In this case, it might be desirable
+ * to unroll the loop. It is important to note that on some CPUs, this
+ * code is the longest interrupt disable period in RTEMS. So it is
+ * necessary to strike a balance when setting this parameter.
+ */
+
+#define CPU_UNROLL_ENQUEUE_PRIORITY TRUE
+
+/*
+ * Does RTEMS manage a dedicated interrupt stack in software?
+ *
+ * If TRUE, then a stack is allocated in _Interrupt_Manager_initialization.
+ * If FALSE, nothing is done.
+ *
+ * If the CPU supports a dedicated interrupt stack in hardware,
+ * then it is generally the responsibility of the BSP to allocate it
+ * and set it up.
+ *
+ * If the CPU does not support a dedicated interrupt stack, then
+ * the porter has two options: (1) execute interrupts on the
+ * stack of the interrupted task, and (2) have RTEMS manage a dedicated
+ * interrupt stack.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+
+/*
+ * Does this CPU have hardware support for a dedicated interrupt stack?
+ *
+ * If TRUE, then it must be installed during initialization.
+ * If FALSE, then no installation is performed.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK TRUE
+
+/*
+ * Does RTEMS allocate a dedicated interrupt stack in the Interrupt Manager?
+ *
+ * If TRUE, then the memory is allocated during initialization.
+ * If FALSE, then the memory is allocated during initialization.
+ *
+ * This should be TRUE is CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE
+ * or CPU_INSTALL_HARDWARE_INTERRUPT_STACK is TRUE.
+ */
+
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * Does the CPU have hardware floating point?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is supported.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is ignored.
+ *
+ * If there is a FP coprocessor such as the i387 or mc68881, then
+ * the answer is TRUE.
+ *
+ * The macro name "NO_CPU_HAS_FPU" should be made CPU specific.
+ * It indicates whether or not this CPU model has FP support. For
+ * example, it would be possible to have an i386_nofp CPU model
+ * which set this to false to indicate that you have an i386 without
+ * an i387 and wish to leave floating point support out of RTEMS.
+ */
+
+#if ( NO_CPU_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+/*
+ * Are all tasks RTEMS_FLOATING_POINT tasks implicitly?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is assumed.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is followed.
+ *
+ * So far, the only CPU in which this option has been used is the
+ * HP PA-RISC. The HP C compiler and gcc both implicitly use the
+ * floating point registers to perform integer multiplies. If
+ * a function which you would not think utilize the FP unit DOES,
+ * then one can not easily predict which tasks will use the FP hardware.
+ * In this case, this option should be TRUE.
+ *
+ * If CPU_HARDWARE_FP is FALSE, then this should be FALSE as well.
+ */
+
+#define CPU_ALL_TASKS_ARE_FP TRUE
+
+/*
+ * Should the IDLE task have a floating point context?
+ *
+ * If TRUE, then the IDLE task is created as a RTEMS_FLOATING_POINT task
+ * and it has a floating point context which is switched in and out.
+ * If FALSE, then the IDLE task does not have a floating point context.
+ *
+ * Setting this to TRUE negatively impacts the time required to preempt
+ * the IDLE task from an interrupt because the floating point context
+ * must be saved as part of the preemption.
+ */
+
+#define CPU_IDLE_TASK_IS_FP FALSE
+
+/*
+ * Should the saving of the floating point registers be deferred
+ * until a context switch is made to another different floating point
+ * task?
+ *
+ * If TRUE, then the floating point context will not be stored until
+ * necessary. It will remain in the floating point registers and not
+ * disturned until another floating point task is switched to.
+ *
+ * If FALSE, then the floating point context is saved when a floating
+ * point task is switched out and restored when the next floating point
+ * task is restored. The state of the floating point registers between
+ * those two operations is not specified.
+ *
+ * If the floating point context does NOT have to be saved as part of
+ * interrupt dispatching, then it should be safe to set this to TRUE.
+ *
+ * Setting this flag to TRUE results in using a different algorithm
+ * for deciding when to save and restore the floating point context.
+ * The deferred FP switch algorithm minimizes the number of times
+ * the FP context is saved and restored. The FP context is not saved
+ * until a context switch is made to another, different FP task.
+ * Thus in a system with only one FP task, the FP context will never
+ * be saved or restored.
+ */
+
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+/*
+ * Does this port provide a CPU dependent IDLE task implementation?
+ *
+ * If TRUE, then the routine _CPU_Thread_Idle_body
+ * must be provided and is the default IDLE thread body instead of
+ * _CPU_Thread_Idle_body.
+ *
+ * If FALSE, then use the generic IDLE thread body if the BSP does
+ * not provide one.
+ *
+ * This is intended to allow for supporting processors which have
+ * a low power or idle mode. When the IDLE thread is executed, then
+ * the CPU can be powered down.
+ *
+ * The order of precedence for selecting the IDLE thread body is:
+ *
+ * 1. BSP provided
+ * 2. CPU dependent (if provided)
+ * 3. generic (if no BSP and no CPU dependent)
+ */
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
+
+/*
+ * Does the stack grow up (toward higher addresses) or down
+ * (toward lower addresses)?
+ *
+ * If TRUE, then the grows upward.
+ * If FALSE, then the grows toward smaller addresses.
+ */
+
+#define CPU_STACK_GROWS_UP TRUE
+
+/*
+ * The following is the variable attribute used to force alignment
+ * of critical RTEMS structures. On some processors it may make
+ * sense to have these aligned on tighter boundaries than
+ * the minimum requirements of the compiler in order to have as
+ * much of the critical data area as possible in a cache line.
+ *
+ * The placement of this macro in the declaration of the variables
+ * is based on the syntactically requirements of the GNU C
+ * "__attribute__" extension. For example with GNU C, use
+ * the following to force a structures to a 32 byte boundary.
+ *
+ * __attribute__ ((aligned (32)))
+ *
+ * NOTE: Currently only the Priority Bit Map table uses this feature.
+ * To benefit from using this, the data must be heavily
+ * used so it will stay in the cache and used frequently enough
+ * in the executive to justify turning this on.
+ */
+
+#define CPU_STRUCTURE_ALIGNMENT
+
+/*
+ * The following defines the number of bits actually used in the
+ * interrupt field of the task mode. How those bits map to the
+ * CPU interrupt levels is defined by the routine _CPU_ISR_Set_level().
+ */
+
+#define CPU_MODES_INTERRUPT_MASK 0x00000001
+
+/*
+ * Processor defined structures
+ *
+ * Examples structures include the descriptor tables from the i386
+ * and the processor control structure on the i960ca.
+ */
+
+/* may need to put some structures here. */
+
+/*
+ * Contexts
+ *
+ * Generally there are 2 types of context to save.
+ * 1. Interrupt registers to save
+ * 2. Task level registers to save
+ *
+ * This means we have the following 3 context items:
+ * 1. task level context stuff:: Context_Control
+ * 2. floating point task stuff:: Context_Control_fp
+ * 3. special interrupt level context :: Context_Control_interrupt
+ *
+ * On some processors, it is cost-effective to save only the callee
+ * preserved registers during a task context switch. This means
+ * that the ISR code needs to save those registers which do not
+ * persist across function calls. It is not mandatory to make this
+ * distinctions between the caller/callee saves registers for the
+ * purpose of minimizing context saved during task switch and on interrupts.
+ * If the cost of saving extra registers is minimal, simplicity is the
+ * choice. Save the same context on interrupt entry as for tasks in
+ * this case.
+ *
+ * Additionally, if gdb is to be made aware of RTEMS tasks for this CPU, then
+ * care should be used in designing the context area.
+ *
+ * On some CPUs with hardware floating point support, the Context_Control_fp
+ * structure will not be used or it simply consist of an array of a
+ * fixed number of bytes. This is done when the floating point context
+ * is dumped by a "FP save context" type instruction and the format
+ * is not really defined by the CPU. In this case, there is no need
+ * to figure out the exact format -- only the size. Of course, although
+ * this is enough information for RTEMS, it is probably not enough for
+ * a debugger such as gdb. But that is another problem.
+ */
+
+typedef struct {
+ unsigned32 some_integer_register;
+ unsigned32 some_system_register;
+} Context_Control;
+
+typedef struct {
+ double some_float_register;
+} Context_Control_fp;
+
+typedef struct {
+ unsigned32 special_interrupt_register;
+} CPU_Interrupt_frame;
+
+
+/*
+ * The following table contains the information required to configure
+ * the XXX processor specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+ unsigned32 some_other_cpu_dependent_info;
+} rtems_cpu_table;
+
+/*
+ * This variable is optional. It is used on CPUs on which it is difficult
+ * to generate an "uninitialized" FP context. It is filled in by
+ * _CPU_Initialize and copied into the task's FP context area during
+ * _CPU_Context_Initialize.
+ */
+
+EXTERN Context_Control_fp _CPU_Null_fp_context;
+
+/*
+ * On some CPUs, RTEMS supports a software managed interrupt stack.
+ * This stack is allocated by the Interrupt Manager and the switch
+ * is performed in _ISR_Handler. These variables contain pointers
+ * to the lowest and highest addresses in the chunk of memory allocated
+ * for the interrupt stack. Since it is unknown whether the stack
+ * grows up or down (in general), this give the CPU dependent
+ * code the option of picking the version it wants to use.
+ *
+ * NOTE: These two variables are required if the macro
+ * CPU_HAS_SOFTWARE_INTERRUPT_STACK is defined as TRUE.
+ */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+/*
+ * With some compilation systems, it is difficult if not impossible to
+ * call a high-level language routine from assembly language. This
+ * is especially true of commercial Ada compilers and name mangling
+ * C++ ones. This variable can be optionally defined by the CPU porter
+ * and contains the address of the routine _Thread_Dispatch. This
+ * can make it easier to invoke that routine at the end of the interrupt
+ * sequence (if a dispatch is necessary).
+ */
+
+EXTERN void (*_CPU_Thread_dispatch_pointer)();
+
+/*
+ * Nothing prevents the porter from declaring more CPU specific variables.
+ */
+
+/* XXX: if needed, put more variables here */
+
+/*
+ * The size of the floating point context area. On some CPUs this
+ * will not be a "sizeof" because the format of the floating point
+ * area is not defined -- only the size is. This is usually on
+ * CPUs with a "floating point save context" instruction.
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/*
+ * Amount of extra stack (above minimum stack size) required by
+ * MPCI receive server thread. Remember that in a multiprocessor
+ * system this thread must exist and be able to process all directives.
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
+
+/*
+ * This defines the number of entries in the ISR_Vector_table managed
+ * by RTEMS.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 32
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Should be large enough to run all RTEMS tests. This insures
+ * that a "reasonable" small application should not have any problems.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE (1024*4)
+
+/*
+ * CPU's worst alignment requirement for data types on a byte boundary. This
+ * alignment does not take into account the requirements for the stack.
+ */
+
+#define CPU_ALIGNMENT 8
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * heap handler. This alignment requirement may be stricter than that
+ * for the data types alignment specified by CPU_ALIGNMENT. It is
+ * common for the heap to follow the same alignment requirement as
+ * CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict enough for the heap,
+ * then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for memory
+ * buffers allocated by the partition manager. This alignment requirement
+ * may be stricter than that for the data types alignment specified by
+ * CPU_ALIGNMENT. It is common for the partition to follow the same
+ * alignment requirement as CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict
+ * enough for the partition, then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * stack. This alignment requirement may be stricter than that for the
+ * data types alignment specified by CPU_ALIGNMENT. If the CPU_ALIGNMENT
+ * is strict enough for the stack, then this should be set to 0.
+ *
+ * NOTE: This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
+ */
+
+#define CPU_STACK_ALIGNMENT 0
+
+/* ISR handler macros */
+
+/*
+ * Disable all interrupts for an RTEMS critical section. The previous
+ * level is returned in _level.
+ */
+
+#define _CPU_ISR_Disable( _isr_cookie ) \
+ { \
+ (_isr_cookie) = 0; /* do something to prevent warnings */ \
+ }
+
+/*
+ * Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
+ * This indicates the end of an RTEMS critical section. The parameter
+ * _level is not modified.
+ */
+
+#define _CPU_ISR_Enable( _isr_cookie ) \
+ { \
+ }
+
+/*
+ * This temporarily restores the interrupt to _level before immediately
+ * disabling them again. This is used to divide long RTEMS critical
+ * sections into two or more parts. The parameter _level is not
+ * modified.
+ */
+
+#define _CPU_ISR_Flash( _isr_cookie ) \
+ { \
+ }
+
+/*
+ * Map interrupt level in task mode onto the hardware that the CPU
+ * actually provides. Currently, interrupt levels which do not
+ * map onto the CPU in a generic fashion are undefined. Someday,
+ * it would be nice if these were "mapped" by the application
+ * via a callout. For example, m68k has 8 levels 0 - 7, levels
+ * 8 - 255 would be available for bsp/application specific meaning.
+ * This could be used to manage a programmable interrupt controller
+ * via the rtems_task_mode directive.
+ */
+
+#define _CPU_ISR_Set_level( new_level ) \
+ { \
+ }
+
+/* end of ISR handler macros */
+
+/* Context handler macros */
+
+/*
+ * Initialize the context to a state suitable for starting a
+ * task after a context restore operation. Generally, this
+ * involves:
+ *
+ * - setting a starting address
+ * - preparing the stack
+ * - preparing the stack and frame pointers
+ * - setting the proper interrupt level in the context
+ * - initializing the floating point context
+ *
+ * This routine generally does not set any unnecessary register
+ * in the context. The state of the "general data" registers is
+ * undefined at task start time.
+ *
+ * NOTE: This is_fp parameter is TRUE if the thread is to be a floating
+ * point thread. This is typically only used on CPUs where the
+ * FPU may be easily disabled by software such as on the SPARC
+ * where the PSR contains an enable FPU bit.
+ */
+
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point, _is_fp ) \
+ { \
+ }
+
+/*
+ * This routine is responsible for somehow restarting the currently
+ * executing task. If you are lucky, then all that is necessary
+ * is restoring the context. Otherwise, there will need to be
+ * a special assembly routine which does something special in this
+ * case. Context_Restore should work most of the time. It will
+ * not work if restarting self conflicts with the stack frame
+ * assumptions of restoring a context.
+ */
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+/*
+ * The purpose of this macro is to allow the initial pointer into
+ * a floating point context area (used to save the floating point
+ * context) to be at an arbitrary place in the floating point
+ * context area.
+ *
+ * This is necessary because some FP units are designed to have
+ * their context saved as a stack which grows into lower addresses.
+ * Other FP units can be saved by simply moving registers into offsets
+ * from the base of the context area. Finally some FP units provide
+ * a "dump context" instruction which could fill in from high to low
+ * or low to high based on the whim of the CPU designers.
+ */
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) (_base) + (_offset) )
+
+/*
+ * This routine initializes the FP context area passed to it to.
+ * There are a few standard ways in which to initialize the
+ * floating point context. The code included for this macro assumes
+ * that this is a CPU in which a "initial" FP context was saved into
+ * _CPU_Null_fp_context and it simply copies it to the destination
+ * context passed to it.
+ *
+ * Other models include (1) not doing anything, and (2) putting
+ * a "null FP status word" in the correct place in the FP context.
+ */
+
+#define _CPU_Context_Initialize_fp( _destination ) \
+ { \
+ *((Context_Control_fp *) *((void **) _destination)) = _CPU_Null_fp_context; \
+ }
+
+/* end of Context handler macros */
+
+/* Fatal Error manager macros */
+
+/*
+ * This routine copies _error into a known place -- typically a stack
+ * location or a register, optionally disables interrupts, and
+ * halts/stops the CPU.
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ { \
+ }
+
+/* end of Fatal Error manager macros */
+
+/* Bitfield handler macros */
+
+/*
+ * This routine sets _output to the bit number of the first bit
+ * set in _value. _value is of CPU dependent type Priority_Bit_map_control.
+ * This type may be either 16 or 32 bits wide although only the 16
+ * least significant bits will be used.
+ *
+ * There are a number of variables in using a "find first bit" type
+ * instruction.
+ *
+ * (1) What happens when run on a value of zero?
+ * (2) Bits may be numbered from MSB to LSB or vice-versa.
+ * (3) The numbering may be zero or one based.
+ * (4) The "find first bit" instruction may search from MSB or LSB.
+ *
+ * RTEMS guarantees that (1) will never happen so it is not a concern.
+ * (2),(3), (4) are handled by the macros _CPU_Priority_mask() and
+ * _CPU_Priority_bits_index(). These three form a set of routines
+ * which must logically operate together. Bits in the _value are
+ * set and cleared based on masks built by _CPU_Priority_mask().
+ * The basic major and minor values calculated by _Priority_Major()
+ * and _Priority_Minor() are "massaged" by _CPU_Priority_bits_index()
+ * to properly range between the values returned by the "find first bit"
+ * instruction. This makes it possible for _Priority_Get_highest() to
+ * calculate the major and directly index into the minor table.
+ * This mapping is necessary to ensure that 0 (a high priority major/minor)
+ * is the first bit found.
+ *
+ * This entire "find first bit" and mapping process depends heavily
+ * on the manner in which a priority is broken into a major and minor
+ * components with the major being the 4 MSB of a priority and minor
+ * the 4 LSB. Thus (0 << 4) + 0 corresponds to priority 0 -- the highest
+ * priority. And (15 << 4) + 14 corresponds to priority 254 -- the next
+ * to the lowest priority.
+ *
+ * If your CPU does not have a "find first bit" instruction, then
+ * there are ways to make do without it. Here are a handful of ways
+ * to implement this in software:
+ *
+ * - a series of 16 bit test instructions
+ * - a "binary search using if's"
+ * - _number = 0
+ * if _value > 0x00ff
+ * _value >>=8
+ * _number = 8;
+ *
+ * if _value > 0x0000f
+ * _value >=8
+ * _number += 4
+ *
+ * _number += bit_set_table[ _value ]
+ *
+ * where bit_set_table[ 16 ] has values which indicate the first
+ * bit set
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
+#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
+
+#if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE)
+
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ (_output) = 0; /* do something to prevent warnings */ \
+ }
+
+#endif
+
+/* end of Bitfield handler macros */
+
+/*
+ * This routine builds the mask which corresponds to the bit fields
+ * as searched by _CPU_Bitfield_Find_first_bit(). See the discussion
+ * for that routine.
+ */
+
+#if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE)
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 1 << (_bit_number) )
+
+#endif
+
+/*
+ * This routine translates the bit numbers returned by
+ * _CPU_Bitfield_Find_first_bit() into something suitable for use as
+ * a major or minor component of a priority. See the discussion
+ * for that routine.
+ */
+
+#if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE)
+
+#define _CPU_Priority_bits_index( _priority ) \
+ (_priority)
+
+#endif
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Install_interrupt_stack
+ *
+ * This routine installs the hardware interrupt stack pointer.
+ *
+ * NOTE: It need only be provided if CPU_HAS_HARDWARE_INTERRUPT_STACK
+ * is TRUE.
+ */
+
+void _CPU_Install_interrupt_stack( void );
+
+/*
+ * _CPU_Thread_Idle_body
+ *
+ * This routine is the CPU dependent IDLE thread body.
+ *
+ * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
+ * is TRUE.
+ */
+
+void _CPU_Thread_Idle_body( void );
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+/* The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ *
+ * This version will work on any processor, but if there is a better
+ * way for your CPU PLEASE use it. The most common way to do this is to:
+ *
+ * swap least significant two bytes with 16-bit rotate
+ * swap upper and lower 16-bits
+ * swap most significant two bytes with 16-bit rotate
+ *
+ * Some CPUs have special instructions which swap a 32-bit quantity in
+ * a single instruction (e.g. i486). It is probably best to avoid
+ * an "endian swapping control bit" in the CPU. One good reason is
+ * that interrupts would probably have to be disabled to insure that
+ * an interrupt does not try to access the same "chunk" with the wrong
+ * endian. Another good reason is that on some CPUs, the endian bit
+ * endianness for ALL fetches -- both code and data -- so the code
+ * will be fetched incorrectly.
+ */
+
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+)
+{
+ unsigned32 byte1, byte2, byte3, byte4, swapped;
+
+ byte4 = (value >> 24) & 0xff;
+ byte3 = (value >> 16) & 0xff;
+ byte2 = (value >> 8) & 0xff;
+ byte1 = value & 0xff;
+
+ swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
+ return( swapped );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/exec/score/cpu/no_cpu/cpu_asm.c b/c/src/exec/score/cpu/no_cpu/cpu_asm.c
new file mode 100644
index 0000000000..5a36ece987
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/cpu_asm.c
@@ -0,0 +1,165 @@
+/* cpu_asm.c ===> cpu_asm.S or cpu_asm.s
+ *
+ * This file contains the basic algorithms for all assembly code used
+ * in an specific CPU port of RTEMS. These algorithms must be implemented
+ * in assembly language
+ *
+ * NOTE: This is supposed to be a .S or .s file NOT a C file.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * This is supposed to be an assembly file. This means that system.h
+ * and cpu.h should not be included in a "real" cpu_asm file. An
+ * implementation in assembly should include "cpu_asm.h>
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/cpu.h>
+/* #include "cpu_asm.h> */
+
+/*
+ * _CPU_Context_save_fp_context
+ *
+ * This routine is responsible for saving the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+)
+{
+}
+
+/*
+ * _CPU_Context_restore_fp_context
+ *
+ * This routine is responsible for restoring the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+)
+{
+}
+
+/* _CPU_Context_switch
+ *
+ * This routine performs a normal non-FP context switch.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+)
+{
+}
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+)
+{
+}
+
+/* void __ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ */
+
+void _ISR_Handler()
+{
+ /*
+ * This discussion ignores a lot of the ugly details in a real
+ * implementation such as saving enough registers/state to be
+ * able to do something real. Keep in mind that the goal is
+ * to invoke a user's ISR handler which is written in C and
+ * uses a certain set of registers.
+ *
+ * Also note that the exact order is to a large extent flexible.
+ * Hardware will dictate a sequence for a certain subset of
+ * _ISR_Handler while requirements for setting
+ */
+
+ /*
+ * At entry to "common" _ISR_Handler, the vector number must be
+ * available. On some CPUs the hardware puts either the vector
+ * number or the offset into the vector table for this ISR in a
+ * known place. If the hardware does not give us this information,
+ * then the assembly portion of RTEMS for this port will contain
+ * a set of distinct interrupt entry points which somehow place
+ * the vector number in a known place (which is safe if another
+ * interrupt nests this one) and branches to _ISR_Handler.
+ *
+ * save some or all context on stack
+ * may need to save some special interrupt information for exit
+ *
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * if ( _ISR_Nest_level == 0 )
+ * switch to software interrupt stack
+ * #endif
+ *
+ * _ISR_Nest_level++;
+ *
+ * _Thread_Dispatch_disable_level++;
+ *
+ * (*_ISR_Vector_table[ vector ])( vector );
+ *
+ * --_ISR_Nest_level;
+ *
+ * if ( _ISR_Nest_level )
+ * goto the label "exit interrupt (simple case)"
+ *
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * restore stack
+ * #endif
+ *
+ * if ( !_Context_Switch_necessary )
+ * goto the label "exit interrupt (simple case)"
+ *
+ * if ( !_ISR_Signals_to_thread_executing )
+ * _ISR_Signals_to_thread_executing = FALSE;
+ * goto the label "exit interrupt (simple case)"
+ *
+ * call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
+ *
+ * prepare to get out of interrupt
+ * return from interrupt (maybe to _ISR_Dispatch)
+ *
+ * LABEL "exit interrupt (simple case):
+ * prepare to get out of interrupt
+ * return from interrupt
+ */
+}
+
diff --git a/c/src/exec/score/cpu/no_cpu/cpu_asm.h b/c/src/exec/score/cpu/no_cpu/cpu_asm.h
new file mode 100644
index 0000000000..dd1d6a427d
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/cpu_asm.h
@@ -0,0 +1,70 @@
+/*
+ * cpu_asm.h
+ *
+ * Very loose template for an include file for the cpu_asm.? file
+ * if it is implemented as a ".S" file (preprocessed by cpp) instead
+ * of a ".s" file (preprocessed by gm4 or gasp).
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#ifndef __CPU_ASM_h
+#define __CPU_ASM_h
+
+/* pull in the generated offsets */
+
+#include <rtems/score/offsets.h>
+
+/*
+ * Hardware General Registers
+ */
+
+/* put something here */
+
+/*
+ * Hardware Floating Point Registers
+ */
+
+/* put something here */
+
+/*
+ * Hardware Control Registers
+ */
+
+/* put something here */
+
+/*
+ * Calling Convention
+ */
+
+/* put something here */
+
+/*
+ * Temporary registers
+ */
+
+/* put something here */
+
+/*
+ * Floating Point Registers - SW Conventions
+ */
+
+/* put something here */
+
+/*
+ * Temporary floating point registers
+ */
+
+/* put something here */
+
+#endif
+
+/* end of file */
diff --git a/c/src/exec/score/cpu/no_cpu/no_cpu.h b/c/src/exec/score/cpu/no_cpu/no_cpu.h
new file mode 100644
index 0000000000..afc3a46571
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/no_cpu.h
@@ -0,0 +1,78 @@
+/* no_cpu.h
+ *
+ * This file is an example (i.e. "no CPU") of the file which is
+ * created for each CPU family port of RTEMS.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#ifndef _INCLUDE_NO_CPU_h
+#define _INCLUDE_NO_CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef no_cpu
+#undef no_cpu
+#endif
+#define no_cpu
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This file contains the information required to build
+ * RTEMS for a particular member of the "no cpu"
+ * family when executing in protected mode. It does
+ * this by setting variables to indicate which implementation
+ * dependent features are present in a particular member
+ * of the family.
+ */
+
+#if defined(no_cpu)
+
+#define CPU_MODEL_NAME "no_cpu"
+#define NOCPU_HAS_FPU 1
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "NO CPU"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_NO_CPU_h */
+/* end of include file */
diff --git a/c/src/exec/score/cpu/no_cpu/no_cputypes.h b/c/src/exec/score/cpu/no_cpu/no_cputypes.h
new file mode 100644
index 0000000000..c2a37667d9
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/no_cputypes.h
@@ -0,0 +1,57 @@
+/* no_cputypes.h
+ *
+ * This include file contains type definitions pertaining to the Intel
+ * no_cpu processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __NO_CPU_TYPES_h
+#define __NO_CPU_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void no_cpu_isr;
+typedef void ( *no_cpu_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/no_cpu/rtems.c b/c/src/exec/score/cpu/no_cpu/rtems.c
new file mode 100644
index 0000000000..8499b6f01d
--- /dev/null
+++ b/c/src/exec/score/cpu/no_cpu/rtems.c
@@ -0,0 +1,45 @@
+/* rtems.c ===> rtems.S or rtems.s
+ *
+ * This file contains the single entry point code for
+ * the XXX implementation of RTEMS.
+ *
+ * NOTE: This is supposed to be a .S or .s file NOT a C file.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * This is supposed to be an assembly file. This means that system.h
+ * and cpu.h should not be included in a "real" rtems file.
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/cpu.h>
+/* #include "asm.h> */
+
+/*
+ * RTEMS
+ *
+ * This routine jumps to the directive indicated in the
+ * CPU defined register. This routine is used when RTEMS is
+ * linked by itself and placed in ROM. This routine is the
+ * first address in the ROM space for RTEMS. The user "calls"
+ * this address with the directive arguments in the normal place.
+ * This routine then jumps indirectly to the correct directive
+ * preserving the arguments. The directive should not realize
+ * it has been "wrapped" in this way. The table "_Entry_points"
+ * is used to look up the directive.
+ */
+
+void RTEMS()
+{
+}
+
diff --git a/c/src/exec/score/cpu/powerpc/README b/c/src/exec/score/cpu/powerpc/README
new file mode 100644
index 0000000000..fc0dd9c7d7
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/README
@@ -0,0 +1,71 @@
+#
+# $Id$
+#
+
+There are various issues regarding this port:
+
+
+
+1) Legal
+
+This port is written by Andrew Bray <andy@i-cubed.co.uk>, and
+is copyright 1995 i-cubed ltd.
+
+
+
+2) CPU support.
+
+This release fully supports the IBM PPC403GA and PPC403GB processors.
+
+It has only been tested on the PPC403GA (using software floating
+point).
+
+With the gratefully acknowledged assistance of IBM and Blue Micro,
+this release contains code to support the following processors
+ PPC601, PPC603, PPC603e, PPC604, and PPC602.
+
+The support for these processors is incomplete, especially that for
+the PPC602 for which only sketchy data is currently available.
+
+
+
+3) Application Binary INterface
+
+In the context of RTEMS, the ABI is of interest for the following
+aspects:
+
+a) Register usage. Which registers are used to provide static variable
+ linkage, stack pointer etc.
+
+b) Function calling convention. How parameters are passed, how function
+ variables should be invoked, how values are returned, etc.
+
+c) Stack frame layout.
+
+I am aware of a number of ABIs for the PowerPC:
+
+a) The PowerOpen ABI. This is the original Power ABI used on the RS/6000.
+ This is the only ABI supported by versions of GCC before 2.7.0.
+
+b) The SVR4 ABI. This is the ABI defined by SunSoft for the Solaris port
+ to the PowerPC.
+
+c) The Embedded ABI. This is an embedded ABI for PowerPC use, which has no
+ operating system interface defined. It is promoted by SunSoft, Motorola,
+ and Cygnus Support. Cygnus are porting the GNU toolchain to this ABI.
+
+d) GCC 2.7.0. This compiler is partway along the road to supporting the EABI,
+ but is currently halfway in between.
+
+This port was built and tested using the PowerOpen ABI, with the following
+caveat: we used an ELF assembler and linker. So some attention may be required
+on the assembler files to get them through a traditional (XCOFF) PowerOpen
+assembler.
+
+This port contains support for the other ABIs, but this may prove to be incomplete
+as it is untested.
+
+In the long term, the RTEMS PowerPC port should move to the EABI as its primary
+or only port. This should wait on a true EABI version of GCC.
+
+Andrew Bray 4/December/1995
diff --git a/c/src/exec/score/cpu/powerpc/TODO b/c/src/exec/score/cpu/powerpc/TODO
new file mode 100644
index 0000000000..6e3e04e6ca
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/TODO
@@ -0,0 +1,7 @@
+#
+# $Id$
+#
+
+Todo list:
+
+Maybe decode external interrupts like the HPPA does.
diff --git a/c/src/exec/score/cpu/powerpc/cpu.c b/c/src/exec/score/cpu/powerpc/cpu.c
new file mode 100644
index 0000000000..77aacc2ed7
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/cpu.c
@@ -0,0 +1,264 @@
+/*
+ * PowerPC CPU Dependent Source
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/cpu.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/context.h>
+#include <rtems/score/thread.h>
+
+/*
+ * These are for testing purposes.
+ */
+#undef Testing
+
+#ifdef Testing
+static unsigned32 msr;
+#ifdef ppc403
+static unsigned32 evpr;
+static unsigned32 exier;
+#endif
+#endif
+
+/*
+ * ppc_interrupt_level_to_msr
+ *
+ * This routine converts a two bit interrupt level to an MSR bit map.
+ */
+
+const unsigned32 _CPU_msrs[4] =
+ { PPC_MSR_0, PPC_MSR_1, PPC_MSR_2, PPC_MSR_3 };
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+static void ppc_spurious(int, CPU_Interrupt_frame *);
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ proc_ptr handler = (proc_ptr)ppc_spurious;
+ int i;
+#if (PPC_ABI != PPC_ABI_POWEROPEN)
+ register unsigned32 r2;
+#if (PPC_ABI != PPC_ABI_GCC27)
+ register unsigned32 r13;
+
+ asm ("mr %0,13" : "=r" ((r13)) : "0" ((r13)));
+ _CPU_IRQ_info.Default_r13 = r13;
+#endif
+
+ asm ("mr %0,2" : "=r" ((r2)) : "0" ((r2)));
+ _CPU_IRQ_info.Default_r2 = r2;
+#endif
+
+ _CPU_IRQ_info.Nest_level = &_ISR_Nest_level;
+ _CPU_IRQ_info.Disable_level = &_Thread_Dispatch_disable_level;
+ _CPU_IRQ_info.Vector_table = _ISR_Vector_table;
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ _CPU_IRQ_info.Dispatch_r2 = ((unsigned32 *)_Thread_Dispatch)[1];
+#endif
+ _CPU_IRQ_info.Switch_necessary = &_Context_Switch_necessary;
+ _CPU_IRQ_info.Signal = &_ISR_Signals_to_thread_executing;
+
+ i = (int)&_CPU_IRQ_info;
+ asm volatile("mtspr 0x113, %0" : "=r" (i) : "0" (i)); /* SPRG 3 */
+
+ i = PPC_MSR_INITIAL & ~PPC_MSR_DISABLE_MASK;
+ asm volatile("mtspr 0x112, %0" : "=r" (i) : "0" (i)); /* SPRG 2 */
+
+#ifdef Testing
+ {
+ unsigned32 tmp;
+
+ asm volatile ("mfmsr %0" : "=r" (tmp));
+ msr = tmp;
+#ifdef ppc403
+ asm volatile ("mfspr %0, 0x3d6" : "=r" (tmp)); /* EVPR */
+ evpr = tmp;
+ asm volatile ("mfdcr %0, 0x42" : "=r" (tmp)); /* EXIER */
+ exier = tmp;
+ asm volatile ("mtspr 0x3d6, %0" :: "r" (0)); /* EVPR */
+#endif
+ }
+#endif
+
+ if ( cpu_table->spurious_handler )
+ handler = (proc_ptr)cpu_table->spurious_handler;
+
+ for (i = 0; i < PPC_INTERRUPT_MAX; i++)
+ _ISR_Vector_table[i] = handler;
+
+ _CPU_Table = *cpu_table;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ *
+ * COMMENTS FROM Andrew Bray <andy@i-cubed.co.uk>:
+ *
+ * The PowerPC puts its interrupt enable status in the MSR register
+ * which also contains things like endianness control. To be more
+ * awkward, the layout varies from processor to processor. This
+ * is why I adopted a table approach in my interrupt handling.
+ * Thus the inverse process is slow, because it requires a table
+ * search.
+ *
+ * This could fail, and return 4 (an invalid level) if the MSR has been
+ * set to a value not in the table. This is also quite an expensive
+ * operation - I do hope its not too common.
+ *
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level, msr;
+
+ asm volatile("mfmsr %0" : "=r" ((msr)));
+
+ msr &= PPC_MSR_DISABLE_MASK;
+
+ for (level = 0; level < 4; level++)
+ if ((_CPU_msrs[level] & PPC_MSR_DISABLE_MASK) == msr)
+ break;
+
+ return level;
+}
+
+/* _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler ? (ISR_Handler_entry)new_handler :
+ _CPU_Table.spurious_handler ?
+ (ISR_Handler_entry)_CPU_Table.spurious_handler :
+ (ISR_Handler_entry)ppc_spurious;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+ _CPU_IRQ_info.Stack = _CPU_Interrupt_stack_high - 56;
+#else
+ _CPU_IRQ_info.Stack = _CPU_Interrupt_stack_high - 8;
+#endif
+}
+
+/* Handle a spurious interrupt */
+static void ppc_spurious(int v, CPU_Interrupt_frame *i)
+{
+#if 0
+ printf("Spurious interrupt on vector %d from %08.8x\n",
+ v, i->pc);
+#endif
+#ifdef ppc403
+ if (v == PPC_IRQ_EXTERNAL)
+ {
+ register int r = 0;
+
+ asm volatile("mtdcr 0x42, %0" : "=r" ((r)) : "0" ((r))); /* EXIER */
+ }
+ else if (v == PPC_IRQ_PIT)
+ {
+ register int r = 0x08000000;
+
+ asm volatile("mtspr 0x3d8, %0" : "=r" ((r)) : "0" ((r))); /* TSR */
+ }
+ else if (v == PPC_IRQ_FIT)
+ {
+ register int r = 0x04000000;
+
+ asm volatile("mtspr 0x3d8, %0" : "=r" ((r)) : "0" ((r))); /* TSR */
+ }
+#endif
+}
+
+void _CPU_Fatal_error(unsigned32 _error)
+{
+#ifdef Testing
+ unsigned32 tmp;
+
+ tmp = msr;
+ asm volatile ("mtmsr %0" :: "r" (tmp));
+#ifdef ppc403
+ tmp = evpr;
+ asm volatile ("mtspr 0x3d6, %0" :: "r" (tmp)); /* EVPR */
+ tmp = exier;
+ asm volatile ("mtdcr 0x42, %0" :: "r" (tmp)); /* EXIER */
+#endif
+#endif
+ asm volatile ("mr 3, %0" : : "r" ((_error)));
+ asm volatile ("tweq 5,5");
+ asm volatile ("li 0,0; mtmsr 0");
+ while (1) ;
+}
diff --git a/c/src/exec/score/cpu/powerpc/cpu.h b/c/src/exec/score/cpu/powerpc/cpu.h
new file mode 100644
index 0000000000..ce365a04ec
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/cpu.h
@@ -0,0 +1,1017 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the PowerPC
+ * processor.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/cpu.h:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/ppc.h> /* pick up machine definitions */
+#ifndef ASM
+struct CPU_Interrupt_frame;
+
+#include <rtems/score/ppctypes.h>
+#endif
+
+/* conditional compilation parameters */
+
+/*
+ * Should the calls to _Thread_Enable_dispatch be inlined?
+ *
+ * If TRUE, then they are inlined.
+ * If FALSE, then a subroutine call is made.
+ *
+ * Basically this is an example of the classic trade-off of size
+ * versus speed. Inlining the call (TRUE) typically increases the
+ * size of RTEMS while speeding up the enabling of dispatching.
+ * [NOTE: In general, the _Thread_Dispatch_disable_level will
+ * only be 0 or 1 unless you are in an interrupt handler and that
+ * interrupt handler invokes the executive.] When not inlined
+ * something calls _Thread_Enable_dispatch which in turns calls
+ * _Thread_Dispatch. If the enable dispatch is inlined, then
+ * one subroutine call is avoided entirely.]
+ */
+
+#define CPU_INLINE_ENABLE_DISPATCH FALSE
+
+/*
+ * Should the body of the search loops in _Thread_queue_Enqueue_priority
+ * be unrolled one time? In unrolled each iteration of the loop examines
+ * two "nodes" on the chain being searched. Otherwise, only one node
+ * is examined per iteration.
+ *
+ * If TRUE, then the loops are unrolled.
+ * If FALSE, then the loops are not unrolled.
+ *
+ * The primary factor in making this decision is the cost of disabling
+ * and enabling interrupts (_ISR_Flash) versus the cost of rest of the
+ * body of the loop. On some CPUs, the flash is more expensive than
+ * one iteration of the loop body. In this case, it might be desirable
+ * to unroll the loop. It is important to note that on some CPUs, this
+ * code is the longest interrupt disable period in RTEMS. So it is
+ * necessary to strike a balance when setting this parameter.
+ */
+
+#define CPU_UNROLL_ENQUEUE_PRIORITY FALSE
+
+/*
+ * Does RTEMS manage a dedicated interrupt stack in software?
+ *
+ * If TRUE, then a stack is allocated in _Interrupt_Manager_initialization.
+ * If FALSE, nothing is done.
+ *
+ * If the CPU supports a dedicated interrupt stack in hardware,
+ * then it is generally the responsibility of the BSP to allocate it
+ * and set it up.
+ *
+ * If the CPU does not support a dedicated interrupt stack, then
+ * the porter has two options: (1) execute interrupts on the
+ * stack of the interrupted task, and (2) have RTEMS manage a dedicated
+ * interrupt stack.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+
+/*
+ * Does this CPU have hardware support for a dedicated interrupt stack?
+ *
+ * If TRUE, then it must be installed during initialization.
+ * If FALSE, then no installation is performed.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+/*
+ * ACB: This is a lie, but it gets us a handle on a call to set up
+ * a variable derived from the top of the interrupt stack.
+ */
+
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK TRUE
+
+/*
+ * Does RTEMS allocate a dedicated interrupt stack in the Interrupt Manager?
+ *
+ * If TRUE, then the memory is allocated during initialization.
+ * If FALSE, then the memory is allocated during initialization.
+ *
+ * This should be TRUE is CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE
+ * or CPU_INSTALL_HARDWARE_INTERRUPT_STACK is TRUE.
+ */
+
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * Does the CPU have hardware floating point?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is supported.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is ignored.
+ *
+ * If there is a FP coprocessor such as the i387 or mc68881, then
+ * the answer is TRUE.
+ *
+ * The macro name "PPC_HAS_FPU" should be made CPU specific.
+ * It indicates whether or not this CPU model has FP support. For
+ * example, it would be possible to have an i386_nofp CPU model
+ * which set this to false to indicate that you have an i386 without
+ * an i387 and wish to leave floating point support out of RTEMS.
+ */
+
+#if ( PPC_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+/*
+ * Are all tasks RTEMS_FLOATING_POINT tasks implicitly?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is assumed.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is followed.
+ *
+ * So far, the only CPU in which this option has been used is the
+ * HP PA-RISC. The HP C compiler and gcc both implicitly use the
+ * floating point registers to perform integer multiplies. If
+ * a function which you would not think utilize the FP unit DOES,
+ * then one can not easily predict which tasks will use the FP hardware.
+ * In this case, this option should be TRUE.
+ *
+ * If CPU_HARDWARE_FP is FALSE, then this should be FALSE as well.
+ */
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+
+/*
+ * Should the IDLE task have a floating point context?
+ *
+ * If TRUE, then the IDLE task is created as a RTEMS_FLOATING_POINT task
+ * and it has a floating point context which is switched in and out.
+ * If FALSE, then the IDLE task does not have a floating point context.
+ *
+ * Setting this to TRUE negatively impacts the time required to preempt
+ * the IDLE task from an interrupt because the floating point context
+ * must be saved as part of the preemption.
+ */
+
+#define CPU_IDLE_TASK_IS_FP FALSE
+
+/*
+ * Should the saving of the floating point registers be deferred
+ * until a context switch is made to another different floating point
+ * task?
+ *
+ * If TRUE, then the floating point context will not be stored until
+ * necessary. It will remain in the floating point registers and not
+ * disturned until another floating point task is switched to.
+ *
+ * If FALSE, then the floating point context is saved when a floating
+ * point task is switched out and restored when the next floating point
+ * task is restored. The state of the floating point registers between
+ * those two operations is not specified.
+ *
+ * If the floating point context does NOT have to be saved as part of
+ * interrupt dispatching, then it should be safe to set this to TRUE.
+ *
+ * Setting this flag to TRUE results in using a different algorithm
+ * for deciding when to save and restore the floating point context.
+ * The deferred FP switch algorithm minimizes the number of times
+ * the FP context is saved and restored. The FP context is not saved
+ * until a context switch is made to another, different FP task.
+ * Thus in a system with only one FP task, the FP context will never
+ * be saved or restored.
+ */
+/*
+ * ACB Note: This could make debugging tricky..
+ */
+
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+/*
+ * Does this port provide a CPU dependent IDLE task implementation?
+ *
+ * If TRUE, then the routine _CPU_Thread_Idle_body
+ * must be provided and is the default IDLE thread body instead of
+ * _CPU_Thread_Idle_body.
+ *
+ * If FALSE, then use the generic IDLE thread body if the BSP does
+ * not provide one.
+ *
+ * This is intended to allow for supporting processors which have
+ * a low power or idle mode. When the IDLE thread is executed, then
+ * the CPU can be powered down.
+ *
+ * The order of precedence for selecting the IDLE thread body is:
+ *
+ * 1. BSP provided
+ * 2. CPU dependent (if provided)
+ * 3. generic (if no BSP and no CPU dependent)
+ */
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+
+/*
+ * Does the stack grow up (toward higher addresses) or down
+ * (toward lower addresses)?
+ *
+ * If TRUE, then the grows upward.
+ * If FALSE, then the grows toward smaller addresses.
+ */
+
+#define CPU_STACK_GROWS_UP FALSE
+
+/*
+ * The following is the variable attribute used to force alignment
+ * of critical RTEMS structures. On some processors it may make
+ * sense to have these aligned on tighter boundaries than
+ * the minimum requirements of the compiler in order to have as
+ * much of the critical data area as possible in a cache line.
+ *
+ * The placement of this macro in the declaration of the variables
+ * is based on the syntactically requirements of the GNU C
+ * "__attribute__" extension. For example with GNU C, use
+ * the following to force a structures to a 32 byte boundary.
+ *
+ * __attribute__ ((aligned (32)))
+ *
+ * NOTE: Currently only the Priority Bit Map table uses this feature.
+ * To benefit from using this, the data must be heavily
+ * used so it will stay in the cache and used frequently enough
+ * in the executive to justify turning this on.
+ */
+
+#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (PPC_CACHE_ALIGNMENT)))
+
+/*
+ * The following defines the number of bits actually used in the
+ * interrupt field of the task mode. How those bits map to the
+ * CPU interrupt levels is defined by the routine _CPU_ISR_Set_level().
+ */
+/*
+ * ACB Note: Levels are:
+ * 0: All maskable interrupts enabled
+ * 1: Other critical exceptions enabled
+ * 2: Machine check enabled
+ * 3: All maskable IRQs disabled
+ */
+
+#define CPU_MODES_INTERRUPT_MASK 0x00000003
+
+/*
+ * Processor defined structures
+ *
+ * Examples structures include the descriptor tables from the i386
+ * and the processor control structure on the i960ca.
+ */
+
+/* may need to put some structures here. */
+
+/*
+ * Contexts
+ *
+ * Generally there are 2 types of context to save.
+ * 1. Interrupt registers to save
+ * 2. Task level registers to save
+ *
+ * This means we have the following 3 context items:
+ * 1. task level context stuff:: Context_Control
+ * 2. floating point task stuff:: Context_Control_fp
+ * 3. special interrupt level context :: Context_Control_interrupt
+ *
+ * On some processors, it is cost-effective to save only the callee
+ * preserved registers during a task context switch. This means
+ * that the ISR code needs to save those registers which do not
+ * persist across function calls. It is not mandatory to make this
+ * distinctions between the caller/callee saves registers for the
+ * purpose of minimizing context saved during task switch and on interrupts.
+ * If the cost of saving extra registers is minimal, simplicity is the
+ * choice. Save the same context on interrupt entry as for tasks in
+ * this case.
+ *
+ * Additionally, if gdb is to be made aware of RTEMS tasks for this CPU, then
+ * care should be used in designing the context area.
+ *
+ * On some CPUs with hardware floating point support, the Context_Control_fp
+ * structure will not be used or it simply consist of an array of a
+ * fixed number of bytes. This is done when the floating point context
+ * is dumped by a "FP save context" type instruction and the format
+ * is not really defined by the CPU. In this case, there is no need
+ * to figure out the exact format -- only the size. Of course, although
+ * this is enough information for RTEMS, it is probably not enough for
+ * a debugger such as gdb. But that is another problem.
+ */
+
+typedef struct {
+ unsigned32 gpr1; /* Stack pointer for all */
+ unsigned32 gpr2; /* TOC in PowerOpen, reserved SVR4, section ptr EABI + */
+ unsigned32 gpr13; /* First non volatile PowerOpen, section ptr SVR4/EABI */
+ unsigned32 gpr14; /* Non volatile for all */
+ unsigned32 gpr15; /* Non volatile for all */
+ unsigned32 gpr16; /* Non volatile for all */
+ unsigned32 gpr17; /* Non volatile for all */
+ unsigned32 gpr18; /* Non volatile for all */
+ unsigned32 gpr19; /* Non volatile for all */
+ unsigned32 gpr20; /* Non volatile for all */
+ unsigned32 gpr21; /* Non volatile for all */
+ unsigned32 gpr22; /* Non volatile for all */
+ unsigned32 gpr23; /* Non volatile for all */
+ unsigned32 gpr24; /* Non volatile for all */
+ unsigned32 gpr25; /* Non volatile for all */
+ unsigned32 gpr26; /* Non volatile for all */
+ unsigned32 gpr27; /* Non volatile for all */
+ unsigned32 gpr28; /* Non volatile for all */
+ unsigned32 gpr29; /* Non volatile for all */
+ unsigned32 gpr30; /* Non volatile for all */
+ unsigned32 gpr31; /* Non volatile for all */
+ unsigned32 cr; /* PART of the CR is non volatile for all */
+ unsigned32 pc; /* Program counter/Link register */
+ unsigned32 msr; /* Initial interrupt level */
+} Context_Control;
+
+typedef struct {
+ /* The ABIs (PowerOpen/SVR4/EABI) only require saving f14-f31 over
+ * procedure calls. However, this would mean that the interrupt
+ * frame had to hold f0-f13, and the fpscr. And as the majority
+ * of tasks will not have an FP context, we will save the whole
+ * context here.
+ */
+#if (PPC_HAS_DOUBLE == 1)
+ double f[32];
+ double fpscr;
+#else
+ float f[32];
+ float fpscr;
+#endif
+} Context_Control_fp;
+
+typedef struct CPU_Interrupt_frame {
+ unsigned32 stacklink; /* Ensure this is a real frame (also reg1 save) */
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+ unsigned32 dummy[13]; /* Used by callees: PowerOpen ABI */
+#else
+ unsigned32 dummy[1]; /* Used by callees: SVR4/EABI */
+#endif
+ /* This is what is left out of the primary contexts */
+ unsigned32 gpr0;
+ unsigned32 gpr2; /* play safe */
+ unsigned32 gpr3;
+ unsigned32 gpr4;
+ unsigned32 gpr5;
+ unsigned32 gpr6;
+ unsigned32 gpr7;
+ unsigned32 gpr8;
+ unsigned32 gpr9;
+ unsigned32 gpr10;
+ unsigned32 gpr11;
+ unsigned32 gpr12;
+ unsigned32 gpr13; /* Play safe */
+ unsigned32 gpr28; /* For internal use by the IRQ handler */
+ unsigned32 gpr29; /* For internal use by the IRQ handler */
+ unsigned32 gpr30; /* For internal use by the IRQ handler */
+ unsigned32 gpr31; /* For internal use by the IRQ handler */
+ unsigned32 cr; /* Bits of this are volatile, so no-one may save */
+ unsigned32 ctr;
+ unsigned32 xer;
+ unsigned32 lr;
+ unsigned32 pc;
+ unsigned32 msr;
+ unsigned32 pad[3];
+} CPU_Interrupt_frame;
+
+
+/*
+ * The following table contains the information required to configure
+ * the PowerPC processor specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+ unsigned32 clicks_per_usec; /* Timer clicks per microsecond */
+ unsigned32 serial_per_sec; /* Serial clocks per second */
+ boolean serial_external_clock;
+ boolean serial_xon_xoff;
+ boolean serial_cts_rts;
+ unsigned32 serial_rate;
+ unsigned32 timer_average_overhead; /* Average overhead of timer in ticks */
+ unsigned32 timer_least_valid; /* Least valid number from timer */
+ void (*spurious_handler)(unsigned32 vector, CPU_Interrupt_frame *);
+} rtems_cpu_table;
+
+/*
+ * This variable is optional. It is used on CPUs on which it is difficult
+ * to generate an "uninitialized" FP context. It is filled in by
+ * _CPU_Initialize and copied into the task's FP context area during
+ * _CPU_Context_Initialize.
+ */
+
+/* EXTERN Context_Control_fp _CPU_Null_fp_context; */
+
+/*
+ * On some CPUs, RTEMS supports a software managed interrupt stack.
+ * This stack is allocated by the Interrupt Manager and the switch
+ * is performed in _ISR_Handler. These variables contain pointers
+ * to the lowest and highest addresses in the chunk of memory allocated
+ * for the interrupt stack. Since it is unknown whether the stack
+ * grows up or down (in general), this give the CPU dependent
+ * code the option of picking the version it wants to use.
+ *
+ * NOTE: These two variables are required if the macro
+ * CPU_HAS_SOFTWARE_INTERRUPT_STACK is defined as TRUE.
+ */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+/*
+ * With some compilation systems, it is difficult if not impossible to
+ * call a high-level language routine from assembly language. This
+ * is especially true of commercial Ada compilers and name mangling
+ * C++ ones. This variable can be optionally defined by the CPU porter
+ * and contains the address of the routine _Thread_Dispatch. This
+ * can make it easier to invoke that routine at the end of the interrupt
+ * sequence (if a dispatch is necessary).
+ */
+
+/* EXTERN void (*_CPU_Thread_dispatch_pointer)(); */
+
+/*
+ * Nothing prevents the porter from declaring more CPU specific variables.
+ */
+
+EXTERN struct {
+ unsigned32 *Nest_level;
+ unsigned32 *Disable_level;
+ void *Vector_table;
+ void *Stack;
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ unsigned32 Dispatch_r2;
+#else
+ unsigned32 Default_r2;
+#if (PPC_ABI != PPC_ABI_GCC27)
+ unsigned32 Default_r13;
+#endif
+#endif
+ boolean *Switch_necessary;
+ boolean *Signal;
+} _CPU_IRQ_info CPU_STRUCTURE_ALIGNMENT;
+
+/*
+ * The size of the floating point context area. On some CPUs this
+ * will not be a "sizeof" because the format of the floating point
+ * area is not defined -- only the size is. This is usually on
+ * CPUs with a "floating point save context" instruction.
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/*
+ * (Optional) # of bytes for libmisc/stackchk to check
+ * If not specifed, then it defaults to something reasonable
+ * for most architectures.
+ */
+
+#define CPU_STACK_CHECK_SIZE (128)
+
+/*
+ * Amount of extra stack (above minimum stack size) required by
+ * MPCI receive server thread. Remember that in a multiprocessor
+ * system this thread must exist and be able to process all directives.
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
+
+/*
+ * This defines the number of entries in the ISR_Vector_table managed
+ * by RTEMS.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS (PPC_INTERRUPT_MAX)
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Should be large enough to run all RTEMS tests. This insures
+ * that a "reasonable" small application should not have any problems.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE (1024*3)
+
+/*
+ * CPU's worst alignment requirement for data types on a byte boundary. This
+ * alignment does not take into account the requirements for the stack.
+ */
+
+#define CPU_ALIGNMENT (PPC_ALIGNMENT)
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * heap handler. This alignment requirement may be stricter than that
+ * for the data types alignment specified by CPU_ALIGNMENT. It is
+ * common for the heap to follow the same alignment requirement as
+ * CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict enough for the heap,
+ * then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_HEAP_ALIGNMENT (PPC_ALIGNMENT)
+
+/*
+ * This number corresponds to the byte alignment requirement for memory
+ * buffers allocated by the partition manager. This alignment requirement
+ * may be stricter than that for the data types alignment specified by
+ * CPU_ALIGNMENT. It is common for the partition to follow the same
+ * alignment requirement as CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict
+ * enough for the partition, then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_PARTITION_ALIGNMENT (PPC_ALIGNMENT)
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * stack. This alignment requirement may be stricter than that for the
+ * data types alignment specified by CPU_ALIGNMENT. If the CPU_ALIGNMENT
+ * is strict enough for the stack, then this should be set to 0.
+ *
+ * NOTE: This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
+ */
+
+#define CPU_STACK_ALIGNMENT (PPC_STACK_ALIGNMENT)
+
+/* ISR handler macros */
+
+/*
+ * Disable all interrupts for an RTEMS critical section. The previous
+ * level is returned in _level.
+ */
+
+#define loc_string(a,b) a " (" #b ")\n"
+
+#define _CPU_ISR_Disable( _isr_cookie ) \
+ { \
+ asm volatile ( \
+ "mfmsr %0; andc %1,%0,%1; mtmsr %1" : \
+ "=r" ((_isr_cookie)) : "r" ((PPC_MSR_DISABLE_MASK)) \
+ ); \
+ }
+
+/*
+ * Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
+ * This indicates the end of an RTEMS critical section. The parameter
+ * _level is not modified.
+ */
+
+#define _CPU_ISR_Enable( _isr_cookie ) \
+ { \
+ asm volatile ( "mtmsr %0" : \
+ "=r" ((_isr_cookie)) : "0" ((_isr_cookie))); \
+ }
+
+/*
+ * This temporarily restores the interrupt to _level before immediately
+ * disabling them again. This is used to divide long RTEMS critical
+ * sections into two or more parts. The parameter _level is not
+ * modified.
+ */
+
+#define _CPU_ISR_Flash( _isr_cookie ) \
+ { \
+ asm volatile ( \
+ "mtmsr %0; andc %1,%0,%1; mtmsr %1" : \
+ "=r" ((_isr_cookie)) : \
+ "r" ((PPC_MSR_DISABLE_MASK)), "0" ((_isr_cookie)) \
+ ); \
+ }
+
+/*
+ * Map interrupt level in task mode onto the hardware that the CPU
+ * actually provides. Currently, interrupt levels which do not
+ * map onto the CPU in a generic fashion are undefined. Someday,
+ * it would be nice if these were "mapped" by the application
+ * via a callout. For example, m68k has 8 levels 0 - 7, levels
+ * 8 - 255 would be available for bsp/application specific meaning.
+ * This could be used to manage a programmable interrupt controller
+ * via the rtems_task_mode directive.
+ */
+
+#define _CPU_ISR_Set_level( new_level ) \
+ { \
+ register unsigned32 tmp; \
+ asm volatile ( \
+ "mfmsr %0; andc %0,%0,%1; and %2, %2, %1; or %0, %0, %2; mtmsr %0" : \
+ "=r" ((tmp)) : \
+ "r" ((PPC_MSR_DISABLE_MASK)), "r" ((_CPU_msrs[new_level])), "0" ((tmp)) \
+ ); \
+ }
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/* Context handler macros */
+
+/*
+ * Initialize the context to a state suitable for starting a
+ * task after a context restore operation. Generally, this
+ * involves:
+ *
+ * - setting a starting address
+ * - preparing the stack
+ * - preparing the stack and frame pointers
+ * - setting the proper interrupt level in the context
+ * - initializing the floating point context
+ *
+ * This routine generally does not set any unnecessary register
+ * in the context. The state of the "general data" registers is
+ * undefined at task start time.
+ */
+
+#if PPC_ABI == PPC_ABI_POWEROPEN
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point, _is_fp ) \
+ { \
+ unsigned32 sp, *desc; \
+ \
+ sp = ((unsigned32)_stack_base) + (_size) - 56; \
+ *((unsigned32 *)sp) = 0; \
+ \
+ desc = (unsigned32 *)_entry_point; \
+ \
+ (_the_context)->msr = PPC_MSR_INITIAL | \
+ _CPU_msrs[ _isr ]; \
+ (_the_context)->pc = desc[0]; \
+ (_the_context)->gpr1 = sp; \
+ (_the_context)->gpr2 = desc[1]; \
+ }
+#endif
+#if PPC_ABI == PPC_ABI_SVR4
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point ) \
+ { \
+ unsigned32 sp, r13; \
+ \
+ sp = ((unsigned32)_stack_base) + (_size) - 8; \
+ *((unsigned32 *)sp) = 0; \
+ \
+ asm volatile ("mr %0, 13" : "=r" ((r13))); \
+ \
+ (_the_context->msr) = PPC_MSR_INITIAL | \
+ _CPU_msrs[ _isr ]; \
+ (_the_context->pc) = _entry_point; \
+ (_the_context->gpr1) = sp; \
+ (_the_context->gpr13) = r13; \
+ }
+#endif
+#if PPC_ABI == PPC_ABI_EABI
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point ) \
+ { \
+ unsigned32 sp, r2, r13; \
+ \
+ sp = ((unsigned32)_stack_base) + (_size) - 8; \
+ *((unsigned32 *)sp) = 0; \
+ \
+ asm volatile ("mr %0,2; mr %1,13" : "=r" ((r2)), "=r" ((r13))); \
+ \
+ (_the_context)->msr = PPC_MSR_INITIAL | \
+ _CPU_msrs[ _isr ]; \
+ (_the_context->pc) = _entry_point; \
+ (_the_context->gpr1) = sp; \
+ (_the_context->gpr2) = r2; \
+ (_the_context->gpr13) = r13; \
+ }
+#endif
+
+/*
+ * This routine is responsible for somehow restarting the currently
+ * executing task. If you are lucky, then all that is necessary
+ * is restoring the context. Otherwise, there will need to be
+ * a special assembly routine which does something special in this
+ * case. Context_Restore should work most of the time. It will
+ * not work if restarting self conflicts with the stack frame
+ * assumptions of restoring a context.
+ */
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+/*
+ * The purpose of this macro is to allow the initial pointer into
+ * a floating point context area (used to save the floating point
+ * context) to be at an arbitrary place in the floating point
+ * context area.
+ *
+ * This is necessary because some FP units are designed to have
+ * their context saved as a stack which grows into lower addresses.
+ * Other FP units can be saved by simply moving registers into offsets
+ * from the base of the context area. Finally some FP units provide
+ * a "dump context" instruction which could fill in from high to low
+ * or low to high based on the whim of the CPU designers.
+ */
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) (_base) + (_offset) )
+
+/*
+ * This routine initializes the FP context area passed to it to.
+ * There are a few standard ways in which to initialize the
+ * floating point context. The code included for this macro assumes
+ * that this is a CPU in which a "initial" FP context was saved into
+ * _CPU_Null_fp_context and it simply copies it to the destination
+ * context passed to it.
+ *
+ * Other models include (1) not doing anything, and (2) putting
+ * a "null FP status word" in the correct place in the FP context.
+ */
+
+#define _CPU_Context_Initialize_fp( _destination ) \
+ { \
+ ((Context_Control_fp *) *((void **) _destination))->fpscr = PPC_INIT_FPSCR; \
+ }
+
+/* end of Context handler macros */
+
+/* Fatal Error manager macros */
+
+/*
+ * This routine copies _error into a known place -- typically a stack
+ * location or a register, optionally disables interrupts, and
+ * halts/stops the CPU.
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ _CPU_Fatal_error(_error)
+
+/* end of Fatal Error manager macros */
+
+/* Bitfield handler macros */
+
+/*
+ * This routine sets _output to the bit number of the first bit
+ * set in _value. _value is of CPU dependent type Priority_Bit_map_control.
+ * This type may be either 16 or 32 bits wide although only the 16
+ * least significant bits will be used.
+ *
+ * There are a number of variables in using a "find first bit" type
+ * instruction.
+ *
+ * (1) What happens when run on a value of zero?
+ * (2) Bits may be numbered from MSB to LSB or vice-versa.
+ * (3) The numbering may be zero or one based.
+ * (4) The "find first bit" instruction may search from MSB or LSB.
+ *
+ * RTEMS guarantees that (1) will never happen so it is not a concern.
+ * (2),(3), (4) are handled by the macros _CPU_Priority_mask() and
+ * _CPU_Priority_Bits_index(). These three form a set of routines
+ * which must logically operate together. Bits in the _value are
+ * set and cleared based on masks built by _CPU_Priority_mask().
+ * The basic major and minor values calculated by _Priority_Major()
+ * and _Priority_Minor() are "massaged" by _CPU_Priority_Bits_index()
+ * to properly range between the values returned by the "find first bit"
+ * instruction. This makes it possible for _Priority_Get_highest() to
+ * calculate the major and directly index into the minor table.
+ * This mapping is necessary to ensure that 0 (a high priority major/minor)
+ * is the first bit found.
+ *
+ * This entire "find first bit" and mapping process depends heavily
+ * on the manner in which a priority is broken into a major and minor
+ * components with the major being the 4 MSB of a priority and minor
+ * the 4 LSB. Thus (0 << 4) + 0 corresponds to priority 0 -- the highest
+ * priority. And (15 << 4) + 14 corresponds to priority 254 -- the next
+ * to the lowest priority.
+ *
+ * If your CPU does not have a "find first bit" instruction, then
+ * there are ways to make do without it. Here are a handful of ways
+ * to implement this in software:
+ *
+ * - a series of 16 bit test instructions
+ * - a "binary search using if's"
+ * - _number = 0
+ * if _value > 0x00ff
+ * _value >>=8
+ * _number = 8;
+ *
+ * if _value > 0x0000f
+ * _value >=8
+ * _number += 4
+ *
+ * _number += bit_set_table[ _value ]
+ *
+ * where bit_set_table[ 16 ] has values which indicate the first
+ * bit set
+ */
+
+#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
+ { \
+ asm volatile ("cntlzw %0, %1" : "=r" ((_output)), "=r" ((_value)) : \
+ "1" ((_value))); \
+ }
+
+/* end of Bitfield handler macros */
+
+/*
+ * This routine builds the mask which corresponds to the bit fields
+ * as searched by _CPU_Bitfield_Find_first_bit(). See the discussion
+ * for that routine.
+ */
+
+#define _CPU_Priority_Mask( _bit_number ) \
+ ( 0x80000000 >> (_bit_number) )
+
+/*
+ * This routine translates the bit numbers returned by
+ * _CPU_Bitfield_Find_first_bit() into something suitable for use as
+ * a major or minor component of a priority. See the discussion
+ * for that routine.
+ */
+
+#define _CPU_Priority_bits_index( _priority ) \
+ (_priority)
+
+/* end of Priority handler macros */
+
+/* variables */
+
+extern const unsigned32 _CPU_msrs[4];
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Install_interrupt_stack
+ *
+ * This routine installs the hardware interrupt stack pointer.
+ *
+ * NOTE: It need only be provided if CPU_HAS_HARDWARE_INTERRUPT_STACK
+ * is TRUE.
+ */
+
+void _CPU_Install_interrupt_stack( void );
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+void _CPU_Fatal_error(
+ unsigned32 _error
+);
+
+/* The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ *
+ * This version will work on any processor, but if there is a better
+ * way for your CPU PLEASE use it. The most common way to do this is to:
+ *
+ * swap least significant two bytes with 16-bit rotate
+ * swap upper and lower 16-bits
+ * swap most significant two bytes with 16-bit rotate
+ *
+ * Some CPUs have special instructions which swap a 32-bit quantity in
+ * a single instruction (e.g. i486). It is probably best to avoid
+ * an "endian swapping control bit" in the CPU. One good reason is
+ * that interrupts would probably have to be disabled to insure that
+ * an interrupt does not try to access the same "chunk" with the wrong
+ * endian. Another good reason is that on some CPUs, the endian bit
+ * endianness for ALL fetches -- both code and data -- so the code
+ * will be fetched incorrectly.
+ */
+
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+)
+{
+ unsigned32 swapped;
+
+ asm volatile("rlwimi %0,%1,8,24,31;"
+ "rlwimi %0,%1,24,16,23;"
+ "rlwimi %0,%1,8,8,15;"
+ "rlwimi %0,%1,24,0,7;" :
+ "=r" ((swapped)) : "r" ((value)));
+
+ return( swapped );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/exec/score/cpu/powerpc/cpu_asm.s b/c/src/exec/score/cpu/powerpc/cpu_asm.s
new file mode 100644
index 0000000000..cf95e25a5c
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/cpu_asm.s
@@ -0,0 +1,749 @@
+
+/* cpu_asm.s 1.1 - 95/12/04
+ *
+ * This file contains the assembly code for the PowerPC implementation
+ * of RTEMS.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/cpu_asm.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+/*
+ * Offsets for various Contexts
+ */
+ .set GP_1, 0
+ .set GP_2, (GP_1 + 4)
+ .set GP_13, (GP_2 + 4)
+ .set GP_14, (GP_13 + 4)
+
+ .set GP_15, (GP_14 + 4)
+ .set GP_16, (GP_15 + 4)
+ .set GP_17, (GP_16 + 4)
+ .set GP_18, (GP_17 + 4)
+
+ .set GP_19, (GP_18 + 4)
+ .set GP_20, (GP_19 + 4)
+ .set GP_21, (GP_20 + 4)
+ .set GP_22, (GP_21 + 4)
+
+ .set GP_23, (GP_22 + 4)
+ .set GP_24, (GP_23 + 4)
+ .set GP_25, (GP_24 + 4)
+ .set GP_26, (GP_25 + 4)
+
+ .set GP_27, (GP_26 + 4)
+ .set GP_28, (GP_27 + 4)
+ .set GP_29, (GP_28 + 4)
+ .set GP_30, (GP_29 + 4)
+
+ .set GP_31, (GP_30 + 4)
+ .set GP_CR, (GP_31 + 4)
+ .set GP_PC, (GP_CR + 4)
+ .set GP_MSR, (GP_PC + 4)
+
+#if (PPC_HAS_DOUBLE == 1)
+ .set FP_0, 0
+ .set FP_1, (FP_0 + 8)
+ .set FP_2, (FP_1 + 8)
+ .set FP_3, (FP_2 + 8)
+ .set FP_4, (FP_3 + 8)
+ .set FP_5, (FP_4 + 8)
+ .set FP_6, (FP_5 + 8)
+ .set FP_7, (FP_6 + 8)
+ .set FP_8, (FP_7 + 8)
+ .set FP_9, (FP_8 + 8)
+ .set FP_10, (FP_9 + 8)
+ .set FP_11, (FP_10 + 8)
+ .set FP_12, (FP_11 + 8)
+ .set FP_13, (FP_12 + 8)
+ .set FP_14, (FP_13 + 8)
+ .set FP_15, (FP_14 + 8)
+ .set FP_16, (FP_15 + 8)
+ .set FP_17, (FP_16 + 8)
+ .set FP_18, (FP_17 + 8)
+ .set FP_19, (FP_18 + 8)
+ .set FP_20, (FP_19 + 8)
+ .set FP_21, (FP_20 + 8)
+ .set FP_22, (FP_21 + 8)
+ .set FP_23, (FP_22 + 8)
+ .set FP_24, (FP_23 + 8)
+ .set FP_25, (FP_24 + 8)
+ .set FP_26, (FP_25 + 8)
+ .set FP_27, (FP_26 + 8)
+ .set FP_28, (FP_27 + 8)
+ .set FP_29, (FP_28 + 8)
+ .set FP_30, (FP_29 + 8)
+ .set FP_31, (FP_30 + 8)
+ .set FP_FPSCR, (FP_31 + 8)
+#else
+ .set FP_0, 0
+ .set FP_1, (FP_0 + 4)
+ .set FP_2, (FP_1 + 4)
+ .set FP_3, (FP_2 + 4)
+ .set FP_4, (FP_3 + 4)
+ .set FP_5, (FP_4 + 4)
+ .set FP_6, (FP_5 + 4)
+ .set FP_7, (FP_6 + 4)
+ .set FP_8, (FP_7 + 4)
+ .set FP_9, (FP_8 + 4)
+ .set FP_10, (FP_9 + 4)
+ .set FP_11, (FP_10 + 4)
+ .set FP_12, (FP_11 + 4)
+ .set FP_13, (FP_12 + 4)
+ .set FP_14, (FP_13 + 4)
+ .set FP_15, (FP_14 + 4)
+ .set FP_16, (FP_15 + 4)
+ .set FP_17, (FP_16 + 4)
+ .set FP_18, (FP_17 + 4)
+ .set FP_19, (FP_18 + 4)
+ .set FP_20, (FP_19 + 4)
+ .set FP_21, (FP_20 + 4)
+ .set FP_22, (FP_21 + 4)
+ .set FP_23, (FP_22 + 4)
+ .set FP_24, (FP_23 + 4)
+ .set FP_25, (FP_24 + 4)
+ .set FP_26, (FP_25 + 4)
+ .set FP_27, (FP_26 + 4)
+ .set FP_28, (FP_27 + 4)
+ .set FP_29, (FP_28 + 4)
+ .set FP_30, (FP_29 + 4)
+ .set FP_31, (FP_30 + 4)
+ .set FP_FPSCR, (FP_31 + 4)
+#endif
+
+ .set IP_LINK, 0
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+ .set IP_0, (IP_LINK + 56)
+#else
+ .set IP_0, (IP_LINK + 8)
+#endif
+ .set IP_2, (IP_0 + 4)
+
+ .set IP_3, (IP_2 + 4)
+ .set IP_4, (IP_3 + 4)
+ .set IP_5, (IP_4 + 4)
+ .set IP_6, (IP_5 + 4)
+
+ .set IP_7, (IP_6 + 4)
+ .set IP_8, (IP_7 + 4)
+ .set IP_9, (IP_8 + 4)
+ .set IP_10, (IP_9 + 4)
+
+ .set IP_11, (IP_10 + 4)
+ .set IP_12, (IP_11 + 4)
+ .set IP_13, (IP_12 + 4)
+ .set IP_28, (IP_13 + 4)
+
+ .set IP_29, (IP_28 + 4)
+ .set IP_30, (IP_29 + 4)
+ .set IP_31, (IP_30 + 4)
+ .set IP_CR, (IP_31 + 4)
+
+ .set IP_CTR, (IP_CR + 4)
+ .set IP_XER, (IP_CTR + 4)
+ .set IP_LR, (IP_XER + 4)
+ .set IP_PC, (IP_LR + 4)
+
+ .set IP_MSR, (IP_PC + 4)
+ .set IP_END, (IP_MSR + 16)
+
+ /* _CPU_IRQ_info offsets */
+ /* These must be in this order */
+ .set Nest_level, 0
+ .set Disable_level, 4
+ .set Vector_table, 8
+ .set Stack, 12
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ .set Dispatch_r2, 16
+ .set Switch_necessary, 20
+#else
+ .set Default_r2, 16
+#if (PPC_ABI != PPC_ABI_GCC27)
+ .set Default_r13, 20
+ .set Switch_necessary, 24
+#else
+ .set Switch_necessary, 20
+#endif
+#endif
+ .set Signal, Switch_necessary + 4
+
+ BEGIN_CODE
+/*
+ * _CPU_Context_save_fp_context
+ *
+ * This routine is responsible for saving the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_CPU_Context_save_fp)
+PROC (_CPU_Context_save_fp):
+#if (PPC_HAS_FPU == 1)
+ lwz r3, 0(r3)
+#if (PPC_HAS_DOUBLE == 1)
+ stfd f0, FP_0(r3)
+ stfd f1, FP_1(r3)
+ stfd f2, FP_2(r3)
+ stfd f3, FP_3(r3)
+ stfd f4, FP_4(r3)
+ stfd f5, FP_5(r3)
+ stfd f6, FP_6(r3)
+ stfd f7, FP_7(r3)
+ stfd f8, FP_8(r3)
+ stfd f9, FP_9(r3)
+ stfd f10, FP_10(r3)
+ stfd f11, FP_11(r3)
+ stfd f12, FP_12(r3)
+ stfd f13, FP_13(r3)
+ stfd f14, FP_14(r3)
+ stfd f15, FP_15(r3)
+ stfd f16, FP_16(r3)
+ stfd f17, FP_17(r3)
+ stfd f18, FP_18(r3)
+ stfd f19, FP_19(r3)
+ stfd f20, FP_20(r3)
+ stfd f21, FP_21(r3)
+ stfd f22, FP_22(r3)
+ stfd f23, FP_23(r3)
+ stfd f24, FP_24(r3)
+ stfd f25, FP_25(r3)
+ stfd f26, FP_26(r3)
+ stfd f27, FP_27(r3)
+ stfd f28, FP_28(r3)
+ stfd f29, FP_29(r3)
+ stfd f30, FP_30(r3)
+ stfd f31, FP_31(r3)
+ mffs f2
+ stfd f2, FP_FPSCR(r3)
+#else
+ stfs f0, FP_0(r3)
+ stfs f1, FP_1(r3)
+ stfs f2, FP_2(r3)
+ stfs f3, FP_3(r3)
+ stfs f4, FP_4(r3)
+ stfs f5, FP_5(r3)
+ stfs f6, FP_6(r3)
+ stfs f7, FP_7(r3)
+ stfs f8, FP_8(r3)
+ stfs f9, FP_9(r3)
+ stfs f10, FP_10(r3)
+ stfs f11, FP_11(r3)
+ stfs f12, FP_12(r3)
+ stfs f13, FP_13(r3)
+ stfs f14, FP_14(r3)
+ stfs f15, FP_15(r3)
+ stfs f16, FP_16(r3)
+ stfs f17, FP_17(r3)
+ stfs f18, FP_18(r3)
+ stfs f19, FP_19(r3)
+ stfs f20, FP_20(r3)
+ stfs f21, FP_21(r3)
+ stfs f22, FP_22(r3)
+ stfs f23, FP_23(r3)
+ stfs f24, FP_24(r3)
+ stfs f25, FP_25(r3)
+ stfs f26, FP_26(r3)
+ stfs f27, FP_27(r3)
+ stfs f28, FP_28(r3)
+ stfs f29, FP_29(r3)
+ stfs f30, FP_30(r3)
+ stfs f31, FP_31(r3)
+ mffs f2
+ stfs f2, FP_FPSCR(r3)
+#endif
+#endif
+ blr
+
+/*
+ * _CPU_Context_restore_fp_context
+ *
+ * This routine is responsible for restoring the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_CPU_Context_restore_fp)
+PROC (_CPU_Context_restore_fp):
+#if (PPC_HAS_FPU == 1)
+ lwz r3, 0(r3)
+#if (PPC_HAS_DOUBLE == 1)
+ lfd f2, FP_FPSCR(r3)
+ mtfsf 255, f2
+ lfd f0, FP_0(r3)
+ lfd f1, FP_1(r3)
+ lfd f2, FP_2(r3)
+ lfd f3, FP_3(r3)
+ lfd f4, FP_4(r3)
+ lfd f5, FP_5(r3)
+ lfd f6, FP_6(r3)
+ lfd f7, FP_7(r3)
+ lfd f8, FP_8(r3)
+ lfd f9, FP_9(r3)
+ lfd f10, FP_10(r3)
+ lfd f11, FP_11(r3)
+ lfd f12, FP_12(r3)
+ lfd f13, FP_13(r3)
+ lfd f14, FP_14(r3)
+ lfd f15, FP_15(r3)
+ lfd f16, FP_16(r3)
+ lfd f17, FP_17(r3)
+ lfd f18, FP_18(r3)
+ lfd f19, FP_19(r3)
+ lfd f20, FP_20(r3)
+ lfd f21, FP_21(r3)
+ lfd f22, FP_22(r3)
+ lfd f23, FP_23(r3)
+ lfd f24, FP_24(r3)
+ lfd f25, FP_25(r3)
+ lfd f26, FP_26(r3)
+ lfd f27, FP_27(r3)
+ lfd f28, FP_28(r3)
+ lfd f29, FP_29(r3)
+ lfd f30, FP_30(r3)
+ lfd f31, FP_31(r3)
+#else
+ lfs f2, FP_FPSCR(r3)
+ mtfsf 255, f2
+ lfs f0, FP_0(r3)
+ lfs f1, FP_1(r3)
+ lfs f2, FP_2(r3)
+ lfs f3, FP_3(r3)
+ lfs f4, FP_4(r3)
+ lfs f5, FP_5(r3)
+ lfs f6, FP_6(r3)
+ lfs f7, FP_7(r3)
+ lfs f8, FP_8(r3)
+ lfs f9, FP_9(r3)
+ lfs f10, FP_10(r3)
+ lfs f11, FP_11(r3)
+ lfs f12, FP_12(r3)
+ lfs f13, FP_13(r3)
+ lfs f14, FP_14(r3)
+ lfs f15, FP_15(r3)
+ lfs f16, FP_16(r3)
+ lfs f17, FP_17(r3)
+ lfs f18, FP_18(r3)
+ lfs f19, FP_19(r3)
+ lfs f20, FP_20(r3)
+ lfs f21, FP_21(r3)
+ lfs f22, FP_22(r3)
+ lfs f23, FP_23(r3)
+ lfs f24, FP_24(r3)
+ lfs f25, FP_25(r3)
+ lfs f26, FP_26(r3)
+ lfs f27, FP_27(r3)
+ lfs f28, FP_28(r3)
+ lfs f29, FP_29(r3)
+ lfs f30, FP_30(r3)
+ lfs f31, FP_31(r3)
+#endif
+#endif
+ blr
+
+
+/* _CPU_Context_switch
+ *
+ * This routine performs a normal non-FP context switch.
+ */
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_CPU_Context_switch)
+PROC (_CPU_Context_switch):
+ sync
+ isync
+#if (PPC_CACHE_ALIGNMENT == 4) /* No cache */
+ stw r1, GP_1(r3)
+ lwz r1, GP_1(r4)
+ stw r2, GP_2(r3)
+ lwz r2, GP_2(r4)
+#if (PPC_USE_MULTIPLE == 1)
+ stmw r13, GP_13(r3)
+ lmw r13, GP_13(r4)
+#else
+ stw r13, GP_13(r3)
+ lwz r13, GP_13(r4)
+ stw r14, GP_14(r3)
+ lwz r14, GP_14(r4)
+ stw r15, GP_15(r3)
+ lwz r15, GP_15(r4)
+ stw r16, GP_16(r3)
+ lwz r16, GP_16(r4)
+ stw r17, GP_17(r3)
+ lwz r17, GP_17(r4)
+ stw r18, GP_18(r3)
+ lwz r18, GP_18(r4)
+ stw r19, GP_19(r3)
+ lwz r19, GP_19(r4)
+ stw r20, GP_20(r3)
+ lwz r20, GP_20(r4)
+ stw r21, GP_21(r3)
+ lwz r21, GP_21(r4)
+ stw r22, GP_22(r3)
+ lwz r22, GP_22(r4)
+ stw r23, GP_23(r3)
+ lwz r23, GP_23(r4)
+ stw r24, GP_24(r3)
+ lwz r24, GP_24(r4)
+ stw r25, GP_25(r3)
+ lwz r25, GP_25(r4)
+ stw r26, GP_26(r3)
+ lwz r26, GP_26(r4)
+ stw r27, GP_27(r3)
+ lwz r27, GP_27(r4)
+ stw r28, GP_28(r3)
+ lwz r28, GP_28(r4)
+ stw r29, GP_29(r3)
+ lwz r29, GP_29(r4)
+ stw r30, GP_30(r3)
+ lwz r30, GP_30(r4)
+ stw r31, GP_31(r3)
+ lwz r31, GP_31(r4)
+#endif
+ mfcr r5
+ stw r5, GP_CR(r3)
+ lwz r5, GP_CR(r4)
+ mflr r6
+ mtcrf 255, r5
+ stw r6, GP_PC(r3)
+ lwz r6, GP_PC(r4)
+ mfmsr r7
+ mtlr r6
+ stw r7, GP_MSR(r3)
+ lwz r7, GP_MSR(r4)
+ mtmsr r7
+#endif
+#if (PPC_CACHE_ALIGNMENT == 16)
+ /* This assumes that all the registers are in the given order */
+ li r5, 16
+ addi r3,r3,-4
+ dcbz r5, r3
+ stw r1, GP_1+4(r3)
+ stw r2, GP_2+4(r3)
+#if (PPC_USE_MULTIPLE == 1)
+ addi r3, r3, GP_14+4
+ dcbz r5, r3
+ addi r3, r3, GP_18-GP_14
+ dcbz r5, r3
+ addi r3, r3, GP_22-GP_18
+ dcbz r5, r3
+ addi r3, r3, GP_26-GP_22
+ dcbz r5, r3
+ stmw r13, GP_13-GP_26(r3)
+#else
+ stw r13, GP_13+4(r3)
+ stwu r14, GP_14+4(r3)
+ dcbz r5, r3
+ stw r15, GP_15-GP_14(r3)
+ stw r16, GP_16-GP_14(r3)
+ stw r17, GP_17-GP_14(r3)
+ stwu r18, GP_18-GP_14(r3)
+ dcbz r5, r3
+ stw r19, GP_19-GP_18(r3)
+ stw r20, GP_20-GP_18(r3)
+ stw r21, GP_21-GP_18(r3)
+ stwu r22, GP_22-GP_18(r3)
+ dcbz r5, r3
+ stw r23, GP_23-GP_22(r3)
+ stw r24, GP_24-GP_22(r3)
+ stw r25, GP_25-GP_22(r3)
+ stwu r26, GP_26-GP_22(r3)
+ dcbz r5, r3
+ stw r27, GP_27-GP_26(r3)
+ stw r28, GP_28-GP_26(r3)
+ stw r29, GP_29-GP_26(r3)
+ stw r30, GP_30-GP_26(r3)
+ stw r31, GP_31-GP_26(r3)
+#endif
+ dcbt r0, r4
+ mfcr r6
+ stw r6, GP_CR-GP_26(r3)
+ mflr r7
+ stw r7, GP_PC-GP_26(r3)
+ mfmsr r8
+ stw r8, GP_MSR-GP_26(r3)
+
+ dcbt r5, r4
+ lwz r1, GP_1(r4)
+ lwz r2, GP_2(r4)
+#if (PPC_USE_MULTIPLE == 1)
+ addi r4, r4, GP_15
+ dcbt r5, r4
+ addi r4, r4, GP_19-GP_15
+ dcbt r5, r4
+ addi r4, r4, GP_23-GP_19
+ dcbt r5, r4
+ addi r4, r4, GP_27-GP_23
+ dcbt r5, r4
+ lmw r13, GP_13-GP_27(r4)
+#else
+ lwz r13, GP_13(r4)
+ lwz r14, GP_14(r4)
+ lwzu r15, GP_15(r4)
+ dcbt r5, r4
+ lwz r16, GP_16-GP_15(r4)
+ lwz r17, GP_17-GP_15(r4)
+ lwz r18, GP_18-GP_15(r4)
+ lwzu r19, GP_19-GP_15(r4)
+ dcbt r5, r4
+ lwz r20, GP_20-GP_19(r4)
+ lwz r21, GP_21-GP_19(r4)
+ lwz r22, GP_22-GP_19(r4)
+ lwzu r23, GP_23-GP_19(r4)
+ dcbt r5, r4
+ lwz r24, GP_24-GP_23(r4)
+ lwz r25, GP_25-GP_23(r4)
+ lwz r26, GP_26-GP_23(r4)
+ lwzu r27, GP_27-GP_23(r4)
+ dcbt r5, r4
+ lwz r28, GP_28-GP_27(r4)
+ lwz r29, GP_29-GP_27(r4)
+ lwz r30, GP_30-GP_27(r4)
+ lwz r31, GP_31-GP_27(r4)
+#endif
+ lwz r6, GP_CR-GP_27(r4)
+ lwz r7, GP_PC-GP_27(r4)
+ lwz r8, GP_MSR-GP_27(r4)
+ mtcrf 255, r6
+ mtlr r7
+ mtmsr r8
+#endif
+#if (PPC_CACHE_ALIGNMENT == 32)
+ /* This assumes that all the registers are in the given order */
+ li r5, 32
+ addi r3,r3,-4
+ dcbz r5, r3
+ stw r1, GP_1+4(r3)
+ stw r2, GP_2+4(r3)
+#if (PPC_USE_MULTIPLE == 1)
+ addi r3, r3, GP_18+4
+ dcbz r5, r3
+ stmw r13, GP_13-GP_18(r3)
+#else
+ stw r13, GP_13+4(r3)
+ stw r14, GP_14+4(r3)
+ stw r15, GP_15+4(r3)
+ stw r16, GP_16+4(r3)
+ stw r17, GP_17+4(r3)
+ stwu r18, GP_18+4(r3)
+ dcbz r5, r3
+ stw r19, GP_19-GP_18(r3)
+ stw r20, GP_20-GP_18(r3)
+ stw r21, GP_21-GP_18(r3)
+ stw r22, GP_22-GP_18(r3)
+ stw r23, GP_23-GP_18(r3)
+ stw r24, GP_24-GP_18(r3)
+ stw r25, GP_25-GP_18(r3)
+ stw r26, GP_26-GP_18(r3)
+ stw r27, GP_27-GP_18(r3)
+ stw r28, GP_28-GP_18(r3)
+ stw r29, GP_29-GP_18(r3)
+ stw r30, GP_30-GP_18(r3)
+ stw r31, GP_31-GP_18(r3)
+#endif
+ dcbt r0, r4
+ mfcr r6
+ stw r6, GP_CR-GP_18(r3)
+ mflr r7
+ stw r7, GP_PC-GP_18(r3)
+ mfmsr r8
+ stw r8, GP_MSR-GP_18(r3)
+
+ dcbt r5, r4
+ lwz r1, GP_1(r4)
+ lwz r2, GP_2(r4)
+#if (PPC_USE_MULTIPLE == 1)
+ addi r4, r4, GP_19
+ dcbt r5, r4
+ lmw r13, GP_13-GP_19(r4)
+#else
+ lwz r13, GP_13(r4)
+ lwz r14, GP_14(r4)
+ lwz r15, GP_15(r4)
+ lwz r16, GP_16(r4)
+ lwz r17, GP_17(r4)
+ lwz r18, GP_18(r4)
+ lwzu r19, GP_19(r4)
+ dcbt r5, r4
+ lwz r20, GP_20-GP_19(r4)
+ lwz r21, GP_21-GP_19(r4)
+ lwz r22, GP_22-GP_19(r4)
+ lwz r23, GP_23-GP_19(r4)
+ lwz r24, GP_24-GP_19(r4)
+ lwz r25, GP_25-GP_19(r4)
+ lwz r26, GP_26-GP_19(r4)
+ lwz r27, GP_27-GP_19(r4)
+ lwz r28, GP_28-GP_19(r4)
+ lwz r29, GP_29-GP_19(r4)
+ lwz r30, GP_30-GP_19(r4)
+ lwz r31, GP_31-GP_19(r4)
+#endif
+ lwz r6, GP_CR-GP_19(r4)
+ lwz r7, GP_PC-GP_19(r4)
+ lwz r8, GP_MSR-GP_19(r4)
+ mtcrf 255, r6
+ mtlr r7
+ mtmsr r8
+#endif
+ blr
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+/*
+ * ACB: Don't worry about cache optimisation here - this is not THAT critical.
+ */
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_CPU_Context_restore)
+PROC (_CPU_Context_restore):
+ lwz r5, GP_CR(r3)
+ lwz r6, GP_PC(r3)
+ lwz r7, GP_MSR(r3)
+ mtcrf 255, r5
+ mtlr r6
+ mtmsr r7
+ lwz r1, GP_1(r3)
+ lwz r2, GP_2(r3)
+#if (PPC_USE_MULTIPLE == 1)
+ lmw r13, GP_13(r3)
+#else
+ lwz r13, GP_13(r3)
+ lwz r14, GP_14(r3)
+ lwz r15, GP_15(r3)
+ lwz r16, GP_16(r3)
+ lwz r17, GP_17(r3)
+ lwz r18, GP_18(r3)
+ lwz r19, GP_19(r3)
+ lwz r20, GP_20(r3)
+ lwz r21, GP_21(r3)
+ lwz r22, GP_22(r3)
+ lwz r23, GP_23(r3)
+ lwz r24, GP_24(r3)
+ lwz r25, GP_25(r3)
+ lwz r26, GP_26(r3)
+ lwz r27, GP_27(r3)
+ lwz r28, GP_28(r3)
+ lwz r29, GP_29(r3)
+ lwz r30, GP_30(r3)
+ lwz r31, GP_31(r3)
+#endif
+
+ blr
+
+/* Individual interrupt prologues look like this:
+ * #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+ * #if (PPC_HAS_FPU)
+ * stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+ * #else
+ * stwu r1, -(20*4 + IP_END)(r1)
+ * #endif
+ * #else
+ * stwu r1, -(IP_END)(r1)
+ * #endif
+ * stw r0, IP_0(r1)
+ *
+ * li r0, vectornum
+ * b PROC (_ISR_Handler{,C})
+ */
+
+/* void __ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ * The vector number is in r0. R0 has already been stacked.
+ *
+ */
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_ISR_Handler)
+PROC (_ISR_Handler):
+#define LABEL(x) x
+#define MTSAVE(x) mtspr sprg0, x
+#define MFSAVE(x) mfspr x, sprg0
+#define MTPC(x) mtspr srr0, x
+#define MFPC(x) mfspr x, srr0
+#define MTMSR(x) mtspr srr1, x
+#define MFMSR(x) mfspr x, srr1
+ #include "irq_stub.s"
+ rfi
+
+#if (PPC_HAS_RFCI == 1)
+/* void __ISR_HandlerC()
+ *
+ * This routine provides the RTEMS interrupt management.
+ * For critical interrupts
+ *
+ */
+ ALIGN (PPC_CACHE_ALIGNMENT, PPC_CACHE_ALIGN_POWER)
+ PUBLIC_PROC (_ISR_HandlerC)
+PROC (_ISR_HandlerC):
+#undef LABEL
+#undef MTSAVE
+#undef MFSAVE
+#undef MTPC
+#undef MFPC
+#undef MTMSR
+#undef MFMSR
+#define LABEL(x) x##_C
+#define MTSAVE(x) mtspr sprg1, x
+#define MFSAVE(x) mfspr x, sprg1
+#define MTPC(x) mtspr srr2, x
+#define MFPC(x) mfspr x, srr2
+#define MTMSR(x) mtspr srr3, x
+#define MFMSR(x) mfspr x, srr3
+ #include "irq_stub.s"
+ rfci
+#endif
+
+/* PowerOpen descriptors for indirect function calls.
+ */
+
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ DESCRIPTOR (_CPU_Context_save_fp)
+ DESCRIPTOR (_CPU_Context_restore_fp)
+ DESCRIPTOR (_CPU_Context_switch)
+ DESCRIPTOR (_CPU_Context_restore)
+ DESCRIPTOR (_ISR_Handler)
+#if (PPC_HAS_RFCI == 1)
+ DESCRIPTOR (_ISR_HandlerC)
+#endif
+#endif
diff --git a/c/src/exec/score/cpu/powerpc/irq_stub.s b/c/src/exec/score/cpu/powerpc/irq_stub.s
new file mode 100644
index 0000000000..42a63e991f
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/irq_stub.s
@@ -0,0 +1,228 @@
+/* irq_stub.s 1.1 - 95/12/04
+ *
+ * This file contains the interrupt handler assembly code for the PowerPC
+ * implementation of RTEMS. It is #included from cpu_asm.s.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ */
+
+/* void __ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ * The vector number is in r0. R0 has already been stacked.
+ *
+ */
+ /* Finish off the interrupt frame */
+ stw r2, IP_2(r1)
+ stw r3, IP_3(r1)
+ stw r4, IP_4(r1)
+ stw r5, IP_5(r1)
+ stw r6, IP_6(r1)
+ stw r7, IP_7(r1)
+ stw r8, IP_8(r1)
+ stw r9, IP_9(r1)
+ stw r10, IP_10(r1)
+ stw r11, IP_11(r1)
+ stw r12, IP_12(r1)
+ stw r13, IP_13(r1)
+ stmw r28, IP_28(r1)
+ mfcr r5
+ mfctr r6
+ mfxer r7
+ mflr r8
+ MFPC (r9)
+ MFMSR (r10)
+ /* Establish addressing */
+ mfspr r11, sprg3
+ dcbt r0, r11
+ stw r5, IP_CR(r1)
+ stw r6, IP_CTR(r1)
+ stw r7, IP_XER(r1)
+ stw r8, IP_LR(r1)
+ stw r9, IP_PC(r1)
+ stw r10, IP_MSR(r1)
+
+ lwz r30, Vector_table(r11)
+ slwi r4,r0,2
+ lwz r28, Nest_level(r11)
+ add r4, r4, r30
+
+ lwz r30, 0(r28)
+ mr r3, r0
+ lwz r31, Stack(r11)
+ /*
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * if ( _ISR_Nest_level == 0 )
+ * switch to software interrupt stack
+ * #endif
+ */
+ /* Switch stacks, here we must prevent ALL interrupts */
+ mfmsr r5
+ mfspr r6, sprg2
+ mtmsr r6
+ cmpwi r30, 0
+ lwz r29, Disable_level(r11)
+ subf r31,r1,r31
+ bne LABEL (nested)
+ stwux r1,r1,r31
+LABEL (nested):
+ /*
+ * _ISR_Nest_level++;
+ */
+ lwz r31, 0(r29)
+ addi r30,r30,1
+ stw r30,0(r28)
+ /* From here on out, interrupts can be re-enabled. RTEMS
+ * convention says not.
+ */
+ lwz r4,0(r4)
+ /*
+ * _Thread_Dispatch_disable_level++;
+ */
+ addi r31,r31,1
+ stw r31, 0(r29)
+ mtmsr r5
+ /*
+ * (*_ISR_Vector_table[ vector ])( vector );
+ */
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ lwz r6,0(r4)
+ lwz r2,4(r4)
+ mtlr r6
+ lwz r11,8(r4)
+#endif
+#if (PPC_ABI == PPC_ABI_GCC27)
+ lwz r2, Default_r2(r11)
+ mtlr r4
+ lwz r2, 0(r2)
+#endif
+#if (PPC_ABI == PPC_ABI_SVR4 || PPC_ABI == PPC_ABI_EABI)
+ mtlr r4
+ lwz r2, Default_r2(r11)
+ lwz r13, Default_r13(r11)
+ lwz r2, 0(r2)
+ lwz r13, 0(r13)
+#endif
+ mr r4,r1
+ blrl
+ /* NOP marker for debuggers */
+ or r6,r6,r6
+
+ /* We must re-disable the interrupts */
+ mfspr r11, sprg3
+ mfspr r0, sprg2
+ mtmsr r0
+ lwz r30, 0(r28)
+ lwz r31, 0(r29)
+
+ /*
+ * if (--Thread_Dispatch_disable,--_ISR_Nest_level)
+ * goto easy_exit;
+ */
+ addi r30, r30, -1
+ cmpwi r30, 0
+ addi r31, r31, -1
+ stw r30, 0(r28)
+ stw r31, 0(r29)
+ bne LABEL (easy_exit)
+ cmpwi r31, 0
+
+ lwz r30, Switch_necessary(r11)
+
+ /*
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * restore stack
+ * #endif
+ */
+ lwz r1,0(r1)
+ bne LABEL (easy_exit)
+ lwz r30, 0(r30)
+ lwz r31, Signal(r11)
+
+ /*
+ * if ( _Context_Switch_necessary )
+ * goto switch
+ */
+ cmpwi r30, 0
+ lwz r28, 0(r31)
+ li r6,0
+ bne LABEL (switch)
+ /*
+ * if ( !_ISR_Signals_to_thread_executing )
+ * goto easy_exit
+ * _ISR_Signals_to_thread_executing = 0;
+ */
+ cmpwi r28, 0
+ beq LABEL (easy_exit)
+
+ /*
+ * switch:
+ * call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
+ */
+LABEL (switch):
+ stw r6, 0(r31)
+ /* Re-enable interrupts */
+ lwz r0, IP_MSR(r1)
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ lwz r2, Dispatch_r2(r11)
+#else
+ /* R2 and R13 still hold their values from the last call */
+#endif
+ mtmsr r0
+ bl SYM (_Thread_Dispatch)
+ /* NOP marker for debuggers */
+ or r6,r6,r6
+ /*
+ * prepare to get out of interrupt
+ */
+ /* Re-disable IRQs */
+ mfspr r0, sprg2
+ mtmsr r0
+ /*
+ * easy_exit:
+ * prepare to get out of interrupt
+ * return from interrupt
+ */
+LABEL (easy_exit):
+ lwz r5, IP_CR(r1)
+ lwz r6, IP_CTR(r1)
+ lwz r7, IP_XER(r1)
+ lwz r8, IP_LR(r1)
+ lwz r9, IP_PC(r1)
+ lwz r10, IP_MSR(r1)
+ mtcrf 255,r5
+ mtctr r6
+ mtxer r7
+ mtlr r8
+ MTPC (r9)
+ MTMSR (r10)
+ lwz r0, IP_0(r1)
+ lwz r2, IP_2(r1)
+ lwz r3, IP_3(r1)
+ lwz r4, IP_4(r1)
+ lwz r5, IP_5(r1)
+ lwz r6, IP_6(r1)
+ lwz r7, IP_7(r1)
+ lwz r8, IP_8(r1)
+ lwz r9, IP_9(r1)
+ lwz r10, IP_10(r1)
+ lwz r11, IP_11(r1)
+ lwz r12, IP_12(r1)
+ lwz r13, IP_13(r1)
+ lmw r28, IP_28(r1)
+ lwz r1, 0(r1)
diff --git a/c/src/exec/score/cpu/powerpc/ppc.h b/c/src/exec/score/cpu/powerpc/ppc.h
new file mode 100644
index 0000000000..c05760ed53
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/ppc.h
@@ -0,0 +1,318 @@
+/* ppc.h
+ *
+ * This file contains definitions for the IBM/Motorola PowerPC
+ * family members.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/no_cpu.h:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ *
+ * Note:
+ * This file is included by both C and assembler code ( -DASM )
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_PPC_h
+#define _INCLUDE_PPC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef ppc
+#undef ppc
+#endif
+#define ppc
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This file contains the information required to build
+ * RTEMS for a particular member of the "no cpu"
+ * family when executing in protected mode. It does
+ * this by setting variables to indicate which implementation
+ * dependent features are present in a particular member
+ * of the family.
+ */
+
+#if defined(ppc403)
+
+#define CPU_MODEL_NAME "PowerPC 403"
+
+#define PPC_ALIGNMENT 4
+#define PPC_CACHE_ALIGNMENT 16
+#define PPC_CACHE_ALIGN_POWER 4
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 0
+#define PPC_HAS_DOUBLE 0
+#define PPC_HAS_RFCI 1
+#define PPC_MSR_DISABLE_MASK 0x00029200
+#define PPC_MSR_INITIAL 0x00000000
+#define PPC_INIT_FPSCR 0x00000000
+#define PPC_USE_MULTIPLE 1
+#define PPC_I_CACHE 2048
+#define PPC_D_CACHE 1024
+
+#define PPC_MSR_0 0x00029200
+#define PPC_MSR_1 0x00021200
+#define PPC_MSR_2 0x00021000
+#define PPC_MSR_3 0x00000000
+
+#elif defined(ppc601)
+
+#define CPU_MODEL_NAME "PowerPC 601"
+
+#define PPC_ALIGNMENT 8
+#define PPC_CACHE_ALIGNMENT 32
+#define PPC_CACHE_ALIGN_POWER 5
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 1
+#define PPC_HAS_DOUBLE 1
+#define PPC_HAS_RFCI 0
+#define PPC_MSR_DISABLE_MASK 0x00009900
+#define PPC_MSR_INITIAL 0x00002000
+#define PPC_INIT_FPSCR 0x000000f8
+#define PPC_USE_MULTIPLE 1
+#define PPC_I_CACHE 0
+#define PPC_D_CACHE 32768
+
+#define PPC_MSR_0 0x00009900
+#define PPC_MSR_1 0x00001000
+#define PPC_MSR_2 0x00001000
+#define PPC_MSR_3 0x00000000
+
+#elif defined(ppc602)
+
+#define CPU_MODEL_NAME "PowerPC 602"
+
+#define PPC_ALIGNMENT 4
+#define PPC_CACHE_ALIGNMENT 32
+#define PPC_CACHE_ALIGN_POWER 5
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 1
+#define PPC_HAS_DOUBLE 0
+#define PPC_HAS_RFCI 0
+#define PPC_MSR_DISABLE_MASK
+#define PPC_MSR_INITIAL
+#define PPC_INIT_FPSCR
+#define PPC_USE_MULTIPLE 0
+#define PPC_I_CACHE 4096
+#define PPC_D_CACHE 4096
+
+#elif defined(ppc603)
+
+#define CPU_MODEL_NAME "PowerPC 603"
+
+#define PPC_ALIGNMENT 8
+#define PPC_CACHE_ALIGNMENT 32
+#define PPC_CACHE_ALIGN_POWER 5
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 1
+#define PPC_HAS_DOUBLE 1
+#define PPC_HAS_RFCI 0
+#define PPC_MSR_DISABLE_MASK 0x00009900
+#define PPC_MSR_INITIAL 0x00002000
+#define PPC_INIT_FPSCR 0x000000f8
+#define PPC_USE_MULTIPLE 0
+#define PPC_I_CACHE 8192
+#define PPC_D_CACHE 8192
+
+#define PPC_MSR_0 0x00009900
+#define PPC_MSR_1 0x00001000
+#define PPC_MSR_2 0x00001000
+#define PPC_MSR_3 0x00000000
+
+#elif defined(ppc603e)
+
+#define CPU_MODEL_NAME "PowerPC 603e"
+
+#define PPC_ALIGNMENT 8
+#define PPC_CACHE_ALIGNMENT 32
+#define PPC_CACHE_ALIGN_POWER 5
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 1
+#define PPC_HAS_DOUBLE 1
+#define PPC_HAS_RFCI 0
+#define PPC_MSR_DISABLE_MASK 0x00009900
+#define PPC_MSR_INITIAL 0x00002000
+#define PPC_INIT_FPSCR 0x000000f8
+#define PPC_USE_MULTIPLE 0
+#define PPC_I_CACHE 16384
+#define PPC_D_CACHE 16384
+
+#define PPC_MSR_0 0x00009900
+#define PPC_MSR_1 0x00001000
+#define PPC_MSR_2 0x00001000
+#define PPC_MSR_3 0x00000000
+
+#elif defined(ppc604)
+
+#define CPU_MODEL_NAME "PowerPC 604"
+
+#define PPC_ALIGNMENT 8
+#define PPC_CACHE_ALIGNMENT 32
+#define PPC_CACHE_ALIGN_POWER 5
+#define PPC_INTERRUPT_MAX 16
+#define PPC_HAS_FPU 1
+#define PPC_HAS_DOUBLE 1
+#define PPC_HAS_RFCI 0
+#define PPC_MSR_DISABLE_MASK 0x00009900
+#define PPC_MSR_INITIAL 0x00002000
+#define PPC_INIT_FPSCR 0x000000f8
+#define PPC_USE_MULTIPLE 0
+#define PPC_I_CACHE 16384
+#define PPC_D_CACHE 16384
+
+#define PPC_MSR_0 0x00009900
+#define PPC_MSR_1 0x00001000
+#define PPC_MSR_2 0x00001000
+#define PPC_MSR_3 0x00000000
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * Application binary interfaces.
+ * PPC_ABI MUST be defined as one of these.
+ * Only PPC_ABI_POWEROPEN is currently fully supported.
+ * Only EABI will be supported in the end when
+ * the tools are there.
+ * Only big endian is currently supported.
+ */
+/*
+ * PowerOpen ABI. This is Andy's hack of the
+ * PowerOpen ABI to ELF. ELF rather than a
+ * XCOFF assembler is used. This may work
+ * if PPC_ASM == PPC_ASM_XCOFF is defined.
+ */
+#define PPC_ABI_POWEROPEN 0
+/*
+ * GCC 2.7.0 munched version of EABI, with
+ * PowerOpen calling convention and stack frames,
+ * but EABI style indirect function calls.
+ */
+#define PPC_ABI_GCC27 1
+/*
+ * SVR4 ABI
+ */
+#define PPC_ABI_SVR4 2
+/*
+ * Embedded ABI
+ */
+#define PPC_ABI_EABI 3
+
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+#define PPC_STACK_ALIGNMENT 8
+#elif (PPC_ABI == PPC_ABI_GCC27)
+#define PPC_STACK_ALIGNMENT 8
+#elif (PPC_ABI == PPC_ABI_SVR4)
+#define PPC_STACK_ALIGNMENT 16
+#elif (PPC_ABI == PPC_ABI_EABI)
+#define PPC_STACK_ALIGNMENT 8
+#else
+#error "PPC_ABI is not properly defined"
+#endif
+#ifndef PPC_ABI
+#error "PPC_ABI is not properly defined"
+#endif
+
+/*
+ * Assemblers.
+ * PPC_ASM MUST be defined as one of these.
+ * Only PPC_ABI_ELF is currently fully supported.
+ */
+/*
+ * ELF assembler. Currently used for all ABIs.
+ */
+#define PPC_ASM_ELF 0
+/*
+ * XCOFF assembler, may be needed for PowerOpen ABI.
+ */
+#define PPC_ASM_XCOFF 1
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "PowerPC"
+
+/*
+ * Interrupt vectors.
+ */
+/* Machine check */
+#define PPC_IRQ_MCHECK 0
+/* Protection violation */
+#define PPC_IRQ_PROTECT 1
+/* External interrupt */
+#define PPC_IRQ_EXTERNAL 2
+/* Program exception */
+#define PPC_IRQ_PROGRAM 3
+/* System call */
+#define PPC_IRQ_SCALL 4
+/* Floating point unavailable */
+#define PPC_IRQ_NOFP 5
+/* Program interval timer */
+#define PPC_IRQ_PIT 6
+/* Fixed interval timer */
+#define PPC_IRQ_FIT 7
+/* Critical interrupt pin */
+#define PPC_IRQ_CRIT 8
+/* Watchdog timer */
+#define PPC_IRQ_WATCHDOG 9
+/* Debug exceptions */
+#define PPC_IRQ_DEBUG 10
+
+/*
+ * The following exceptions are not maskable, and are not
+ * necessarily predictable, so cannot be offered to RTEMS:
+ * Alignment exception - handled by the CPU module
+ * Data exceptions.
+ * Instruction exceptions.
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_PPC_h */
+/* end of include file */
diff --git a/c/src/exec/score/cpu/powerpc/ppctypes.h b/c/src/exec/score/cpu/powerpc/ppctypes.h
new file mode 100644
index 0000000000..4bbb436bf8
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/ppctypes.h
@@ -0,0 +1,74 @@
+/* ppctypes.h
+ *
+ * This include file contains type definitions pertaining to the PowerPC
+ * processor family.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/no_cputypes.h:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PPC_TYPES_h
+#define __PPC_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned32 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void ppc_isr;
+typedef void ( *ppc_isr_entry )( int, struct CPU_Interrupt_frame * );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/powerpc/rtems.s b/c/src/exec/score/cpu/powerpc/rtems.s
new file mode 100644
index 0000000000..ae6022d24b
--- /dev/null
+++ b/c/src/exec/score/cpu/powerpc/rtems.s
@@ -0,0 +1,132 @@
+/* rtems.s
+ *
+ * This file contains the single entry point code for
+ * the PowerPC implementation of RTEMS.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/exec/cpu/no_cpu/rtems.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+ BEGIN_CODE
+/*
+ * RTEMS
+ *
+ * This routine jumps to the directive indicated in r11.
+ * This routine is used when RTEMS is linked by itself and placed
+ * in ROM. This routine is the first address in the ROM space for
+ * RTEMS. The user "calls" this address with the directive arguments
+ * in the normal place.
+ * This routine then jumps indirectly to the correct directive
+ * preserving the arguments. The directive should not realize
+ * it has been "wrapped" in this way. The table "_Entry_points"
+ * is used to look up the directive.
+ */
+
+ ALIGN (4, 2)
+ PUBLIC_PROC (RTEMS)
+PROC (RTEMS):
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ mflr r0
+ stw r0, 8(r1)
+ stwu r1, -64(r1)
+
+ /* Establish addressing */
+ bl base
+base:
+ mflr r12
+ addi r12, r12, tabaddr - base
+
+ lwz r12, Entry_points-abase(r12)
+ slwi r11, r11, 2
+ lwzx r12, r12, r11
+
+ stw r2, 56(r1)
+ lwz r0, 0(r12)
+ mtlr r0
+ lwz r2, 4(r12)
+ lwz r11, 8(r12)
+ blrl
+ lwz r2, 56(r1)
+ addi r1, r1, 64
+ lwz r0, 8(r1)
+ mtlr r0
+#else
+ mflr r0
+ stw r0, 4(r1)
+ stwu r1, -16(r1)
+
+ /* Establish addressing */
+ bl base
+base:
+ mflr r12
+ addi r12, r12, tabaddr - base
+
+ lwz r12, Entry_points-abase(r12)
+ slwi r11, r11, 2
+ lwzx r11, r12, r11
+
+ stw r2, 8(r1)
+#if (PPC_ABI != PPC_ABI_GCC27)
+ stw r13, 12(r1)
+#endif
+ mtlr r11
+ lwz r11, irqinfo-abase(r12)
+ lwz r2, 0(r11)
+#if (PPC_ABI != PPC_ABI_GCC27)
+ lwz r13, 4(r11)
+#endif
+ blrl
+ lwz r2, 8(r1)
+#if (PPC_ABI != PPC_ABI_GCC27)
+ lwz r13, 12(r1)
+#endif
+ addi r1, r1, 16
+ lwz r0, 4(r1)
+ mtlr r0
+#endif
+ blr
+
+
+ /* Addressability stuff */
+tabaddr:
+abase:
+ EXTERN_VAR (_Entry_points)
+Entry_points:
+ EXT_SYM_REF (_Entry_points)
+#if (PPC_ABI != PPC_ABI_POWEROPEN)
+ EXTERN_VAR (_CPU_IRQ_info)
+irqinfo:
+ EXT_SYM_REF (_CPU_IRQ_info)
+#endif
+
+#if (PPC_ABI == PPC_ABI_POWEROPEN)
+ DESCRIPTOR (RTEMS)
+#endif
+
+
diff --git a/c/src/exec/score/cpu/sparc/README b/c/src/exec/score/cpu/sparc/README
new file mode 100644
index 0000000000..c4c2200075
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/README
@@ -0,0 +1,110 @@
+#
+# $Id$
+#
+
+This file discusses SPARC specific issues which are important to
+this port. The primary topics in this file are:
+
+ + Global Register Usage
+ + Stack Frame
+ + EF bit in the PSR
+
+
+Global Register Usage
+=====================
+
+This information on register usage is based heavily on a comment in the
+file gcc-2.7.0/config/sparc/sparc.h in the the gcc 2.7.0 source.
+
+ + g0 is hardwired to 0
+ + On non-v9 systems:
+ - g1 is free to use as temporary.
+ - g2-g4 are reserved for applications. Gcc normally uses them as
+ temporaries, but this can be disabled via the -mno-app-regs option.
+ - g5 through g7 are reserved for the operating system.
+ + On v9 systems:
+ - g1 and g5 are free to use as temporaries.
+ - g2-g4 are reserved for applications (the compiler will not normally use
+ them, but they can be used as temporaries with -mapp-regs).
+ - g6-g7 are reserved for the operating system.
+
+ NOTE: As of gcc 2.7.0 register g1 was used in the following scenarios:
+
+ + as a temporary by the 64 bit sethi pattern
+ + when restoring call-preserved registers in large stack frames
+
+RTEMS places no constraints on the usage of the global registers. Although
+gcc assumes that either g5-g7 (non-V9) or g6-g7 (V9) are reserved for the
+operating system, RTEMS does not assume any special use for them.
+
+
+
+Stack Frame
+===========
+
+The stack grows downward (i.e. to lower addresses) on the SPARC architecture.
+
+The following is the organization of the stack frame:
+
+
+
+ | ............... |
+ fp | |
+ +-------------------------------+
+ | |
+ | Local registers, temporaries, |
+ | and saved floats | x bytes
+ | |
+ sp + x +-------------------------------+
+ | |
+ | outgoing parameters past |
+ | the sixth one | x bytes
+ | |
+ sp + 92 +-------------------------------+ *
+ | | *
+ | area for callee to save | *
+ | register arguments | * 24 bytes
+ | | *
+ sp + 68 +-------------------------------+ *
+ | | *
+ | structure return pointer | * 4 bytes
+ | | *
+ sp + 64 +-------------------------------+ *
+ | | *
+ | local register set | * 32 bytes
+ | | *
+ sp + 32 +-------------------------------+ *
+ | | *
+ | input register set | * 32 bytes
+ | | *
+ sp +-------------------------------+ *
+
+
+* = minimal stack frame
+
+x = optional components
+
+EF bit in the PSR
+=================
+
+The EF (enable floating point unit) in the PSR is utilized in this port to
+prevent non-floating point tasks from performing floating point
+operations. This bit is maintained as part of the integer context.
+However, the floating point context is switched BEFORE the integer
+context. Thus the EF bit in place at the time of the FP switch may
+indicate that FP operations are disabled. This occurs on certain task
+switches, when the EF bit will be 0 for the outgoing task and thus a fault
+will be generated on the first FP operation of the FP context save.
+
+The remedy for this is to enable FP access as the first step in both the
+save and restore of the FP context area. This bit will be subsequently
+reloaded by the integer context switch.
+
+Two of the scenarios which demonstrate this problem are outlined below:
+
+1. When the first FP task is switched to. The system tasks are not FP and
+thus would be unable to restore the FP context of the incoming task.
+
+2. On a deferred FP context switch. In this case, the system might switch
+from FP Task A to non-FP Task B and then to FP Task C. In this scenario,
+the floating point state must technically be saved by a non-FP task.
diff --git a/c/src/exec/score/cpu/sparc/asm.h b/c/src/exec/score/cpu/sparc/asm.h
new file mode 100644
index 0000000000..a3d62416b8
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/asm.h
@@ -0,0 +1,111 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted.
+ *
+ * $Id$
+ */
+
+#ifndef __SPARC_ASM_h
+#define __SPARC_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+
+#include <rtems/score/sparc.h>
+#include <rtems/score/cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
+/* XXX The following ifdef magic fixes the problem but results in a warning */
+/* XXX when compiling assembly code. */
+#undef __USER_LABEL_PREFIX__
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+/*
+ * Entry for traps which jump to a programmer-specified trap handler.
+ */
+
+#define TRAP(_vector, _handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ mov _vector, %l3
+
+#endif
+/* end of include file */
+
+
diff --git a/c/src/exec/score/cpu/sparc/cpu.c b/c/src/exec/score/cpu/sparc/cpu.c
new file mode 100644
index 0000000000..23a93f176e
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/cpu.c
@@ -0,0 +1,404 @@
+/*
+ * SPARC Dependent Source
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+#if defined(erc32)
+#include <erc32.h>
+#endif
+
+/*
+ * This initializes the set of opcodes placed in each trap
+ * table entry. The routine which installs a handler is responsible
+ * for filling in the fields for the _handler address and the _vector
+ * trap type.
+ *
+ * The constants following this structure are masks for the fields which
+ * must be filled in when the handler is installed.
+ */
+
+const CPU_Trap_table_entry _CPU_Trap_slot_template = {
+ 0xa1480000, /* mov %psr, %l0 */
+ 0x29000000, /* sethi %hi(_handler), %l4 */
+ 0x81c52000, /* jmp %l4 + %lo(_handler) */
+ 0xa6102000 /* mov _vector, %l3 */
+};
+
+/*PAGE
+ *
+ * _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * Input Parameters:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ * Output Parameters: NONE
+ *
+ * NOTE: There is no need to save the pointer to the thread dispatch routine.
+ * The SPARC's assembly code can reference it directly with no problems.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ void *pointer;
+ unsigned32 trap_table_start;
+ unsigned32 tbr_value;
+ CPU_Trap_table_entry *old_tbr;
+ CPU_Trap_table_entry *trap_table;
+
+ /*
+ * Install the executive's trap table. All entries from the original
+ * trap table are copied into the executive's trap table. This is essential
+ * since this preserves critical trap handlers such as the window underflow
+ * and overflow handlers. It is the responsibility of the BSP to provide
+ * install these in the initial trap table.
+ */
+
+ trap_table_start = (unsigned32) &_CPU_Trap_Table_area;
+ if (trap_table_start & (SPARC_TRAP_TABLE_ALIGNMENT-1))
+ trap_table_start = (trap_table_start + SPARC_TRAP_TABLE_ALIGNMENT) &
+ ~(SPARC_TRAP_TABLE_ALIGNMENT-1);
+
+ trap_table = (CPU_Trap_table_entry *) trap_table_start;
+
+ sparc_get_tbr( tbr_value );
+
+ old_tbr = (CPU_Trap_table_entry *) (tbr_value & 0xfffff000);
+
+ memcpy( trap_table, (void *) old_tbr, 256 * sizeof( CPU_Trap_table_entry ) );
+
+ sparc_set_tbr( trap_table_start );
+
+ /*
+ * This seems to be the most appropriate way to obtain an initial
+ * FP context on the SPARC. The NULL fp context is copied it to
+ * the task's FP context during Context_Initialize.
+ */
+
+ pointer = &_CPU_Null_fp_context;
+ _CPU_Context_save_fp( &pointer );
+
+ /*
+ * Grab our own copy of the user's CPU table.
+ */
+
+ _CPU_Table = *cpu_table;
+
+#if defined(erc32)
+
+ /*
+ * ERC32 specific initialization
+ */
+
+ _ERC32_MEC_Timer_Control_Mirror = 0;
+ ERC32_MEC.Timer_Control = 0;
+
+ ERC32_MEC.Control |= ERC32_CONFIGURATION_POWER_DOWN_ALLOWED;
+
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ *
+ * Input Parameters: NONE
+ *
+ * Output Parameters:
+ * returns the current interrupt level (PIL field of the PSR)
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ sparc_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs the specified handler as a "raw" non-executive
+ * supported trap handler (a.k.a. interrupt service routine).
+ *
+ * Input Parameters:
+ * vector - trap table entry number plus synchronous
+ * vs. asynchronous information
+ * new_handler - address of the handler to be installed
+ * old_handler - pointer to an address of the handler previously installed
+ *
+ * Output Parameters: NONE
+ * *new_handler - address of the handler previously installed
+ *
+ * NOTE:
+ *
+ * On the SPARC, there are really only 256 vectors. However, the executive
+ * has no easy, fast, reliable way to determine which traps are synchronous
+ * and which are asynchronous. By default, synchronous traps return to the
+ * instruction which caused the interrupt. So if you install a software
+ * trap handler as an executive interrupt handler (which is desirable since
+ * RTEMS takes care of window and register issues), then the executive needs
+ * to know that the return address is to the trap rather than the instruction
+ * following the trap.
+ *
+ * So vectors 0 through 255 are treated as regular asynchronous traps which
+ * provide the "correct" return address. Vectors 256 through 512 are assumed
+ * by the executive to be synchronous and to require that the return address
+ * be fudged.
+ *
+ * If you use this mechanism to install a trap handler which must reexecute
+ * the instruction which caused the trap, then it should be installed as
+ * an asynchronous trap. This will avoid the executive changing the return
+ * address.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ unsigned32 real_vector;
+ CPU_Trap_table_entry *tbr;
+ CPU_Trap_table_entry *slot;
+ unsigned32 u32_tbr;
+ unsigned32 u32_handler;
+
+ /*
+ * Get the "real" trap number for this vector ignoring the synchronous
+ * versus asynchronous indicator included with our vector numbers.
+ */
+
+ real_vector = SPARC_REAL_TRAP_NUMBER( vector );
+
+ /*
+ * Get the current base address of the trap table and calculate a pointer
+ * to the slot we are interested in.
+ */
+
+ sparc_get_tbr( u32_tbr );
+
+ u32_tbr &= 0xfffff000;
+
+ tbr = (CPU_Trap_table_entry *) u32_tbr;
+
+ slot = &tbr[ real_vector ];
+
+ /*
+ * Get the address of the old_handler from the trap table.
+ *
+ * NOTE: The old_handler returned will be bogus if it does not follow
+ * the RTEMS model.
+ */
+
+#define HIGH_BITS_MASK 0xFFFFFC00
+#define HIGH_BITS_SHIFT 10
+#define LOW_BITS_MASK 0x000003FF
+
+ if ( slot->mov_psr_l0 == _CPU_Trap_slot_template.mov_psr_l0 ) {
+ u32_handler =
+ ((slot->sethi_of_handler_to_l4 & HIGH_BITS_MASK) << HIGH_BITS_SHIFT) |
+ (slot->jmp_to_low_of_handler_plus_l4 & LOW_BITS_MASK);
+ *old_handler = (proc_ptr) u32_handler;
+ } else
+ *old_handler = 0;
+
+ /*
+ * Copy the template to the slot and then fix it.
+ */
+
+ *slot = _CPU_Trap_slot_template;
+
+ u32_handler = (unsigned32) new_handler;
+
+ slot->mov_vector_l3 |= vector;
+ slot->sethi_of_handler_to_l4 |=
+ (u32_handler & HIGH_BITS_MASK) >> HIGH_BITS_SHIFT;
+ slot->jmp_to_low_of_handler_plus_l4 |= (u32_handler & LOW_BITS_MASK);
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * new_handler - replacement ISR for this vector number
+ * old_handler - pointer to former ISR for this vector number
+ *
+ * Output parameters:
+ * *old_handler - former ISR for this vector number
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ unsigned32 real_vector;
+ proc_ptr ignored;
+
+ /*
+ * Get the "real" trap number for this vector ignoring the synchronous
+ * versus asynchronous indicator included with our vector numbers.
+ */
+
+ real_vector = SPARC_REAL_TRAP_NUMBER( vector );
+
+ /*
+ * Return the previous ISR handler.
+ */
+
+ *old_handler = _ISR_Vector_table[ real_vector ];
+
+ /*
+ * Install the wrapper so this ISR can be invoked properly.
+ */
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ real_vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Context_Initialize
+ *
+ * This kernel routine initializes the basic non-FP context area associated
+ * with each thread.
+ *
+ * Input parameters:
+ * the_context - pointer to the context area
+ * stack_base - address of memory for the SPARC
+ * size - size in bytes of the stack area
+ * new_level - interrupt level for this context area
+ * entry_point - the starting execution point for this this context
+ * is_fp - TRUE if this context is associated with an FP thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CPU_Context_Initialize(
+ Context_Control *the_context,
+ unsigned32 *stack_base,
+ unsigned32 size,
+ unsigned32 new_level,
+ void *entry_point,
+ boolean is_fp
+)
+{
+ unsigned32 stack_high; /* highest "stack aligned" address */
+ unsigned32 the_size;
+ unsigned32 tmp_psr;
+
+ /*
+ * On CPUs with stacks which grow down (i.e. SPARC), we build the stack
+ * based on the stack_high address.
+ */
+
+ stack_high = ((unsigned32)(stack_base) + size);
+ stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ the_size = size & ~(CPU_STACK_ALIGNMENT - 1);
+
+ /*
+ * See the README in this directory for a diagram of the stack.
+ */
+
+ the_context->o7 = ((unsigned32) entry_point) - 8;
+ the_context->o6_sp = stack_high - CPU_MINIMUM_STACK_FRAME_SIZE;
+ the_context->i6_fp = stack_high;
+
+ /*
+ * Build the PSR for the task. Most everything can be 0 and the
+ * CWP is corrected during the context switch.
+ *
+ * The EF bit determines if the floating point unit is available.
+ * The FPU is ONLY enabled if the context is associated with an FP task
+ * and this SPARC model has an FPU.
+ */
+
+ sparc_get_psr( tmp_psr );
+ tmp_psr &= ~SPARC_PSR_PIL_MASK;
+ tmp_psr |= (new_level << 8) & SPARC_PSR_PIL_MASK;
+ tmp_psr &= ~SPARC_PSR_EF_MASK; /* disabled by default */
+
+#if (SPARC_HAS_FPU == 1)
+ /*
+ * If this bit is not set, then a task gets a fault when it accesses
+ * a floating point register. This is a nice way to detect floating
+ * point tasks which are not currently declared as such.
+ */
+
+ if ( is_fp )
+ tmp_psr |= SPARC_PSR_EF_MASK;
+#endif
+ the_context->psr = tmp_psr;
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * Some SPARC implementations have low power, sleep, or idle modes. This
+ * tries to take advantage of those models.
+ */
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
+
+/*
+ * This is the implementation for the erc32.
+ *
+ * NOTE: Low power mode was enabled at initialization time.
+ */
+
+#if defined(erc32)
+
+void _CPU_Thread_Idle_body( void )
+{
+ while (1) {
+ ERC32_MEC.Power_Down = 0; /* value is irrelevant */
+ }
+}
+
+#endif
+
+#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */
diff --git a/c/src/exec/score/cpu/sparc/cpu.h b/c/src/exec/score/cpu/sparc/cpu.h
new file mode 100644
index 0000000000..84280c94bf
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/cpu.h
@@ -0,0 +1,991 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the port of
+ * the executive to the SPARC processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/sparc.h> /* pick up machine definitions */
+#ifndef ASM
+#include <rtems/score/sparctypes.h>
+#endif
+
+/* conditional compilation parameters */
+
+/*
+ * Should the calls to _Thread_Enable_dispatch be inlined?
+ *
+ * If TRUE, then they are inlined.
+ * If FALSE, then a subroutine call is made.
+ */
+
+#define CPU_INLINE_ENABLE_DISPATCH TRUE
+
+/*
+ * Should the body of the search loops in _Thread_queue_Enqueue_priority
+ * be unrolled one time? In unrolled each iteration of the loop examines
+ * two "nodes" on the chain being searched. Otherwise, only one node
+ * is examined per iteration.
+ *
+ * If TRUE, then the loops are unrolled.
+ * If FALSE, then the loops are not unrolled.
+ *
+ * This parameter could go either way on the SPARC. The interrupt flash
+ * code is relatively lengthy given the requirements for nops following
+ * writes to the psr. But if the clock speed were high enough, this would
+ * not represent a great deal of time.
+ */
+
+#define CPU_UNROLL_ENQUEUE_PRIORITY TRUE
+
+/*
+ * Does the executive manage a dedicated interrupt stack in software?
+ *
+ * If TRUE, then a stack is allocated in _Interrupt_Manager_initialization.
+ * If FALSE, nothing is done.
+ *
+ * The SPARC does not have a dedicated HW interrupt stack and one has
+ * been implemented in SW.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE
+
+/*
+ * Does this CPU have hardware support for a dedicated interrupt stack?
+ *
+ * If TRUE, then it must be installed during initialization.
+ * If FALSE, then no installation is performed.
+ *
+ * The SPARC does not have a dedicated HW interrupt stack.
+ */
+
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
+
+/*
+ * Do we allocate a dedicated interrupt stack in the Interrupt Manager?
+ *
+ * If TRUE, then the memory is allocated during initialization.
+ * If FALSE, then the memory is allocated during initialization.
+ */
+
+#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
+
+/*
+ * Does the CPU have hardware floating point?
+ *
+ * If TRUE, then the FLOATING_POINT task attribute is supported.
+ * If FALSE, then the FLOATING_POINT task attribute is ignored.
+ */
+
+#if ( SPARC_HAS_FPU == 1 )
+#define CPU_HARDWARE_FP TRUE
+#else
+#define CPU_HARDWARE_FP FALSE
+#endif
+
+/*
+ * Are all tasks FLOATING_POINT tasks implicitly?
+ *
+ * If TRUE, then the FLOATING_POINT task attribute is assumed.
+ * If FALSE, then the FLOATING_POINT task attribute is followed.
+ */
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+
+/*
+ * Should the IDLE task have a floating point context?
+ *
+ * If TRUE, then the IDLE task is created as a FLOATING_POINT task
+ * and it has a floating point context which is switched in and out.
+ * If FALSE, then the IDLE task does not have a floating point context.
+ */
+
+#define CPU_IDLE_TASK_IS_FP FALSE
+
+/*
+ * Should the saving of the floating point registers be deferred
+ * until a context switch is made to another different floating point
+ * task?
+ *
+ * If TRUE, then the floating point context will not be stored until
+ * necessary. It will remain in the floating point registers and not
+ * disturned until another floating point task is switched to.
+ *
+ * If FALSE, then the floating point context is saved when a floating
+ * point task is switched out and restored when the next floating point
+ * task is restored. The state of the floating point registers between
+ * those two operations is not specified.
+ */
+
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+/*
+ * Does this port provide a CPU dependent IDLE task implementation?
+ *
+ * If TRUE, then the routine _CPU_Thread_Idle_body
+ * must be provided and is the default IDLE thread body instead of
+ * _CPU_Thread_Idle_body.
+ *
+ * If FALSE, then use the generic IDLE thread body if the BSP does
+ * not provide one.
+ */
+
+#if (SPARC_HAS_LOW_POWER_MODE == 1)
+#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
+#else
+#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#endif
+
+/*
+ * Does the stack grow up (toward higher addresses) or down
+ * (toward lower addresses)?
+ *
+ * If TRUE, then the grows upward.
+ * If FALSE, then the grows toward smaller addresses.
+ *
+ * The stack grows to lower addresses on the SPARC.
+ */
+
+#define CPU_STACK_GROWS_UP FALSE
+
+/*
+ * The following is the variable attribute used to force alignment
+ * of critical data structures. On some processors it may make
+ * sense to have these aligned on tighter boundaries than
+ * the minimum requirements of the compiler in order to have as
+ * much of the critical data area as possible in a cache line.
+ *
+ * The SPARC does not appear to have particularly strict alignment
+ * requirements. This value was chosen to take advantages of caches.
+ */
+
+#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16)))
+
+/*
+ * The following defines the number of bits actually used in the
+ * interrupt field of the task mode. How those bits map to the
+ * CPU interrupt levels is defined by the routine _CPU_ISR_Set_level().
+ *
+ * The SPARC has 16 interrupt levels in the PIL field of the PSR.
+ */
+
+#define CPU_MODES_INTERRUPT_MASK 0x0000000F
+
+/*
+ * This structure represents the organization of the minimum stack frame
+ * for the SPARC. More framing information is required in certain situaions
+ * such as when there are a large number of out parameters or when the callee
+ * must save floating point registers.
+ */
+
+#ifndef ASM
+
+typedef struct {
+ unsigned32 l0;
+ unsigned32 l1;
+ unsigned32 l2;
+ unsigned32 l3;
+ unsigned32 l4;
+ unsigned32 l5;
+ unsigned32 l6;
+ unsigned32 l7;
+ unsigned32 i0;
+ unsigned32 i1;
+ unsigned32 i2;
+ unsigned32 i3;
+ unsigned32 i4;
+ unsigned32 i5;
+ unsigned32 i6_fp;
+ unsigned32 i7;
+ void *structure_return_address;
+ /*
+ * The following are for the callee to save the register arguments in
+ * should this be necessary.
+ */
+ unsigned32 saved_arg0;
+ unsigned32 saved_arg1;
+ unsigned32 saved_arg2;
+ unsigned32 saved_arg3;
+ unsigned32 saved_arg4;
+ unsigned32 saved_arg5;
+ unsigned32 pad0;
+} CPU_Minimum_stack_frame;
+
+#endif /* ASM */
+
+#define CPU_STACK_FRAME_L0_OFFSET 0x00
+#define CPU_STACK_FRAME_L1_OFFSET 0x04
+#define CPU_STACK_FRAME_L2_OFFSET 0x08
+#define CPU_STACK_FRAME_L3_OFFSET 0x0c
+#define CPU_STACK_FRAME_L4_OFFSET 0x10
+#define CPU_STACK_FRAME_L5_OFFSET 0x14
+#define CPU_STACK_FRAME_L6_OFFSET 0x18
+#define CPU_STACK_FRAME_L7_OFFSET 0x1c
+#define CPU_STACK_FRAME_I0_OFFSET 0x20
+#define CPU_STACK_FRAME_I1_OFFSET 0x24
+#define CPU_STACK_FRAME_I2_OFFSET 0x28
+#define CPU_STACK_FRAME_I3_OFFSET 0x2c
+#define CPU_STACK_FRAME_I4_OFFSET 0x30
+#define CPU_STACK_FRAME_I5_OFFSET 0x34
+#define CPU_STACK_FRAME_I6_FP_OFFSET 0x38
+#define CPU_STACK_FRAME_I7_OFFSET 0x3c
+#define CPU_STRUCTURE_RETURN_ADDRESS_OFFSET 0x40
+#define CPU_STACK_FRAME_SAVED_ARG0_OFFSET 0x44
+#define CPU_STACK_FRAME_SAVED_ARG1_OFFSET 0x48
+#define CPU_STACK_FRAME_SAVED_ARG2_OFFSET 0x4c
+#define CPU_STACK_FRAME_SAVED_ARG3_OFFSET 0x50
+#define CPU_STACK_FRAME_SAVED_ARG4_OFFSET 0x54
+#define CPU_STACK_FRAME_SAVED_ARG5_OFFSET 0x58
+#define CPU_STACK_FRAME_PAD0_OFFSET 0x5c
+
+#define CPU_MINIMUM_STACK_FRAME_SIZE 0x60
+
+/*
+ * Contexts
+ *
+ * Generally there are 2 types of context to save.
+ * 1. Interrupt registers to save
+ * 2. Task level registers to save
+ *
+ * This means we have the following 3 context items:
+ * 1. task level context stuff:: Context_Control
+ * 2. floating point task stuff:: Context_Control_fp
+ * 3. special interrupt level context :: Context_Control_interrupt
+ *
+ * On the SPARC, we are relatively conservative in that we save most
+ * of the CPU state in the context area. The ET (enable trap) bit and
+ * the CWP (current window pointer) fields of the PSR are considered
+ * system wide resources and are not maintained on a per-thread basis.
+ */
+
+#ifndef ASM
+
+typedef struct {
+ /*
+ * Using a double g0_g1 will put everything in this structure on a
+ * double word boundary which allows us to use double word loads
+ * and stores safely in the context switch.
+ */
+ double g0_g1;
+ unsigned32 g2;
+ unsigned32 g3;
+ unsigned32 g4;
+ unsigned32 g5;
+ unsigned32 g6;
+ unsigned32 g7;
+
+ unsigned32 l0;
+ unsigned32 l1;
+ unsigned32 l2;
+ unsigned32 l3;
+ unsigned32 l4;
+ unsigned32 l5;
+ unsigned32 l6;
+ unsigned32 l7;
+
+ unsigned32 i0;
+ unsigned32 i1;
+ unsigned32 i2;
+ unsigned32 i3;
+ unsigned32 i4;
+ unsigned32 i5;
+ unsigned32 i6_fp;
+ unsigned32 i7;
+
+ unsigned32 o0;
+ unsigned32 o1;
+ unsigned32 o2;
+ unsigned32 o3;
+ unsigned32 o4;
+ unsigned32 o5;
+ unsigned32 o6_sp;
+ unsigned32 o7;
+
+ unsigned32 psr;
+} Context_Control;
+
+#endif /* ASM */
+
+/*
+ * Offsets of fields with Context_Control for assembly routines.
+ */
+
+#define G0_OFFSET 0x00
+#define G1_OFFSET 0x04
+#define G2_OFFSET 0x08
+#define G3_OFFSET 0x0C
+#define G4_OFFSET 0x10
+#define G5_OFFSET 0x14
+#define G6_OFFSET 0x18
+#define G7_OFFSET 0x1C
+
+#define L0_OFFSET 0x20
+#define L1_OFFSET 0x24
+#define L2_OFFSET 0x28
+#define L3_OFFSET 0x2C
+#define L4_OFFSET 0x30
+#define L5_OFFSET 0x34
+#define L6_OFFSET 0x38
+#define L7_OFFSET 0x3C
+
+#define I0_OFFSET 0x40
+#define I1_OFFSET 0x44
+#define I2_OFFSET 0x48
+#define I3_OFFSET 0x4C
+#define I4_OFFSET 0x50
+#define I5_OFFSET 0x54
+#define I6_FP_OFFSET 0x58
+#define I7_OFFSET 0x5C
+
+#define O0_OFFSET 0x60
+#define O1_OFFSET 0x64
+#define O2_OFFSET 0x68
+#define O3_OFFSET 0x6C
+#define O4_OFFSET 0x70
+#define O5_OFFSET 0x74
+#define O6_SP_OFFSET 0x78
+#define O7_OFFSET 0x7C
+
+#define PSR_OFFSET 0x80
+
+#define CONTEXT_CONTROL_SIZE 0x84
+
+/*
+ * The floating point context area.
+ */
+
+#ifndef ASM
+
+typedef struct {
+ double f0_f1;
+ double f2_f3;
+ double f4_f5;
+ double f6_f7;
+ double f8_f9;
+ double f10_f11;
+ double f12_f13;
+ double f14_f15;
+ double f16_f17;
+ double f18_f19;
+ double f20_f21;
+ double f22_f23;
+ double f24_f25;
+ double f26_f27;
+ double f28_f29;
+ double f30_f31;
+ unsigned32 fsr;
+} Context_Control_fp;
+
+#endif /* ASM */
+
+/*
+ * Offsets of fields with Context_Control_fp for assembly routines.
+ */
+
+#define FO_F1_OFFSET 0x00
+#define F2_F3_OFFSET 0x08
+#define F4_F5_OFFSET 0x10
+#define F6_F7_OFFSET 0x18
+#define F8_F9_OFFSET 0x20
+#define F1O_F11_OFFSET 0x28
+#define F12_F13_OFFSET 0x30
+#define F14_F15_OFFSET 0x38
+#define F16_F17_OFFSET 0x40
+#define F18_F19_OFFSET 0x48
+#define F2O_F21_OFFSET 0x50
+#define F22_F23_OFFSET 0x58
+#define F24_F25_OFFSET 0x60
+#define F26_F27_OFFSET 0x68
+#define F28_F29_OFFSET 0x70
+#define F3O_F31_OFFSET 0x78
+#define FSR_OFFSET 0x80
+
+#define CONTEXT_CONTROL_FP_SIZE 0x84
+
+#ifndef ASM
+
+/*
+ * Context saved on stack for an interrupt.
+ *
+ * NOTE: The PSR, PC, and NPC are only saved in this structure for the
+ * benefit of the user's handler.
+ */
+
+typedef struct {
+ CPU_Minimum_stack_frame Stack_frame;
+ unsigned32 psr;
+ unsigned32 pc;
+ unsigned32 npc;
+ unsigned32 g1;
+ unsigned32 g2;
+ unsigned32 g3;
+ unsigned32 g4;
+ unsigned32 g5;
+ unsigned32 g6;
+ unsigned32 g7;
+ unsigned32 i0;
+ unsigned32 i1;
+ unsigned32 i2;
+ unsigned32 i3;
+ unsigned32 i4;
+ unsigned32 i5;
+ unsigned32 i6_fp;
+ unsigned32 i7;
+ unsigned32 y;
+ unsigned32 pad0_offset;
+} CPU_Interrupt_frame;
+
+#endif /* ASM */
+
+/*
+ * Offsets of fields with CPU_Interrupt_frame for assembly routines.
+ */
+
+#define ISF_STACK_FRAME_OFFSET 0x00
+#define ISF_PSR_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x00
+#define ISF_PC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x04
+#define ISF_NPC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x08
+#define ISF_G1_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x0c
+#define ISF_G2_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x10
+#define ISF_G3_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x14
+#define ISF_G4_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x18
+#define ISF_G5_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x1c
+#define ISF_G6_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x20
+#define ISF_G7_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x24
+#define ISF_I0_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x28
+#define ISF_I1_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x2c
+#define ISF_I2_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x30
+#define ISF_I3_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x34
+#define ISF_I4_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x38
+#define ISF_I5_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x3c
+#define ISF_I6_FP_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x40
+#define ISF_I7_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x44
+#define ISF_Y_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x48
+#define ISF_PAD0_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c
+
+#define CONTEXT_CONTROL_INTERRUPT_FRAME_SIZE CPU_MINIMUM_STACK_FRAME_SIZE + 0x50
+#ifndef ASM
+
+/*
+ * The following table contains the information required to configure
+ * the processor specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of fields required on all CPUs */
+
+} rtems_cpu_table;
+
+/*
+ * This variable is contains the initialize context for the FP unit.
+ * It is filled in by _CPU_Initialize and copied into the task's FP
+ * context area during _CPU_Context_Initialize.
+ */
+
+EXTERN Context_Control_fp _CPU_Null_fp_context CPU_STRUCTURE_ALIGNMENT;
+
+/*
+ * This stack is allocated by the Interrupt Manager and the switch
+ * is performed in _ISR_Handler. These variables contain pointers
+ * to the lowest and highest addresses in the chunk of memory allocated
+ * for the interrupt stack. Since it is unknown whether the stack
+ * grows up or down (in general), this give the CPU dependent
+ * code the option of picking the version it wants to use. Thus
+ * both must be present if either is.
+ *
+ * The SPARC supports a software based interrupt stack and these
+ * are required.
+ */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+#if defined(erc32)
+
+/*
+ * ERC32 Specific Variables
+ */
+
+EXTERN unsigned32 _ERC32_MEC_Timer_Control_Mirror;
+
+#endif
+
+/*
+ * The following type defines an entry in the SPARC's trap table.
+ *
+ * NOTE: The instructions chosen are RTEMS dependent although one is
+ * obligated to use two of the four instructions to perform a
+ * long jump. The other instructions load one register with the
+ * trap type (a.k.a. vector) and another with the psr.
+ */
+
+typedef struct {
+ unsigned32 mov_psr_l0; /* mov %psr, %l0 */
+ unsigned32 sethi_of_handler_to_l4; /* sethi %hi(_handler), %l4 */
+ unsigned32 jmp_to_low_of_handler_plus_l4; /* jmp %l4 + %lo(_handler) */
+ unsigned32 mov_vector_l3; /* mov _vector, %l3 */
+} CPU_Trap_table_entry;
+
+/*
+ * This is the set of opcodes for the instructions loaded into a trap
+ * table entry. The routine which installs a handler is responsible
+ * for filling in the fields for the _handler address and the _vector
+ * trap type.
+ *
+ * The constants following this structure are masks for the fields which
+ * must be filled in when the handler is installed.
+ */
+
+extern const CPU_Trap_table_entry _CPU_Trap_slot_template;
+
+/*
+ * This is the executive's trap table which is installed into the TBR
+ * register.
+ *
+ * NOTE: Unfortunately, this must be aligned on a 4096 byte boundary.
+ * The GNU tools as of binutils 2.5.2 and gcc 2.7.0 would not
+ * align an entity to anything greater than a 512 byte boundary.
+ *
+ * Because of this, we pull a little bit of a trick. We allocate
+ * enough memory so we can grab an address on a 4096 byte boundary
+ * from this area.
+ */
+
+#define SPARC_TRAP_TABLE_ALIGNMENT 4096
+
+EXTERN unsigned8 _CPU_Trap_Table_area[ 8192 ]
+ __attribute__ ((aligned (SPARC_TRAP_TABLE_ALIGNMENT)));
+
+
+/*
+ * The size of the floating point context area.
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+#endif
+
+/*
+ * Amount of extra stack (above minimum stack size) required by
+ * MPCI receive server thread. Remember that in a multiprocessor
+ * system this thread must exist and be able to process all directives.
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024
+
+/*
+ * This defines the number of entries in the ISR_Vector_table managed
+ * by the executive.
+ *
+ * On the SPARC, there are really only 256 vectors. However, the executive
+ * has no easy, fast, reliable way to determine which traps are synchronous
+ * and which are asynchronous. By default, synchronous traps return to the
+ * instruction which caused the interrupt. So if you install a software
+ * trap handler as an executive interrupt handler (which is desirable since
+ * RTEMS takes care of window and register issues), then the executive needs
+ * to know that the return address is to the trap rather than the instruction
+ * following the trap.
+ *
+ * So vectors 0 through 255 are treated as regular asynchronous traps which
+ * provide the "correct" return address. Vectors 256 through 512 are assumed
+ * by the executive to be synchronous and to require that the return address
+ * be fudged.
+ *
+ * If you use this mechanism to install a trap handler which must reexecute
+ * the instruction which caused the trap, then it should be installed as
+ * an asynchronous trap. This will avoid the executive changing the return
+ * address.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER 511
+
+#define SPARC_SYNCHRONOUS_TRAP_BIT_MASK 0x100
+#define SPARC_ASYNCHRONOUS_TRAP( _trap ) (_trap)
+#define SPARC_SYNCHRONOUS_TRAP( _trap ) ((_trap) + 256 )
+
+#define SPARC_REAL_TRAP_NUMBER( _trap ) ((_trap) % 256)
+
+/*
+ * Should be large enough to run all tests. This insures
+ * that a "reasonable" small application should not have any problems.
+ *
+ * This appears to be a fairly generous number for the SPARC since
+ * represents a call depth of about 20 routines based on the minimum
+ * stack frame.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE (1024*2 + 512)
+
+/*
+ * CPU's worst alignment requirement for data types on a byte boundary. This
+ * alignment does not take into account the requirements for the stack.
+ *
+ * On the SPARC, this is required for double word loads and stores.
+ */
+
+#define CPU_ALIGNMENT 8
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * heap handler. This alignment requirement may be stricter than that
+ * for the data types alignment specified by CPU_ALIGNMENT. It is
+ * common for the heap to follow the same alignment requirement as
+ * CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict enough for the heap,
+ * then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for memory
+ * buffers allocated by the partition manager. This alignment requirement
+ * may be stricter than that for the data types alignment specified by
+ * CPU_ALIGNMENT. It is common for the partition to follow the same
+ * alignment requirement as CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict
+ * enough for the partition, then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * stack. This alignment requirement may be stricter than that for the
+ * data types alignment specified by CPU_ALIGNMENT. If the CPU_ALIGNMENT
+ * is strict enough for the stack, then this should be set to 0.
+ *
+ * NOTE: This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
+ *
+ * The alignment restrictions for the SPARC are not that strict but this
+ * should unsure that the stack is always sufficiently alignment that the
+ * window overflow, underflow, and flush routines can use double word loads
+ * and stores.
+ */
+
+#define CPU_STACK_ALIGNMENT 16
+
+#ifndef ASM
+
+/* ISR handler macros */
+
+/*
+ * Disable all interrupts for a critical section. The previous
+ * level is returned in _level.
+ */
+
+#define _CPU_ISR_Disable( _level ) \
+ sparc_disable_interrupts( _level )
+
+/*
+ * Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
+ * This indicates the end of a critical section. The parameter
+ * _level is not modified.
+ */
+
+#define _CPU_ISR_Enable( _level ) \
+ sparc_enable_interrupts( _level )
+
+/*
+ * This temporarily restores the interrupt to _level before immediately
+ * disabling them again. This is used to divide long critical
+ * sections into two or more parts. The parameter _level is not
+ * modified.
+ */
+
+#define _CPU_ISR_Flash( _level ) \
+ sparc_flash_interrupts( _level )
+
+/*
+ * Map interrupt level in task mode onto the hardware that the CPU
+ * actually provides. Currently, interrupt levels which do not
+ * map onto the CPU in a straight fashion are undefined.
+ */
+
+#define _CPU_ISR_Set_level( _newlevel ) \
+ sparc_set_interrupt_level( _newlevel )
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/* Context handler macros */
+
+/*
+ * Initialize the context to a state suitable for starting a
+ * task after a context restore operation. Generally, this
+ * involves:
+ *
+ * - setting a starting address
+ * - preparing the stack
+ * - preparing the stack and frame pointers
+ * - setting the proper interrupt level in the context
+ * - initializing the floating point context
+ *
+ * NOTE: Implemented as a subroutine for the SPARC port.
+ */
+
+void _CPU_Context_Initialize(
+ Context_Control *the_context,
+ unsigned32 *stack_base,
+ unsigned32 size,
+ unsigned32 new_level,
+ void *entry_point,
+ boolean is_fp
+);
+
+/*
+ * This routine is responsible for somehow restarting the currently
+ * executing task.
+ *
+ * On the SPARC, this is is relatively painless but requires a small
+ * amount of wrapper code before using the regular restore code in
+ * of the context switch.
+ */
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+/*
+ * The FP context area for the SPARC is a simple structure and nothing
+ * special is required to find the "starting load point"
+ */
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) (_base) + (_offset) )
+
+/*
+ * This routine initializes the FP context area passed to it to.
+ *
+ * The SPARC allows us to use the simple initialization model
+ * in which an "initial" FP context was saved into _CPU_Null_fp_context
+ * at CPU initialization and it is simply copied into the destination
+ * context.
+ */
+
+#define _CPU_Context_Initialize_fp( _destination ) \
+ do { \
+ *((Context_Control_fp *) *((void **) _destination)) = _CPU_Null_fp_context; \
+ } while (0)
+
+/* end of Context handler macros */
+
+/* Fatal Error manager macros */
+
+/*
+ * This routine copies _error into a known place -- typically a stack
+ * location or a register, optionally disables interrupts, and
+ * halts/stops the CPU.
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ do { \
+ unsigned32 level; \
+ \
+ sparc_disable_interrupts( level ); \
+ asm volatile ( "mov %0, %%g1 " : "=r" (level) : "0" (level) ); \
+ while (1); /* loop forever */ \
+ } while (0)
+
+/* end of Fatal Error manager macros */
+
+/* Bitfield handler macros */
+
+/*
+ * The SPARC port uses the generic C algorithm for bitfield scan if the
+ * CPU model does not have a scan instruction.
+ */
+
+#if ( SPARC_HAS_BITSCAN == 0 )
+#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
+#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
+#else
+#error "scan instruction not currently supported by RTEMS!!"
+#endif
+
+/* end of Bitfield handler macros */
+
+/* Priority handler handler macros */
+
+/*
+ * The SPARC port uses the generic C algorithm for bitfield scan if the
+ * CPU model does not have a scan instruction.
+ */
+
+#if ( SPARC_HAS_BITSCAN == 1 )
+#error "scan instruction not currently supported by RTEMS!!"
+#endif
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs new_handler to be directly called from the trap
+ * table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
+
+/*
+ * _CPU_Thread_Idle_body
+ *
+ * Some SPARC implementations have low power, sleep, or idle modes. This
+ * tries to take advantage of those models.
+ */
+
+void _CPU_Thread_Idle_body( void );
+
+#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Context_save_fp
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * _CPU_Context_restore_fp
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+);
+
+/*
+ * CPU_swap_u32
+ *
+ * The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ *
+ * This version will work on any processor, but if you come across a better
+ * way for the SPARC PLEASE use it. The most common way to swap a 32-bit
+ * entity as shown below is not any more efficient on the SPARC.
+ *
+ * swap least significant two bytes with 16-bit rotate
+ * swap upper and lower 16-bits
+ * swap most significant two bytes with 16-bit rotate
+ *
+ * It is not obvious how the SPARC can do significantly better than the
+ * generic code. gcc 2.7.0 only generates about 12 instructions for the
+ * following code at optimization level four (i.e. -O4).
+ */
+
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+)
+{
+ unsigned32 byte1, byte2, byte3, byte4, swapped;
+
+ byte4 = (value >> 24) & 0xff;
+ byte3 = (value >> 16) & 0xff;
+ byte2 = (value >> 8) & 0xff;
+ byte1 = value & 0xff;
+
+ swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
+ return( swapped );
+}
+
+#endif ASM
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/exec/score/cpu/sparc/cpu_asm.s b/c/src/exec/score/cpu/sparc/cpu_asm.s
new file mode 100644
index 0000000000..f3c3435ca8
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/cpu_asm.s
@@ -0,0 +1,707 @@
+/* cpu_asm.s
+ *
+ * This file contains the basic algorithms for all assembly code used
+ * in an specific CPU port of RTEMS. These algorithms must be implemented
+ * in assembly language.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+#include <rtems/score/cpu.h>
+
+#if (SPARC_HAS_FPU == 1)
+
+/*
+ * void _CPU_Context_save_fp(
+ * void **fp_context_ptr
+ * )
+ *
+ * This routine is responsible for saving the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * NOTE: See the README in this directory for information on the
+ * management of the "EF" bit in the PSR.
+ */
+
+ .align 4
+ PUBLIC(_CPU_Context_save_fp)
+SYM(_CPU_Context_save_fp):
+ save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE, %sp
+
+ /*
+ * The following enables the floating point unit.
+ */
+
+ mov %psr, %l0
+ sethi %hi(SPARC_PSR_EF_MASK), %l1
+ or %l1, %lo(SPARC_PSR_EF_MASK), %l1
+ or %l0, %l1, %l0
+ mov %l0, %psr ! **** ENABLE FLOAT ACCESS ****
+
+ ld [%i0], %l0
+ std %f0, [%l0 + FO_F1_OFFSET]
+ std %f2, [%l0 + F2_F3_OFFSET]
+ std %f4, [%l0 + F4_F5_OFFSET]
+ std %f6, [%l0 + F6_F7_OFFSET]
+ std %f8, [%l0 + F8_F9_OFFSET]
+ std %f10, [%l0 + F1O_F11_OFFSET]
+ std %f12, [%l0 + F12_F13_OFFSET]
+ std %f14, [%l0 + F14_F15_OFFSET]
+ std %f16, [%l0 + F16_F17_OFFSET]
+ std %f18, [%l0 + F18_F19_OFFSET]
+ std %f20, [%l0 + F2O_F21_OFFSET]
+ std %f22, [%l0 + F22_F23_OFFSET]
+ std %f24, [%l0 + F24_F25_OFFSET]
+ std %f26, [%l0 + F26_F27_OFFSET]
+ std %f28, [%l0 + F28_F29_OFFSET]
+ std %f30, [%l0 + F3O_F31_OFFSET]
+ st %fsr, [%l0 + FSR_OFFSET]
+ ret
+ restore
+
+/*
+ * void _CPU_Context_restore_fp(
+ * void **fp_context_ptr
+ * )
+ *
+ * This routine is responsible for restoring the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * NOTE: See the README in this directory for information on the
+ * management of the "EF" bit in the PSR.
+ */
+
+ .align 4
+ PUBLIC(_CPU_Context_restore_fp)
+SYM(_CPU_Context_restore_fp):
+ save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE , %sp
+
+ /*
+ * The following enables the floating point unit.
+ */
+
+ mov %psr, %l0
+ sethi %hi(SPARC_PSR_EF_MASK), %l1
+ or %l1, %lo(SPARC_PSR_EF_MASK), %l1
+ or %l0, %l1, %l0
+ mov %l0, %psr ! **** ENABLE FLOAT ACCESS ****
+
+ ld [%i0], %l0
+ ldd [%l0 + FO_F1_OFFSET], %f0
+ ldd [%l0 + F2_F3_OFFSET], %f2
+ ldd [%l0 + F4_F5_OFFSET], %f4
+ ldd [%l0 + F6_F7_OFFSET], %f6
+ ldd [%l0 + F8_F9_OFFSET], %f8
+ ldd [%l0 + F1O_F11_OFFSET], %f10
+ ldd [%l0 + F12_F13_OFFSET], %f12
+ ldd [%l0 + F14_F15_OFFSET], %f14
+ ldd [%l0 + F16_F17_OFFSET], %f16
+ ldd [%l0 + F18_F19_OFFSET], %f18
+ ldd [%l0 + F2O_F21_OFFSET], %f20
+ ldd [%l0 + F22_F23_OFFSET], %f22
+ ldd [%l0 + F24_F25_OFFSET], %f24
+ ldd [%l0 + F26_F27_OFFSET], %f26
+ ldd [%l0 + F28_F29_OFFSET], %f28
+ ldd [%l0 + F3O_F31_OFFSET], %f30
+ ld [%l0 + FSR_OFFSET], %fsr
+ ret
+ restore
+
+#endif /* SPARC_HAS_FPU */
+
+/*
+ * void _CPU_Context_switch(
+ * Context_Control *run,
+ * Context_Control *heir
+ * )
+ *
+ * This routine performs a normal non-FP context switch.
+ */
+
+ .align 4
+ PUBLIC(_CPU_Context_switch)
+SYM(_CPU_Context_switch):
+ ! skip g0
+ st %g1, [%o0 + G1_OFFSET] ! save the global registers
+ std %g2, [%o0 + G2_OFFSET]
+ std %g4, [%o0 + G4_OFFSET]
+ std %g6, [%o0 + G6_OFFSET]
+
+ std %l0, [%o0 + L0_OFFSET] ! save the local registers
+ std %l2, [%o0 + L2_OFFSET]
+ std %l4, [%o0 + L4_OFFSET]
+ std %l6, [%o0 + L6_OFFSET]
+
+ std %i0, [%o0 + I0_OFFSET] ! save the input registers
+ std %i2, [%o0 + I2_OFFSET]
+ std %i4, [%o0 + I4_OFFSET]
+ std %i6, [%o0 + I6_FP_OFFSET]
+
+ std %o0, [%o0 + O0_OFFSET] ! save the output registers
+ std %o2, [%o0 + O2_OFFSET]
+ std %o4, [%o0 + O4_OFFSET]
+ std %o6, [%o0 + O6_SP_OFFSET]
+
+ rd %psr, %o2
+ st %o2, [%o0 + PSR_OFFSET] ! save status register
+
+ /*
+ * This is entered from _CPU_Context_restore with:
+ * o1 = context to restore
+ * o2 = psr
+ */
+
+ PUBLIC(_CPU_Context_restore_heir)
+SYM(_CPU_Context_restore_heir):
+ /*
+ * Flush all windows with valid contents except the current one.
+ * In examining the set register windows, one may logically divide
+ * the windows into sets (some of which may be empty) based on their
+ * current status:
+ *
+ * + current (i.e. in use),
+ * + used (i.e. a restore would not trap)
+ * + invalid (i.e. 1 in corresponding bit in WIM)
+ * + unused
+ *
+ * Either the used or unused set of windows may be empty.
+ *
+ * NOTE: We assume only one bit is set in the WIM at a time.
+ *
+ * Given a CWP of 5 and a WIM of 0x1, the registers are divided
+ * into sets as follows:
+ *
+ * + 0 - invalid
+ * + 1-4 - unused
+ * + 5 - current
+ * + 6-7 - used
+ *
+ * In this case, we only would save the used windows -- 6 and 7.
+ *
+ * Traps are disabled for the same logical period as in a
+ * flush all windows trap handler.
+ *
+ * Register Usage while saving the windows:
+ * g1 = current PSR
+ * g2 = current wim
+ * g3 = CWP
+ * g4 = wim scratch
+ * g5 = scratch
+ */
+
+ ld [%o1 + PSR_OFFSET], %g1 ! g1 = saved psr
+
+ and %o2, SPARC_PSR_CWP_MASK, %g3 ! g3 = CWP
+ ! g1 = psr w/o cwp
+ andn %g1, SPARC_PSR_ET_MASK | SPARC_PSR_CWP_MASK, %g1
+ or %g1, %g3, %g1 ! g1 = heirs psr
+ mov %g1, %psr ! restore status register and
+ ! **** DISABLE TRAPS ****
+ mov %wim, %g2 ! g2 = wim
+ mov 1, %g4
+ sll %g4, %g3, %g4 ! g4 = WIM mask for CW invalid
+
+save_frame_loop:
+ sll %g4, 1, %g5 ! rotate the "wim" left 1
+ srl %g4, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g4
+ or %g4, %g5, %g4 ! g4 = wim if we do one restore
+
+ /*
+ * If a restore would not underflow, then continue.
+ */
+
+ andcc %g4, %g2, %g0 ! Any windows to flush?
+ bnz done_flushing ! No, then continue
+ nop
+
+ restore ! back one window
+
+ /*
+ * Now save the window just as if we overflowed to it.
+ */
+
+ std %l0, [%sp + CPU_STACK_FRAME_L0_OFFSET]
+ std %l2, [%sp + CPU_STACK_FRAME_L2_OFFSET]
+ std %l4, [%sp + CPU_STACK_FRAME_L4_OFFSET]
+ std %l6, [%sp + CPU_STACK_FRAME_L6_OFFSET]
+
+ std %i0, [%sp + CPU_STACK_FRAME_I0_OFFSET]
+ std %i2, [%sp + CPU_STACK_FRAME_I2_OFFSET]
+ std %i4, [%sp + CPU_STACK_FRAME_I4_OFFSET]
+ std %i6, [%sp + CPU_STACK_FRAME_I6_FP_OFFSET]
+
+ ba save_frame_loop
+ nop
+
+done_flushing:
+
+ add %g3, 1, %g3 ! calculate desired WIM
+ and %g3, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g3
+ mov 1, %g4
+ sll %g4, %g3, %g4 ! g4 = new WIM
+ mov %g4, %wim
+
+ or %g1, SPARC_PSR_ET_MASK, %g1
+ mov %g1, %psr ! **** ENABLE TRAPS ****
+ ! and restore CWP
+ nop
+ nop
+ nop
+
+ ! skip g0
+ ld [%o1 + G1_OFFSET], %g1 ! restore the global registers
+ ldd [%o1 + G2_OFFSET], %g2
+ ldd [%o1 + G4_OFFSET], %g4
+ ldd [%o1 + G6_OFFSET], %g6
+
+ ldd [%o1 + L0_OFFSET], %l0 ! restore the local registers
+ ldd [%o1 + L2_OFFSET], %l2
+ ldd [%o1 + L4_OFFSET], %l4
+ ldd [%o1 + L6_OFFSET], %l6
+
+ ldd [%o1 + I0_OFFSET], %i0 ! restore the output registers
+ ldd [%o1 + I2_OFFSET], %i2
+ ldd [%o1 + I4_OFFSET], %i4
+ ldd [%o1 + I6_FP_OFFSET], %i6
+
+ ldd [%o1 + O2_OFFSET], %o2 ! restore the output registers
+ ldd [%o1 + O4_OFFSET], %o4
+ ldd [%o1 + O6_SP_OFFSET], %o6
+ ! do o0/o1 last to avoid destroying heir context pointer
+ ldd [%o1 + O0_OFFSET], %o0 ! overwrite heir pointer
+
+ jmp %o7 + 8 ! return
+ nop ! delay slot
+
+/*
+ * void _CPU_Context_restore(
+ * Context_Control *new_context
+ * )
+ *
+ * This routine is generally used only to perform restart self.
+ *
+ * NOTE: It is unnecessary to reload some registers.
+ */
+
+ .align 4
+ PUBLIC(_CPU_Context_restore)
+SYM(_CPU_Context_restore):
+ save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE, %sp
+ rd %psr, %o2
+ ba SYM(_CPU_Context_restore_heir)
+ mov %i0, %o1 ! in the delay slot
+
+/*
+ * void _ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ * We enter this handler from the 4 instructions in the trap table with
+ * the following registers assumed to be set as shown:
+ *
+ * l0 = PSR
+ * l1 = PC
+ * l2 = nPC
+ * l3 = trap type
+ *
+ * NOTE: By an executive defined convention, trap type is between 0 and 255 if
+ * it is an asynchonous trap and 256 and 511 if it is synchronous.
+ */
+
+ .align 4
+ PUBLIC(_ISR_Handler)
+SYM(_ISR_Handler):
+ /*
+ * Fix the return address for synchronous traps.
+ */
+
+ andcc %l3, SPARC_SYNCHRONOUS_TRAP_BIT_MASK, %g0
+ ! Is this a synchronous trap?
+ be,a win_ovflow ! No, then skip the adjustment
+ nop ! DELAY
+ mov %l2, %l1 ! do not return to the instruction
+ add %l2, 4, %l2 ! indicated
+
+win_ovflow:
+ /*
+ * Save the globals this block uses.
+ *
+ * These registers are not restored from the locals. Their contents
+ * are saved directly from the locals into the ISF below.
+ */
+
+ mov %g4, %l4 ! save the globals this block uses
+ mov %g5, %l5
+
+ /*
+ * When at a "window overflow" trap, (wim == (1 << cwp)).
+ * If we get here like that, then process a window overflow.
+ */
+
+ rd %wim, %g4
+ srl %g4, %l0, %g5 ! g5 = win >> cwp ; shift count and CWP
+ ! are LS 5 bits ; how convenient :)
+ cmp %g5, 1 ! Is this an invalid window?
+ bne dont_do_the_window ! No, then skip all this stuff
+ ! we are using the delay slot
+
+ /*
+ * The following is same as a 1 position right rotate of WIM
+ */
+
+ srl %g4, 1, %g5 ! g5 = WIM >> 1
+ sll %g4, SPARC_NUMBER_OF_REGISTER_WINDOWS-1 , %g4
+ ! g4 = WIM << (Number Windows - 1)
+ or %g4, %g5, %g4 ! g4 = (WIM >> 1) |
+ ! (WIM << (Number Windows - 1))
+
+ /*
+ * At this point:
+ *
+ * g4 = the new WIM
+ * g5 is free
+ */
+
+ /*
+ * Since we are tinkering with the register windows, we need to
+ * make sure that all the required information is in global registers.
+ */
+
+ save ! Save into the window
+ wr %g4, 0, %wim ! WIM = new WIM
+ nop ! delay slots
+ nop
+ nop
+
+ /*
+ * Now save the window just as if we overflowed to it.
+ */
+
+ std %l0, [%sp + CPU_STACK_FRAME_L0_OFFSET]
+ std %l2, [%sp + CPU_STACK_FRAME_L2_OFFSET]
+ std %l4, [%sp + CPU_STACK_FRAME_L4_OFFSET]
+ std %l6, [%sp + CPU_STACK_FRAME_L6_OFFSET]
+
+ std %i0, [%sp + CPU_STACK_FRAME_I0_OFFSET]
+ std %i2, [%sp + CPU_STACK_FRAME_I2_OFFSET]
+ std %i4, [%sp + CPU_STACK_FRAME_I4_OFFSET]
+ std %i6, [%sp + CPU_STACK_FRAME_I6_FP_OFFSET]
+
+ restore
+ nop
+
+dont_do_the_window:
+ /*
+ * Global registers %g4 and %g5 are saved directly from %l4 and
+ * %l5 directly into the ISF below.
+ */
+
+save_isf:
+
+ /*
+ * Save the state of the interrupted task -- especially the global
+ * registers -- in the Interrupt Stack Frame. Note that the ISF
+ * includes a regular minimum stack frame which will be used if
+ * needed by register window overflow and underflow handlers.
+ *
+ * REGISTERS SAME AS AT _ISR_Handler
+ */
+
+ sub %fp, CONTEXT_CONTROL_INTERRUPT_FRAME_SIZE, %sp
+ ! make space for ISF
+
+ std %l0, [%sp + ISF_PSR_OFFSET] ! save psr, PC
+ st %l2, [%sp + ISF_NPC_OFFSET] ! save nPC
+ st %g1, [%sp + ISF_G1_OFFSET] ! save g1
+ std %g2, [%sp + ISF_G2_OFFSET] ! save g2, g3
+ std %l4, [%sp + ISF_G4_OFFSET] ! save g4, g5 -- see above
+ std %g6, [%sp + ISF_G6_OFFSET] ! save g6, g7
+
+ std %i0, [%sp + ISF_I0_OFFSET] ! save i0, i1
+ std %i2, [%sp + ISF_I2_OFFSET] ! save i2, i3
+ std %i4, [%sp + ISF_I4_OFFSET] ! save i4, i5
+ std %i6, [%sp + ISF_I6_FP_OFFSET] ! save i6/fp, i7
+
+ rd %y, %g1
+ st %g1, [%sp + ISF_Y_OFFSET] ! save y
+
+ mov %sp, %o1 ! 2nd arg to ISR Handler
+
+ /*
+ * Increment ISR nest level and Thread dispatch disable level.
+ *
+ * Register usage for this section:
+ *
+ * l4 = _Thread_Dispatch_disable_level pointer
+ * l5 = _ISR_Nest_level pointer
+ * l6 = _Thread_Dispatch_disable_level value
+ * l7 = _ISR_Nest_level value
+ *
+ * NOTE: It is assumed that l4 - l7 will be preserved until the ISR
+ * nest and thread dispatch disable levels are unnested.
+ */
+
+ sethi %hi(SYM(_Thread_Dispatch_disable_level)), %l4
+ ld [%l4 + %lo(SYM(_Thread_Dispatch_disable_level))], %l6
+ sethi %hi(SYM(_ISR_Nest_level)), %l5
+ ld [%l5 + %lo(SYM(_ISR_Nest_level))], %l7
+
+ add %l6, 1, %l6
+ st %l6, [%l4 + %lo(SYM(_Thread_Dispatch_disable_level))]
+
+ add %l7, 1, %l7
+ st %l7, [%l5 + %lo(SYM(_ISR_Nest_level))]
+
+ /*
+ * If ISR nest level was zero (now 1), then switch stack.
+ */
+
+ mov %sp, %fp
+ subcc %l7, 1, %l7 ! outermost interrupt handler?
+ bnz dont_switch_stacks ! No, then do not switch stacks
+
+ sethi %hi(SYM(_CPU_Interrupt_stack_high)), %g4
+ ld [%g4 + %lo(SYM(_CPU_Interrupt_stack_high))], %sp
+
+dont_switch_stacks:
+ /*
+ * Make sure we have a place on the stack for the window overflow
+ * trap handler to write into. At this point it is safe to
+ * enable traps again.
+ */
+
+ sub %sp, CPU_MINIMUM_STACK_FRAME_SIZE, %sp
+
+ wr %l0, SPARC_PSR_ET_MASK, %psr ! **** ENABLE TRAPS ****
+
+ /*
+ * Vector to user's handler.
+ *
+ * NOTE: TBR may no longer have vector number in it since
+ * we just enabled traps. It is definitely in l3.
+ */
+
+ sethi %hi(SYM(_ISR_Vector_table)), %g4
+ or %g4, %lo(SYM(_ISR_Vector_table)), %g4
+ and %l3, 0xFF, %g5 ! remove synchronous trap indicator
+ sll %g5, 2, %g5 ! g5 = offset into table
+ ld [%g4 + %g5], %g4 ! g4 = _ISR_Vector_table[ vector ]
+
+
+ ! o1 = 2nd arg = address of the ISF
+ ! WAS LOADED WHEN ISF WAS SAVED!!!
+ mov %l3, %o0 ! o0 = 1st arg = vector number
+ call %g4, 0
+ nop ! delay slot
+
+ /*
+ * Redisable traps so we can finish up the interrupt processing.
+ * This is a VERY conservative place to do this.
+ *
+ * NOTE: %l0 has the PSR which was in place when we took the trap.
+ */
+
+ mov %l0, %psr ! **** DISABLE TRAPS ****
+
+ /*
+ * Decrement ISR nest level and Thread dispatch disable level.
+ *
+ * Register usage for this section:
+ *
+ * l4 = _Thread_Dispatch_disable_level pointer
+ * l5 = _ISR_Nest_level pointer
+ * l6 = _Thread_Dispatch_disable_level value
+ * l7 = _ISR_Nest_level value
+ */
+
+ sub %l6, 1, %l6
+ st %l6, [%l4 + %lo(SYM(_Thread_Dispatch_disable_level))]
+
+ st %l7, [%l5 + %lo(SYM(_ISR_Nest_level))]
+
+ /*
+ * If dispatching is disabled (includes nested interrupt case),
+ * then do a "simple" exit.
+ */
+
+ orcc %l6, %g0, %g0 ! Is dispatching disabled?
+ bnz simple_return ! Yes, then do a "simple" exit
+ nop ! delay slot
+
+ /*
+ * If a context switch is necessary, then do fudge stack to
+ * return to the interrupt dispatcher.
+ */
+
+ sethi %hi(SYM(_Context_Switch_necessary)), %l4
+ ld [%l4 + %lo(SYM(_Context_Switch_necessary))], %l5
+
+ orcc %l5, %g0, %g0 ! Is thread switch necessary?
+ bnz SYM(_ISR_Dispatch) ! yes, then invoke the dispatcher
+ nop ! delay slot
+
+ /*
+ * Finally, check to see if signals were sent to the currently
+ * executing task. If so, we need to invoke the interrupt dispatcher.
+ */
+
+ sethi %hi(SYM(_ISR_Signals_to_thread_executing)), %l6
+ ld [%l6 + %lo(SYM(_ISR_Signals_to_thread_executing))], %l7
+
+ orcc %l7, %g0, %g0 ! Were signals sent to the currently
+ ! executing thread?
+ bz simple_return ! yes, then invoke the dispatcher
+ ! use the delay slot to clear the signals
+ ! to the currently executing task flag
+ st %g0, [%l6 + %lo(SYM(_ISR_Signals_to_thread_executing))]
+
+
+ /*
+ * Invoke interrupt dispatcher.
+ */
+
+ PUBLIC(_ISR_Dispatch)
+SYM(_ISR_Dispatch):
+
+ /*
+ * The following subtract should get us back on the interrupted
+ * tasks stack and add enough room to invoke the dispatcher.
+ * When we enable traps, we are mostly back in the context
+ * of the task and subsequent interrupts can operate normally.
+ */
+
+ sub %fp, CPU_MINIMUM_STACK_FRAME_SIZE, %sp
+
+ or %l0, SPARC_PSR_ET_MASK, %l7 ! l7 = PSR with ET=1
+ mov %l7, %psr ! **** ENABLE TRAPS ****
+ nop
+ nop
+ nop
+
+ call SYM(_Thread_Dispatch), 0
+ nop
+
+ /*
+ * The CWP in place at this point may be different from
+ * that which was in effect at the beginning of the ISR if we
+ * have been context switched between the beginning of this invocation
+ * of _ISR_Handler and this point. Thus the CWP and WIM should
+ * not be changed back to their values at ISR entry time. Any
+ * changes to the PSR must preserve the CWP.
+ */
+
+simple_return:
+ ld [%fp + ISF_Y_OFFSET], %l5 ! restore y
+ wr %l5, 0, %y
+
+ ldd [%fp + ISF_PSR_OFFSET], %l0 ! restore psr, PC
+ ld [%fp + ISF_NPC_OFFSET], %l2 ! restore nPC
+ rd %psr, %l3
+ and %l3, SPARC_PSR_CWP_MASK, %l3 ! want "current" CWP
+ andn %l0, SPARC_PSR_CWP_MASK, %l0 ! want rest from task
+ or %l3, %l0, %l0 ! install it later...
+ andn %l0, SPARC_PSR_ET_MASK, %l0
+
+ /*
+ * Restore tasks global and out registers
+ */
+
+ mov %fp, %g1
+
+ ! g1 is restored later
+ ldd [%fp + ISF_G2_OFFSET], %g2 ! restore g2, g3
+ ldd [%fp + ISF_G4_OFFSET], %g4 ! restore g4, g5
+ ldd [%fp + ISF_G6_OFFSET], %g6 ! restore g6, g7
+
+ ldd [%fp + ISF_I0_OFFSET], %i0 ! restore i0, i1
+ ldd [%fp + ISF_I2_OFFSET], %i2 ! restore i2, i3
+ ldd [%fp + ISF_I4_OFFSET], %i4 ! restore i4, i5
+ ldd [%fp + ISF_I6_FP_OFFSET], %i6 ! restore i6/fp, i7
+
+ /*
+ * Registers:
+ *
+ * ALL global registers EXCEPT G1 and the input registers have
+ * already been restored and thuse off limits.
+ *
+ * The following is the contents of the local registers:
+ *
+ * l0 = original psr
+ * l1 = return address (i.e. PC)
+ * l2 = nPC
+ * l3 = CWP
+ */
+
+ /*
+ * if (CWP + 1) is an invalid window then we need to reload it.
+ *
+ * WARNING: Traps should now be disabled
+ */
+
+ mov %l0, %psr ! **** DISABLE TRAPS ****
+ nop
+ nop
+ nop
+ rd %wim, %l4
+ add %l0, 1, %l6 ! l6 = cwp + 1
+ and %l6, SPARC_PSR_CWP_MASK, %l6 ! do the modulo on it
+ srl %l4, %l6, %l5 ! l5 = win >> cwp + 1 ; shift count
+ ! and CWP are conveniently LS 5 bits
+ cmp %l5, 1 ! Is tasks window invalid?
+ bne good_task_window
+
+ /*
+ * The following code is the same as a 1 position left rotate of WIM.
+ */
+
+ sll %l4, 1, %l5 ! l5 = WIM << 1
+ srl %l4, SPARC_NUMBER_OF_REGISTER_WINDOWS-1 , %l4
+ ! l4 = WIM >> (Number Windows - 1)
+ or %l4, %l5, %l4 ! l4 = (WIM << 1) |
+ ! (WIM >> (Number Windows - 1))
+
+ /*
+ * Now restore the window just as if we underflowed to it.
+ */
+
+ wr %l4, 0, %wim ! WIM = new WIM
+ restore ! now into the tasks window
+
+ ldd [%g1 + CPU_STACK_FRAME_L0_OFFSET], %l0
+ ldd [%g1 + CPU_STACK_FRAME_L2_OFFSET], %l2
+ ldd [%g1 + CPU_STACK_FRAME_L4_OFFSET], %l4
+ ldd [%g1 + CPU_STACK_FRAME_L6_OFFSET], %l6
+ ldd [%g1 + CPU_STACK_FRAME_I0_OFFSET], %i0
+ ldd [%g1 + CPU_STACK_FRAME_I2_OFFSET], %i2
+ ldd [%g1 + CPU_STACK_FRAME_I4_OFFSET], %i4
+ ldd [%g1 + CPU_STACK_FRAME_I6_FP_OFFSET], %i6
+ ! reload of sp clobbers ISF
+ save ! Back to ISR dispatch window
+
+good_task_window:
+
+ mov %l0, %psr ! **** DISABLE TRAPS ****
+ ! and restore condition codes.
+ ld [%g1 + ISF_G1_OFFSET], %g1 ! restore g1
+ jmp %l1 ! transfer control and
+ rett %l2 ! go back to tasks window
+
+/* end of file */
diff --git a/c/src/exec/score/cpu/sparc/erc32.h b/c/src/exec/score/cpu/sparc/erc32.h
new file mode 100644
index 0000000000..8dd5162cea
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/erc32.h
@@ -0,0 +1,518 @@
+/* erc32.h
+ *
+ * This include file contains information pertaining to the ERC32.
+ * The ERC32 is a custom SPARC V7 implementation based on the Cypress
+ * 601/602 chipset. This CPU has a number of on-board peripherals and
+ * was developed by the European Space Agency to target space applications.
+ *
+ * NOTE: Other than where absolutely required, this version currently
+ * supports only the peripherals and bits used by the basic board
+ * support package. This includes at least significant pieces of
+ * the following items:
+ *
+ * + UART Channels A and B
+ * + General Purpose Timer
+ * + Real Time Clock
+ * + Watchdog Timer (so it can be disabled)
+ * + Control Register (so powerdown mode can be enabled)
+ * + Memory Control Register
+ * + Interrupt Control
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ERC32_h
+#define _INCLUDE_ERC32_h
+
+#include <rtems/score/sparc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Interrupt Sources
+ *
+ * The interrupt source numbers directly map to the trap type and to
+ * the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask,
+ * and the Interrupt Pending Registers.
+ */
+
+#define ERC32_INTERRUPT_MASKED_ERRORS 1
+#define ERC32_INTERRUPT_EXTERNAL_1 2
+#define ERC32_INTERRUPT_EXTERNAL_2 3
+#define ERC32_INTERRUPT_UART_A_RX_TX 4
+#define ERC32_INTERRUPT_UART_B_RX_TX 5
+#define ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR 6
+#define ERC32_INTERRUPT_UART_ERROR 7
+#define ERC32_INTERRUPT_DMA_ACCESS_ERROR 8
+#define ERC32_INTERRUPT_DMA_TIMEOUT 9
+#define ERC32_INTERRUPT_EXTERNAL_3 10
+#define ERC32_INTERRUPT_EXTERNAL_4 11
+#define ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER 12
+#define ERC32_INTERRUPT_REAL_TIME_CLOCK 13
+#define ERC32_INTERRUPT_EXTERNAL_5 14
+#define ERC32_INTERRUPT_WATCHDOG_TIMEOUT 15
+
+#ifndef ASM
+
+/*
+ * Trap Types for on-chip peripherals
+ *
+ * Source: Table 8 - Interrupt Trap Type and Default Priority Assignments
+ *
+ * NOTE: The priority level for each source corresponds to the least
+ * significant nibble of the trap type.
+ */
+
+#define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
+
+#define ERC32_TRAP_SOURCE( _trap ) ((_trap) - 0x10)
+
+#define ERC32_Is_MEC_Trap( _trap ) \
+ ( (_trap) >= ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ) && \
+ (_trap) <= ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ) )
+
+/*
+ * Structure for ERC32 memory mapped registers.
+ *
+ * Source: Section 3.25.2 - Register Address Map
+ *
+ * NOTE: There is only one of these structures per CPU, its base address
+ * is 0x01f80000, and the variable MEC is placed there by the
+ * linkcmds file.
+ */
+
+typedef struct {
+ volatile unsigned32 Control; /* offset 0x00 */
+ volatile unsigned32 Software_Reset; /* offset 0x04 */
+ volatile unsigned32 Power_Down; /* offset 0x08 */
+ volatile unsigned32 Unimplemented_0; /* offset 0x0c */
+ volatile unsigned32 Memory_Configuration; /* offset 0x10 */
+ volatile unsigned32 IO_Configuration; /* offset 0x14 */
+ volatile unsigned32 Wait_State_Configuration; /* offset 0x18 */
+ volatile unsigned32 Unimplemented_1; /* offset 0x1c */
+ volatile unsigned32 Memory_Access_0; /* offset 0x20 */
+ volatile unsigned32 Memory_Access_1; /* offset 0x24 */
+ volatile unsigned32 Unimplemented_2[ 7 ]; /* offset 0x28 */
+ volatile unsigned32 Interrupt_Shape; /* offset 0x44 */
+ volatile unsigned32 Interrupt_Pending; /* offset 0x48 */
+ volatile unsigned32 Interrupt_Mask; /* offset 0x4c */
+ volatile unsigned32 Interrupt_Clear; /* offset 0x50 */
+ volatile unsigned32 Interrupt_Force; /* offset 0x54 */
+ volatile unsigned32 Unimplemented_3[ 2 ]; /* offset 0x58 */
+ /* offset 0x60 */
+ volatile unsigned32 Watchdog_Program_and_Timeout_Acknowledge;
+ volatile unsigned32 Watchdog_Trap_Door_Set; /* offset 0x64 */
+ volatile unsigned32 Unimplemented_4[ 6 ]; /* offset 0x68 */
+ volatile unsigned32 Real_Time_Clock_Counter; /* offset 0x80 */
+ volatile unsigned32 Real_Time_Clock_Scalar; /* offset 0x84 */
+ volatile unsigned32 General_Purpose_Timer_Counter; /* offset 0x88 */
+ volatile unsigned32 General_Purpose_Timer_Scalar; /* offset 0x8c */
+ volatile unsigned32 Unimplemented_5[ 2 ]; /* offset 0x90 */
+ volatile unsigned32 Timer_Control; /* offset 0x98 */
+ volatile unsigned32 Unimplemented_6; /* offset 0x9c */
+ volatile unsigned32 System_Fault_Status; /* offset 0xa0 */
+ volatile unsigned32 First_Failing_Address; /* offset 0xa4 */
+ volatile unsigned32 First_Failing_Data; /* offset 0xa8 */
+ volatile unsigned32 First_Failing_Syndrome_and_Check_Bits;/* offset 0xac */
+ volatile unsigned32 Error_and_Reset_Status; /* offset 0xb0 */
+ volatile unsigned32 Error_Mask; /* offset 0xb4 */
+ volatile unsigned32 Unimplemented_7[ 2 ]; /* offset 0xb8 */
+ volatile unsigned32 Debug_Control; /* offset 0xc0 */
+ volatile unsigned32 Breakpoint; /* offset 0xc4 */
+ volatile unsigned32 Watchpoint; /* offset 0xc8 */
+ volatile unsigned32 Unimplemented_8; /* offset 0xcc */
+ volatile unsigned32 Test_Control; /* offset 0xd0 */
+ volatile unsigned32 Test_Data; /* offset 0xd4 */
+ volatile unsigned32 Unimplemented_9[ 2 ]; /* offset 0xd8 */
+ volatile unsigned32 UART_Channel_A; /* offset 0xe0 */
+ volatile unsigned32 UART_Channel_B; /* offset 0xe4 */
+ volatile unsigned32 UART_Status; /* offset 0xe8 */
+} ERC32_Register_Map;
+
+#endif
+
+/*
+ * The following constants are intended to be used ONLY in assembly
+ * language files.
+ *
+ * NOTE: The intended style of usage is to load the address of MEC
+ * into a register and then use these as displacements from
+ * that register.
+ */
+
+#ifdef ASM
+
+#define ERC32_MEC_CONTROL_OFFSET 0x00
+#define ERC32_MEC_SOFTWARE_RESET_OFFSET 0x04
+#define ERC32_MEC_POWER_DOWN_OFFSET 0x08
+#define ERC32_MEC_UNIMPLEMENTED_0_OFFSET 0x0C
+#define ERC32_MEC_MEMORY_CONFIGURATION_OFFSET 0x10
+#define ERC32_MEC_IO_CONFIGURATION_OFFSET 0x14
+#define ERC32_MEC_WAIT_STATE_CONFIGURATION_OFFSET 0x18
+#define ERC32_MEC_UNIMPLEMENTED_1_OFFSET 0x1C
+#define ERC32_MEC_MEMORY_ACCESS_0_OFFSET 0x20
+#define ERC32_MEC_MEMORY_ACCESS_1_OFFSET 0x24
+#define ERC32_MEC_UNIMPLEMENTED_2_OFFSET 0x28
+#define ERC32_MEC_INTERRUPT_SHAPE_OFFSET 0x44
+#define ERC32_MEC_INTERRUPT_PENDING_OFFSET 0x48
+#define ERC32_MEC_INTERRUPT_MASK_OFFSET 0x4C
+#define ERC32_MEC_INTERRUPT_CLEAR_OFFSET 0x50
+#define ERC32_MEC_INTERRUPT_FORCE_OFFSET 0x54
+#define ERC32_MEC_UNIMPLEMENTED_3_OFFSET 0x58
+#define ERC32_MEC_WATCHDOG_PROGRAM_AND_TIMEOUT_ACKNOWLEDGE_OFFSET 0x60
+#define ERC32_MEC_WATCHDOG_TRAP_DOOR_SET_OFFSET 0x64
+#define ERC32_MEC_UNIMPLEMENTED_4_OFFSET 0x6C
+#define ERC32_MEC_REAL_TIME_CLOCK_COUNTER_OFFSET 0x80
+#define ERC32_MEC_REAL_TIME_CLOCK_SCALAR_OFFSET 0x84
+#define ERC32_MEC_GENERAL_PURPOSE_TIMER_COUNTER_OFFSET 0x88
+#define ERC32_MEC_GENERAL_PURPOSE_TIMER_SCALAR_OFFSET 0x8C
+#define ERC32_MEC_UNIMPLEMENTED_5_OFFSET 0x90
+#define ERC32_MEC_TIMER_CONTROL_OFFSET 0x98
+#define ERC32_MEC_UNIMPLEMENTED_6_OFFSET 0x9C
+#define ERC32_MEC_SYSTEM_FAULT_STATUS_OFFSET 0xA0
+#define ERC32_MEC_FIRST_FAILING_ADDRESS_OFFSET 0xA4
+#define ERC32_MEC_FIRST_FAILING_DATA_OFFSET 0xA8
+#define ERC32_MEC_FIRST_FAILING_SYNDROME_AND_CHECK_BITS_OFFSET 0xAC
+#define ERC32_MEC_ERROR_AND_RESET_STATUS_OFFSET 0xB0
+#define ERC32_MEC_ERROR_MASK_OFFSET 0xB4
+#define ERC32_MEC_UNIMPLEMENTED_7_OFFSET 0xB8
+#define ERC32_MEC_DEBUG_CONTROL_OFFSET 0xC0
+#define ERC32_MEC_BREAKPOINT_OFFSET 0xC4
+#define ERC32_MEC_WATCHPOINT_OFFSET 0xC8
+#define ERC32_MEC_UNIMPLEMENTED_8_OFFSET 0xCC
+#define ERC32_MEC_TEST_CONTROL_OFFSET 0xD0
+#define ERC32_MEC_TEST_DATA_OFFSET 0xD4
+#define ERC32_MEC_UNIMPLEMENTED_9_OFFSET 0xD8
+#define ERC32_MEC_UART_CHANNEL_A_OFFSET 0xE0
+#define ERC32_MEC_UART_CHANNEL_B_OFFSET 0xE4
+#define ERC32_MEC_UART_STATUS_OFFSET 0xE8
+
+#endif
+
+/*
+ * The following defines the bits in the Configuration Register.
+ */
+
+#define ERC32_CONFIGURATION_POWER_DOWN_MASK 0x00000001
+#define ERC32_CONFIGURATION_POWER_DOWN_ALLOWED 0x00000001
+#define ERC32_CONFIGURATION_POWER_DOWN_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_MASK 0x00000002
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_ALLOWED 0x00000002
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_MASK 0x00000004
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_ENABLED 0x00000004
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_MASK 0x00000008
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_ENABLED 0x00000008
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_DISABLED 0x00000000
+
+
+/*
+ * The following defines the bits in the Memory Configuration Register.
+ */
+
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001C00
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_256K ( 0 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_512K ( 1 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_1MB ( 2 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_2MB ( 3 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_4MB ( 4 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_8MB ( 5 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_16MB ( 6 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_32MB ( 7 << 10 )
+
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x001C0000
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_4K ( 0 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_8K ( 1 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_16K ( 2 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_32K ( 3 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_64K ( 4 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_128K ( 5 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_256K ( 6 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_512K ( 7 << 18 )
+
+/*
+ * The following defines the bits in the Timer Control Register.
+ */
+
+#define ERC32_MEC_TIMER_CONTROL_GCR 0x00000001 /* 1 = reload at 0 */
+ /* 0 = stop at 0 */
+#define ERC32_MEC_TIMER_CONTROL_GCL 0x00000002 /* 1 = load and start */
+ /* 0 = no function */
+#define ERC32_MEC_TIMER_CONTROL_GSE 0x00000004 /* 1 = enable counting */
+ /* 0 = hold scalar and counter */
+#define ERC32_MEC_TIMER_CONTROL_GSL 0x00000008 /* 1 = load scalar and start */
+ /* 0 = no function */
+
+#define ERC32_MEC_TIMER_CONTROL_RTCCR 0x00000100 /* 1 = reload at 0 */
+ /* 0 = stop at 0 */
+#define ERC32_MEC_TIMER_CONTROL_RTCCL 0x00000200 /* 1 = load and start */
+ /* 0 = no function */
+#define ERC32_MEC_TIMER_CONTROL_RTCSE 0x00000400 /* 1 = enable counting */
+ /* 0 = hold scalar and counter */
+#define ERC32_MEC_TIMER_CONTROL_RTCSL 0x00000800 /* 1 = load scalar and start */
+ /* 0 = no function */
+
+/*
+ * The following defines the bits in the UART Control Registers.
+ *
+ * NOTE: Same bits in UART channels A and B.
+ */
+
+#define ERC32_MEC_UART_CONTROL_RTD 0x000000FF /* RX/TX data */
+#define ERC32_MEC_UART_CONTROL_DR 0x00000100 /* RX Data Ready */
+#define ERC32_MEC_UART_CONTROL_TSE 0x00000200 /* TX Send Empty */
+ /* (i.e. no data to send) */
+#define ERC32_MEC_UART_CONTROL_THE 0x00000400 /* TX Hold Empty */
+ /* (i.e. ready to load) */
+
+/*
+ * The following defines the bits in the MEC UART Control Registers.
+ */
+
+#define ERC32_MEC_UART_STATUS_DR 0x00000001 /* Data Ready */
+#define ERC32_MEC_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */
+#define ERC32_MEC_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */
+#define ERC32_MEC_UART_STATUS_FE 0x00000010 /* RX Framing Error */
+#define ERC32_MEC_UART_STATUS_PE 0x00000020 /* RX Parity Error */
+#define ERC32_MEC_UART_STATUS_OE 0x00000040 /* RX Overrun Error */
+#define ERC32_MEC_UART_STATUS_CU 0x00000080 /* Clear Errors */
+#define ERC32_MEC_UART_STATUS_TXE 0x00000006 /* TX Empty */
+
+#define ERC32_MEC_UART_STATUS_DRA (ERC32_MEC_UART_STATUS_DR << 0)
+#define ERC32_MEC_UART_STATUS_TSEA (ERC32_MEC_UART_STATUS_TSE << 0)
+#define ERC32_MEC_UART_STATUS_THEA (ERC32_MEC_UART_STATUS_THE << 0)
+#define ERC32_MEC_UART_STATUS_FEA (ERC32_MEC_UART_STATUS_FE << 0)
+#define ERC32_MEC_UART_STATUS_PEA (ERC32_MEC_UART_STATUS_PE << 0)
+#define ERC32_MEC_UART_STATUS_OEA (ERC32_MEC_UART_STATUS_OE << 0)
+#define ERC32_MEC_UART_STATUS_CUA (ERC32_MEC_UART_STATUS_CU << 0)
+#define ERC32_MEC_UART_STATUS_TXEA (ERC32_MEC_UART_STATUS_TXE << 0)
+
+#define ERC32_MEC_UART_STATUS_DRB (ERC32_MEC_UART_STATUS_DR << 16)
+#define ERC32_MEC_UART_STATUS_TSEB (ERC32_MEC_UART_STATUS_TSE << 16)
+#define ERC32_MEC_UART_STATUS_THEB (ERC32_MEC_UART_STATUS_THE << 16)
+#define ERC32_MEC_UART_STATUS_FEB (ERC32_MEC_UART_STATUS_FE << 16)
+#define ERC32_MEC_UART_STATUS_PEB (ERC32_MEC_UART_STATUS_PE << 16)
+#define ERC32_MEC_UART_STATUS_OEB (ERC32_MEC_UART_STATUS_OE << 16)
+#define ERC32_MEC_UART_STATUS_CUB (ERC32_MEC_UART_STATUS_CU << 16)
+#define ERC32_MEC_UART_STATUS_TXEB (ERC32_MEC_UART_STATUS_TXE << 16)
+
+#ifndef ASM
+
+/*
+ * This is used to manipulate the on-chip registers.
+ *
+ * The following symbol must be defined in the linkcmds file and point
+ * to the correct location.
+ */
+
+extern ERC32_Register_Map ERC32_MEC;
+
+/*
+ * Macros to manipulate the Interrupt Clear, Interrupt Force, Interrupt Mask,
+ * and the Interrupt Pending Registers.
+ *
+ * NOTE: For operations which are not atomic, this code disables interrupts
+ * to guarantee there are no intervening accesses to the same register.
+ * The operations which read the register, modify the value and then
+ * store the result back are vulnerable.
+ */
+
+#define ERC32_Clear_interrupt( _source ) \
+ do { \
+ ERC32_MEC.Interrupt_Clear = (1 << (_source)); \
+ } while (0)
+
+#define ERC32_Force_interrupt( _source ) \
+ do { \
+ ERC32_MEC.Interrupt_Force = (1 << (_source)); \
+ } while (0)
+
+#define ERC32_Is_interrupt_pending( _source ) \
+ (ERC32_MEC.Interrupt_Pending & (1 << (_source)))
+
+#define ERC32_Is_interrupt_masked( _source ) \
+ (ERC32_MEC.Interrupt_Masked & (1 << (_source)))
+
+#define ERC32_Mask_interrupt( _source ) \
+ do { \
+ unsigned32 _level; \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask |= (1 << (_source)); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+#define ERC32_Unmask_interrupt( _source ) \
+ do { \
+ unsigned32 _level; \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask &= ~(1 << (_source)); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+#define ERC32_Disable_interrupt( _source, _previous ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _mask = 1 << (_source); \
+ \
+ sparc_disable_interrupts( _level ); \
+ (_previous) = ERC32_MEC.Interrupt_Mask; \
+ ERC32_MEC.Interrupt_Mask = _previous | _mask; \
+ sparc_enable_interrupts( _level ); \
+ (_previous) &= ~_mask; \
+ } while (0)
+
+#define ERC32_Restore_interrupt( _source, _previous ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _mask = 1 << (_source); \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask = \
+ (ERC32_MEC.Interrupt_Mask & ~_mask) | (_previous); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+/*
+ * The following macros attempt to hide the fact that the General Purpose
+ * Timer and Real Time Clock Timer share the Timer Control Register. Because
+ * the Timer Control Register is write only, we must mirror it in software
+ * and insure that writes to one timer do not alter the current settings
+ * and status of the other timer.
+ *
+ * This code promotes the view that the two timers are completely independent.
+ * By exclusively using the routines below to access the Timer Control
+ * Register, the application can view the system as having a General Purpose
+ * Timer Control Register and a Real Time Clock Timer Control Register
+ * rather than the single shared value.
+ *
+ * Each logical timer control register is organized as follows:
+ *
+ * D0 - Counter Reload
+ * 1 = reload counter at zero and restart
+ * 0 = stop counter at zero
+ *
+ * D1 - Counter Load
+ * 1 = load counter with preset value and restart
+ * 0 = no function
+ *
+ * D2 - Enable
+ * 1 = enable counting
+ * 0 = hold scaler and counter
+ *
+ * D2 - Scaler Load
+ * 1 = load scalar with preset value and restart
+ * 0 = no function
+ *
+ * To insure the management of the mirror is atomic, we disable interrupts
+ * around updates.
+ */
+
+#define ERC32_MEC_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000001
+#define ERC32_MEC_TIMER_COUNTER_STOP_AT_ZERO 0x00000000
+
+#define ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER 0x00000002
+
+#define ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING 0x00000004
+#define ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING 0x00000000
+
+#define ERC32_MEC_TIMER_COUNTER_LOAD_SCALER 0x00000008
+
+#define ERC32_MEC_TIMER_COUNTER_RELOAD_MASK 0x00000001
+#define ERC32_MEC_TIMER_COUNTER_ENABLE_MASK 0x00000004
+
+#define ERC32_MEC_TIMER_COUNTER_DEFINED_MASK 0x0000000F
+#define ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000005
+
+extern unsigned32 _ERC32_MEC_Timer_Control_Mirror;
+
+/*
+ * This macros manipulate the General Purpose Timer portion of the
+ * Timer Control register and promote the view that there are actually
+ * two independent Timer Control Registers.
+ */
+
+#define ERC32_MEC_Set_General_Purpose_Timer_Control( _value ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _control; \
+ unsigned32 __value; \
+ \
+ __value = ((_value) & 0x0f); \
+ sparc_disable_interrupts( _level ); \
+ _control = _ERC32_MEC_Timer_Control_Mirror; \
+ _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK << 8; \
+ _ERC32_MEC_Timer_Control_Mirror = _control | _value; \
+ _control &= (ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK << 8); \
+ _control |= __value; \
+ /* printf( "GPT 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \
+ ERC32_MEC.Timer_Control = _control; \
+ sparc_enable_interrupts( _level ); \
+ } while ( 0 )
+
+#define ERC32_MEC_Get_General_Purpose_Timer_Control( _value ) \
+ do { \
+ (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \
+ } while ( 0 )
+
+/*
+ * This macros manipulate the Real Timer Clock Timer portion of the
+ * Timer Control register and promote the view that there are actually
+ * two independent Timer Control Registers.
+ */
+
+#define ERC32_MEC_Set_Real_Time_Clock_Timer_Control( _value ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _control; \
+ unsigned32 __value; \
+ \
+ __value = ((_value) & 0x0f) << 8; \
+ sparc_disable_interrupts( _level ); \
+ _control = _ERC32_MEC_Timer_Control_Mirror; \
+ _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK; \
+ _ERC32_MEC_Timer_Control_Mirror = _control | _value; \
+ _control &= ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK; \
+ _control |= __value; \
+ /* printf( "RTC 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \
+ ERC32_MEC.Timer_Control = _control; \
+ sparc_enable_interrupts( _level ); \
+ } while ( 0 )
+
+#define ERC32_MEC_Get_Real_Time_Clock_Timer_Control( _value ) \
+ do { \
+ (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \
+ } while ( 0 )
+
+
+#endif /* !ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_INCLUDE_ERC32_h */
+/* end of include file */
+
diff --git a/c/src/exec/score/cpu/sparc/rtems.s b/c/src/exec/score/cpu/sparc/rtems.s
new file mode 100644
index 0000000000..e4dfd83fd6
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/rtems.s
@@ -0,0 +1,58 @@
+/* rtems.s
+ *
+ * This file contains the single entry point code for
+ * the SPARC port of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+
+/*
+ * RTEMS
+ *
+ * This routine jumps to the directive indicated in the
+ * CPU defined register. This routine is used when RTEMS is
+ * linked by itself and placed in ROM. This routine is the
+ * first address in the ROM space for RTEMS. The user "calls"
+ * this address with the directive arguments in the normal place.
+ * This routine then jumps indirectly to the correct directive
+ * preserving the arguments. The directive should not realize
+ * it has been "wrapped" in this way. The table "_Entry_points"
+ * is used to look up the directive.
+ *
+ * void RTEMS()
+ */
+
+ .align 4
+ PUBLIC(RTEMS)
+SYM(RTEMS):
+ /*
+ * g2 was chosen because gcc uses it as a scratch register in
+ * similar code scenarios and the other locals, ins, and outs
+ * are off limits to this routine unless it does a "save" and
+ * copies its in registers to the outs which only works up until
+ * 6 parameters. Best to take the simple approach in this case.
+ */
+ sethi SYM(_Entry_points), %g2
+ or %g2, %lo(SYM(_Entry_points)), %g2
+ sll %g1, 2, %g1
+ add %g1, %g2, %g2
+ jmp %g2
+ nop
+
diff --git a/c/src/exec/score/cpu/sparc/sparc.h b/c/src/exec/score/cpu/sparc/sparc.h
new file mode 100644
index 0000000000..b282aa0189
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/sparc.h
@@ -0,0 +1,275 @@
+/* sparc.h
+ *
+ * This include file contains information pertaining to the SPARC
+ * processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_SPARC_h
+#define _INCLUDE_SPARC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef sparc
+#undef sparc
+#endif
+#define sparc
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+/*
+ * This file contains the information required to build
+ * RTEMS for a particular member of the "sparc" family. It does
+ * this by setting variables to indicate which implementation
+ * dependent features are present in a particular member
+ * of the family.
+ *
+ * Currently recognized feature flags:
+ *
+ * + SPARC_HAS_FPU
+ * 0 - no HW FPU
+ * 1 - has HW FPU (assumed to be compatible w/90C602)
+ *
+ * + SPARC_HAS_BITSCAN
+ * 0 - does not have scan instructions
+ * 1 - has scan instruction (not currently implemented)
+ *
+ * + SPARC_NUMBER_OF_REGISTER_WINDOWS
+ * 8 is the most common number supported by SPARC implementations.
+ * SPARC_PSR_CWP_MASK is derived from this value.
+ *
+ * + SPARC_HAS_LOW_POWER_MODE
+ * 0 - does not have low power mode support (or not supported)
+ * 1 - has low power mode and thus a CPU model dependent idle task.
+ *
+ */
+
+#if defined(erc32)
+
+#define CPU_MODEL_NAME "erc32"
+#define SPARC_HAS_FPU 1
+#define SPARC_HAS_BITSCAN 0
+#define SPARC_NUMBER_OF_REGISTER_WINDOWS 8
+#define SPARC_HAS_LOW_POWER_MODE 1
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+/*
+ * Define the name of the CPU family.
+ */
+
+#define CPU_NAME "SPARC"
+
+/*
+ * Miscellaneous constants
+ */
+
+/*
+ * PSR masks and starting bit positions
+ *
+ * NOTE: Reserved bits are ignored.
+ */
+
+#if (SPARC_NUMBER_OF_REGISTER_WINDOWS == 8)
+#define SPARC_PSR_CWP_MASK 0x07 /* bits 0 - 4 */
+#elif (SPARC_NUMBER_OF_REGISTER_WINDOWS == 16)
+#define SPARC_PSR_CWP_MASK 0x0F /* bits 0 - 4 */
+#elif (SPARC_NUMBER_OF_REGISTER_WINDOWS == 32)
+#define SPARC_PSR_CWP_MASK 0x1F /* bits 0 - 4 */
+#else
+#error "Unsupported number of register windows for this cpu"
+#endif
+
+#define SPARC_PSR_ET_MASK 0x00000020 /* bit 5 */
+#define SPARC_PSR_PS_MASK 0x00000040 /* bit 6 */
+#define SPARC_PSR_S_MASK 0x00000080 /* bit 7 */
+#define SPARC_PSR_PIL_MASK 0x00000F00 /* bits 8 - 11 */
+#define SPARC_PSR_EF_MASK 0x00001000 /* bit 12 */
+#define SPARC_PSR_EC_MASK 0x00002000 /* bit 13 */
+#define SPARC_PSR_ICC_MASK 0x00F00000 /* bits 20 - 23 */
+#define SPARC_PSR_VER_MASK 0x0F000000 /* bits 24 - 27 */
+#define SPARC_PSR_IMPL_MASK 0xF0000000 /* bits 28 - 31 */
+
+#define SPARC_PSR_CWP_BIT_POSITION 0 /* bits 0 - 4 */
+#define SPARC_PSR_ET_BIT_POSITION 5 /* bit 5 */
+#define SPARC_PSR_PS_BIT_POSITION 6 /* bit 6 */
+#define SPARC_PSR_S_BIT_POSITION 7 /* bit 7 */
+#define SPARC_PSR_PIL_BIT_POSITION 8 /* bits 8 - 11 */
+#define SPARC_PSR_EF_BIT_POSITION 12 /* bit 12 */
+#define SPARC_PSR_EC_BIT_POSITION 13 /* bit 13 */
+#define SPARC_PSR_ICC_BIT_POSITION 20 /* bits 20 - 23 */
+#define SPARC_PSR_VER_BIT_POSITION 24 /* bits 24 - 27 */
+#define SPARC_PSR_IMPL_BIT_POSITION 28 /* bits 28 - 31 */
+
+#ifndef ASM
+
+/*
+ * Standard nop
+ */
+
+#define nop() \
+ do { \
+ asm volatile ( "nop" ); \
+ } while ( 0 )
+
+/*
+ * Get and set the PSR
+ */
+
+#define sparc_get_psr( _psr ) \
+ do { \
+ (_psr) = 0; \
+ asm volatile( "rd %%psr, %0" : "=r" (_psr) : "0" (_psr) ); \
+ } while ( 0 )
+
+#define sparc_set_psr( _psr ) \
+ do { \
+ asm volatile ( "mov %0, %%psr " : "=r" ((_psr)) : "0" ((_psr)) ); \
+ nop(); \
+ nop(); \
+ nop(); \
+ } while ( 0 )
+
+/*
+ * Get and set the TBR
+ */
+
+#define sparc_get_tbr( _tbr ) \
+ do { \
+ (_tbr) = 0; /* to avoid unitialized warnings */ \
+ asm volatile( "rd %%tbr, %0" : "=r" (_tbr) : "0" (_tbr) ); \
+ } while ( 0 )
+
+#define sparc_set_tbr( _tbr ) \
+ do { \
+ asm volatile( "wr %0, 0, %%tbr" : "=r" (_tbr) : "0" (_tbr) ); \
+ } while ( 0 )
+
+/*
+ * Get and set the WIM
+ */
+
+#define sparc_get_wim( _wim ) \
+ do { \
+ asm volatile( "rd %%wim, %0" : "=r" (_wim) : "0" (_wim) ); \
+ } while ( 0 )
+
+#define sparc_set_wim( _wim ) \
+ do { \
+ asm volatile( "wr %0, %%wim" : "=r" (_wim) : "0" (_wim) ); \
+ nop(); \
+ nop(); \
+ nop(); \
+ } while ( 0 )
+
+/*
+ * Get and set the Y
+ */
+
+#define sparc_get_y( _y ) \
+ do { \
+ asm volatile( "rd %%y, %0" : "=r" (_y) : "0" (_y) ); \
+ } while ( 0 )
+
+#define sparc_set_y( _y ) \
+ do { \
+ asm volatile( "wr %0, %%y" : "=r" (_y) : "0" (_y) ); \
+ } while ( 0 )
+
+/*
+ * Manipulate the interrupt level in the psr
+ *
+ */
+
+#define sparc_disable_interrupts( _level ) \
+ do { \
+ register unsigned int _newlevel; \
+ \
+ sparc_get_psr( _level ); \
+ (_newlevel) = (_level) | SPARC_PSR_PIL_MASK; \
+ sparc_set_psr( _newlevel ); \
+ } while ( 0 )
+
+#define sparc_enable_interrupts( _level ) \
+ do { \
+ unsigned int _tmp; \
+ \
+ sparc_get_psr( _tmp ); \
+ _tmp &= ~SPARC_PSR_PIL_MASK; \
+ _tmp |= (_level) & SPARC_PSR_PIL_MASK; \
+ sparc_set_psr( _tmp ); \
+ } while ( 0 )
+
+#define sparc_flash_interrupts( _level ) \
+ do { \
+ register unsigned32 _ignored = 0; \
+ \
+ sparc_enable_interrupts( (_level) ); \
+ sparc_disable_interrupts( _ignored ); \
+ } while ( 0 )
+
+#define sparc_set_interrupt_level( _new_level ) \
+ do { \
+ register unsigned32 _new_psr_level = 0; \
+ \
+ sparc_get_psr( _new_psr_level ); \
+ _new_psr_level &= ~SPARC_PSR_PIL_MASK; \
+ _new_psr_level |= \
+ (((_new_level) << SPARC_PSR_PIL_BIT_POSITION) & SPARC_PSR_PIL_MASK); \
+ sparc_set_psr( _new_psr_level ); \
+ } while ( 0 )
+
+#define sparc_get_interrupt_level( _level ) \
+ do { \
+ register unsigned32 _psr_level = 0; \
+ \
+ sparc_get_psr( _psr_level ); \
+ (_level) = \
+ (_psr_level & SPARC_PSR_PIL_MASK) >> SPARC_PSR_PIL_BIT_POSITION; \
+ } while ( 0 )
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_SPARC_h */
+/* end of include file */
diff --git a/c/src/exec/score/cpu/sparc/sparctypes.h b/c/src/exec/score/cpu/sparc/sparctypes.h
new file mode 100644
index 0000000000..1d23f8fea0
--- /dev/null
+++ b/c/src/exec/score/cpu/sparc/sparctypes.h
@@ -0,0 +1,64 @@
+/* sparctypes.h
+ *
+ * This include file contains type definitions pertaining to the
+ * SPARC processor family.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#ifndef __SPARC_TYPES_h
+#define __SPARC_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void sparc_isr;
+typedef void ( *sparc_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c
new file mode 100644
index 0000000000..4c1604465f
--- /dev/null
+++ b/c/src/exec/score/cpu/unix/cpu.c
@@ -0,0 +1,969 @@
+/*
+ * UNIX Simulator Dependent Source
+ *
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/interr.h>
+
+#if defined(solaris2)
+/*
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#define __STRICT_ANSI__
+*/
+#define __EXTENSIONS__
+#endif
+
+#if defined(linux)
+#define MALLOC_0_RETURNS_NULL
+#endif
+
+#include <sys/types.h>
+#include <sys/times.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <string.h> /* memset */
+
+#ifndef SA_RESTART
+#define SA_RESTART 0
+#endif
+
+typedef struct {
+ jmp_buf regs;
+ sigset_t isr_level;
+} Context_Control_overlay;
+
+void _CPU_Signal_initialize(void);
+void _CPU_Stray_signal(int);
+void _CPU_ISR_Handler(int);
+
+sigset_t _CPU_Signal_mask;
+Context_Control _CPU_Context_Default_with_ISRs_enabled;
+Context_Control _CPU_Context_Default_with_ISRs_disabled;
+
+/*
+ * Which cpu are we? Used by libcpu and libbsp.
+ */
+
+int cpu_number;
+
+/*PAGE
+ *
+ * _CPU_ISR_From_CPU_Init
+ */
+
+sigset_t posix_empty_mask;
+
+void _CPU_ISR_From_CPU_Init()
+{
+ unsigned32 i;
+ proc_ptr old_handler;
+
+ /*
+ * Generate an empty mask to be used by disable_support
+ */
+
+ sigemptyset(&posix_empty_mask);
+
+ /*
+ * Block all the signals except SIGTRAP for the debugger
+ * and SIGABRT for fatal errors.
+ */
+
+ (void) sigfillset(&_CPU_Signal_mask);
+ (void) sigdelset(&_CPU_Signal_mask, SIGTRAP);
+ (void) sigdelset(&_CPU_Signal_mask, SIGABRT);
+ (void) sigdelset(&_CPU_Signal_mask, SIGIOT);
+ (void) sigdelset(&_CPU_Signal_mask, SIGCONT);
+
+ _CPU_ISR_Enable(1);
+
+ /*
+ * Set the handler for all signals to be signal_handler
+ * which will then vector out to the correct handler
+ * for whichever signal actually happened. Initially
+ * set the vectors to the stray signal handler.
+ */
+
+ for (i = 0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++)
+ (void)_CPU_ISR_install_vector(i, _CPU_Stray_signal, &old_handler);
+
+ _CPU_Signal_initialize();
+}
+
+void _CPU_Signal_initialize( void )
+{
+ struct sigaction act;
+ sigset_t mask;
+
+ /* mark them all active except for TraceTrap and Abort */
+
+ sigfillset(&mask);
+ sigdelset(&mask, SIGTRAP);
+ sigdelset(&mask, SIGABRT);
+ sigdelset(&mask, SIGIOT);
+ sigdelset(&mask, SIGCONT);
+ sigprocmask(SIG_UNBLOCK, &mask, 0);
+
+ act.sa_handler = _CPU_ISR_Handler;
+ act.sa_mask = mask;
+ act.sa_flags = SA_RESTART;
+
+ sigaction(SIGHUP, &act, 0);
+ sigaction(SIGINT, &act, 0);
+ sigaction(SIGQUIT, &act, 0);
+ sigaction(SIGILL, &act, 0);
+#ifdef SIGEMT
+ sigaction(SIGEMT, &act, 0);
+#endif
+ sigaction(SIGFPE, &act, 0);
+ sigaction(SIGKILL, &act, 0);
+ sigaction(SIGBUS, &act, 0);
+ sigaction(SIGSEGV, &act, 0);
+#ifdef SIGSYS
+ sigaction(SIGSYS, &act, 0);
+#endif
+ sigaction(SIGPIPE, &act, 0);
+ sigaction(SIGALRM, &act, 0);
+ sigaction(SIGTERM, &act, 0);
+ sigaction(SIGUSR1, &act, 0);
+ sigaction(SIGUSR2, &act, 0);
+ sigaction(SIGCHLD, &act, 0);
+ sigaction(SIGCLD, &act, 0);
+ sigaction(SIGPWR, &act, 0);
+ sigaction(SIGVTALRM, &act, 0);
+ sigaction(SIGPROF, &act, 0);
+ sigaction(SIGIO, &act, 0);
+ sigaction(SIGWINCH, &act, 0);
+ sigaction(SIGSTOP, &act, 0);
+ sigaction(SIGTTIN, &act, 0);
+ sigaction(SIGTTOU, &act, 0);
+ sigaction(SIGURG, &act, 0);
+#ifdef SIGLOST
+ sigaction(SIGLOST, &act, 0);
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_Context_From_CPU_Init
+ */
+
+void _CPU_Context_From_CPU_Init()
+{
+
+#if defined(hppa1_1) && defined(RTEMS_UNIXLIB_SETJMP)
+ /*
+ * HACK - set the _SYSTEM_ID to 0x20c so that setjmp/longjmp
+ * will handle the full 32 floating point registers.
+ */
+
+ {
+ extern unsigned32 _SYSTEM_ID;
+
+ _SYSTEM_ID = 0x20c;
+ }
+#endif
+
+ /*
+ * get default values to use in _CPU_Context_Initialize()
+ */
+
+
+ (void) memset(
+ &_CPU_Context_Default_with_ISRs_enabled,
+ 0,
+ sizeof(Context_Control)
+ );
+ (void) memset(
+ &_CPU_Context_Default_with_ISRs_disabled,
+ 0,
+ sizeof(Context_Control)
+ );
+
+ _CPU_ISR_Set_level( 0 );
+ _CPU_Context_switch(
+ &_CPU_Context_Default_with_ISRs_enabled,
+ &_CPU_Context_Default_with_ISRs_enabled
+ );
+
+ _CPU_ISR_Set_level( 1 );
+ _CPU_Context_switch(
+ &_CPU_Context_Default_with_ISRs_disabled,
+ &_CPU_Context_Default_with_ISRs_disabled
+ );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+sigset_t GET_old_mask;
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+/* sigset_t old_mask; */
+ unsigned32 old_level;
+
+ sigprocmask(0, 0, &GET_old_mask);
+
+ if (memcmp((void *)&posix_empty_mask, (void *)&GET_old_mask, sizeof(sigset_t)))
+ old_level = 1;
+ else
+ old_level = 0;
+
+ return old_level;
+}
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ /*
+ * The thread_dispatch argument is the address of the entry point
+ * for the routine called at the end of an ISR once it has been
+ * decided a context switch is necessary. On some compilation
+ * systems it is difficult to call a high-level language routine
+ * from assembly. This allows us to trick these systems.
+ *
+ * If you encounter this problem save the entry point in a CPU
+ * dependent variable.
+ */
+
+ _CPU_Thread_dispatch_pointer = thread_dispatch;
+
+ /*
+ * XXX; If there is not an easy way to initialize the FP context
+ * during Context_Initialize, then it is usually easier to
+ * save an "uninitialized" FP context here and copy it to
+ * the task's during Context_Initialize.
+ */
+
+ /* XXX: FP context initialization support */
+
+ _CPU_Table = *cpu_table;
+
+ _CPU_ISR_From_CPU_Init();
+
+ _CPU_Context_From_CPU_Init();
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ _CPU_Fatal_halt( 0xdeaddead );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _CPU_ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * Stop until we get a signal which is the logically the same thing
+ * entering low-power or sleep mode on a real processor and waiting for
+ * an interrupt. This significantly reduces the consumption of host
+ * CPU cycles which is again similar to low power mode.
+ */
+
+void _CPU_Thread_Idle_body( void )
+{
+ while (1)
+ pause();
+}
+
+/*PAGE
+ *
+ * _CPU_Context_Initialize
+ */
+
+void _CPU_Context_Initialize(
+ Context_Control *_the_context,
+ unsigned32 *_stack_base,
+ unsigned32 _size,
+ unsigned32 _new_level,
+ void *_entry_point,
+ boolean _is_fp
+)
+{
+ void *source;
+ unsigned32 *addr;
+ unsigned32 jmp_addr;
+ unsigned32 _stack_low; /* lowest "stack aligned" address */
+ unsigned32 _stack_high; /* highest "stack aligned" address */
+ unsigned32 _the_size;
+
+ jmp_addr = (unsigned32) _entry_point;
+
+ /*
+ * On CPUs with stacks which grow down, we build the stack
+ * based on the _stack_high address. On CPUs with stacks which
+ * grow up, we build the stack based on the _stack_low address.
+ */
+
+ _stack_low = (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT - 1;
+ _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ _stack_high = (unsigned32)(_stack_base) + _size;
+ _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ if (_stack_high > _stack_low)
+ _the_size = _stack_high - _stack_low;
+ else
+ _the_size = _stack_low - _stack_high;
+
+ /*
+ * Slam our jmp_buf template into the context we are creating
+ */
+
+ if ( _new_level == 0 )
+ source = &_CPU_Context_Default_with_ISRs_enabled;
+ else
+ source = &_CPU_Context_Default_with_ISRs_disabled;
+
+ memcpy(
+ _the_context,
+ source,
+ sizeof(Context_Control) /* sizeof(jmp_buf)); */
+ );
+
+ addr = (unsigned32 *)_the_context;
+
+#if defined(hppa1_1)
+ *(addr + RP_OFF) = jmp_addr;
+ *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
+
+ /*
+ * See if we are using shared libraries by checking
+ * bit 30 in 24 off of newp. If bit 30 is set then
+ * we are using shared libraries and the jump address
+ * points to the pointer, so we put that into rp instead.
+ */
+
+ if (jmp_addr & 0x40000000) {
+ jmp_addr &= 0xfffffffc;
+ *(addr + RP_OFF) = *(unsigned32 *)jmp_addr;
+ }
+#elif defined(sparc)
+
+ /*
+ * See /usr/include/sys/stack.h in Solaris 2.3 for a nice
+ * diagram of the stack.
+ */
+
+ asm ("ta 0x03"); /* flush registers */
+
+ *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
+ *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
+ *(addr + FP_OFF) = (unsigned32)(_stack_high);
+
+#elif defined(i386)
+
+ /*
+ * This information was gathered by disassembling setjmp().
+ */
+
+ {
+ unsigned32 stack_ptr;
+
+ stack_ptr = _stack_high - CPU_FRAME_SIZE;
+
+ *(addr + EBX_OFF) = 0xFEEDFEED;
+ *(addr + ESI_OFF) = 0xDEADDEAD;
+ *(addr + EDI_OFF) = 0xDEAFDEAF;
+ *(addr + EBP_OFF) = stack_ptr;
+ *(addr + ESP_OFF) = stack_ptr;
+ *(addr + RET_OFF) = jmp_addr;
+
+ addr = (unsigned32 *) stack_ptr;
+
+ addr[ 0 ] = jmp_addr;
+ addr[ 1 ] = (unsigned32) stack_ptr;
+ addr[ 2 ] = (unsigned32) stack_ptr;
+ }
+
+#else
+#error "UNKNOWN CPU!!!"
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_Context_restore
+ */
+
+void _CPU_Context_restore(
+ Context_Control *next
+)
+{
+ Context_Control_overlay *nextp = (Context_Control_overlay *)next;
+
+ sigprocmask( SIG_SETMASK, &nextp->isr_level, 0 );
+ longjmp( nextp->regs, 0 );
+}
+
+/*PAGE
+ *
+ * _CPU_Context_switch
+ */
+
+void _CPU_Context_switch(
+ Context_Control *current,
+ Context_Control *next
+)
+{
+ Context_Control_overlay *currentp = (Context_Control_overlay *)current;
+ Context_Control_overlay *nextp = (Context_Control_overlay *)next;
+
+ int status;
+
+ /*
+ * Switch levels in one operation
+ */
+
+ status = sigprocmask( SIG_SETMASK, &nextp->isr_level, &currentp->isr_level );
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+
+ if (setjmp(currentp->regs) == 0) { /* Save the current context */
+ longjmp(nextp->regs, 0); /* Switch to the new context */
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+ }
+
+}
+
+/*PAGE
+ *
+ * _CPU_Save_float_context
+ */
+
+void _CPU_Save_float_context(
+ Context_Control_fp *fp_context
+)
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Restore_float_context
+ */
+
+void _CPU_Restore_float_context(
+ Context_Control_fp *fp_context
+)
+{
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Disable_support
+ */
+
+unsigned32 _CPU_ISR_Disable_support(void)
+{
+ int status;
+ sigset_t old_mask;
+
+ status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask);
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+
+ if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t)))
+ return 1;
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Enable
+ */
+
+void _CPU_ISR_Enable(
+ unsigned32 level
+)
+{
+ int status;
+
+ if (level == 0)
+ status = sigprocmask(SIG_UNBLOCK, &_CPU_Signal_mask, 0);
+ else
+ status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, 0);
+
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Handler
+ *
+ * External interrupt handler.
+ * This is installed as a UNIX signal handler.
+ * It vectors out to specific user interrupt handlers.
+ */
+
+void _CPU_ISR_Handler(int vector)
+{
+ extern void _Thread_Dispatch(void);
+ extern unsigned32 _Thread_Dispatch_disable_level;
+ extern boolean _Context_Switch_necessary;
+
+ if (_ISR_Nest_level++ == 0) {
+ /* switch to interrupt stack */
+ }
+
+ _Thread_Dispatch_disable_level++;
+
+ if (_ISR_Vector_table[vector]) {
+ _ISR_Vector_table[vector](vector);
+ } else {
+ _CPU_Stray_signal(vector);
+ }
+
+ if (_ISR_Nest_level-- == 0) {
+ /* switch back to original stack */
+ }
+
+ _Thread_Dispatch_disable_level--;
+
+ if (_Thread_Dispatch_disable_level == 0 &&
+ (_Context_Switch_necessary || _ISR_Signals_to_thread_executing)) {
+ _ISR_Signals_to_thread_executing = FALSE;
+ _CPU_ISR_Enable(0);
+ _Thread_Dispatch();
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_Stray_signal
+ */
+
+void _CPU_Stray_signal(int sig_num)
+{
+ char buffer[ 4 ];
+
+ /*
+ * print "stray" msg about ones which that might mean something
+ * Avoid using the stdio section of the library.
+ * The following is generally safe.
+ */
+
+ switch (sig_num)
+ {
+ case SIGCLD:
+ break;
+
+ default:
+ {
+ /*
+ * We avoid using the stdio section of the library.
+ * The following is generally safe
+ */
+
+ int digit;
+ int number = sig_num;
+ int len = 0;
+
+ digit = number / 100;
+ number %= 100;
+ if (digit) buffer[len++] = '0' + digit;
+
+ digit = number / 10;
+ number %= 10;
+ if (digit || len) buffer[len++] = '0' + digit;
+
+ digit = number;
+ buffer[len++] = '0' + digit;
+
+ buffer[ len++ ] = '\n';
+
+ write( 2, "Stray signal ", 13 );
+ write( 2, buffer, len );
+
+ }
+ }
+
+ /*
+ * If it was a "fatal" signal, then exit here
+ * If app code has installed a hander for one of these, then
+ * we won't call _CPU_Stray_signal, so this is ok.
+ */
+
+ switch (sig_num) {
+ case SIGINT:
+ case SIGHUP:
+ case SIGQUIT:
+ case SIGILL:
+#ifdef SIGEMT
+ case SIGEMT:
+#endif
+ case SIGKILL:
+ case SIGBUS:
+ case SIGSEGV:
+ case SIGTERM:
+ _CPU_Fatal_error(0x100 + sig_num);
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_Fatal_error
+ */
+
+void _CPU_Fatal_error(unsigned32 error)
+{
+ setitimer(ITIMER_REAL, 0, 0);
+
+ if ( error ) {
+#ifdef RTEMS_DEBUG
+ abort();
+#endif
+ if (getenv("RTEMS_DEBUG"))
+ abort();
+ }
+
+ _exit(error);
+}
+
+/*
+ * Special Purpose Routines to hide the use of UNIX system calls.
+ */
+
+int _CPU_Get_clock_vector( void )
+{
+ return SIGALRM;
+}
+
+void _CPU_Start_clock(
+ int microseconds
+)
+{
+ struct itimerval new;
+
+ new.it_value.tv_sec = 0;
+ new.it_value.tv_usec = microseconds;
+ new.it_interval.tv_sec = 0;
+ new.it_interval.tv_usec = microseconds;
+
+ setitimer(ITIMER_REAL, &new, 0);
+}
+
+void _CPU_Stop_clock( void )
+{
+ struct itimerval new;
+ struct sigaction act;
+
+ /*
+ * Set the SIGALRM signal to ignore any last
+ * signals that might come in while we are
+ * disarming the timer and removing the interrupt
+ * vector.
+ */
+
+ (void) memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_IGN;
+
+ sigaction(SIGALRM, &act, 0);
+
+ (void) memset(&new, 0, sizeof(new));
+ setitimer(ITIMER_REAL, &new, 0);
+}
+
+int _CPU_SHM_Semid;
+extern void fix_syscall_errno( void );
+
+void _CPU_SHM_Init(
+ unsigned32 maximum_nodes,
+ boolean is_master_node,
+ void **shm_address,
+ unsigned32 *shm_length
+)
+{
+ int i;
+ int shmid;
+ char *shm_addr;
+ key_t shm_key;
+ key_t sem_key;
+ int status;
+ int shm_size;
+
+ if (getenv("RTEMS_SHM_KEY"))
+ shm_key = strtol(getenv("RTEMS_SHM_KEY"), 0, 0);
+ else
+#ifdef RTEMS_SHM_KEY
+ shm_key = RTEMS_SHM_KEY;
+#else
+ shm_key = 0xa000;
+#endif
+
+ if (getenv("RTEMS_SHM_SIZE"))
+ shm_size = strtol(getenv("RTEMS_SHM_SIZE"), 0, 0);
+ else
+#ifdef RTEMS_SHM_SIZE
+ shm_size = RTEMS_SHM_SIZE;
+#else
+ shm_size = 64 * 1024;
+#endif
+
+ if (getenv("RTEMS_SHM_SEMAPHORE_KEY"))
+ sem_key = strtol(getenv("RTEMS_SHM_SEMAPHORE_KEY"), 0, 0);
+ else
+#ifdef RTEMS_SHM_SEMAPHORE_KEY
+ sem_key = RTEMS_SHM_SEMAPHORE_KEY;
+#else
+ sem_key = 0xa001;
+#endif
+
+ shmid = shmget(shm_key, shm_size, IPC_CREAT | 0660);
+ if ( shmid == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "shmget" );
+ _CPU_Fatal_halt( 0xdead0001 );
+ }
+
+ shm_addr = shmat(shmid, (char *)0, SHM_RND);
+ if ( shm_addr == (void *)-1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "shmat" );
+ _CPU_Fatal_halt( 0xdead0002 );
+ }
+
+ _CPU_SHM_Semid = semget(sem_key, maximum_nodes + 1, IPC_CREAT | 0660);
+ if ( _CPU_SHM_Semid == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "semget" );
+ _CPU_Fatal_halt( 0xdead0003 );
+ }
+
+ if ( is_master_node ) {
+ for ( i=0 ; i <= maximum_nodes ; i++ ) {
+#if defined(solaris2)
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ ushort *array;
+ } help;
+
+ help.val = 1;
+ status = semctl( _CPU_SHM_Semid, i, SETVAL, help );
+#endif
+#if defined(hpux)
+ status = semctl( _CPU_SHM_Semid, i, SETVAL, 1 );
+#endif
+
+ fix_syscall_errno(); /* in case of newlib */
+ if ( status == -1 ) {
+ _CPU_Fatal_halt( 0xdead0004 );
+ }
+ }
+ }
+
+ *shm_address = shm_addr;
+ *shm_length = shm_size;
+
+}
+
+int _CPU_Get_pid( void )
+{
+ return getpid();
+}
+
+/*
+ * Define this to use signals for MPCI shared memory driver.
+ * If undefined, the shared memory driver will poll from the
+ * clock interrupt.
+ * Ref: ../shmsupp/getcfg.c
+ *
+ * BEWARE:: many UN*X kernels and debuggers become severely confused when
+ * debugging programs which use signals. The problem is *much*
+ * worse when using multiple signals, since ptrace(2) tends to
+ * drop all signals except 1 in the case of multiples.
+ * On hpux9, this problem was so bad, we couldn't use interrupts
+ * with the shared memory driver if we ever hoped to debug
+ * RTEMS programs.
+ * Maybe systems that use /proc don't have this problem...
+ */
+
+
+int _CPU_SHM_Get_vector( void )
+{
+#ifdef CPU_USE_SHM_INTERRUPTS
+ return SIGUSR1;
+#else
+ return 0;
+#endif
+}
+
+void _CPU_SHM_Send_interrupt(
+ int pid,
+ int vector
+)
+{
+ kill((pid_t) pid, vector);
+}
+
+void _CPU_SHM_Lock(
+ int semaphore
+)
+{
+ struct sembuf sb;
+ int status;
+
+ sb.sem_num = semaphore;
+ sb.sem_op = -1;
+ sb.sem_flg = 0;
+
+ while (1) {
+ status = semop(_CPU_SHM_Semid, &sb, 1);
+ if ( status >= 0 )
+ break;
+ if ( status == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ if (errno == EINTR)
+ continue;
+ perror("shm lock");
+ _CPU_Fatal_halt( 0xdead0005 );
+ }
+ }
+
+}
+
+void _CPU_SHM_Unlock(
+ int semaphore
+)
+{
+ struct sembuf sb;
+ int status;
+
+ sb.sem_num = semaphore;
+ sb.sem_op = 1;
+ sb.sem_flg = 0;
+
+ while (1) {
+ status = semop(_CPU_SHM_Semid, &sb, 1);
+ if ( status >= 0 )
+ break;
+
+ if ( status == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ if (errno == EINTR)
+ continue;
+ perror("shm unlock");
+ _CPU_Fatal_halt( 0xdead0006 );
+ }
+ }
+
+}
diff --git a/c/src/exec/score/cpu/unix/cpu.h b/c/src/exec/score/cpu/unix/cpu.h
new file mode 100644
index 0000000000..e813a92364
--- /dev/null
+++ b/c/src/exec/score/cpu/unix/cpu.h
@@ -0,0 +1,1024 @@
+/* cpu.h
+ *
+ * This include file contains information pertaining to the HP
+ * PA-RISC processor (Level 1.1).
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#ifndef __CPU_h
+#define __CPU_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/unix.h>
+#ifndef ASM
+#include <rtems/score/unixtypes.h>
+#endif
+
+#include <rtems/score/unixsize.h>
+
+#if defined(solaris2)
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#define __STRICT_ANSI__
+#endif
+
+#if defined(linux)
+#define MALLOC_0_RETURNS_NULL
+#endif
+
+/* conditional compilation parameters */
+
+/*
+ * Should the calls to _Thread_Enable_dispatch be inlined?
+ *
+ * If TRUE, then they are inlined.
+ * If FALSE, then a subroutine call is made.
+ *
+ * Basically this is an example of the classic trade-off of size
+ * versus speed. Inlining the call (TRUE) typically increases the
+ * size of RTEMS while speeding up the enabling of dispatching.
+ * [NOTE: In general, the _Thread_Dispatch_disable_level will
+ * only be 0 or 1 unless you are in an interrupt handler and that
+ * interrupt handler invokes the executive.] When not inlined
+ * something calls _Thread_Enable_dispatch which in turns calls
+ * _Thread_Dispatch. If the enable dispatch is inlined, then
+ * one subroutine call is avoided entirely.]
+ */
+
+#define CPU_INLINE_ENABLE_DISPATCH FALSE
+
+/*
+ * Should the body of the search loops in _Thread_queue_Enqueue_priority
+ * be unrolled one time? In unrolled each iteration of the loop examines
+ * two "nodes" on the chain being searched. Otherwise, only one node
+ * is examined per iteration.
+ *
+ * If TRUE, then the loops are unrolled.
+ * If FALSE, then the loops are not unrolled.
+ *
+ * The primary factor in making this decision is the cost of disabling
+ * and enabling interrupts (_ISR_Flash) versus the cost of rest of the
+ * body of the loop. On some CPUs, the flash is more expensive than
+ * one iteration of the loop body. In this case, it might be desirable
+ * to unroll the loop. It is important to note that on some CPUs, this
+ * code is the longest interrupt disable period in RTEMS. So it is
+ * necessary to strike a balance when setting this parameter.
+ */
+
+#define CPU_UNROLL_ENQUEUE_PRIORITY TRUE
+
+/*
+ * Does RTEMS manage a dedicated interrupt stack in software?
+ *
+ * If TRUE, then a stack is allocated in _Interrupt_Manager_initialization.
+ * If FALSE, nothing is done.
+ *
+ * If the CPU supports a dedicated interrupt stack in hardware,
+ * then it is generally the responsibility of the BSP to allocate it
+ * and set it up.
+ *
+ * If the CPU does not support a dedicated interrupt stack, then
+ * the porter has two options: (1) execute interrupts on the
+ * stack of the interrupted task, and (2) have RTEMS manage a dedicated
+ * interrupt stack.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+#define CPU_HAS_SOFTWARE_INTERRUPT_STACK FALSE
+
+/*
+ * Does this CPU have hardware support for a dedicated interrupt stack?
+ *
+ * If TRUE, then it must be installed during initialization.
+ * If FALSE, then no installation is performed.
+ *
+ * If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
+ *
+ * Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
+ * CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE. It is
+ * possible that both are FALSE for a particular CPU. Although it
+ * is unclear what that would imply about the interrupt processing
+ * procedure on that CPU.
+ */
+
+#define CPU_HAS_HARDWARE_INTERRUPT_STACK TRUE
+
+/*
+ * Does RTEMS allocate a dedicated interrupt stack in the Interrupt Manager?
+ *
+ * If TRUE, then the memory is allocated during initialization.
+ * If FALSE, then the memory is allocated during initialization.
+ *
+ * This should be TRUE if CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE
+ * or CPU_INSTALL_HARDWARE_INTERRUPT_STACK is TRUE.
+ */
+
+#define CPU_ALLOCATE_INTERRUPT_STACK FALSE
+
+/*
+ * Does the CPU have hardware floating point?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is supported.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is ignored.
+ *
+ * If there is a FP coprocessor such as the i387 or mc68881, then
+ * the answer is TRUE.
+ *
+ * The macro name "NO_CPU_HAS_FPU" should be made CPU specific.
+ * It indicates whether or not this CPU model has FP support. For
+ * example, it would be possible to have an i386_nofp CPU model
+ * which set this to false to indicate that you have an i386 without
+ * an i387 and wish to leave floating point support out of RTEMS.
+ */
+
+#define CPU_HARDWARE_FP TRUE
+
+/*
+ * Are all tasks RTEMS_FLOATING_POINT tasks implicitly?
+ *
+ * If TRUE, then the RTEMS_FLOATING_POINT task attribute is assumed.
+ * If FALSE, then the RTEMS_FLOATING_POINT task attribute is followed.
+ *
+ * So far, the only CPU in which this option has been used is the
+ * HP PA-RISC. The HP C compiler and gcc both implicitly use the
+ * floating point registers to perform integer multiplies. If
+ * a function which you would not think utilize the FP unit DOES,
+ * then one can not easily predict which tasks will use the FP hardware.
+ * In this case, this option should be TRUE.
+ *
+ * If CPU_HARDWARE_FP is FALSE, then this should be FALSE as well.
+ */
+
+#define CPU_ALL_TASKS_ARE_FP FALSE
+
+/*
+ * Should the IDLE task have a floating point context?
+ *
+ * If TRUE, then the IDLE task is created as a RTEMS_FLOATING_POINT task
+ * and it has a floating point context which is switched in and out.
+ * If FALSE, then the IDLE task does not have a floating point context.
+ *
+ * Setting this to TRUE negatively impacts the time required to preempt
+ * the IDLE task from an interrupt because the floating point context
+ * must be saved as part of the preemption.
+ */
+
+#define CPU_IDLE_TASK_IS_FP FALSE
+
+/*
+ * Should the saving of the floating point registers be deferred
+ * until a context switch is made to another different floating point
+ * task?
+ *
+ * If TRUE, then the floating point context will not be stored until
+ * necessary. It will remain in the floating point registers and not
+ * disturned until another floating point task is switched to.
+ *
+ * If FALSE, then the floating point context is saved when a floating
+ * point task is switched out and restored when the next floating point
+ * task is restored. The state of the floating point registers between
+ * those two operations is not specified.
+ *
+ * If the floating point context does NOT have to be saved as part of
+ * interrupt dispatching, then it should be safe to set this to TRUE.
+ *
+ * Setting this flag to TRUE results in using a different algorithm
+ * for deciding when to save and restore the floating point context.
+ * The deferred FP switch algorithm minimizes the number of times
+ * the FP context is saved and restored. The FP context is not saved
+ * until a context switch is made to another, different FP task.
+ * Thus in a system with only one FP task, the FP context will never
+ * be saved or restored.
+ */
+
+#define CPU_USE_DEFERRED_FP_SWITCH TRUE
+
+/*
+ * Does this port provide a CPU dependent IDLE task implementation?
+ *
+ * If TRUE, then the routine _CPU_Thread_Idle_body
+ * must be provided and is the default IDLE thread body instead of
+ * _CPU_Thread_Idle_body.
+ *
+ * If FALSE, then use the generic IDLE thread body if the BSP does
+ * not provide one.
+ *
+ * This is intended to allow for supporting processors which have
+ * a low power or idle mode. When the IDLE thread is executed, then
+ * the CPU can be powered down.
+ *
+ * The order of precedence for selecting the IDLE thread body is:
+ *
+ * 1. BSP provided
+ * 2. CPU dependent (if provided)
+ * 3. generic (if no BSP and no CPU dependent)
+ */
+
+#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
+
+/*
+ * Does the stack grow up (toward higher addresses) or down
+ * (toward lower addresses)?
+ *
+ * If TRUE, then the grows upward.
+ * If FALSE, then the grows toward smaller addresses.
+ */
+
+#if defined(hppa1_1)
+#define CPU_STACK_GROWS_UP TRUE
+#elif defined(sparc) || defined(i386)
+#define CPU_STACK_GROWS_UP FALSE
+#else
+#error "unknown CPU!!"
+#endif
+
+
+/*
+ * The following is the variable attribute used to force alignment
+ * of critical RTEMS structures. On some processors it may make
+ * sense to have these aligned on tighter boundaries than
+ * the minimum requirements of the compiler in order to have as
+ * much of the critical data area as possible in a cache line.
+ *
+ * The placement of this macro in the declaration of the variables
+ * is based on the syntactically requirements of the GNU C
+ * "__attribute__" extension. For example with GNU C, use
+ * the following to force a structures to a 32 byte boundary.
+ *
+ * __attribute__ ((aligned (32)))
+ *
+ * NOTE: Currently only the Priority Bit Map table uses this feature.
+ * To benefit from using this, the data must be heavily
+ * used so it will stay in the cache and used frequently enough
+ * in the executive to justify turning this on.
+ */
+
+#ifdef __GNUC__
+#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32)))
+#else
+#define CPU_STRUCTURE_ALIGNMENT
+#endif
+
+/*
+ * The following defines the number of bits actually used in the
+ * interrupt field of the task mode. How those bits map to the
+ * CPU interrupt levels is defined by the routine _CPU_ISR_Set_level().
+ */
+
+#define CPU_MODES_INTERRUPT_MASK 0x00000001
+
+#define CPU_NAME "UNIX"
+
+/*
+ * Processor defined structures
+ *
+ * Examples structures include the descriptor tables from the i386
+ * and the processor control structure on the i960ca.
+ */
+
+/* may need to put some structures here. */
+
+#if defined(hppa1_1)
+/*
+ * Word indices within a jmp_buf structure
+ */
+
+#ifdef RTEMS_NEWLIB_SETJMP
+#define RP_OFF 6
+#define SP_OFF 2
+#define R3_OFF 10
+#define R4_OFF 11
+#define R5_OFF 12
+#define R6_OFF 13
+#define R7_OFF 14
+#define R8_OFF 15
+#define R9_OFF 16
+#define R10_OFF 17
+#define R11_OFF 18
+#define R12_OFF 19
+#define R13_OFF 20
+#define R14_OFF 21
+#define R15_OFF 22
+#define R16_OFF 23
+#define R17_OFF 24
+#define R18_OFF 25
+#define DP_OFF 26
+#endif
+
+#ifdef RTEMS_UNIXLIB_SETJMP
+#define RP_OFF 0
+#define SP_OFF 1
+#define R3_OFF 4
+#define R4_OFF 5
+#define R5_OFF 6
+#define R6_OFF 7
+#define R7_OFF 8
+#define R8_OFF 9
+#define R9_OFF 10
+#define R10_OFF 11
+#define R11_OFF 12
+#define R12_OFF 13
+#define R13_OFF 14
+#define R14_OFF 15
+#define R15_OFF 16
+#define R16_OFF 17
+#define R17_OFF 18
+#define R18_OFF 19
+#define DP_OFF 20
+#endif
+#endif
+
+#if defined(i386)
+
+#ifdef RTEMS_NEWLIB
+#error "Newlib not installed"
+#endif
+
+/*
+ * For Linux 1.1
+ */
+
+#ifdef RTEMS_UNIXLIB
+#define EBX_OFF 0
+#define ESI_OFF 1
+#define EDI_OFF 2
+#define EBP_OFF 3
+#define ESP_OFF 4
+#define RET_OFF 5
+#endif
+
+#endif
+
+#if defined(sparc)
+
+/*
+ * Word indices within a jmp_buf structure
+ */
+
+#ifdef RTEMS_NEWLIB
+#define ADDR_ADJ_OFFSET -8
+#define SP_OFF 0
+#define RP_OFF 1
+#define FP_OFF 2
+#endif
+
+#ifdef RTEMS_UNIXLIB
+#define ADDR_ADJ_OFFSET 0
+#define G0_OFF 0
+#define SP_OFF 1
+#define RP_OFF 2
+#define FP_OFF 3
+#define I7_OFF 4
+#endif
+
+#endif
+
+/*
+ * Contexts
+ *
+ * Generally there are 2 types of context to save.
+ * 1. Interrupt registers to save
+ * 2. Task level registers to save
+ *
+ * This means we have the following 3 context items:
+ * 1. task level context stuff:: Context_Control
+ * 2. floating point task stuff:: Context_Control_fp
+ * 3. special interrupt level context :: Context_Control_interrupt
+ *
+ * On some processors, it is cost-effective to save only the callee
+ * preserved registers during a task context switch. This means
+ * that the ISR code needs to save those registers which do not
+ * persist across function calls. It is not mandatory to make this
+ * distinctions between the caller/callee saves registers for the
+ * purpose of minimizing context saved during task switch and on interrupts.
+ * If the cost of saving extra registers is minimal, simplicity is the
+ * choice. Save the same context on interrupt entry as for tasks in
+ * this case.
+ *
+ * Additionally, if gdb is to be made aware of RTEMS tasks for this CPU, then
+ * care should be used in designing the context area.
+ *
+ * On some CPUs with hardware floating point support, the Context_Control_fp
+ * structure will not be used or it simply consist of an array of a
+ * fixed number of bytes. This is done when the floating point context
+ * is dumped by a "FP save context" type instruction and the format
+ * is not really defined by the CPU. In this case, there is no need
+ * to figure out the exact format -- only the size. Of course, although
+ * this is enough information for RTEMS, it is probably not enough for
+ * a debugger such as gdb. But that is another problem.
+ */
+
+/*
+ * This is really just the area for the following fields.
+ *
+ * jmp_buf regs;
+ * sigset_t isr_level;
+ *
+ * Doing it this way avoids conflicts between the native stuff and the
+ * RTEMS stuff.
+ *
+ * NOTE:
+ * hpux9 setjmp is optimized for the case where the setjmp buffer
+ * is 8 byte aligned. In a RISC world, this seems likely to enable
+ * 8 byte copies, especially for the float registers.
+ * So we always align them on 8 byte boundaries.
+ */
+
+#ifdef __GNUC__
+#define CONTEXT_STRUCTURE_ALIGNMENT __attribute__ ((aligned (8)))
+#else
+#define CONTEXT_STRUCTURE_ALIGNMENT
+#endif
+
+typedef struct {
+ char Area[ CPU_CONTEXT_SIZE_IN_BYTES ] CONTEXT_STRUCTURE_ALIGNMENT;
+} Context_Control;
+
+typedef struct {
+} Context_Control_fp;
+
+typedef struct {
+} CPU_Interrupt_frame;
+
+
+/*
+ * The following table contains the information required to configure
+ * the UNIX Simulator specific parameters.
+ */
+
+typedef struct {
+ void (*pretasking_hook)( void );
+ void (*predriver_hook)( void );
+ void (*postdriver_hook)( void );
+ void (*idle_task)( void );
+ boolean do_zero_of_workspace;
+ unsigned32 interrupt_stack_size;
+ unsigned32 extra_mpci_receive_server_stack;
+ void * (*stack_allocate_hook)( unsigned32 );
+ void (*stack_free_hook)( void* );
+ /* end of required fields */
+} rtems_cpu_table;
+
+/*
+ * This variable is optional. It is used on CPUs on which it is difficult
+ * to generate an "uninitialized" FP context. It is filled in by
+ * _CPU_Initialize and copied into the task's FP context area during
+ * _CPU_Context_Initialize.
+ */
+
+EXTERN Context_Control_fp _CPU_Null_fp_context;
+
+/*
+ * On some CPUs, RTEMS supports a software managed interrupt stack.
+ * This stack is allocated by the Interrupt Manager and the switch
+ * is performed in _ISR_Handler. These variables contain pointers
+ * to the lowest and highest addresses in the chunk of memory allocated
+ * for the interrupt stack. Since it is unknown whether the stack
+ * grows up or down (in general), this give the CPU dependent
+ * code the option of picking the version it wants to use.
+ *
+ * NOTE: These two variables are required if the macro
+ * CPU_HAS_SOFTWARE_INTERRUPT_STACK is defined as TRUE.
+ */
+
+EXTERN void *_CPU_Interrupt_stack_low;
+EXTERN void *_CPU_Interrupt_stack_high;
+
+/*
+ * With some compilation systems, it is difficult if not impossible to
+ * call a high-level language routine from assembly language. This
+ * is especially true of commercial Ada compilers and name mangling
+ * C++ ones. This variable can be optionally defined by the CPU porter
+ * and contains the address of the routine _Thread_Dispatch. This
+ * can make it easier to invoke that routine at the end of the interrupt
+ * sequence (if a dispatch is necessary).
+ */
+
+EXTERN void (*_CPU_Thread_dispatch_pointer)();
+
+/*
+ * Nothing prevents the porter from declaring more CPU specific variables.
+ */
+
+/* XXX: if needed, put more variables here */
+
+/*
+ * The size of the floating point context area. On some CPUs this
+ * will not be a "sizeof" because the format of the floating point
+ * area is not defined -- only the size is. This is usually on
+ * CPUs with a "floating point save context" instruction.
+ */
+
+#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
+
+/*
+ * The size of a frame on the stack
+ */
+
+#if defined(hppa1_1)
+#define CPU_FRAME_SIZE (32 * 4)
+#elif defined(sparc)
+#define CPU_FRAME_SIZE (112) /* based on disassembled test code */
+#elif defined(i386)
+#define CPU_FRAME_SIZE (24) /* return address, sp, and bp pushed plus fudge */
+#else
+#error "Unknown CPU!!!"
+#endif
+
+/*
+ * Amount of extra stack (above minimum stack size) required by
+ * MPCI receive server thread. Remember that in a multiprocessor
+ * system this thread must exist and be able to process all directives.
+ */
+
+#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
+
+/*
+ * This defines the number of entries in the ISR_Vector_table managed
+ * by RTEMS.
+ */
+
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 64
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+
+/*
+ * Should be large enough to run all RTEMS tests. This insures
+ * that a "reasonable" small application should not have any problems.
+ */
+
+#define CPU_STACK_MINIMUM_SIZE (16 * 1024)
+
+/*
+ * CPU's worst alignment requirement for data types on a byte boundary. This
+ * alignment does not take into account the requirements for the stack.
+ */
+
+#define CPU_ALIGNMENT 8
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * heap handler. This alignment requirement may be stricter than that
+ * for the data types alignment specified by CPU_ALIGNMENT. It is
+ * common for the heap to follow the same alignment requirement as
+ * CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict enough for the heap,
+ * then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for memory
+ * buffers allocated by the partition manager. This alignment requirement
+ * may be stricter than that for the data types alignment specified by
+ * CPU_ALIGNMENT. It is common for the partition to follow the same
+ * alignment requirement as CPU_ALIGNMENT. If the CPU_ALIGNMENT is strict
+ * enough for the partition, then this should be set to CPU_ALIGNMENT.
+ *
+ * NOTE: This does not have to be a power of 2. It does have to
+ * be greater or equal to than CPU_ALIGNMENT.
+ */
+
+#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
+
+/*
+ * This number corresponds to the byte alignment requirement for the
+ * stack. This alignment requirement may be stricter than that for the
+ * data types alignment specified by CPU_ALIGNMENT. If the CPU_ALIGNMENT
+ * is strict enough for the stack, then this should be set to 0.
+ *
+ * NOTE: This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
+ */
+
+#define CPU_STACK_ALIGNMENT 64
+
+/* ISR handler macros */
+
+/*
+ * Disable all interrupts for an RTEMS critical section. The previous
+ * level is returned in _level.
+ */
+
+extern unsigned32 _CPU_ISR_Disable_support(void);
+
+#define _CPU_ISR_Disable( _level ) \
+ do { \
+ (_level) = _CPU_ISR_Disable_support(); \
+ } while ( 0 )
+
+/*
+ * Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
+ * This indicates the end of an RTEMS critical section. The parameter
+ * _level is not modified.
+ */
+
+void _CPU_ISR_Enable(unsigned32 level);
+
+/*
+ * This temporarily restores the interrupt to _level before immediately
+ * disabling them again. This is used to divide long RTEMS critical
+ * sections into two or more parts. The parameter _level is not
+ * modified.
+ */
+
+#define _CPU_ISR_Flash( _level ) \
+ do { \
+ register _ignored = 0; \
+ _CPU_ISR_Enable( (_level) ); \
+ _CPU_ISR_Disable( _ignored ); \
+ } while ( 0 )
+
+/*
+ * Map interrupt level in task mode onto the hardware that the CPU
+ * actually provides. Currently, interrupt levels which do not
+ * map onto the CPU in a generic fashion are undefined. Someday,
+ * it would be nice if these were "mapped" by the application
+ * via a callout. For example, m68k has 8 levels 0 - 7, levels
+ * 8 - 255 would be available for bsp/application specific meaning.
+ * This could be used to manage a programmable interrupt controller
+ * via the rtems_task_mode directive.
+ */
+
+#define _CPU_ISR_Set_level( new_level ) \
+ { \
+ if ( new_level == 0 ) _CPU_ISR_Enable( 0 ); \
+ else _CPU_ISR_Enable( 1 ); \
+ }
+
+unsigned32 _CPU_ISR_Get_level( void );
+
+/* end of ISR handler macros */
+
+/* Context handler macros */
+
+/*
+ * This routine is responsible for somehow restarting the currently
+ * executing task. If you are lucky, then all that is necessary
+ * is restoring the context. Otherwise, there will need to be
+ * a special assembly routine which does something special in this
+ * case. Context_Restore should work most of the time. It will
+ * not work if restarting self conflicts with the stack frame
+ * assumptions of restoring a context.
+ */
+
+#define _CPU_Context_Restart_self( _the_context ) \
+ _CPU_Context_restore( (_the_context) );
+
+/*
+ * The purpose of this macro is to allow the initial pointer into
+ * a floating point context area (used to save the floating point
+ * context) to be at an arbitrary place in the floating point
+ * context area.
+ *
+ * This is necessary because some FP units are designed to have
+ * their context saved as a stack which grows into lower addresses.
+ * Other FP units can be saved by simply moving registers into offsets
+ * from the base of the context area. Finally some FP units provide
+ * a "dump context" instruction which could fill in from high to low
+ * or low to high based on the whim of the CPU designers.
+ */
+
+#define _CPU_Context_Fp_start( _base, _offset ) \
+ ( (void *) (_base) + (_offset) )
+
+/*
+ * This routine initializes the FP context area passed to it to.
+ * There are a few standard ways in which to initialize the
+ * floating point context. The code included for this macro assumes
+ * that this is a CPU in which a "initial" FP context was saved into
+ * _CPU_Null_fp_context and it simply copies it to the destination
+ * context passed to it.
+ *
+ * Other models include (1) not doing anything, and (2) putting
+ * a "null FP status word" in the correct place in the FP context.
+ */
+
+#define _CPU_Context_Initialize_fp( _destination ) \
+ { \
+ *((Context_Control_fp *) *((void **) _destination)) = _CPU_Null_fp_context; \
+ }
+
+#define _CPU_Context_save_fp( _fp_context ) \
+ _CPU_Save_float_context( *(Context_Control_fp **)(_fp_context))
+
+#define _CPU_Context_restore_fp( _fp_context ) \
+ _CPU_Restore_float_context( *(Context_Control_fp **)(_fp_context))
+
+extern void _CPU_Context_Initialize(
+ Context_Control *_the_context,
+ unsigned32 *_stack_base,
+ unsigned32 _size,
+ unsigned32 _new_level,
+ void *_entry_point,
+ boolean _is_fp
+);
+
+/* end of Context handler macros */
+
+/* Fatal Error manager macros */
+
+/*
+ * This routine copies _error into a known place -- typically a stack
+ * location or a register, optionally disables interrupts, and
+ * halts/stops the CPU.
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ _CPU_Fatal_error( _error )
+
+/* end of Fatal Error manager macros */
+
+/* Bitfield handler macros */
+
+/*
+ * This routine sets _output to the bit number of the first bit
+ * set in _value. _value is of CPU dependent type Priority_Bit_map_control.
+ * This type may be either 16 or 32 bits wide although only the 16
+ * least significant bits will be used.
+ *
+ * There are a number of variables in using a "find first bit" type
+ * instruction.
+ *
+ * (1) What happens when run on a value of zero?
+ * (2) Bits may be numbered from MSB to LSB or vice-versa.
+ * (3) The numbering may be zero or one based.
+ * (4) The "find first bit" instruction may search from MSB or LSB.
+ *
+ * RTEMS guarantees that (1) will never happen so it is not a concern.
+ * (2),(3), (4) are handled by the macros _CPU_Priority_mask() and
+ * _CPU_Priority_bits_index(). These three form a set of routines
+ * which must logically operate together. Bits in the _value are
+ * set and cleared based on masks built by _CPU_Priority_mask().
+ * The basic major and minor values calculated by _Priority_Major()
+ * and _Priority_Minor() are "massaged" by _CPU_Priority_bits_index()
+ * to properly range between the values returned by the "find first bit"
+ * instruction. This makes it possible for _Priority_Get_highest() to
+ * calculate the major and directly index into the minor table.
+ * This mapping is necessary to ensure that 0 (a high priority major/minor)
+ * is the first bit found.
+ *
+ * This entire "find first bit" and mapping process depends heavily
+ * on the manner in which a priority is broken into a major and minor
+ * components with the major being the 4 MSB of a priority and minor
+ * the 4 LSB. Thus (0 << 4) + 0 corresponds to priority 0 -- the highest
+ * priority. And (15 << 4) + 14 corresponds to priority 254 -- the next
+ * to the lowest priority.
+ *
+ * If your CPU does not have a "find first bit" instruction, then
+ * there are ways to make do without it. Here are a handful of ways
+ * to implement this in software:
+ *
+ * - a series of 16 bit test instructions
+ * - a "binary search using if's"
+ * - _number = 0
+ * if _value > 0x00ff
+ * _value >>=8
+ * _number = 8;
+ *
+ * if _value > 0x0000f
+ * _value >=8
+ * _number += 4
+ *
+ * _number += bit_set_table[ _value ]
+ *
+ * where bit_set_table[ 16 ] has values which indicate the first
+ * bit set
+ */
+
+/*
+ * The UNIX port uses the generic C algorithm for bitfield scan to avoid
+ * dependencies on either a native bitscan instruction or an ffs() in the
+ * C library.
+ */
+
+#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
+#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
+
+/* end of Bitfield handler macros */
+
+/* Priority handler handler macros */
+
+/*
+ * The UNIX port uses the generic C algorithm for bitfield scan to avoid
+ * dependencies on either a native bitscan instruction or an ffs() in the
+ * C library.
+ */
+
+/* end of Priority handler macros */
+
+/* functions */
+
+/*
+ * _CPU_Initialize
+ *
+ * This routine performs CPU dependent initialization.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch)
+);
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs a "raw" interrupt handler directly into the
+ * processor's vector table.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This routine installs an interrupt vector.
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+);
+
+/*
+ * _CPU_Install_interrupt_stack
+ *
+ * This routine installs the hardware interrupt stack pointer.
+ *
+ * NOTE: It need only be provided if CPU_HAS_HARDWARE_INTERRUPT_STACK
+ * is TRUE.
+ */
+
+void _CPU_Install_interrupt_stack( void );
+
+/*
+ * _CPU_Thread_Idle_body
+ *
+ * This routine is the CPU dependent IDLE thread body.
+ *
+ * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
+ * is TRUE.
+ */
+
+void _CPU_Thread_Idle_body( void );
+
+/*
+ * _CPU_Context_switch
+ *
+ * This routine switches from the run context to the heir context.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+);
+
+/*
+ * _CPU_Save_float_context
+ *
+ * This routine saves the floating point context passed to it.
+ */
+
+void _CPU_Save_float_context(
+ Context_Control_fp *fp_context_ptr
+);
+
+/*
+ * _CPU_Restore_float_context
+ *
+ * This routine restores the floating point context passed to it.
+ */
+
+void _CPU_Restore_float_context(
+ Context_Control_fp *fp_context_ptr
+);
+
+
+void _CPU_ISR_Set_signal_level(
+ unsigned32 level
+);
+
+void _CPU_Fatal_error(
+ unsigned32 _error
+);
+
+/* The following routine swaps the endian format of an unsigned int.
+ * It must be static because it is referenced indirectly.
+ *
+ * This version will work on any processor, but if there is a better
+ * way for your CPU PLEASE use it. The most common way to do this is to:
+ *
+ * swap least significant two bytes with 16-bit rotate
+ * swap upper and lower 16-bits
+ * swap most significant two bytes with 16-bit rotate
+ *
+ * Some CPUs have special instructions which swap a 32-bit quantity in
+ * a single instruction (e.g. i486). It is probably best to avoid
+ * an "endian swapping control bit" in the CPU. One good reason is
+ * that interrupts would probably have to be disabled to insure that
+ * an interrupt does not try to access the same "chunk" with the wrong
+ * endian. Another good reason is that on some CPUs, the endian bit
+ * endianness for ALL fetches -- both code and data -- so the code
+ * will be fetched incorrectly.
+ */
+
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+)
+{
+ unsigned32 byte1, byte2, byte3, byte4, swapped;
+
+ byte4 = (value >> 24) & 0xff;
+ byte3 = (value >> 16) & 0xff;
+ byte2 = (value >> 8) & 0xff;
+ byte1 = value & 0xff;
+
+ swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
+ return( swapped );
+}
+
+/*
+ * Special Purpose Routines to hide the use of UNIX system calls.
+ */
+
+int _CPU_Get_clock_vector( void );
+
+void _CPU_Start_clock(
+ int microseconds
+);
+
+void _CPU_Stop_clock( void );
+
+void _CPU_SHM_Init(
+ unsigned32 maximum_nodes,
+ boolean is_master_node,
+ void **shm_address,
+ unsigned32 *shm_length
+);
+
+int _CPU_Get_pid( void );
+
+int _CPU_SHM_Get_vector( void );
+
+void _CPU_SHM_Send_interrupt(
+ int pid,
+ int vector
+);
+
+void _CPU_SHM_Lock(
+ int semaphore
+);
+
+void _CPU_SHM_Unlock(
+ int semaphore
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/exec/score/cpu/unix/unix.h b/c/src/exec/score/cpu/unix/unix.h
new file mode 100644
index 0000000000..bb5011b41b
--- /dev/null
+++ b/c/src/exec/score/cpu/unix/unix.h
@@ -0,0 +1,89 @@
+/* unix.h
+ *
+ * This include file contains the definitions required by RTEMS
+ * which are typical for a modern UNIX computer using GCC.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __UNIX_h
+#define __UNIX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
+ * with the name of the appropriate macro for this target CPU.
+ */
+
+#ifdef unix
+#undef unix
+#endif
+#define unix
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_FAMILY
+#undef REPLACE_THIS_WITH_THE_CPU_FAMILY
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_FAMILY
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
+#define REPLACE_THIS_WITH_THE_BSP
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
+#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_UNIX_FLAVOR
+#undef REPLACE_THIS_WITH_THE_UNIX_FLAVOR
+#endif
+#define REPLACE_THIS_WITH_THE_UNIX_FLAVOR
+
+/*
+ * This file contains the information required to build
+ * RTEMS for a particular member of the "unix"
+ * family when executing in protected mode. It does
+ * this by setting variables to indicate which implementation
+ * dependent features are present in a particular member
+ * of the family.
+ */
+
+#if defined(hpux)
+
+#define CPU_MODEL_NAME "HP-UX"
+
+#elif defined(solaris)
+
+#define CPU_MODEL_NAME "Solaris"
+
+#elif defined(linux)
+
+#define CPU_MODEL_NAME "Linux"
+
+#else
+
+#error "Unsupported CPU Model"
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/cpu/unix/unixtypes.h b/c/src/exec/score/cpu/unix/unixtypes.h
new file mode 100644
index 0000000000..45f5cf9366
--- /dev/null
+++ b/c/src/exec/score/cpu/unix/unixtypes.h
@@ -0,0 +1,72 @@
+/* unixtypes.h
+ *
+ * This include file contains type definitions which are appropriate
+ * for a typical modern UNIX box using GNU C for the RTEMS simulator.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __UNIX_TYPES_h
+#define __UNIX_TYPES_h
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * some C++ compilers (eg: HP's) don't do 'signed' or 'volatile'
+ */
+#if defined(__cplusplus) && !defined(__GNUC__)
+#define signed
+#define volatile
+#endif
+
+/*
+ * This section defines the basic types for this processor.
+ */
+
+typedef unsigned char unsigned8; /* unsigned 8-bit integer */
+typedef unsigned short unsigned16; /* unsigned 16-bit integer */
+typedef unsigned int unsigned32; /* unsigned 32-bit integer */
+
+typedef unsigned16 Priority_Bit_map_control;
+
+typedef signed char signed8; /* 8-bit signed integer */
+typedef signed short signed16; /* 16-bit signed integer */
+typedef signed int signed32; /* 32-bit signed integer */
+
+/*
+ * some C++ compilers (eg: HP's) don't do 'long long'
+ */
+#if defined(__GNUC__)
+typedef unsigned long long unsigned64; /* unsigned 64-bit integer */
+typedef signed long long signed64; /* 64 bit signed integer */
+#endif
+
+typedef unsigned32 boolean; /* Boolean value */
+
+typedef float single_precision; /* single precision float */
+typedef double double_precision; /* double precision float */
+
+typedef void unix_isr;
+
+typedef unix_isr ( *unix_isr_entry )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !ASM */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/address.h b/c/src/exec/score/headers/address.h
new file mode 100644
index 0000000000..d9be75ee4b
--- /dev/null
+++ b/c/src/exec/score/headers/address.h
@@ -0,0 +1,31 @@
+/* address.h
+ *
+ * This include file contains the information required to manipulate
+ * physical addresses.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ADDRESSES_h
+#define __RTEMS_ADDRESSES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/apiext.h b/c/src/exec/score/headers/apiext.h
new file mode 100644
index 0000000000..44e7bc8dd3
--- /dev/null
+++ b/c/src/exec/score/headers/apiext.h
@@ -0,0 +1,102 @@
+/* apiext.h
+ *
+ * XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __API_EXTENSIONS_h
+#define __API_EXTENSIONS_h
+
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The control structure which defines the points at which an API
+ * can add an extension to the system initialization thread.
+ */
+
+typedef void (*API_extensions_Predriver_hook)(void);
+typedef void (*API_extensions_Postdriver_hook)(void);
+typedef void (*API_extensions_Postswitch_hook)(
+ Thread_Control *
+ );
+
+
+typedef struct {
+ Chain_Node Node;
+ API_extensions_Predriver_hook predriver_hook;
+ API_extensions_Postdriver_hook postdriver_hook;
+ API_extensions_Postswitch_hook postswitch_hook;
+} API_extensions_Control;
+
+/*
+ * This is the list of API extensions to the system initialization.
+ */
+
+EXTERN Chain_Control _API_extensions_List;
+
+/*
+ * _API_extensions_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the API extension handler.
+ *
+ */
+
+void _API_extensions_Initialization( void );
+
+/*
+ * _API_extensions_Add
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Add(
+ API_extensions_Control *the_extension
+);
+
+/*
+ * _API_extensions_Run_predriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_predriver( void );
+
+/*
+ * _API_extensions_Run_postdriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postdriver( void );
+
+/*
+ * _API_extensions_Run_postswitch
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postswitch( void );
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/bitfield.h b/c/src/exec/score/headers/bitfield.h
new file mode 100644
index 0000000000..6dbf1e0ba0
--- /dev/null
+++ b/c/src/exec/score/headers/bitfield.h
@@ -0,0 +1,98 @@
+/* bitfield.h
+ *
+ * This include file contains all bit field manipulation routines.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_BITFIELD_h
+#define __RTEMS_BITFIELD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Bitfield_Find_first_bit
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the bit_number of the first bit set
+ * in the specified value. The correspondence between bit_number
+ * and actual bit position is processor dependent. The search for
+ * the first bit set may run from most to least significant bit
+ * or vice-versa.
+ *
+ * NOTE:
+ *
+ * This routine is used when the executing thread is removed
+ * from the ready state and, as a result, its performance has a
+ * significant impact on the performance of the executive as a whole.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
+
+#ifndef INIT
+ extern const unsigned char __log2table[256];
+#else
+const unsigned char __log2table[256] = {
+ 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
+
+#endif
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ _CPU_Bitfield_Find_first_bit( _value, _bit_number )
+
+#else
+
+/*
+ * The following must be a macro because if a CPU specific version
+ * is used it will most likely use inline assembly.
+ */
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ { \
+ register __value = (_value); \
+ register const unsigned char *__p = __log2table; \
+ \
+ if ( __value < 0x100 ) \
+ (_bit_number) = __p[ __value ] + 8; \
+ else \
+ (_bit_number) = __p[ __value >> 8 ]; \
+ }
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/chain.h b/c/src/exec/score/headers/chain.h
new file mode 100644
index 0000000000..11c1f8aee0
--- /dev/null
+++ b/c/src/exec/score/headers/chain.h
@@ -0,0 +1,168 @@
+/* chain.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Doubly Linked Chain Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CHAIN_h
+#define __RTEMS_CHAIN_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+
+/*
+ * This is used to manage each element (node) which is placed
+ * on a chain.
+ *
+ * NOTE: Typically, a more complicated structure will use the
+ * chain package. The more complicated structure will
+ * include a chain node as the first element in its
+ * control structure. It will then call the chain package
+ * with a pointer to that node element. The node pointer
+ * and the higher level structure start at the same address
+ * so the user can cast the pointers back and forth.
+ *
+ */
+
+typedef struct Chain_Node_struct Chain_Node;
+
+struct Chain_Node_struct {
+ Chain_Node *next;
+ Chain_Node *previous;
+};
+
+/*
+ * This is used to manage a chain. A chain consists of a doubly
+ * linked list of zero or more nodes.
+ *
+ * NOTE: This implementation does not require special checks for
+ * manipulating the first and last elements on the chain.
+ * To accomplish this the chain control structure is
+ * treated as two overlapping chain nodes. The permanent
+ * head of the chain overlays a node structure on the
+ * first and permanent_null fields. The permanent tail
+ * of the chain overlays a node structure on the
+ * permanent_null and last elements of the structure.
+ *
+ */
+
+typedef struct {
+ Chain_Node *first;
+ Chain_Node *permanent_null;
+ Chain_Node *last;
+} Chain_Control;
+
+/*
+ * _Chain_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_chain structure to manage the
+ * contiguous array of number_nodes nodes which starts at
+ * starting_address. Each node is of node_size bytes.
+ *
+ */
+
+void _Chain_Initialize(
+ Chain_Control *the_chain,
+ void *starting_address,
+ unsigned32 number_nodes,
+ unsigned32 node_size
+);
+
+/*
+ * _Chain_Get_first_unprotected
+ */
+
+#ifndef USE_INLINES
+Chain_Node *_Chain_Get_first_unprotected(
+ Chain_Control *the_chain
+);
+#endif
+
+/*
+ * _Chain_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It disables interrupts to insure the atomicity of the
+ * extract operation.
+ *
+ */
+
+void _Chain_Extract(
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It disables interrupts to insure the atomicity of the
+ * get operation.
+ *
+ */
+
+Chain_Node *_Chain_Get(
+ Chain_Control *the_chain
+);
+
+/*
+ * _Chain_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It disables interrupts to insure the atomicity
+ * of the extract operation.
+ *
+ */
+
+void _Chain_Insert(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * append operation.
+ *
+ */
+
+void _Chain_Append(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/chain.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/context.h b/c/src/exec/score/headers/context.h
new file mode 100644
index 0000000000..4cd1f1e4c5
--- /dev/null
+++ b/c/src/exec/score/headers/context.h
@@ -0,0 +1,134 @@
+/* context.h
+ *
+ * This include file contains all information about a context.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONTEXT_h
+#define __RTEMS_CONTEXT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/cpu.h>
+
+/*
+ * The following constant defines the number of bytes required
+ * to store a full floating point context.
+ */
+
+#define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE
+
+/*
+ * The following variable is set to TRUE when a reschedule operation
+ * has determined that the processor should be taken away from the
+ * currently executing thread and given to the heir thread.
+ */
+
+EXTERN boolean _Context_Switch_necessary;
+
+/*
+ * _Context_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes THE_CONTEXT such that the stack
+ * pointer, interrupt level, and entry point are correct for the
+ * thread's initial state.
+ */
+
+#define \
+ _Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp ) \
+ _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp )
+
+/*
+ * _Context_Switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current context into the EXECUTING
+ * context record and restores the context specified by HEIR.
+ */
+
+#define _Context_Switch( _executing, _heir ) \
+ _CPU_Context_switch( _executing, _heir )
+
+/*
+ * _Context_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine restarts the calling thread by restoring its initial
+ * stack pointer and returning to the thread's entry point.
+ */
+
+#define _Context_Restart_self( _the_context ) \
+ _CPU_Context_Restart_self( _the_context )
+
+/*
+ * _Context_Fp_start
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the floating
+ * point context save area. It is assumed that the are reserved
+ * for the floating point save area is large enough.
+ */
+
+#define _Context_Fp_start( _base, _offset ) \
+ _CPU_Context_Fp_start( (_base), (_offset) )
+
+/*
+ * _Context_Initialize_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the floating point context save
+ * area to contain an initial known state.
+ */
+
+#define _Context_Initialize_fp( _fp_area ) \
+ _CPU_Context_Initialize_fp( _fp_area )
+
+/*
+ * _Context_Restore_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine restores the floating point context contained
+ * in the FP_CONTEXT area. It is assumed that the current
+ * floating point context has been saved by a previous invocation
+ * of SAVE_FP.
+ */
+
+#define _Context_Restore_fp( _fp ) \
+ _CPU_Context_restore_fp( _fp )
+
+/*
+ * _Context_Save_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current floating point context
+ * in the FP_CONTEXT area.
+ */
+
+#define _Context_Save_fp( _fp ) \
+ _CPU_Context_save_fp( _fp )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/copyrt.h b/c/src/exec/score/headers/copyrt.h
new file mode 100644
index 0000000000..c711ba09b3
--- /dev/null
+++ b/c/src/exec/score/headers/copyrt.h
@@ -0,0 +1,42 @@
+/* copyrt.h
+ *
+ * This include file contains the copyright notice for RTEMS
+ * which is included in every binary copy of the executive.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_COPYRIGHT_h
+#define __RTEMS_COPYRIGHT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef INIT
+
+const char _Copyright_Notice[] =
+"COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n\
+On-Line Applications Research Corporation (OAR).\n\
+All rights assigned to U.S. Government, 1994.\n";
+
+#else
+
+extern const char _Copyright_Notice[];
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/coremsg.h b/c/src/exec/score/headers/coremsg.h
new file mode 100644
index 0000000000..b51e07ef61
--- /dev/null
+++ b/c/src/exec/score/headers/coremsg.h
@@ -0,0 +1,274 @@
+/* coremsg.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message queue Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
+#define __RTEMS_CORE_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on message_queues.
+ */
+
+typedef void ( *CORE_message_queue_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * The following defines the data types needed to manipulate
+ * the contents of message buffers.
+ * Since msgs are variable length we just make a ptr to 1.
+ */
+
+typedef struct {
+ unsigned32 size;
+
+#ifndef __cplusplus
+ /* NOTE: [0] is gcc specific,
+ * but specifically disallowed by ANSI STD C++
+ * g++ warns about it, so we #ifdef it out to
+ * get rid of warnings when compiled by g++.
+ */
+ unsigned32 buffer[0];
+#endif
+
+} CORE_message_queue_Buffer;
+
+/*
+ * The following records define the organization of a message
+ * buffer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ CORE_message_queue_Buffer Contents;
+} CORE_message_queue_Buffer_control;
+
+/*
+ * Blocking disciplines for a message_queue.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
+} CORE_message_queue_Disciplines;
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_SEND_REQUEST = 0,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
+} CORE_message_queue_Submit_types;
+
+/*
+ * Core Message queue handler return statuses.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
+ CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
+ CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+} CORE_message_queue_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each message queue.
+ */
+
+typedef struct {
+ CORE_message_queue_Disciplines discipline;
+} CORE_message_queue_Attributes;
+
+/*
+ * The following defines the type for a Notification handler. A notification
+ * handler is invoked when the message queue makes a 0->1 transition on
+ * pending messages.
+ */
+
+typedef void (*CORE_message_queue_Notify_Handler)( void * );
+
+/*
+ * The following defines the control block used to manage each
+ * counting message_queue.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_message_queue_Attributes Attributes;
+ unsigned32 maximum_pending_messages;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_message_size;
+ Chain_Control Pending_messages;
+ CORE_message_queue_Buffer *message_buffers;
+ CORE_message_queue_Notify_Handler notify_handler;
+ void *notify_argument;
+ Chain_Control Inactive_messages;
+} CORE_message_queue_Control;
+
+/*
+ * _CORE_message_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the message_queue based on the parameters passed.
+ */
+
+boolean _CORE_message_queue_Initialize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Classes the_class,
+ CORE_message_queue_Attributes *the_message_queue_attributes,
+ unsigned32 maximum_pending_messages,
+ unsigned32 maximum_message_size,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_message_queue_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function closes a message by returning all allocated space and
+ * flushing the message_queue's task wait queue.
+ */
+
+void _CORE_message_queue_Close(
+ CORE_message_queue_Control *the_message_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ *
+ * _CORE_message_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This function flushes the message_queue's task wait queue. The number
+ * messages flushed from the queue is returned.
+ *
+ */
+
+unsigned32 _CORE_message_queue_Flush(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ * _CORE_message_queue_Flush_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine flushes all outstanding messages and returns
+ * them to the inactive message chain.
+ */
+
+unsigned32 _CORE_message_queue_Flush_support(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *
+ * _CORE_message_queue_Broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This function sends a message for every thread waiting on the queue and
+ * returns the number of threads made ready by the message.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Seize
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+void _CORE_message_queue_Seize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremsg.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/headers/coremutex.h b/c/src/exec/score/headers/coremutex.h
new file mode 100644
index 0000000000..73b7e34417
--- /dev/null
+++ b/c/src/exec/score/headers/coremutex.h
@@ -0,0 +1,171 @@
+/* mutex.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Mutex Handler. A mutex is an enhanced version of the standard
+ * Dijkstra binary semaphore used to provide synchronization and mutual
+ * exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MUTEX_h
+#define __RTEMS_CORE_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on mutexes.
+ */
+
+typedef void ( *CORE_mutex_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a mutex.
+ */
+
+typedef enum {
+ CORE_MUTEX_DISCIPLINES_FIFO,
+ CORE_MUTEX_DISCIPLINES_PRIORITY,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+} CORE_mutex_Disciplines;
+
+/*
+ * Mutex handler return statuses.
+ */
+
+typedef enum {
+ CORE_MUTEX_STATUS_SUCCESSFUL,
+ CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
+ CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
+ CORE_MUTEX_WAS_DELETED,
+ CORE_MUTEX_TIMEOUT
+} CORE_mutex_Status;
+
+/*
+ * Locked and unlocked values
+ */
+
+#define CORE_MUTEX_UNLOCKED 1
+#define CORE_MUTEX_LOCKED 0
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each mutex.
+ */
+
+typedef struct {
+ boolean allow_nesting;
+ CORE_mutex_Disciplines discipline;
+ Priority_Control priority_ceiling;
+} CORE_mutex_Attributes;
+
+/*
+ * The following defines the control block used to manage each mutex.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_mutex_Attributes Attributes;
+ unsigned32 lock;
+ unsigned32 nest_count;
+ Thread_Control *holder;
+ Objects_Id holder_id;
+} CORE_mutex_Control;
+
+/*
+ * _CORE_mutex_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the mutex based on the parameters passed.
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_mutex_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_mutex.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+);
+
+/*
+ * _CORE_mutex_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a mutex by flushing the associated
+ * wait queue.
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremutex.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/headers/coresem.h b/c/src/exec/score/headers/coresem.h
new file mode 100644
index 0000000000..88f712be5d
--- /dev/null
+++ b/c/src/exec/score/headers/coresem.h
@@ -0,0 +1,156 @@
+/* core_sem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Counting Semaphore Handler. A counting semaphore is the
+ * standard Dijkstra binary semaphore used to provide synchronization
+ * and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h
+#define __RTEMS_CORE_COUNTING_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on semaphores.
+ */
+
+typedef void ( *CORE_semaphore_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a semaphore.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_DISCIPLINES_FIFO,
+ CORE_SEMAPHORE_DISCIPLINES_PRIORITY
+} CORE_semaphore_Disciplines;
+
+/*
+ * Core Semaphore handler return statuses.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_STATUS_SUCCESSFUL,
+ CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_SEMAPHORE_WAS_DELETED,
+ CORE_SEMAPHORE_TIMEOUT
+} CORE_semaphore_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each semaphore.
+ */
+
+typedef struct {
+ CORE_semaphore_Disciplines discipline;
+} CORE_semaphore_Attributes;
+
+/*
+ * The following defines the control block used to manage each
+ * counting semaphore.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_semaphore_Attributes Attributes;
+ unsigned32 count;
+} CORE_semaphore_Control;
+
+/*
+ * _CORE_semaphore_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the semaphore based on the parameters passed.
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_semaphore_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the semaphore. If a task was blocked waiting
+ * for a unit from this semaphore, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the semaphore.
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+);
+
+/*
+ * _CORE_semaphore_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a semaphore by flushing the
+ * associated wait queue.
+ */
+
+void _CORE_semaphore_Flush(
+ CORE_semaphore_Control *the_semaphore,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coresem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/headers/debug.h b/c/src/exec/score/headers/debug.h
new file mode 100644
index 0000000000..afe6251bbe
--- /dev/null
+++ b/c/src/exec/score/headers/debug.h
@@ -0,0 +1,98 @@
+/* debug.h
+ *
+ * This include file contains the information pertaining to the debug
+ * support within RTEMS. It is currently cast in the form of a
+ * Manager since it is externally accessible.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DEBUG_h
+#define __RTEMS_DEBUG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type is used to manage the debug mask.
+ */
+
+typedef unsigned32 rtems_debug_control;
+
+/*
+ * These constants represent various classes of debugging.
+ */
+
+#define RTEMS_DEBUG_ALL_MASK 0xffffffff
+#define RTEMS_DEBUG_REGION 0x00000001
+
+/*
+ * This variable contains the current debug level.
+ */
+
+EXTERN rtems_debug_control _Debug_Level;
+
+/*
+ * _Debug_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Debug_Manager_initialization( void );
+
+/*
+ * rtems_debug_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables the specified types of debug checks.
+ */
+
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+);
+
+/*
+ * rtems_debug_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables the specified types of debug checks.
+ */
+
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+);
+
+/*
+ *
+ * _Debug_Is_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the requested debug level is
+ * enabled, and FALSE otherwise.
+ */
+
+boolean _Debug_Is_enabled(
+ rtems_debug_control level
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/heap.h b/c/src/exec/score/headers/heap.h
new file mode 100644
index 0000000000..c1a0650d0a
--- /dev/null
+++ b/c/src/exec/score/headers/heap.h
@@ -0,0 +1,226 @@
+/* heap.h
+ *
+ * This include file contains the information pertaining to the Heap
+ * Handler. A heap is a doubly linked list of variable size
+ * blocks which are allocated using the first fit method. Garbage
+ * collection is performed each time a block is returned to the heap by
+ * coalescing neighbor blocks. Control information for both allocated
+ * and unallocated blocks is contained in the heap space. A heap header
+ * contains control information for the heap.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_HEAP_h
+#define __RTEMS_HEAP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Status codes for heap_extend
+ */
+
+typedef enum {
+ HEAP_EXTEND_SUCCESSFUL,
+ HEAP_EXTEND_ERROR,
+ HEAP_EXTEND_NOT_IMPLEMENTED
+} Heap_Extend_status;
+
+/*
+ * Constants used in the size/used field of each heap block to
+ * indicate when a block is free or in use.
+ */
+
+#define HEAP_BLOCK_USED 1 /* indicates block is in use */
+#define HEAP_BLOCK_FREE 0 /* indicates block is free */
+
+/*
+ * The size/used field value for the dummy front and back flags.
+ */
+
+#define HEAP_DUMMY_FLAG (0 + HEAP_BLOCK_USED)
+
+/*
+ * The following constants reflect various requirements of the
+ * heap data structures which impact the management of a heap.
+ *
+ * NOTE: Because free block overhead is greater than used block
+ * overhead AND a portion of the allocated space is from
+ * the extra free block overhead, the absolute lower bound
+ * of the minimum fragment size is equal to the size of
+ * the free block overhead.
+ */
+
+#define HEAP_OVERHEAD \
+ (sizeof( unsigned32 ) * 2) /* size dummy first and last blocks */
+#define HEAP_BLOCK_USED_OVERHEAD \
+ (sizeof( void * ) * 2) /* num bytes overhead in used block */
+#define HEAP_MINIMUM_SIZE \
+ (HEAP_OVERHEAD + sizeof (Heap_Block))
+ /* min number of bytes the user may */
+ /* specify for the heap size */
+
+/*
+ * The following defines the data structure used to manage
+ * individual blocks in a heap. When the block is allocated, the
+ * next and previous fields are not used by the Heap Handler
+ * and thus the address returned for the block starts at
+ * the address of the next field.
+ *
+ * NOTE: The next and previous pointers are only valid when the
+ * block is free. Caution must be exercised to insure that
+ * allocated blocks are large enough to contain them and
+ * that they are not accidentally overwritten when the
+ * block is actually allocated.
+ */
+
+typedef struct Heap_Block_struct Heap_Block;
+
+struct Heap_Block_struct {
+ unsigned32 back_flag; /* size and status of prev block */
+ unsigned32 front_flag; /* size and status of block */
+ Heap_Block *next; /* pointer to next block */
+ Heap_Block *previous; /* pointer to previous block */
+};
+
+/*
+ * The following defines the control block used to manage each heap.
+ *
+ * NOTE:
+ *
+ * This structure is layed out such that it can be used a a dummy
+ * first and last block on the free block chain. The extra padding
+ * insures the dummy last block is the correct size.
+ *
+ * The first Heap_Block starts at first while the second starts at
+ * final. This is effectively the same trick as is used in the Chain
+ * Handler.
+ */
+
+typedef struct {
+ Heap_Block *start; /* first valid block address in heap */
+ Heap_Block *final; /* last valid block address in heap */
+
+ Heap_Block *first; /* pointer to first block in heap */
+ Heap_Block *permanent_null; /* always NULL pointer */
+ Heap_Block *last; /* pointer to last block in heap */
+ unsigned32 page_size; /* allocation unit */
+ unsigned32 reserved;
+} Heap_Control;
+
+/*
+ * _Heap_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_heap record to manage the
+ * contiguous heap of size bytes which starts at starting_address.
+ * Blocks of memory are allocated from the heap in multiples of
+ * page_size byte units.
+ */
+
+unsigned32 _Heap_Initialize(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 page_size
+);
+
+/*
+ * _Heap_Extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine grows the_heap memory area using the size bytes which
+ * begin at starting_address.
+ */
+
+Heap_Extend_status _Heap_Extend(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 *amount_extended
+);
+
+/*
+ * _Heap_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a block of size bytes from
+ * the_heap. If insufficient memory is free in the_heap to allocate
+ * a block of the requested size, then NULL is returned.
+ */
+
+void *_Heap_Allocate(
+ Heap_Control *the_heap,
+ unsigned32 size
+);
+
+/*
+ * _Heap_Size_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This kernel routine sets size to the size of the given heap block.
+ * It returns TRUE if the starting_address is in the heap, and FALSE
+ * otherwise.
+ */
+
+boolean _Heap_Size_of_user_area(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 *size
+);
+
+/*
+ * _Heap_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the block of memory which begins
+ * at starting_address to the_heap. Any coalescing which is
+ * possible with the freeing of this routine is performed.
+ */
+
+boolean _Heap_Free(
+ Heap_Control *the_heap,
+ void *start_address
+);
+
+/*
+ * _Heap_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine walks the heap to verify its integrity.
+ */
+
+void _Heap_Walk(
+ Heap_Control *the_heap,
+ int source,
+ boolean do_dump
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/heap.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/interr.h b/c/src/exec/score/headers/interr.h
new file mode 100644
index 0000000000..b9b2a3c51a
--- /dev/null
+++ b/c/src/exec/score/headers/interr.h
@@ -0,0 +1,94 @@
+/* interr.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Internal Error Handler.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERNAL_ERROR_h
+#define __RTEMS_INTERNAL_ERROR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This type lists the possible sources from which an error
+ * can be reported.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_CORE,
+ INTERNAL_ERROR_RTEMS_API
+} Internal_errors_Source;
+
+/*
+ * A list of errors which are generated internally by the executive core.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
+ INTERNAL_ERROR_NO_CPU_TABLE,
+ INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS,
+ INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
+ INTERNAL_ERROR_WORKSPACE_ALLOCATION,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
+ INTERNAL_ERROR_THREAD_EXITTED,
+ INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
+ INTERNAL_ERROR_INVALID_NODE,
+ INTERNAL_ERROR_NO_MPCI,
+ INTERNAL_ERROR_BAD_PACKET,
+ INTERNAL_ERROR_OUT_OF_PACKETS,
+ INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
+ INTERNAL_ERROR_OUT_OF_PROXIES,
+ INTERNAL_ERROR_INVALID_GLOBAL_ID,
+ INTERNAL_ERROR_BAD_STACK_HOOK
+} Internal_errors_Core_list;
+
+/*
+ * This type holds the fatal error information.
+ */
+
+typedef struct {
+ Internal_errors_Source the_source;
+ boolean is_internal;
+ unsigned32 the_error;
+} Internal_errors_Information;
+
+/*
+ * When a fatal error occurs, the error information is stored here.
+ */
+
+EXTERN Internal_errors_Information Internal_errors_What_happened;
+
+/*
+ * _Internal_error_Occurred
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the application or the executive itself
+ * determines that a fatal error has occurred.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/isr.h b/c/src/exec/score/headers/isr.h
new file mode 100644
index 0000000000..cf8f4cad59
--- /dev/null
+++ b/c/src/exec/score/headers/isr.h
@@ -0,0 +1,224 @@
+/* isr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the management of processor interrupt levels. This handler
+ * supports interrupt critical sections, vectoring of user interrupt
+ * handlers, nesting of interrupts, and manipulating interrupt levels.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_h
+#define __ISR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * the interrupt level portion of the status register.
+ */
+
+typedef unsigned32 ISR_Level;
+
+/*
+ * The following type defines the type used to manage the vectors.
+ */
+
+typedef unsigned32 ISR_Vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void ISR_Handler;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef ISR_Handler ( *ISR_Handler_entry )(
+ ISR_Vector_number
+ );
+/*
+ * This constant promotes out the number of vectors truly supported by
+ * the current CPU being used. This is usually the number of distinct vectors
+ * the cpu can vector.
+ */
+
+#define ISR_NUMBER_OF_VECTORS CPU_INTERRUPT_NUMBER_OF_VECTORS
+
+/*
+ * This constant promotes out the highest valid interrupt vector number.
+ */
+
+#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER
+
+/*
+ * The following is TRUE if signals have been sent to the currently
+ * executing thread by an ISR handler.
+ */
+
+EXTERN boolean _ISR_Signals_to_thread_executing;
+
+/*
+ * The following contains the interrupt service routine nest level.
+ * When this variable is zero, a thread is executing.
+ */
+
+EXTERN unsigned32 _ISR_Nest_level;
+
+/*
+ * The following declares the Vector Table. Application
+ * interrupt service routines are vectored by the ISR Handler via this table.
+ */
+
+EXTERN ISR_Handler_entry _ISR_Vector_table[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _ISR_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _ISR_Handler_initialization ( void );
+
+/*
+ * _ISR_Disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all interrupts so that a critical section
+ * of code can be executing without being interrupted. Upon return,
+ * the argument _level will contain the previous interrupt mask level.
+ */
+
+#define _ISR_Disable( _level ) \
+ _CPU_ISR_Disable( _level )
+
+/*
+ * _ISR_Enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables interrupts to the previous interrupt mask
+ * LEVEL. It is used at the end of a critical section of code to
+ * enable interrupts so they can be processed again.
+ */
+
+#define _ISR_Enable( _level ) \
+ _CPU_ISR_Enable( _level )
+
+/*
+ * _ISR_Flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables interrupts to the previous
+ * interrupt mask level and then disables all interrupts so that
+ * the caller can continue into the second part of a critical
+ * section. This routine is used to temporarily enable interrupts
+ * during a long critical section. It is used in long sections of
+ * critical code when a point is reached at which interrupts can
+ * be temporarily enabled. Deciding where to flash interrupts
+ * in a long critical section is often difficult and the point
+ * must be selected with care to insure that the critical section
+ * properly protects itself.
+ */
+
+#define _ISR_Flash( _level ) \
+ _CPU_ISR_Flash( _level )
+
+/*
+ * _ISR_Install_vector
+ *
+ * DESCRIPTION:
+ *
+ * This routine installs new_handler as the interrupt service routine
+ * for the specified vector. The previous interrupt service routine is
+ * returned as old_handler.
+ */
+
+#define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \
+ _CPU_ISR_install_vector( _vector, _new_handler, _old_handler )
+
+/*
+ * _ISR_Get_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current interrupt level.
+ */
+
+#define _ISR_Get_level() \
+ _CPU_ISR_Get_level()
+
+/*
+ * _ISR_Set_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * by new_level. The new interrupt level is effective when the
+ * routine exits.
+ */
+
+#define _ISR_Set_level( _new_level ) \
+ _CPU_ISR_Set_level( _new_level )
+
+/*
+ * _ISR_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the interrupt dispatcher. ALL interrupts
+ * are vectored to this routine so that minimal context can be saved
+ * and setup performed before the application's high-level language
+ * interrupt service routine is invoked. After the application's
+ * interrupt service routine returns control to this routine, it
+ * will determine if a thread dispatch is necessary. If so, it will
+ * insure that the necessary thread scheduling operations are
+ * performed when the outermost interrupt service routine exits.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Handler( void );
+
+/*
+ * _ISR_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine provides a wrapper so that the routine
+ * _Thread_Dispatch can be invoked when a reschedule is necessary
+ * at the end of the outermost interrupt service routine. This
+ * wrapper is necessary to establish the processor context needed
+ * by _Thread_Dispatch and to save the processor context which is
+ * corrupted by _Thread_Dispatch. This context typically consists
+ * of registers which are not preserved across routine invocations.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Dispatch( void );
+
+#include <rtems/score/isr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/mpci.h b/c/src/exec/score/headers/mpci.h
new file mode 100644
index 0000000000..25d7ac4094
--- /dev/null
+++ b/c/src/exec/score/headers/mpci.h
@@ -0,0 +1,411 @@
+/* mpci.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the MPCI layer. It provides mechanisms to utilize packets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MPCI_h
+#define __MPCI_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/coresem.h>
+
+/*
+ * The following constants define the stack size requirements for
+ * the system threads.
+ */
+
+#define MPCI_RECEIVE_SERVER_STACK_SIZE \
+ ( STACK_MINIMUM_SIZE + \
+ CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \
+ _CPU_Table.extra_mpci_receive_server_stack \
+ )
+
+/*
+ * The following defines the node number used when a broadcast is desired.
+ */
+
+#define MPCI_ALL_NODES 0
+
+/*
+ * For packets associated with requests that don't already have a timeout,
+ * use the one specified by this MPCI driver. The value specified by
+ * the MPCI driver sets an upper limit on how long a remote request
+ * should take to complete.
+ */
+
+#define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF
+
+/*
+ * The following records define the Multiprocessor Communications
+ * Interface (MPCI) Table. This table defines the user-provided
+ * MPCI which is a required part of a multiprocessor system.
+ *
+ * For non-blocking local operations that become remote operations,
+ * we need a timeout. This is a per-driver timeout: default_timeout
+ */
+
+typedef void MPCI_Entry;
+
+typedef MPCI_Entry ( *MPCI_initialization_entry )( void );
+
+typedef MPCI_Entry ( *MPCI_get_packet_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef MPCI_Entry ( *MPCI_return_packet_entry )(
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_send_entry )(
+ unsigned32,
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_receive_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef struct {
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ MPCI_initialization_entry initialization;
+ MPCI_get_packet_entry get_packet;
+ MPCI_return_packet_entry return_packet;
+ MPCI_send_entry send_packet;
+ MPCI_receive_entry receive_packet;
+} MPCI_Control;
+
+/*
+ * The following defines the type for packet processing routines
+ * invoked by the MPCI Receive server.
+ */
+
+typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
+
+/*
+ * The following enumerated type defines the list of
+ * internal MP operations.
+ */
+
+typedef enum {
+ MPCI_PACKETS_SYSTEM_VERIFY = 0
+} MPCI_Internal_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ MPCI_Internal_Remote_operations operation;
+ unsigned32 maximum_nodes;
+ unsigned32 maximum_global_objects;
+} MPCI_Internal_packet;
+
+/*
+ * This is the core semaphore which the MPCI Receive Server blocks on.
+ */
+
+EXTERN CORE_semaphore_Control _MPCI_Semaphore;
+/*
+ * The following thread queue is used to maintain a list of tasks
+ * which currently have outstanding remote requests.
+ */
+
+EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
+
+/*
+ * The following define the internal pointers to the user's
+ * configuration information.
+ */
+
+EXTERN MPCI_Control *_MPCI_table;
+
+/*
+ * The following points to the MPCI Receive Server.
+ */
+
+EXTERN Thread_Control *_MPCI_Receive_server_tcb;
+
+/*
+ * The following table contains the process packet routines provided
+ * by each object that supports MP operations.
+ */
+
+EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
+
+/*
+ * _MPCI_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table,
+ unsigned32 timeout_status
+);
+
+/*
+ * _MPCI_Create_server
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the packet receive server used in MP systems.
+ */
+
+void _MPCI_Create_server( void );
+
+/*
+ * _MPCI_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the MPCI driver by
+ * invoking the user provided MPCI initialization callout.
+ */
+
+void _MPCI_Initialization ( void );
+
+/*
+ * _MPCI_Register_packet_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine registers the MPCI packet processor for the
+ * designated object class.
+ */
+
+void _MPCI_Register_packet_processor(
+ MP_packet_Classes the_object,
+ MPCI_Packet_processor the_packet_processor
+
+);
+
+/*
+ * _MPCI_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+MP_packet_Prefix *_MPCI_Get_packet ( void );
+
+/*
+ * _MPCI_Return_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a packet by invoking the user provided
+ * MPCI return packet callout.
+ */
+
+void _MPCI_Return_packet (
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a process packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_process_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine 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
+);
+
+/*
+ * _MPCI_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a response packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_response_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Receive_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine receives a packet by invoking the user provided
+ * MPCI receive callout.
+ */
+
+MP_packet_Prefix *_MPCI_Receive_packet ( void );
+
+/*
+ * _MPCI_Process_response
+ *
+ * DESCRIPTION:
+ *
+ * This routine obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+Thread_Control *_MPCI_Process_response (
+ MP_packet_Prefix *the_packet
+);
+
+/*PAGE
+ *
+ * _MPCI_Receive_server
+ *
+ */
+
+Thread _MPCI_Receive_server(
+ unsigned32 ignored
+);
+
+/*PAGE
+ *
+ * _MPCI_Announce
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _MPCI_Announce ( void );
+
+/*
+ * _MPCI_Internal_packets_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _MPCI_Internal_packets_Send_process_packet (
+ MPCI_Internal_Remote_operations operation
+);
+
+/*
+ * _MPCI_Internal_packets_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ *
+ * This routine is not needed since there are no request
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ *
+ * This routine is not needed since there are no response
+ * packets to be sent by this manager.
+ */
+
+/*
+ *
+ * _MPCI_Internal_packets_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _MPCI_Internal_packets_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _MPCI_Internal_packets_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to obtain a internal threads mp packet.
+ */
+
+ MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/mppkt.h b/c/src/exec/score/headers/mppkt.h
new file mode 100644
index 0000000000..0c651bc4e8
--- /dev/null
+++ b/c/src/exec/score/headers/mppkt.h
@@ -0,0 +1,100 @@
+/* mppkt.h
+ *
+ * This package is the specification for the Packet Handler.
+ * This handler defines the basic packet and provides
+ * mechanisms to utilize packets based on this prefix.
+ * Packets are the fundamental basis for messages passed between
+ * nodes in an MP system.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MP_PACKET_h
+#define __MP_PACKET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the packet classes.
+ *
+ * NOTE: In general, each class corresponds to a manager
+ * which supports global operations. Each manager
+ * defines the set of supported operations.
+ */
+
+typedef enum {
+ MP_PACKET_MPCI_INTERNAL = 0,
+ MP_PACKET_TASKS = 1,
+ MP_PACKET_MESSAGE_QUEUE = 2,
+ MP_PACKET_SEMAPHORE = 3,
+ MP_PACKET_PARTITION = 4,
+ MP_PACKET_REGION = 5,
+ MP_PACKET_EVENT = 6,
+ MP_PACKET_SIGNAL = 7
+} MP_packet_Classes;
+
+#define MP_PACKET_CLASSES_FIRST MP_PACKET_MPCI_INTERNAL
+#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL
+
+/*
+ * The following record contains the prefix for every packet
+ * passed between nodes in an MP system.
+ *
+ * NOTE: This structure is padded to insure that anything
+ * following it is on a 16 byte boundary. This is
+ * the most stringent structure alignment rule
+ * encountered yet (i960CA).
+ */
+
+typedef struct {
+ MP_packet_Classes the_class;
+ Objects_Id id;
+ Objects_Id source_tid;
+ Priority_Control source_priority;
+ unsigned32 return_code;
+ unsigned32 length;
+ unsigned32 to_convert;
+ Watchdog_Interval timeout;
+} MP_packet_Prefix;
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define MP_PACKET_MINIMUM_PACKET_SIZE 64
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/mppkt.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/object.h b/c/src/exec/score/headers/object.h
new file mode 100644
index 0000000000..d70009c3c9
--- /dev/null
+++ b/c/src/exec/score/headers/object.h
@@ -0,0 +1,397 @@
+/* object.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Object Handler. This Handler provides mechanisms which
+ * can be used to initialize and manipulate all objects which have
+ * ids.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_h
+#define __OBJECTS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+
+/*
+ * The following type defines the control block used to manage
+ * object names.
+ */
+
+typedef void * Objects_Name;
+
+/*
+ * Space for object names is allocated in multiples of this.
+ *
+ * NOTE: Must be a power of 2. Matches the name manipulation routines.
+ */
+
+#define OBJECTS_NAME_ALIGNMENT 4
+
+/*
+ * Functions which compare names are prototyped like this.
+ */
+
+typedef boolean (*Objects_Name_comparators)(
+ void * /* name_1 */,
+ void * /* name_2 */,
+ unsigned32 /* length */
+);
+
+/*
+ * The following type defines the control block used to manage
+ * object IDs. The format is as follows (0=LSB):
+ *
+ * Bits 0 .. 15 = index
+ * Bits 16 .. 25 = node
+ * Bits 26 .. 31 = class
+ */
+
+typedef unsigned32 Objects_Id;
+
+#define OBJECTS_INDEX_START_BIT 0
+#define OBJECTS_NODE_START_BIT 16
+#define OBJECTS_CLASS_START_BIT 26
+
+#define OBJECTS_INDEX_MASK 0x0000ffff
+#define OBJECTS_NODE_MASK 0x03ff0000
+#define OBJECTS_CLASS_MASK 0xfc000000
+
+#define OBJECTS_INDEX_VALID_BITS 0x0000ffff
+#define OBJECTS_NODE_VALID_BITS 0x000003ff
+#define OBJECTS_CLASS_VALID_BITS 0x000000cf
+
+/*
+ * This enumerated type is used in the class field of the object ID.
+ */
+
+typedef enum {
+ OBJECTS_NO_CLASS = 0,
+ OBJECTS_INTERNAL_THREADS = 1,
+ OBJECTS_RTEMS_TASKS = 2,
+ OBJECTS_POSIX_THREADS = 3,
+ OBJECTS_RTEMS_TIMERS = 4,
+ OBJECTS_RTEMS_SEMAPHORES = 5,
+ OBJECTS_RTEMS_MESSAGE_QUEUES = 6,
+ OBJECTS_RTEMS_PARTITIONS = 7,
+ OBJECTS_RTEMS_REGIONS = 8,
+ OBJECTS_RTEMS_PORTS = 9,
+ OBJECTS_RTEMS_PERIODS = 10,
+ OBJECTS_RTEMS_EXTENSIONS = 11,
+ OBJECTS_POSIX_KEYS = 12,
+ OBJECTS_POSIX_INTERRUPTS = 13,
+ OBJECTS_POSIX_MESSAGE_QUEUES = 14,
+ OBJECTS_POSIX_MUTEXES = 15,
+ OBJECTS_POSIX_SEMAPHORES = 16,
+ OBJECTS_POSIX_CONDITION_VARIABLES = 17
+} Objects_Classes;
+
+#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS
+#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES
+#define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_MPCI_PACKETS
+#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS
+
+/*
+ * This enumerated type lists the locations which may be returned
+ * by _Objects_Get. These codes indicate the success of locating
+ * an object with the specified ID.
+ */
+
+typedef enum {
+ OBJECTS_LOCAL = 0, /* object is local */
+ OBJECTS_REMOTE = 1, /* object is remote */
+ OBJECTS_ERROR = 2 /* id was invalid */
+} Objects_Locations;
+
+/*
+ * The following defines the Object Control Block used to manage
+ * each object local to this node.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Objects_Id id;
+ Objects_Name name;
+} Objects_Control;
+
+/*
+ * The following defines the structure for the information used to
+ * manage each class of objects.
+ */
+
+typedef struct {
+ Objects_Classes the_class; /* Class of this object */
+ Objects_Id minimum_id; /* minimum valid id of this type */
+ Objects_Id maximum_id; /* maximum valid id of this type */
+ unsigned32 maximum; /* maximum number of objects */
+ Objects_Control **local_table; /* table of local object pointers */
+ Objects_Name *name_table; /* table of local object names */
+ Chain_Control *global_table; /* pointer to global table */
+ Chain_Control Inactive; /* chain of inactive ctl blocks */
+ boolean is_string; /* TRUE if names are strings */
+ unsigned32 name_length; /* maximum length of names */
+ boolean is_thread; /* TRUE if these are threads */
+ /* irregardless of API */
+} Objects_Information;
+
+/*
+ * The following defines the data storage which contains the
+ * node number of the local node.
+ */
+
+EXTERN unsigned32 _Objects_Local_node;
+EXTERN unsigned32 _Objects_Maximum_nodes;
+
+/*
+ * The following is the list of information blocks for each object
+ * class. From the ID, we can go to one of these information blocks,
+ * and obtain a pointer to the appropriate object control block.
+ */
+
+EXTERN Objects_Information
+ *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1];
+
+/*
+ * The following defines the constant which may be used
+ * with _Objects_Get to manipulate the calling task.
+ *
+ */
+
+#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define OBJECTS_SEARCH_ALL_NODES 0
+#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
+#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
+#define OBJECTS_WHO_AM_I 0
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define OBJECTS_ID_INITIAL_INDEX (0)
+#define OBJECTS_ID_FINAL_INDEX (0xffff)
+
+#define OBJECTS_ID_INITIAL(_class, _node) \
+ _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
+
+#define OBJECTS_ID_FINAL ((Objects_Id)~0)
+
+/*
+ * _Objects_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function performs the initialization necessary for this handler.
+ *
+ */
+
+void _Objects_Handler_initialization(
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*
+ * _Objects_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This function initializes an object class information record.
+ * SUPPORTS_GLOBAL is TRUE if the object class supports global
+ * objects, and FALSE otherwise. Maximum indicates the number
+ * of objects required in this class and size indicates the size
+ * in bytes of each control block for this object class. The
+ * name length and string designator are also set. In addition,
+ * the class may be a task, therefore this information is also included.
+ */
+
+void _Objects_Initialize_information (
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_task
+);
+
+/*
+ * _Objects_Clear_name
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Clear_name(
+ void *name,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Copy_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_string(
+ void *source,
+ void *destination
+);
+
+/*
+ * _Objects_Copy_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_raw(
+ void *source,
+ void *destination,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_string(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_raw(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+/*
+ * _Objects_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * This function implements the common portion of the object
+ * identification directives. This directive returns the object
+ * id associated with name. If more than one object of this class
+ * is named name, then the object to which the id belongs is
+ * arbitrary. Node indicates the extent of the search for the
+ * id of the object named name. If the object class supports global
+ * objects, then the search can be limited to a particular node
+ * or allowed to encompass all nodes.
+ *
+ */
+
+typedef enum {
+ OBJECTS_SUCCESSFUL,
+ OBJECTS_INVALID_NAME,
+ OBJECTS_INVALID_NODE
+} Objects_Name_to_id_errors;
+
+#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL
+#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE
+
+Objects_Name_to_id_errors _Objects_Name_to_id(
+ Objects_Information *information,
+ Objects_Name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * _Objects_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps object ids to object control blocks.
+ * If id corresponds to a local object, then it returns
+ * the_object control pointer which maps to id and location
+ * is set to OBJECTS_LOCAL. If the object class supports global
+ * objects and the object id is global and resides on a remote
+ * node, then location is set to OBJECTS_REMOTE, and the_object
+ * is undefined. Otherwise, location is set to OBJECTS_ERROR
+ * and the_object is undefined.
+ *
+ */
+
+Objects_Control *_Objects_Get (
+ Objects_Information *information,
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _Objects_Get_next
+ *
+ * DESCRIPTION:
+ *
+ * Like _Objects_Get, but is used to find "next" open object.
+ *
+ */
+
+Objects_Control *_Objects_Get_next(
+ Objects_Information *information,
+ Objects_Id id,
+ unsigned32 *location_p,
+ Objects_Id *next_id_p
+);
+
+/*
+ * _Objects_Get_information
+ *
+ * DESCRIPTION:
+ *
+ * Returns the information control block for the class of objects
+ * corresponding to this id.
+ */
+
+Objects_Information *_Objects_Get_information(
+ Objects_Id id
+);
+
+/*
+ * Pieces of object.inl are promoted out to the user
+ */
+
+#include <rtems/score/object.inl>
+#include <rtems/score/objectmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/objectmp.h b/c/src/exec/score/headers/objectmp.h
new file mode 100644
index 0000000000..96496656df
--- /dev/null
+++ b/c/src/exec/score/headers/objectmp.h
@@ -0,0 +1,152 @@
+/* objectmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of Global RTEMS Objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OBJECTS_MP_h
+#define __RTEMS_OBJECTS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the Global Object Control Block used to manage
+ * objects resident on other nodes.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ unsigned32 name; /* XXX broken but works */
+ /* XXX If any API is MP with variable length names .. BOOM!!!! */
+} Objects_MP_Control;
+
+/*
+ * _Objects_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine intializes the inactive global object chain
+ * based on the maximum number of global objects configured.
+ */
+
+void _Objects_MP_Handler_initialization (
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*PAGE
+ *
+ * _Objects_MP_Open
+ *
+ * DESCRIPTION:
+ *
+ * This routine place the specified global object in the
+ * specified information table.
+ */
+
+void _Objects_MP_Open (
+ Objects_Information *information,
+ Objects_MP_Control *the_global_object,
+ unsigned32 the_name, /* XXX -- wrong for variable */
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Allocate_and_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a global object control block
+ * and places it in the specified information table. If the
+ * allocation fails, then is_fatal_error determines the
+ * error processing actions taken.
+ */
+
+boolean _Objects_MP_Allocate_and_open (
+ Objects_Information *information,
+ unsigned32 the_name, /* XXX -- wrong for variable length */
+ Objects_Id the_id,
+ boolean is_fatal_error
+);
+
+/*
+ * _Objects_MP_Close
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes a global object from the specified
+ * information table and deallocates the global object control block.
+ */
+
+void _Objects_MP_Close (
+ Objects_Information *information,
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Global_name_search
+ *
+ * DESCRIPTION:
+ *
+ * This routine looks for the object with the_name in the global
+ * object tables indicated by information. It returns the ID of the
+ * object with that name if one is found.
+ */
+
+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
+);
+
+/*
+ * _Objects_MP_Is_remote
+ *
+ * DESCRIPTION:
+ *
+ * This function searches the Global Object Table managed
+ * by information for the object indicated by ID. If the object
+ * is found, then location is set to objects_remote, otherwise
+ * location is set to objects_error. In both cases, the_object
+ * is undefined.
+ */
+
+void _Objects_MP_Is_remote (
+ Objects_Information *information,
+ Objects_Id the_id,
+ Objects_Locations *location,
+ Objects_Control **the_object
+);
+
+/*
+ * The following chain header is used to manage the set of
+ * inactive global object control blocks.
+ */
+
+EXTERN unsigned32 _Objects_MP_Maximum_global_objects;
+EXTERN Chain_Control _Objects_MP_Inactive_global_objects;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/objectmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/priority.h b/c/src/exec/score/headers/priority.h
new file mode 100644
index 0000000000..b7de14f0f9
--- /dev/null
+++ b/c/src/exec/score/headers/priority.h
@@ -0,0 +1,96 @@
+/* priority.h
+ *
+ * This include file contains all thread priority manipulation routines.
+ * This Handler provides mechanisms which can be used to
+ * initialize and manipulate thread priorities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_h
+#define __PRIORITY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * thread priorities.
+ *
+ * NOTE: Priority 0 is reserved for internal threads only.
+ */
+
+typedef unsigned32 Priority_Control;
+
+#define PRIORITY_MINIMUM 0 /* highest thread priority */
+#define PRIORITY_MAXIMUM 255 /* lowest thread priority */
+
+/*
+ * The following record defines the information associated with
+ * each thread to manage its interaction with the priority bit maps.
+ */
+
+typedef struct {
+ Priority_Bit_map_control *minor; /* addr of minor bit map slot */
+ Priority_Bit_map_control ready_major; /* priority bit map ready mask */
+ Priority_Bit_map_control ready_minor; /* priority bit map ready mask */
+ Priority_Bit_map_control block_major; /* priority bit map block mask */
+ Priority_Bit_map_control block_minor; /* priority bit map block mask */
+} Priority_Information;
+
+/*
+ * The following data items are the priority bit map.
+ * Each of the sixteen bits used in the _Priority_Major_bit_map is
+ * associated with one of the sixteen entries in the _Priority_Bit_map.
+ * Each bit in the _Priority_Bit_map indicates whether or not there are
+ * threads ready at a particular priority. The mapping of
+ * individual priority levels to particular bits is processor
+ * dependent as is the value of each bit used to indicate that
+ * threads are ready at that priority.
+ */
+
+EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map;
+EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
+
+/*
+ * The definition of the Priority_Bit_map_control type is CPU dependent.
+ *
+ */
+
+/*
+ * Priority Bitfield Manipulation Routines
+ *
+ * NOTE:
+ *
+ * These may simply be pass throughs to CPU dependent routines.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Priority_Mask( _bit_number ) \
+ _CPU_Priority_Mask( _bit_number )
+
+#define _Priority_Bits_index( _priority ) \
+ _CPU_Priority_bits_index( _priority )
+
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/priority.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/stack.h b/c/src/exec/score/headers/stack.h
new file mode 100644
index 0000000000..bf72782b42
--- /dev/null
+++ b/c/src/exec/score/headers/stack.h
@@ -0,0 +1,50 @@
+/* stack.h
+ *
+ * This include file contains all information about the thread
+ * Stack Handler. This Handler provides mechanisms which can be used to
+ * initialize and utilize stacks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_h
+#define __STACK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the control block used to manage each stack.
+ */
+
+typedef struct {
+ unsigned32 size; /* stack size */
+ void *area; /* low memory addr of stack */
+} Stack_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/stack.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/states.h b/c/src/exec/score/headers/states.h
new file mode 100644
index 0000000000..1f8fd49fae
--- /dev/null
+++ b/c/src/exec/score/headers/states.h
@@ -0,0 +1,78 @@
+/* states.h
+ *
+ * This include file contains thread execution state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATES_h
+#define __RTEMS_STATES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage a
+ * thread's state.
+ */
+
+typedef unsigned32 States_Control;
+
+/*
+ * The following constants define the individual states which may be
+ * be used to compose and manipulate a thread's state.
+ */
+
+#define STATES_ALL_SET 0xffff /* all states */
+#define STATES_READY 0x0000 /* ready to run */
+#define STATES_DORMANT 0x0001 /* created not started */
+#define STATES_SUSPENDED 0x0002 /* waiting for resume */
+#define STATES_TRANSIENT 0x0004 /* thread in transition */
+#define STATES_DELAYING 0x0008 /* wait for timeout */
+#define STATES_WAITING_FOR_TIME 0x0010 /* wait for TOD */
+#define STATES_WAITING_FOR_BUFFER 0x0020
+#define STATES_WAITING_FOR_SEGMENT 0x0040
+#define STATES_WAITING_FOR_MESSAGE 0x0080
+#define STATES_WAITING_FOR_EVENT 0x0100
+#define STATES_WAITING_FOR_SEMAPHORE 0x0200
+#define STATES_WAITING_FOR_MUTEX 0x0400
+#define STATES_WAITING_FOR_CONDITION_VARIABLE 0x0800
+#define STATES_WAITING_FOR_RPC_REPLY 0x1000
+#define STATES_WAITING_FOR_PERIOD 0x2000
+
+#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \
+ STATES_WAITING_FOR_SEGMENT | \
+ STATES_WAITING_FOR_MESSAGE | \
+ STATES_WAITING_FOR_MUTEX | \
+ STATES_WAITING_FOR_CONDITION_VARIABLE | \
+ STATES_WAITING_FOR_SEMAPHORE )
+
+#define STATES_WAITING_ON_THREAD_QUEUE \
+ ( STATES_LOCALLY_BLOCKED | \
+ STATES_WAITING_FOR_RPC_REPLY )
+
+#define STATES_BLOCKED ( STATES_DELAYING | \
+ STATES_WAITING_FOR_TIME | \
+ STATES_WAITING_FOR_PERIOD | \
+ STATES_WAITING_FOR_EVENT | \
+ STATES_WAITING_ON_THREAD_QUEUE )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/states.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/sysstate.h b/c/src/exec/score/headers/sysstate.h
new file mode 100644
index 0000000000..d7e43b2356
--- /dev/null
+++ b/c/src/exec/score/headers/sysstate.h
@@ -0,0 +1,66 @@
+/* sysstates.h
+ *
+ * This include file contains information regarding the system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_STATE_h
+#define __RTEMS_SYSTEM_STATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+/*
+ * The following type defines the possible system states.
+ */
+
+typedef enum {
+ SYSTEM_STATE_BEFORE_INITIALIZATION, /* start -> end of 1st init part */
+ SYSTEM_STATE_BEFORE_MULTITASKING, /* end of 1st -> beginning of 2nd */
+ SYSTEM_STATE_BEGIN_MULTITASKING, /* just before multitasking starts */
+ SYSTEM_STATE_UP, /* normal operation */
+ SYSTEM_STATE_FAILED /* fatal error occurred */
+} System_state_Codes;
+
+#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
+#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
+
+/*
+ * The following variable indicates whether or not this is
+ * an multiprocessing system.
+ */
+
+EXTERN boolean _System_state_Is_multiprocessing;
+
+/*
+ * The following variable contains the current system state.
+ */
+
+EXTERN System_state_Codes _System_state_Current;
+
+/*
+ * Make it possible for the application to get the system state information.
+ */
+
+#include <rtems/score/sysstate.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/system.h b/c/src/exec/score/headers/system.h
new file mode 100644
index 0000000000..9b50159c81
--- /dev/null
+++ b/c/src/exec/score/headers/system.h
@@ -0,0 +1,134 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the executive. This must be the first include file
+ * included in all internal RTEMS files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_h
+#define __RTEMS_SYSTEM_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_USE_INLINE_OR_MACROS" is replaced
+ * with either "USE_INLINES" or "USE_MACROS" based upon the
+ * whether this target configuration uses the inline or
+ * macro implementations of the inlined RTEMS routines.
+ */
+
+
+#define REPLACE_THIS_WITH_USE_INLINE_OR_MACROS
+
+/*
+ * The following insures that all data is declared in the space
+ * of the Initialization Manager. It is referenced as "external"
+ * in every other file.
+ */
+
+#ifdef INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * The following (in conjunction with compiler arguments) are used
+ * to choose between the use of static inline functions and macro
+ * functions. The static inline implementation allows better
+ * type checking with no cost in code size or execution speed.
+ */
+
+#ifdef USE_INLINES
+# define STATIC static
+# ifdef __GNUC__
+# define INLINE __inline__
+# else
+# define INLINE inline
+# endif
+#else
+# define STATIC
+# define INLINE
+#endif
+
+/*
+ * Include a base set of files.
+ */
+
+/*
+ * XXX: Eventually proc_ptr needs to disappear!!!
+ */
+
+typedef void * proc_ptr;
+
+#include <rtems/score/cpu.h> /* processor specific information */
+
+/*
+ * Define NULL
+ */
+
+#ifndef NULL
+#define NULL 0 /* NULL value */
+#endif
+
+/*
+ * Boolean constants
+ */
+
+#if !defined( TRUE ) || (TRUE != 1)
+#undef TRUE
+#define TRUE (1)
+#endif
+
+#if !defined( FALSE ) || (FALSE != 0)
+#undef FALSE
+#define FALSE (0)
+#endif
+
+#define stringify( _x ) # _x
+
+#define RTEMS_offsetof(type, field) \
+ ((unsigned32) &(((type *) 0)->field))
+
+/*
+ * The following is the extern for the RTEMS version string.
+ * The contents of this string are CPU specific.
+ */
+
+extern const char _RTEMS_version[]; /* RTEMS version string */
+extern const char _Copyright_Notice[]; /* RTEMS copyright string */
+
+/*
+ * The following defines the CPU dependent information table.
+ */
+
+EXTERN rtems_cpu_table _CPU_Table; /* CPU dependent info */
+
+/*
+ * XXX weird RTEMS stuff
+ */
+
+#define RTEMS_MAXIMUM_NAME_LENGTH 4
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/thread.h b/c/src/exec/score/headers/thread.h
new file mode 100644
index 0000000000..74399545b9
--- /dev/null
+++ b/c/src/exec/score/headers/thread.h
@@ -0,0 +1,585 @@
+/* thread.h
+ *
+ * This include file contains all constants and structures associated
+ * with the thread control block.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_h
+#define __THREAD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/context.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following defines the "return type" of a thread.
+ */
+
+typedef void Thread;
+
+/*
+ * The following defines the ways in which the entry point for a
+ * thread can be invoked. Basically, it can be passed any
+ * combination/permutation of a pointer and an unsigned32 value.
+ *
+ * NOTE: For now, we are ignoring the return type.
+ */
+
+typedef enum {
+ THREAD_START_NUMERIC,
+ THREAD_START_POINTER,
+ THREAD_START_BOTH_POINTER_FIRST,
+ THREAD_START_BOTH_NUMERIC_FIRST
+} Thread_Start_types;
+
+typedef Thread ( *Thread_Entry )( );
+
+/*
+ * The following structure contains the information which defines
+ * the starting state of a thread.
+ */
+
+typedef struct {
+ Thread_Entry entry_point; /* starting thread address */
+ Thread_Start_types prototype; /* how task is invoked */
+ void *pointer_argument; /* pointer argument */
+ unsigned32 numeric_argument; /* numeric argument */
+ /* initial execution modes */
+ boolean is_preemptible;
+ boolean is_timeslice;
+ unsigned32 isr_level;
+ Priority_Control initial_priority; /* initial priority */
+ Stack_Control Initial_stack; /* stack information */
+ void *fp_context; /* initial FP context area address */
+ void *stack; /* initial FP context area address */
+} Thread_Start_information;
+
+/*
+ * The following structure contains the information necessary to manage
+ * a thread which it is waiting for a resource.
+ */
+
+#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
+
+typedef struct {
+ Objects_Id id; /* waiting on this object */
+ unsigned32 count; /* "generic" fields to be used */
+ void *return_argument; /* when blocking */
+ void *return_argument_1;
+ unsigned32 option;
+
+ /*
+ * NOTE: The following assumes that all API return codes can be
+ * treated as an unsigned32.
+ */
+ unsigned32 return_code; /* status for thread awakened */
+
+ Chain_Control Block2n; /* 2 - n priority blocked chain */
+ Thread_queue_Control *queue; /* pointer to thread queue */
+} Thread_Wait_information;
+
+/*
+ * The following defines the control block used to manage
+ * each thread proxy.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ Chain_Node Active;
+} Thread_Proxy_control;
+
+
+/*
+ * The following record defines the control block used
+ * to manage each thread.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef enum {
+ THREAD_API_RTEMS,
+ THREAD_API_POSIX
+} Thread_APIs;
+
+#define THREAD_API_FIRST THREAD_API_RTEMS
+#define THREAD_API_LAST THREAD_API_POSIX
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ boolean is_global;
+ boolean do_post_task_switch_extension;
+ Chain_Control *ready;
+ Priority_Information Priority_map;
+ Thread_Start_information Start;
+ boolean is_preemptible;
+ boolean is_timeslice;
+ Context_Control Registers;
+ void *fp_context;
+ void *API_Extensions[ THREAD_API_LAST + 1 ];
+ void **extensions;
+} Thread_Control;
+
+/*
+ * The following constants define the stack size requirements for
+ * the idle thread.
+ */
+
+
+#define THREAD_IDLE_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Thread_Internal_information;
+
+/*
+ * The following define the thread control pointers used to access
+ * and manipulate the idle thread.
+ */
+
+EXTERN Thread_Control *_Thread_Idle;
+
+/*
+ * The following context area contains the context of the "thread"
+ * which invoked the start multitasking routine. This context is
+ * restored as the last action of the stop multitasking routine. Thus
+ * control of the processor can be returned to the environment
+ * which initiated the system.
+ */
+
+EXTERN Context_Control _Thread_BSP_context;
+
+/*
+ * The following declares the dispatch critical section nesting
+ * counter which is used to prevent context switches at inopportune
+ * moments.
+ */
+
+EXTERN unsigned32 _Thread_Dispatch_disable_level;
+
+/*
+ * The following holds how many user extensions are in the system. This
+ * is used to determine how many user extension data areas to allocate
+ * per thread.
+ */
+
+EXTERN unsigned32 _Thread_Maximum_extensions;
+
+/*
+ * The following data items are used to manage timeslicing.
+ */
+
+EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
+EXTERN unsigned32 _Thread_Ticks_per_timeslice;
+
+/*
+ * The following points to the array of FIFOs used to manage the
+ * set of ready threads.
+ */
+
+EXTERN Chain_Control *_Thread_Ready_chain;
+
+/*
+ * The following points to the thread which is currently executing.
+ * This thread is implicitly manipulated by numerous directives.
+ */
+
+EXTERN Thread_Control *_Thread_Executing;
+
+/*
+ * The following points to the highest priority ready thread
+ * in the system. Unless the current thread is not preemptibl,
+ * then this thread will be context switched to when the next
+ * dispatch occurs.
+ */
+
+EXTERN Thread_Control *_Thread_Heir;
+
+/*
+ * The following points to the thread whose floating point
+ * context is currently loaded.
+ */
+
+EXTERN Thread_Control *_Thread_Allocated_fp;
+
+/*
+ * _Thread_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Thread_Handler_initialization (
+ unsigned32 ticks_per_timeslice,
+ unsigned32 maximum_extensions,
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_Create_idle
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the idle thread.
+ *
+ * WARNING!! No thread should be created before this one.
+ */
+
+void _Thread_Create_idle( void );
+
+/*
+ * _Thread_Start_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine initiates multitasking. It is invoked only as
+ * part of initialization and its invocation is the last act of
+ * the non-multitasking part of the system initialization.
+ */
+
+void _Thread_Start_multitasking( void );
+
+/*
+ * _Thread_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is responsible for transferring control of the
+ * processor from the executing thread to the heir thread. As part
+ * of this process, it is responsible for the following actions:
+ *
+ * + saving the context of the executing thread
+ * + restoring the context of the heir thread
+ * + dispatching any signals for the resulting executing thread
+ */
+
+void _Thread_Dispatch( void );
+
+/*
+ * _Thread_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Initialize(
+ Objects_Information *information,
+ Thread_Control *the_thread,
+ void *stack_area, /* NULL if to be allocated */
+ unsigned32 stack_size, /* insure it is >= min */
+ boolean is_fp, /* TRUE if thread uses FP */
+ Priority_Control priority,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
+ Objects_Name name
+
+);
+
+/*
+ * _Thread_Start
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Start(
+ Thread_Control *the_thread,
+ Thread_Start_types the_prototype,
+ void *entry_point,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Restart
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+/* XXX multiple task arg profiles */
+
+boolean _Thread_Restart(
+ Thread_Control *the_thread,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Close
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Thread_Close(
+ Objects_Information *information,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Ready
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes any set states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Ready(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Clear_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the indicated STATES for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Clear_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the indicated states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ *
+ */
+
+void _Thread_Set_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_transient
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the TRANSIENT state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Set_transient(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Reset_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked upon expiration of the currently
+ * executing thread's timeslice. If no other thread's are ready
+ * at the priority of the currently executing thread, then the
+ * executing thread's timeslice is reset. Otherwise, the
+ * currently executing thread is placed at the rear of the
+ * FIFO for this priority and a new heir is selected.
+ */
+
+void _Thread_Reset_timeslice( void );
+
+/*
+ * _Thread_Tickle_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked as part of processing each clock tick.
+ * It is responsible for determining if the current thread allows
+ * timeslicing and, if so, when its timeslice expires.
+ */
+
+void _Thread_Tickle_timeslice( void );
+
+/*
+ * _Thread_Yield_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread of equal
+ * or greater priority.
+ */
+
+void _Thread_Yield_processor( void );
+
+/*
+ * _Thread_Load_environment
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the context of the_thread to its
+ * appropriate starting state.
+ */
+
+void _Thread_Load_environment(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the wrapper function for all threads. It is
+ * the starting point for all threads. The user provided thread
+ * entry point is invoked by this routine. Operations
+ * which must be performed immediately before and after the user's
+ * thread executes are found here.
+ */
+
+void _Thread_Handler( void );
+
+/*
+ * _Thread_Delay_ended
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread must be unblocked at the
+ * end of a time based delay (i.e. wake after or wake when).
+ */
+
+void _Thread_Delay_ended(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * _Thread_Change_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the current priority of the_thread to
+ * new_priority. It performs any necessary scheduling operations
+ * including the selection of a new heir thread.
+ */
+
+void _Thread_Change_priority (
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine updates the priority related fields in the_thread
+ * control block to indicate the current priority is now new_priority.
+ */
+
+void _Thread_Set_priority(
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Evaluate_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine XXX
+ */
+
+boolean _Thread_Evaluate_mode( void );
+
+/*
+ * _Thread_Get
+ *
+ * NOTE: If we are not using static inlines, this must be a real
+ * subroutine call.
+ */
+
+#ifndef USE_INLINES
+Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+#endif
+
+/*
+ * _Thread_Idle_body
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the body of the system idle thread.
+ */
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
+Thread _Thread_Idle_body(
+ unsigned32 ignored
+);
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/thread.inl>
+#endif
+#include <rtems/score/threadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/threadmp.h b/c/src/exec/score/headers/threadmp.h
new file mode 100644
index 0000000000..0466a04065
--- /dev/null
+++ b/c/src/exec/score/headers/threadmp.h
@@ -0,0 +1,89 @@
+/* threadmp.h
+ *
+ * This include file contains the specification for all routines
+ * and data specific to the multiprocessing portion of the thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_THREAD_MP_h
+#define __RTEMS_THREAD_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Thread_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the multiprocessing portion of the Thread Handler.
+ */
+
+void _Thread_MP_Handler_initialization (
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_MP_Allocate_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This allocates a proxy control block from
+ * the inactive chain of free proxy control blocks.
+ *
+ * NOTE: This function returns a thread control pointer
+ * because proxies are substitutes for remote threads.
+ */
+
+Thread_Control *_Thread_MP_Allocate_proxy (
+ States_Control the_state
+);
+
+/*
+ * _Thread_MP_Find_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the proxy control block for the specified
+ * id from the active chain of proxy control blocks.
+ */
+
+Thread_Control *_Thread_MP_Find_proxy (
+ Objects_Id the_id
+);
+
+/*
+ * The following is used to determine when the multiprocessing receive
+ * thread is executing so that a proxy can be allocated instead of
+ * blocking the multiprocessing receive thread.
+ */
+
+EXTERN Thread_Control *_Thread_MP_Receive;
+
+/*
+ * The following chains are used to manage proxies.
+ */
+
+EXTERN Chain_Control _Thread_MP_Active_proxies;
+EXTERN Chain_Control _Thread_MP_Inactive_proxies;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/threadmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/threadq.h b/c/src/exec/score/headers/threadq.h
new file mode 100644
index 0000000000..6a074daf16
--- /dev/null
+++ b/c/src/exec/score/headers/threadq.h
@@ -0,0 +1,301 @@
+/* threadq.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_h
+#define __THREAD_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tqdata.h>
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * Constant for indefinite wait.
+ */
+
+#define THREAD_QUEUE_WAIT_FOREVER WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following type defines the callout used when a remote task
+ * is extracted from a local thread queue.
+ */
+
+typedef void ( *Thread_queue_Flush_callout )(
+ Thread_Control *
+ );
+
+/*
+ * The following type defines the callout used when a local task
+ * is extracted from a remote thread queue (i.e. it's proxy must
+ * extracted from the remote queue).
+ */
+
+typedef void ( *Thread_queue_Extract_callout )(
+ Thread_Control *
+ );
+
+EXTERN Thread_queue_Extract_callout
+ _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
+
+/*
+ * _Thread_queue_Dequeue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to a thread waiting on
+ * the_thread_queue. The selection of this thread is based on
+ * the discipline of the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout.
+ */
+
+void _Thread_queue_Enqueue(
+ Thread_queue_Control *the_thread_queue,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_Extract_with_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_thread from the_thread_queue
+ * and insures that if there is a proxy for this task on
+ * another node, it is also dealt with.
+ */
+
+boolean _Thread_queue_Extract_with_proxy(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is selected
+ * based on the discipline of the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine unblocks all threads blocked on the_thread_queue
+ * and cancels any associated timeouts.
+ */
+
+void _Thread_queue_Flush(
+ Thread_queue_Control *the_thread_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ * _Thread_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_thread_queue based on the
+ * discipline indicated in attribute_set. The state set on
+ * threads which block on the_thread_queue is state.
+ */
+
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ Objects_Classes the_class,
+ Thread_queue_Disciplines the_discipline,
+ States_Control state,
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
+);
+
+/*
+ * _Thread_queue_Dequeue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * thread waiting on the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * priority discipline.
+ */
+
+void _Thread_queue_Enqueue_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is the highest
+ * priority thread waiting on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Dequeue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the thread which has
+ * been waiting the longest on the_thread_queue. If no
+ * threads are waiting on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * FIFO discipline.
+ */
+
+void _Thread_queue_Enqueue_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The first thread is the thread
+ * which has been waiting longest on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's request has not
+ * been satisfied after the timeout interval specified to
+ * enqueue. The task represented by ID will be unblocked and
+ * its status code will be set in it's control block to indicate
+ * that a timeout has occurred.
+ */
+
+void _Thread_queue_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/tod.h b/c/src/exec/score/headers/tod.h
new file mode 100644
index 0000000000..b0fb686014
--- /dev/null
+++ b/c/src/exec/score/headers/tod.h
@@ -0,0 +1,260 @@
+/* tod.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_h
+#define __TIME_OF_DAY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following constants are related to the time of day.
+ */
+
+#define TOD_SECONDS_PER_MINUTE 60
+#define TOD_MINUTES_PER_HOUR 60
+#define TOD_MONTHS_PER_YEAR 12
+#define TOD_DAYS_PER_YEAR 365
+#define TOD_HOURS_PER_DAY 24
+#define TOD_SECONDS_PER_DAY (TOD_SECONDS_PER_MINUTE * \
+ TOD_MINUTES_PER_HOUR * \
+ TOD_HOURS_PER_DAY)
+
+#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY)
+
+#define TOD_MICROSECONDS_PER_SECOND 1000000
+#define TOD_MILLISECONDS_PER_SECOND 1000
+
+/*
+ * The following constant define the earliest year to which an
+ * time of day can be initialized. This is considered the
+ * epoch.
+ */
+
+#define TOD_BASE_YEAR 1988
+
+/*
+ * The following record defines the time of control block. This
+ * control block is used to maintain the current time of day.
+ */
+
+typedef struct { /* RTEID style time/date */
+ unsigned32 year; /* year, A.D. */
+ unsigned32 month; /* month, 1 -> 12 */
+ unsigned32 day; /* day, 1 -> 31 */
+ unsigned32 hour; /* hour, 0 -> 23 */
+ unsigned32 minute; /* minute, 0 -> 59 */
+ unsigned32 second; /* second, 0 -> 59 */
+ unsigned32 ticks; /* elapsed ticks between secs */
+} TOD_Control;
+
+/*
+ * The following contains the current time of day.
+ */
+
+EXTERN TOD_Control _TOD_Current;
+
+/*
+ * The following contains the number of seconds from 00:00:00
+ * January 1, TOD_BASE_YEAR until the current time of day.
+ */
+
+EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
+
+/*
+ * The following contains the number of ticks since the
+ * system was booted.
+ */
+
+EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
+
+/*
+ * The following contains the number of microseconds per tick.
+ */
+
+EXTERN unsigned32 _TOD_Microseconds_per_tick;
+
+/*
+ * The following contains the number of clock ticks per second.
+ *
+ * NOTE:
+ *
+ * If one second is NOT evenly divisible by the number of microseconds
+ * per clock tick, this value will contain only the integer portion
+ * of the division. This means that the interval between clock ticks
+ * can be a source of error in the current time of day.
+ */
+
+EXTERN unsigned32 _TOD_Ticks_per_second;
+
+/*
+ * This is the control structure for the watchdog timer which
+ * fires to service the seconds chain.
+ */
+
+EXTERN Watchdog_Control _TOD_Seconds_watchdog;
+
+#ifdef INIT
+
+/*
+ * The following array contains the number of days in all months.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ * The second dimension should range from 1 to 12 for January to
+ * February, respectively.
+ */
+
+const unsigned32 _TOD_Days_per_month[ 2 ][ 13 ] = {
+ { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+/*
+ * The following array contains the number of days in all months
+ * up to the month indicated by the index of the second dimension.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ */
+
+const unsigned16 _TOD_Days_to_date[2][13] = {
+ { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
+ { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
+};
+
+/*
+ * The following array contains the number of days in the years
+ * since the last leap year. The index should be 0 for leap
+ * years, and the number of years since the beginning of a leap
+ * year otherwise.
+ */
+
+const unsigned16 _TOD_Days_since_last_leap_year[4] = { 0, 366, 761, 1126 };
+
+#else
+
+extern const unsigned16 _TOD_Days_to_date[2][13]; /* Julian days */
+extern const unsigned16 _TOD_Days_since_last_leap_year[4];
+extern const unsigned32 _TOD_Days_per_month[2][13];
+
+#endif
+
+/*
+ * _TOD_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _TOD_Handler_initialization(
+ unsigned32 microseconds_per_tick
+);
+
+/*
+ * _TOD_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current time of day to THE_TOD and
+ * the equivalent SECONDS_SINCE_EPOCH.
+ */
+
+void _TOD_Set(
+ TOD_Control *the_tod,
+ Watchdog_Interval seconds_since_epoch
+);
+
+/*
+ * _TOD_Validate
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if THE_TOD contains
+ * a valid time of day, and FALSE otherwise.
+ */
+
+boolean _TOD_Validate(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_To_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number seconds between the epoch and THE_TOD.
+ */
+
+Watchdog_Interval _TOD_To_seconds(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is scheduled as a watchdog function and is invoked at
+ * each second boundary. It updates the current time of day to indicate
+ * that a second has passed and processes the seconds watchdog chain.
+ */
+
+void _TOD_Tickle(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * TOD_MILLISECONDS_TO_MICROSECONDS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to microseconds.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000)
+
+/*
+ * TOD_MILLISECONDS_TO_TICKS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to ticks.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_TICKS(_ms) \
+ (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tod.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/tqdata.h b/c/src/exec/score/headers/tqdata.h
new file mode 100644
index 0000000000..c9c9585f7f
--- /dev/null
+++ b/c/src/exec/score/headers/tqdata.h
@@ -0,0 +1,91 @@
+/* tqdata.h
+ *
+ * This include file contains all the constants and structures
+ * needed to declare a thread queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_h
+#define __THREAD_QUEUE_DATA_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+
+/*
+ * The following enumerated type details all of the disciplines
+ * supported by the Thread Queue Handler.
+ */
+
+typedef enum {
+ THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */
+ THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */
+} Thread_queue_Disciplines;
+
+/*
+ * The following enumerated types indicate what happened while the thread
+ * queue was in the synchronization window.
+ */
+
+typedef enum {
+ THREAD_QUEUE_SYNCHRONIZED,
+ THREAD_QUEUE_NOTHING_HAPPENED,
+ THREAD_QUEUE_TIMEOUT,
+ THREAD_QUEUE_SATISFIED
+} Thread_queue_States;
+
+/*
+ * The following constants are used to manage the priority queues.
+ *
+ * There are four chains used to maintain a priority -- each chain
+ * manages a distinct set of task priorities. The number of chains
+ * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS.
+ * The following set must be consistent.
+ *
+ * The set below configures 4 headers -- each contains 64 priorities.
+ * Header x manages priority range (x*64) through ((x*64)+63). If
+ * the priority is more than half way through the priority range it
+ * is in, then the search is performed from the rear of the chain.
+ * This halves the search time to find the insertion point.
+ */
+
+#define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4
+#define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64
+#define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20
+
+typedef struct {
+ union {
+ Chain_Control Fifo; /* FIFO discipline list */
+ Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS];
+ /* priority discipline list */
+ } Queues;
+ Thread_queue_States sync_state; /* alloc/dealloc critical section */
+ Thread_queue_Disciplines discipline; /* queue discipline */
+ States_Control state; /* state of threads on Thread_q */
+ unsigned32 timeout_status;
+ unsigned32 count;
+} Thread_queue_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tqdata.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/userext.h b/c/src/exec/score/headers/userext.h
new file mode 100644
index 0000000000..1a6ac3437e
--- /dev/null
+++ b/c/src/exec/score/headers/userext.h
@@ -0,0 +1,213 @@
+/* userext.h
+ *
+ * This include file contains all information about user extensions. This
+ * Handler provides mechanisms which can be used to initialize and manipulate
+ * all user extensions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_h
+#define __USER_EXTENSIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/interr.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following records defines the User Extension Table.
+ * This table defines the application dependent routines which
+ * are invoked at critical points in the life of each thread and
+ * the system as a whole.
+ */
+
+typedef void User_extensions_routine;
+
+typedef boolean ( *User_extensions_thread_create_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_delete_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_start_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_restart_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_begin_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_fatal_extension )(
+ Internal_errors_Source /* the_source */,
+ boolean /* is_internal */,
+ unsigned32 /* the_error */
+ );
+
+
+typedef struct {
+ User_extensions_thread_create_extension thread_create;
+ User_extensions_thread_start_extension thread_start;
+ User_extensions_thread_restart_extension thread_restart;
+ User_extensions_thread_delete_extension thread_delete;
+ User_extensions_thread_switch_extension thread_switch;
+ User_extensions_thread_begin_extension thread_begin;
+ User_extensions_thread_exitted_extension thread_exitted;
+ User_extensions_fatal_extension fatal;
+} User_extensions_Table;
+
+/*
+ * The following is used to manage each user extension set.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ User_extensions_Table Callouts;
+} User_extensions_Control;
+
+/*
+ * The following contains the static extension set which may be
+ * configured by the application.
+ */
+
+EXTERN User_extensions_Control _User_extensions_Initial;
+
+/*
+ * The following is used to manage the list of active extensions.
+ */
+
+EXTERN Chain_Control _User_extensions_List;
+
+/*
+ * _User_extensions_Thread_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread creation operate.
+ */
+
+boolean _User_extensions_Thread_create (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread deletion operation.
+ */
+
+void _User_extensions_Thread_delete (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread start operation.
+ */
+
+void _User_extensions_Thread_start (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread restart operation.
+ */
+
+void _User_extensions_Thread_restart (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_begin
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread begins.
+ */
+
+void _User_extensions_Thread_begin (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Thread_exitted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread exits.
+ */
+
+void _User_extensions_Thread_exitted (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Fatal
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension invoked
+ * when a fatal error occurs.
+ */
+
+void _User_extensions_Fatal (
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/userext.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/watchdog.h b/c/src/exec/score/headers/watchdog.h
new file mode 100644
index 0000000000..9b13407c8e
--- /dev/null
+++ b/c/src/exec/score/headers/watchdog.h
@@ -0,0 +1,185 @@
+/* watchdog.h
+ *
+ * This include file contains all the constants and structures associated
+ * with watchdog timers. This Handler provides mechanisms which can be
+ * used to initialize and manipulate watchdog timers.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_h
+#define __WATCHDOG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following type defines the control block used to manage
+ * intervals.
+ */
+
+typedef unsigned32 Watchdog_Interval;
+
+/*
+ * The following types define a pointer to a watchdog service routine.
+ */
+
+typedef void Watchdog_Service_routine;
+
+typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
+ Objects_Id,
+ void *
+ );
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define WATCHDOG_NO_TIMEOUT 0
+
+/*
+ * The following enumerated type lists the states in which a
+ * watchdog timer may be at any given time.
+ */
+
+typedef enum {
+ WATCHDOG_INACTIVE, /* off all chains */
+ WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
+ WATCHDOG_ACTIVE, /* on chain, allowed to fire */
+ WATCHDOG_REMOVE_IT /* on chain, remove without firing if expires */
+} Watchdog_States;
+
+/*
+ * The following enumerated type details the manner in which
+ * a watchdog chain may be adjusted by the Watchdog_Adjust
+ * routine. The direction indicates a movement FORWARD
+ * or BACKWARD in time.
+ */
+
+typedef enum {
+ WATCHDOG_FORWARD, /* adjust delta value forward */
+ WATCHDOG_BACKWARD /* adjust delta value backward */
+} Watchdog_Adjust_directions;
+
+/*
+ * The following record defines the control block used
+ * to manage each watchdog timer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Watchdog_States state;
+ Watchdog_Interval initial;
+ Watchdog_Interval delta_interval;
+ Watchdog_Service_routine_entry routine;
+ Objects_Id id;
+ void *user_data;
+} Watchdog_Control;
+
+/*
+ * The following are used for synchronization purposes
+ * during an insert on a watchdog delta chain.
+ */
+
+EXTERN volatile unsigned32 _Watchdog_Sync_level;
+EXTERN volatile unsigned32 _Watchdog_Sync_count;
+
+/*
+ * The following defines the watchdog chains which are managed
+ * on ticks and second boundaries.
+ */
+
+EXTERN Chain_Control _Watchdog_Ticks_chain;
+EXTERN Chain_Control _Watchdog_Seconds_chain;
+
+/*
+ * _Watchdog_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the watchdog handler. The watchdog
+ * synchronization flag is initialized and the watchdog chains are
+ * initialized and emptied.
+ */
+
+void _Watchdog_Handler_initialization( void );
+
+/*
+ * _Watchdog_Remove
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes THE_WATCHDOG from the watchdog chain on which
+ * it resides and returns the state THE_WATCHDOG timer was in.
+ */
+
+Watchdog_States _Watchdog_Remove (
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Adjust
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the HEADER watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+void _Watchdog_Adjust (
+ Chain_Control *header,
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+);
+
+/*
+ * _Watchdog_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the HEADER watchdog chain
+ * for a time of UNITS. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ *
+ */
+
+void _Watchdog_Insert (
+ Chain_Control *header,
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at appropriate intervals to update
+ * the HEADER watchdog chain.
+ */
+
+void _Watchdog_Tickle (
+ Chain_Control *header
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/watchdog.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/headers/wkspace.h b/c/src/exec/score/headers/wkspace.h
new file mode 100644
index 0000000000..9814a707b1
--- /dev/null
+++ b/c/src/exec/score/headers/wkspace.h
@@ -0,0 +1,71 @@
+/* wkspace.h
+ *
+ * This include file contains information related to the
+ * RAM Workspace. This Handler provides mechanisms which can be used to
+ * define, initialize and manipulate the workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_h
+#define __WORKSPACE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+
+/*
+ * The following is used to manage the Workspace.
+ *
+ */
+
+EXTERN Heap_Control _Workspace_Area; /* executive heap header */
+
+/*
+ * _Workspace_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Workspace_Handler_initialization(
+ void *starting_address,
+ unsigned32 size
+);
+
+/*
+ * _Workspace_Allocate_or_fatal_error
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then the internal error handler is invoked.
+ */
+
+void *_Workspace_Allocate_or_fatal_error(
+ unsigned32 size
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/wkspace.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/debug.h b/c/src/exec/score/include/rtems/debug.h
new file mode 100644
index 0000000000..afe6251bbe
--- /dev/null
+++ b/c/src/exec/score/include/rtems/debug.h
@@ -0,0 +1,98 @@
+/* debug.h
+ *
+ * This include file contains the information pertaining to the debug
+ * support within RTEMS. It is currently cast in the form of a
+ * Manager since it is externally accessible.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DEBUG_h
+#define __RTEMS_DEBUG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type is used to manage the debug mask.
+ */
+
+typedef unsigned32 rtems_debug_control;
+
+/*
+ * These constants represent various classes of debugging.
+ */
+
+#define RTEMS_DEBUG_ALL_MASK 0xffffffff
+#define RTEMS_DEBUG_REGION 0x00000001
+
+/*
+ * This variable contains the current debug level.
+ */
+
+EXTERN rtems_debug_control _Debug_Level;
+
+/*
+ * _Debug_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Debug_Manager_initialization( void );
+
+/*
+ * rtems_debug_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables the specified types of debug checks.
+ */
+
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+);
+
+/*
+ * rtems_debug_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables the specified types of debug checks.
+ */
+
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+);
+
+/*
+ *
+ * _Debug_Is_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the requested debug level is
+ * enabled, and FALSE otherwise.
+ */
+
+boolean _Debug_Is_enabled(
+ rtems_debug_control level
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/address.h b/c/src/exec/score/include/rtems/score/address.h
new file mode 100644
index 0000000000..d9be75ee4b
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/address.h
@@ -0,0 +1,31 @@
+/* address.h
+ *
+ * This include file contains the information required to manipulate
+ * physical addresses.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ADDRESSES_h
+#define __RTEMS_ADDRESSES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/apiext.h b/c/src/exec/score/include/rtems/score/apiext.h
new file mode 100644
index 0000000000..44e7bc8dd3
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/apiext.h
@@ -0,0 +1,102 @@
+/* apiext.h
+ *
+ * XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __API_EXTENSIONS_h
+#define __API_EXTENSIONS_h
+
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The control structure which defines the points at which an API
+ * can add an extension to the system initialization thread.
+ */
+
+typedef void (*API_extensions_Predriver_hook)(void);
+typedef void (*API_extensions_Postdriver_hook)(void);
+typedef void (*API_extensions_Postswitch_hook)(
+ Thread_Control *
+ );
+
+
+typedef struct {
+ Chain_Node Node;
+ API_extensions_Predriver_hook predriver_hook;
+ API_extensions_Postdriver_hook postdriver_hook;
+ API_extensions_Postswitch_hook postswitch_hook;
+} API_extensions_Control;
+
+/*
+ * This is the list of API extensions to the system initialization.
+ */
+
+EXTERN Chain_Control _API_extensions_List;
+
+/*
+ * _API_extensions_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the API extension handler.
+ *
+ */
+
+void _API_extensions_Initialization( void );
+
+/*
+ * _API_extensions_Add
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Add(
+ API_extensions_Control *the_extension
+);
+
+/*
+ * _API_extensions_Run_predriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_predriver( void );
+
+/*
+ * _API_extensions_Run_postdriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postdriver( void );
+
+/*
+ * _API_extensions_Run_postswitch
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postswitch( void );
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/bitfield.h b/c/src/exec/score/include/rtems/score/bitfield.h
new file mode 100644
index 0000000000..6dbf1e0ba0
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/bitfield.h
@@ -0,0 +1,98 @@
+/* bitfield.h
+ *
+ * This include file contains all bit field manipulation routines.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_BITFIELD_h
+#define __RTEMS_BITFIELD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Bitfield_Find_first_bit
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the bit_number of the first bit set
+ * in the specified value. The correspondence between bit_number
+ * and actual bit position is processor dependent. The search for
+ * the first bit set may run from most to least significant bit
+ * or vice-versa.
+ *
+ * NOTE:
+ *
+ * This routine is used when the executing thread is removed
+ * from the ready state and, as a result, its performance has a
+ * significant impact on the performance of the executive as a whole.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
+
+#ifndef INIT
+ extern const unsigned char __log2table[256];
+#else
+const unsigned char __log2table[256] = {
+ 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
+
+#endif
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ _CPU_Bitfield_Find_first_bit( _value, _bit_number )
+
+#else
+
+/*
+ * The following must be a macro because if a CPU specific version
+ * is used it will most likely use inline assembly.
+ */
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ { \
+ register __value = (_value); \
+ register const unsigned char *__p = __log2table; \
+ \
+ if ( __value < 0x100 ) \
+ (_bit_number) = __p[ __value ] + 8; \
+ else \
+ (_bit_number) = __p[ __value >> 8 ]; \
+ }
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/chain.h b/c/src/exec/score/include/rtems/score/chain.h
new file mode 100644
index 0000000000..11c1f8aee0
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/chain.h
@@ -0,0 +1,168 @@
+/* chain.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Doubly Linked Chain Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CHAIN_h
+#define __RTEMS_CHAIN_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+
+/*
+ * This is used to manage each element (node) which is placed
+ * on a chain.
+ *
+ * NOTE: Typically, a more complicated structure will use the
+ * chain package. The more complicated structure will
+ * include a chain node as the first element in its
+ * control structure. It will then call the chain package
+ * with a pointer to that node element. The node pointer
+ * and the higher level structure start at the same address
+ * so the user can cast the pointers back and forth.
+ *
+ */
+
+typedef struct Chain_Node_struct Chain_Node;
+
+struct Chain_Node_struct {
+ Chain_Node *next;
+ Chain_Node *previous;
+};
+
+/*
+ * This is used to manage a chain. A chain consists of a doubly
+ * linked list of zero or more nodes.
+ *
+ * NOTE: This implementation does not require special checks for
+ * manipulating the first and last elements on the chain.
+ * To accomplish this the chain control structure is
+ * treated as two overlapping chain nodes. The permanent
+ * head of the chain overlays a node structure on the
+ * first and permanent_null fields. The permanent tail
+ * of the chain overlays a node structure on the
+ * permanent_null and last elements of the structure.
+ *
+ */
+
+typedef struct {
+ Chain_Node *first;
+ Chain_Node *permanent_null;
+ Chain_Node *last;
+} Chain_Control;
+
+/*
+ * _Chain_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_chain structure to manage the
+ * contiguous array of number_nodes nodes which starts at
+ * starting_address. Each node is of node_size bytes.
+ *
+ */
+
+void _Chain_Initialize(
+ Chain_Control *the_chain,
+ void *starting_address,
+ unsigned32 number_nodes,
+ unsigned32 node_size
+);
+
+/*
+ * _Chain_Get_first_unprotected
+ */
+
+#ifndef USE_INLINES
+Chain_Node *_Chain_Get_first_unprotected(
+ Chain_Control *the_chain
+);
+#endif
+
+/*
+ * _Chain_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It disables interrupts to insure the atomicity of the
+ * extract operation.
+ *
+ */
+
+void _Chain_Extract(
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It disables interrupts to insure the atomicity of the
+ * get operation.
+ *
+ */
+
+Chain_Node *_Chain_Get(
+ Chain_Control *the_chain
+);
+
+/*
+ * _Chain_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It disables interrupts to insure the atomicity
+ * of the extract operation.
+ *
+ */
+
+void _Chain_Insert(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * append operation.
+ *
+ */
+
+void _Chain_Append(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/chain.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/context.h b/c/src/exec/score/include/rtems/score/context.h
new file mode 100644
index 0000000000..4cd1f1e4c5
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/context.h
@@ -0,0 +1,134 @@
+/* context.h
+ *
+ * This include file contains all information about a context.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONTEXT_h
+#define __RTEMS_CONTEXT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/cpu.h>
+
+/*
+ * The following constant defines the number of bytes required
+ * to store a full floating point context.
+ */
+
+#define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE
+
+/*
+ * The following variable is set to TRUE when a reschedule operation
+ * has determined that the processor should be taken away from the
+ * currently executing thread and given to the heir thread.
+ */
+
+EXTERN boolean _Context_Switch_necessary;
+
+/*
+ * _Context_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes THE_CONTEXT such that the stack
+ * pointer, interrupt level, and entry point are correct for the
+ * thread's initial state.
+ */
+
+#define \
+ _Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp ) \
+ _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp )
+
+/*
+ * _Context_Switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current context into the EXECUTING
+ * context record and restores the context specified by HEIR.
+ */
+
+#define _Context_Switch( _executing, _heir ) \
+ _CPU_Context_switch( _executing, _heir )
+
+/*
+ * _Context_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine restarts the calling thread by restoring its initial
+ * stack pointer and returning to the thread's entry point.
+ */
+
+#define _Context_Restart_self( _the_context ) \
+ _CPU_Context_Restart_self( _the_context )
+
+/*
+ * _Context_Fp_start
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the floating
+ * point context save area. It is assumed that the are reserved
+ * for the floating point save area is large enough.
+ */
+
+#define _Context_Fp_start( _base, _offset ) \
+ _CPU_Context_Fp_start( (_base), (_offset) )
+
+/*
+ * _Context_Initialize_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the floating point context save
+ * area to contain an initial known state.
+ */
+
+#define _Context_Initialize_fp( _fp_area ) \
+ _CPU_Context_Initialize_fp( _fp_area )
+
+/*
+ * _Context_Restore_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine restores the floating point context contained
+ * in the FP_CONTEXT area. It is assumed that the current
+ * floating point context has been saved by a previous invocation
+ * of SAVE_FP.
+ */
+
+#define _Context_Restore_fp( _fp ) \
+ _CPU_Context_restore_fp( _fp )
+
+/*
+ * _Context_Save_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current floating point context
+ * in the FP_CONTEXT area.
+ */
+
+#define _Context_Save_fp( _fp ) \
+ _CPU_Context_save_fp( _fp )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/copyrt.h b/c/src/exec/score/include/rtems/score/copyrt.h
new file mode 100644
index 0000000000..c711ba09b3
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/copyrt.h
@@ -0,0 +1,42 @@
+/* copyrt.h
+ *
+ * This include file contains the copyright notice for RTEMS
+ * which is included in every binary copy of the executive.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_COPYRIGHT_h
+#define __RTEMS_COPYRIGHT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef INIT
+
+const char _Copyright_Notice[] =
+"COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n\
+On-Line Applications Research Corporation (OAR).\n\
+All rights assigned to U.S. Government, 1994.\n";
+
+#else
+
+extern const char _Copyright_Notice[];
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/coremsg.h b/c/src/exec/score/include/rtems/score/coremsg.h
new file mode 100644
index 0000000000..b51e07ef61
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/coremsg.h
@@ -0,0 +1,274 @@
+/* coremsg.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message queue Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
+#define __RTEMS_CORE_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on message_queues.
+ */
+
+typedef void ( *CORE_message_queue_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * The following defines the data types needed to manipulate
+ * the contents of message buffers.
+ * Since msgs are variable length we just make a ptr to 1.
+ */
+
+typedef struct {
+ unsigned32 size;
+
+#ifndef __cplusplus
+ /* NOTE: [0] is gcc specific,
+ * but specifically disallowed by ANSI STD C++
+ * g++ warns about it, so we #ifdef it out to
+ * get rid of warnings when compiled by g++.
+ */
+ unsigned32 buffer[0];
+#endif
+
+} CORE_message_queue_Buffer;
+
+/*
+ * The following records define the organization of a message
+ * buffer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ CORE_message_queue_Buffer Contents;
+} CORE_message_queue_Buffer_control;
+
+/*
+ * Blocking disciplines for a message_queue.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
+} CORE_message_queue_Disciplines;
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_SEND_REQUEST = 0,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
+} CORE_message_queue_Submit_types;
+
+/*
+ * Core Message queue handler return statuses.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
+ CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
+ CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+} CORE_message_queue_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each message queue.
+ */
+
+typedef struct {
+ CORE_message_queue_Disciplines discipline;
+} CORE_message_queue_Attributes;
+
+/*
+ * The following defines the type for a Notification handler. A notification
+ * handler is invoked when the message queue makes a 0->1 transition on
+ * pending messages.
+ */
+
+typedef void (*CORE_message_queue_Notify_Handler)( void * );
+
+/*
+ * The following defines the control block used to manage each
+ * counting message_queue.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_message_queue_Attributes Attributes;
+ unsigned32 maximum_pending_messages;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_message_size;
+ Chain_Control Pending_messages;
+ CORE_message_queue_Buffer *message_buffers;
+ CORE_message_queue_Notify_Handler notify_handler;
+ void *notify_argument;
+ Chain_Control Inactive_messages;
+} CORE_message_queue_Control;
+
+/*
+ * _CORE_message_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the message_queue based on the parameters passed.
+ */
+
+boolean _CORE_message_queue_Initialize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Classes the_class,
+ CORE_message_queue_Attributes *the_message_queue_attributes,
+ unsigned32 maximum_pending_messages,
+ unsigned32 maximum_message_size,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_message_queue_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function closes a message by returning all allocated space and
+ * flushing the message_queue's task wait queue.
+ */
+
+void _CORE_message_queue_Close(
+ CORE_message_queue_Control *the_message_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ *
+ * _CORE_message_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This function flushes the message_queue's task wait queue. The number
+ * messages flushed from the queue is returned.
+ *
+ */
+
+unsigned32 _CORE_message_queue_Flush(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ * _CORE_message_queue_Flush_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine flushes all outstanding messages and returns
+ * them to the inactive message chain.
+ */
+
+unsigned32 _CORE_message_queue_Flush_support(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *
+ * _CORE_message_queue_Broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This function sends a message for every thread waiting on the queue and
+ * returns the number of threads made ready by the message.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Seize
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+void _CORE_message_queue_Seize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremsg.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/include/rtems/score/coremutex.h b/c/src/exec/score/include/rtems/score/coremutex.h
new file mode 100644
index 0000000000..73b7e34417
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/coremutex.h
@@ -0,0 +1,171 @@
+/* mutex.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Mutex Handler. A mutex is an enhanced version of the standard
+ * Dijkstra binary semaphore used to provide synchronization and mutual
+ * exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MUTEX_h
+#define __RTEMS_CORE_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on mutexes.
+ */
+
+typedef void ( *CORE_mutex_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a mutex.
+ */
+
+typedef enum {
+ CORE_MUTEX_DISCIPLINES_FIFO,
+ CORE_MUTEX_DISCIPLINES_PRIORITY,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+} CORE_mutex_Disciplines;
+
+/*
+ * Mutex handler return statuses.
+ */
+
+typedef enum {
+ CORE_MUTEX_STATUS_SUCCESSFUL,
+ CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
+ CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
+ CORE_MUTEX_WAS_DELETED,
+ CORE_MUTEX_TIMEOUT
+} CORE_mutex_Status;
+
+/*
+ * Locked and unlocked values
+ */
+
+#define CORE_MUTEX_UNLOCKED 1
+#define CORE_MUTEX_LOCKED 0
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each mutex.
+ */
+
+typedef struct {
+ boolean allow_nesting;
+ CORE_mutex_Disciplines discipline;
+ Priority_Control priority_ceiling;
+} CORE_mutex_Attributes;
+
+/*
+ * The following defines the control block used to manage each mutex.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_mutex_Attributes Attributes;
+ unsigned32 lock;
+ unsigned32 nest_count;
+ Thread_Control *holder;
+ Objects_Id holder_id;
+} CORE_mutex_Control;
+
+/*
+ * _CORE_mutex_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the mutex based on the parameters passed.
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_mutex_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_mutex.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+);
+
+/*
+ * _CORE_mutex_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a mutex by flushing the associated
+ * wait queue.
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremutex.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/include/rtems/score/coresem.h b/c/src/exec/score/include/rtems/score/coresem.h
new file mode 100644
index 0000000000..88f712be5d
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/coresem.h
@@ -0,0 +1,156 @@
+/* core_sem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Counting Semaphore Handler. A counting semaphore is the
+ * standard Dijkstra binary semaphore used to provide synchronization
+ * and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h
+#define __RTEMS_CORE_COUNTING_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on semaphores.
+ */
+
+typedef void ( *CORE_semaphore_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a semaphore.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_DISCIPLINES_FIFO,
+ CORE_SEMAPHORE_DISCIPLINES_PRIORITY
+} CORE_semaphore_Disciplines;
+
+/*
+ * Core Semaphore handler return statuses.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_STATUS_SUCCESSFUL,
+ CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_SEMAPHORE_WAS_DELETED,
+ CORE_SEMAPHORE_TIMEOUT
+} CORE_semaphore_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each semaphore.
+ */
+
+typedef struct {
+ CORE_semaphore_Disciplines discipline;
+} CORE_semaphore_Attributes;
+
+/*
+ * The following defines the control block used to manage each
+ * counting semaphore.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_semaphore_Attributes Attributes;
+ unsigned32 count;
+} CORE_semaphore_Control;
+
+/*
+ * _CORE_semaphore_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the semaphore based on the parameters passed.
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_semaphore_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the semaphore. If a task was blocked waiting
+ * for a unit from this semaphore, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the semaphore.
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+);
+
+/*
+ * _CORE_semaphore_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a semaphore by flushing the
+ * associated wait queue.
+ */
+
+void _CORE_semaphore_Flush(
+ CORE_semaphore_Control *the_semaphore,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coresem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/score/include/rtems/score/heap.h b/c/src/exec/score/include/rtems/score/heap.h
new file mode 100644
index 0000000000..c1a0650d0a
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/heap.h
@@ -0,0 +1,226 @@
+/* heap.h
+ *
+ * This include file contains the information pertaining to the Heap
+ * Handler. A heap is a doubly linked list of variable size
+ * blocks which are allocated using the first fit method. Garbage
+ * collection is performed each time a block is returned to the heap by
+ * coalescing neighbor blocks. Control information for both allocated
+ * and unallocated blocks is contained in the heap space. A heap header
+ * contains control information for the heap.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_HEAP_h
+#define __RTEMS_HEAP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Status codes for heap_extend
+ */
+
+typedef enum {
+ HEAP_EXTEND_SUCCESSFUL,
+ HEAP_EXTEND_ERROR,
+ HEAP_EXTEND_NOT_IMPLEMENTED
+} Heap_Extend_status;
+
+/*
+ * Constants used in the size/used field of each heap block to
+ * indicate when a block is free or in use.
+ */
+
+#define HEAP_BLOCK_USED 1 /* indicates block is in use */
+#define HEAP_BLOCK_FREE 0 /* indicates block is free */
+
+/*
+ * The size/used field value for the dummy front and back flags.
+ */
+
+#define HEAP_DUMMY_FLAG (0 + HEAP_BLOCK_USED)
+
+/*
+ * The following constants reflect various requirements of the
+ * heap data structures which impact the management of a heap.
+ *
+ * NOTE: Because free block overhead is greater than used block
+ * overhead AND a portion of the allocated space is from
+ * the extra free block overhead, the absolute lower bound
+ * of the minimum fragment size is equal to the size of
+ * the free block overhead.
+ */
+
+#define HEAP_OVERHEAD \
+ (sizeof( unsigned32 ) * 2) /* size dummy first and last blocks */
+#define HEAP_BLOCK_USED_OVERHEAD \
+ (sizeof( void * ) * 2) /* num bytes overhead in used block */
+#define HEAP_MINIMUM_SIZE \
+ (HEAP_OVERHEAD + sizeof (Heap_Block))
+ /* min number of bytes the user may */
+ /* specify for the heap size */
+
+/*
+ * The following defines the data structure used to manage
+ * individual blocks in a heap. When the block is allocated, the
+ * next and previous fields are not used by the Heap Handler
+ * and thus the address returned for the block starts at
+ * the address of the next field.
+ *
+ * NOTE: The next and previous pointers are only valid when the
+ * block is free. Caution must be exercised to insure that
+ * allocated blocks are large enough to contain them and
+ * that they are not accidentally overwritten when the
+ * block is actually allocated.
+ */
+
+typedef struct Heap_Block_struct Heap_Block;
+
+struct Heap_Block_struct {
+ unsigned32 back_flag; /* size and status of prev block */
+ unsigned32 front_flag; /* size and status of block */
+ Heap_Block *next; /* pointer to next block */
+ Heap_Block *previous; /* pointer to previous block */
+};
+
+/*
+ * The following defines the control block used to manage each heap.
+ *
+ * NOTE:
+ *
+ * This structure is layed out such that it can be used a a dummy
+ * first and last block on the free block chain. The extra padding
+ * insures the dummy last block is the correct size.
+ *
+ * The first Heap_Block starts at first while the second starts at
+ * final. This is effectively the same trick as is used in the Chain
+ * Handler.
+ */
+
+typedef struct {
+ Heap_Block *start; /* first valid block address in heap */
+ Heap_Block *final; /* last valid block address in heap */
+
+ Heap_Block *first; /* pointer to first block in heap */
+ Heap_Block *permanent_null; /* always NULL pointer */
+ Heap_Block *last; /* pointer to last block in heap */
+ unsigned32 page_size; /* allocation unit */
+ unsigned32 reserved;
+} Heap_Control;
+
+/*
+ * _Heap_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_heap record to manage the
+ * contiguous heap of size bytes which starts at starting_address.
+ * Blocks of memory are allocated from the heap in multiples of
+ * page_size byte units.
+ */
+
+unsigned32 _Heap_Initialize(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 page_size
+);
+
+/*
+ * _Heap_Extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine grows the_heap memory area using the size bytes which
+ * begin at starting_address.
+ */
+
+Heap_Extend_status _Heap_Extend(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 *amount_extended
+);
+
+/*
+ * _Heap_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a block of size bytes from
+ * the_heap. If insufficient memory is free in the_heap to allocate
+ * a block of the requested size, then NULL is returned.
+ */
+
+void *_Heap_Allocate(
+ Heap_Control *the_heap,
+ unsigned32 size
+);
+
+/*
+ * _Heap_Size_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This kernel routine sets size to the size of the given heap block.
+ * It returns TRUE if the starting_address is in the heap, and FALSE
+ * otherwise.
+ */
+
+boolean _Heap_Size_of_user_area(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 *size
+);
+
+/*
+ * _Heap_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the block of memory which begins
+ * at starting_address to the_heap. Any coalescing which is
+ * possible with the freeing of this routine is performed.
+ */
+
+boolean _Heap_Free(
+ Heap_Control *the_heap,
+ void *start_address
+);
+
+/*
+ * _Heap_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine walks the heap to verify its integrity.
+ */
+
+void _Heap_Walk(
+ Heap_Control *the_heap,
+ int source,
+ boolean do_dump
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/heap.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/interr.h b/c/src/exec/score/include/rtems/score/interr.h
new file mode 100644
index 0000000000..b9b2a3c51a
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/interr.h
@@ -0,0 +1,94 @@
+/* interr.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Internal Error Handler.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERNAL_ERROR_h
+#define __RTEMS_INTERNAL_ERROR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This type lists the possible sources from which an error
+ * can be reported.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_CORE,
+ INTERNAL_ERROR_RTEMS_API
+} Internal_errors_Source;
+
+/*
+ * A list of errors which are generated internally by the executive core.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
+ INTERNAL_ERROR_NO_CPU_TABLE,
+ INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS,
+ INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
+ INTERNAL_ERROR_WORKSPACE_ALLOCATION,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
+ INTERNAL_ERROR_THREAD_EXITTED,
+ INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
+ INTERNAL_ERROR_INVALID_NODE,
+ INTERNAL_ERROR_NO_MPCI,
+ INTERNAL_ERROR_BAD_PACKET,
+ INTERNAL_ERROR_OUT_OF_PACKETS,
+ INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
+ INTERNAL_ERROR_OUT_OF_PROXIES,
+ INTERNAL_ERROR_INVALID_GLOBAL_ID,
+ INTERNAL_ERROR_BAD_STACK_HOOK
+} Internal_errors_Core_list;
+
+/*
+ * This type holds the fatal error information.
+ */
+
+typedef struct {
+ Internal_errors_Source the_source;
+ boolean is_internal;
+ unsigned32 the_error;
+} Internal_errors_Information;
+
+/*
+ * When a fatal error occurs, the error information is stored here.
+ */
+
+EXTERN Internal_errors_Information Internal_errors_What_happened;
+
+/*
+ * _Internal_error_Occurred
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the application or the executive itself
+ * determines that a fatal error has occurred.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/isr.h b/c/src/exec/score/include/rtems/score/isr.h
new file mode 100644
index 0000000000..cf8f4cad59
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/isr.h
@@ -0,0 +1,224 @@
+/* isr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the management of processor interrupt levels. This handler
+ * supports interrupt critical sections, vectoring of user interrupt
+ * handlers, nesting of interrupts, and manipulating interrupt levels.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_h
+#define __ISR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * the interrupt level portion of the status register.
+ */
+
+typedef unsigned32 ISR_Level;
+
+/*
+ * The following type defines the type used to manage the vectors.
+ */
+
+typedef unsigned32 ISR_Vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void ISR_Handler;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef ISR_Handler ( *ISR_Handler_entry )(
+ ISR_Vector_number
+ );
+/*
+ * This constant promotes out the number of vectors truly supported by
+ * the current CPU being used. This is usually the number of distinct vectors
+ * the cpu can vector.
+ */
+
+#define ISR_NUMBER_OF_VECTORS CPU_INTERRUPT_NUMBER_OF_VECTORS
+
+/*
+ * This constant promotes out the highest valid interrupt vector number.
+ */
+
+#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER
+
+/*
+ * The following is TRUE if signals have been sent to the currently
+ * executing thread by an ISR handler.
+ */
+
+EXTERN boolean _ISR_Signals_to_thread_executing;
+
+/*
+ * The following contains the interrupt service routine nest level.
+ * When this variable is zero, a thread is executing.
+ */
+
+EXTERN unsigned32 _ISR_Nest_level;
+
+/*
+ * The following declares the Vector Table. Application
+ * interrupt service routines are vectored by the ISR Handler via this table.
+ */
+
+EXTERN ISR_Handler_entry _ISR_Vector_table[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _ISR_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _ISR_Handler_initialization ( void );
+
+/*
+ * _ISR_Disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all interrupts so that a critical section
+ * of code can be executing without being interrupted. Upon return,
+ * the argument _level will contain the previous interrupt mask level.
+ */
+
+#define _ISR_Disable( _level ) \
+ _CPU_ISR_Disable( _level )
+
+/*
+ * _ISR_Enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables interrupts to the previous interrupt mask
+ * LEVEL. It is used at the end of a critical section of code to
+ * enable interrupts so they can be processed again.
+ */
+
+#define _ISR_Enable( _level ) \
+ _CPU_ISR_Enable( _level )
+
+/*
+ * _ISR_Flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables interrupts to the previous
+ * interrupt mask level and then disables all interrupts so that
+ * the caller can continue into the second part of a critical
+ * section. This routine is used to temporarily enable interrupts
+ * during a long critical section. It is used in long sections of
+ * critical code when a point is reached at which interrupts can
+ * be temporarily enabled. Deciding where to flash interrupts
+ * in a long critical section is often difficult and the point
+ * must be selected with care to insure that the critical section
+ * properly protects itself.
+ */
+
+#define _ISR_Flash( _level ) \
+ _CPU_ISR_Flash( _level )
+
+/*
+ * _ISR_Install_vector
+ *
+ * DESCRIPTION:
+ *
+ * This routine installs new_handler as the interrupt service routine
+ * for the specified vector. The previous interrupt service routine is
+ * returned as old_handler.
+ */
+
+#define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \
+ _CPU_ISR_install_vector( _vector, _new_handler, _old_handler )
+
+/*
+ * _ISR_Get_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current interrupt level.
+ */
+
+#define _ISR_Get_level() \
+ _CPU_ISR_Get_level()
+
+/*
+ * _ISR_Set_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * by new_level. The new interrupt level is effective when the
+ * routine exits.
+ */
+
+#define _ISR_Set_level( _new_level ) \
+ _CPU_ISR_Set_level( _new_level )
+
+/*
+ * _ISR_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the interrupt dispatcher. ALL interrupts
+ * are vectored to this routine so that minimal context can be saved
+ * and setup performed before the application's high-level language
+ * interrupt service routine is invoked. After the application's
+ * interrupt service routine returns control to this routine, it
+ * will determine if a thread dispatch is necessary. If so, it will
+ * insure that the necessary thread scheduling operations are
+ * performed when the outermost interrupt service routine exits.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Handler( void );
+
+/*
+ * _ISR_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine provides a wrapper so that the routine
+ * _Thread_Dispatch can be invoked when a reschedule is necessary
+ * at the end of the outermost interrupt service routine. This
+ * wrapper is necessary to establish the processor context needed
+ * by _Thread_Dispatch and to save the processor context which is
+ * corrupted by _Thread_Dispatch. This context typically consists
+ * of registers which are not preserved across routine invocations.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Dispatch( void );
+
+#include <rtems/score/isr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/mpci.h b/c/src/exec/score/include/rtems/score/mpci.h
new file mode 100644
index 0000000000..25d7ac4094
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/mpci.h
@@ -0,0 +1,411 @@
+/* mpci.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the MPCI layer. It provides mechanisms to utilize packets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MPCI_h
+#define __MPCI_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/coresem.h>
+
+/*
+ * The following constants define the stack size requirements for
+ * the system threads.
+ */
+
+#define MPCI_RECEIVE_SERVER_STACK_SIZE \
+ ( STACK_MINIMUM_SIZE + \
+ CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \
+ _CPU_Table.extra_mpci_receive_server_stack \
+ )
+
+/*
+ * The following defines the node number used when a broadcast is desired.
+ */
+
+#define MPCI_ALL_NODES 0
+
+/*
+ * For packets associated with requests that don't already have a timeout,
+ * use the one specified by this MPCI driver. The value specified by
+ * the MPCI driver sets an upper limit on how long a remote request
+ * should take to complete.
+ */
+
+#define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF
+
+/*
+ * The following records define the Multiprocessor Communications
+ * Interface (MPCI) Table. This table defines the user-provided
+ * MPCI which is a required part of a multiprocessor system.
+ *
+ * For non-blocking local operations that become remote operations,
+ * we need a timeout. This is a per-driver timeout: default_timeout
+ */
+
+typedef void MPCI_Entry;
+
+typedef MPCI_Entry ( *MPCI_initialization_entry )( void );
+
+typedef MPCI_Entry ( *MPCI_get_packet_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef MPCI_Entry ( *MPCI_return_packet_entry )(
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_send_entry )(
+ unsigned32,
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_receive_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef struct {
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ MPCI_initialization_entry initialization;
+ MPCI_get_packet_entry get_packet;
+ MPCI_return_packet_entry return_packet;
+ MPCI_send_entry send_packet;
+ MPCI_receive_entry receive_packet;
+} MPCI_Control;
+
+/*
+ * The following defines the type for packet processing routines
+ * invoked by the MPCI Receive server.
+ */
+
+typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
+
+/*
+ * The following enumerated type defines the list of
+ * internal MP operations.
+ */
+
+typedef enum {
+ MPCI_PACKETS_SYSTEM_VERIFY = 0
+} MPCI_Internal_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ MPCI_Internal_Remote_operations operation;
+ unsigned32 maximum_nodes;
+ unsigned32 maximum_global_objects;
+} MPCI_Internal_packet;
+
+/*
+ * This is the core semaphore which the MPCI Receive Server blocks on.
+ */
+
+EXTERN CORE_semaphore_Control _MPCI_Semaphore;
+/*
+ * The following thread queue is used to maintain a list of tasks
+ * which currently have outstanding remote requests.
+ */
+
+EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
+
+/*
+ * The following define the internal pointers to the user's
+ * configuration information.
+ */
+
+EXTERN MPCI_Control *_MPCI_table;
+
+/*
+ * The following points to the MPCI Receive Server.
+ */
+
+EXTERN Thread_Control *_MPCI_Receive_server_tcb;
+
+/*
+ * The following table contains the process packet routines provided
+ * by each object that supports MP operations.
+ */
+
+EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
+
+/*
+ * _MPCI_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table,
+ unsigned32 timeout_status
+);
+
+/*
+ * _MPCI_Create_server
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the packet receive server used in MP systems.
+ */
+
+void _MPCI_Create_server( void );
+
+/*
+ * _MPCI_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the MPCI driver by
+ * invoking the user provided MPCI initialization callout.
+ */
+
+void _MPCI_Initialization ( void );
+
+/*
+ * _MPCI_Register_packet_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine registers the MPCI packet processor for the
+ * designated object class.
+ */
+
+void _MPCI_Register_packet_processor(
+ MP_packet_Classes the_object,
+ MPCI_Packet_processor the_packet_processor
+
+);
+
+/*
+ * _MPCI_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+MP_packet_Prefix *_MPCI_Get_packet ( void );
+
+/*
+ * _MPCI_Return_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a packet by invoking the user provided
+ * MPCI return packet callout.
+ */
+
+void _MPCI_Return_packet (
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a process packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_process_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine 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
+);
+
+/*
+ * _MPCI_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a response packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_response_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Receive_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine receives a packet by invoking the user provided
+ * MPCI receive callout.
+ */
+
+MP_packet_Prefix *_MPCI_Receive_packet ( void );
+
+/*
+ * _MPCI_Process_response
+ *
+ * DESCRIPTION:
+ *
+ * This routine obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+Thread_Control *_MPCI_Process_response (
+ MP_packet_Prefix *the_packet
+);
+
+/*PAGE
+ *
+ * _MPCI_Receive_server
+ *
+ */
+
+Thread _MPCI_Receive_server(
+ unsigned32 ignored
+);
+
+/*PAGE
+ *
+ * _MPCI_Announce
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _MPCI_Announce ( void );
+
+/*
+ * _MPCI_Internal_packets_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _MPCI_Internal_packets_Send_process_packet (
+ MPCI_Internal_Remote_operations operation
+);
+
+/*
+ * _MPCI_Internal_packets_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ *
+ * This routine is not needed since there are no request
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ *
+ * This routine is not needed since there are no response
+ * packets to be sent by this manager.
+ */
+
+/*
+ *
+ * _MPCI_Internal_packets_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _MPCI_Internal_packets_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _MPCI_Internal_packets_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to obtain a internal threads mp packet.
+ */
+
+ MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/mppkt.h b/c/src/exec/score/include/rtems/score/mppkt.h
new file mode 100644
index 0000000000..0c651bc4e8
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/mppkt.h
@@ -0,0 +1,100 @@
+/* mppkt.h
+ *
+ * This package is the specification for the Packet Handler.
+ * This handler defines the basic packet and provides
+ * mechanisms to utilize packets based on this prefix.
+ * Packets are the fundamental basis for messages passed between
+ * nodes in an MP system.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MP_PACKET_h
+#define __MP_PACKET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the packet classes.
+ *
+ * NOTE: In general, each class corresponds to a manager
+ * which supports global operations. Each manager
+ * defines the set of supported operations.
+ */
+
+typedef enum {
+ MP_PACKET_MPCI_INTERNAL = 0,
+ MP_PACKET_TASKS = 1,
+ MP_PACKET_MESSAGE_QUEUE = 2,
+ MP_PACKET_SEMAPHORE = 3,
+ MP_PACKET_PARTITION = 4,
+ MP_PACKET_REGION = 5,
+ MP_PACKET_EVENT = 6,
+ MP_PACKET_SIGNAL = 7
+} MP_packet_Classes;
+
+#define MP_PACKET_CLASSES_FIRST MP_PACKET_MPCI_INTERNAL
+#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL
+
+/*
+ * The following record contains the prefix for every packet
+ * passed between nodes in an MP system.
+ *
+ * NOTE: This structure is padded to insure that anything
+ * following it is on a 16 byte boundary. This is
+ * the most stringent structure alignment rule
+ * encountered yet (i960CA).
+ */
+
+typedef struct {
+ MP_packet_Classes the_class;
+ Objects_Id id;
+ Objects_Id source_tid;
+ Priority_Control source_priority;
+ unsigned32 return_code;
+ unsigned32 length;
+ unsigned32 to_convert;
+ Watchdog_Interval timeout;
+} MP_packet_Prefix;
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define MP_PACKET_MINIMUM_PACKET_SIZE 64
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/mppkt.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/object.h b/c/src/exec/score/include/rtems/score/object.h
new file mode 100644
index 0000000000..d70009c3c9
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/object.h
@@ -0,0 +1,397 @@
+/* object.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Object Handler. This Handler provides mechanisms which
+ * can be used to initialize and manipulate all objects which have
+ * ids.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_h
+#define __OBJECTS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+
+/*
+ * The following type defines the control block used to manage
+ * object names.
+ */
+
+typedef void * Objects_Name;
+
+/*
+ * Space for object names is allocated in multiples of this.
+ *
+ * NOTE: Must be a power of 2. Matches the name manipulation routines.
+ */
+
+#define OBJECTS_NAME_ALIGNMENT 4
+
+/*
+ * Functions which compare names are prototyped like this.
+ */
+
+typedef boolean (*Objects_Name_comparators)(
+ void * /* name_1 */,
+ void * /* name_2 */,
+ unsigned32 /* length */
+);
+
+/*
+ * The following type defines the control block used to manage
+ * object IDs. The format is as follows (0=LSB):
+ *
+ * Bits 0 .. 15 = index
+ * Bits 16 .. 25 = node
+ * Bits 26 .. 31 = class
+ */
+
+typedef unsigned32 Objects_Id;
+
+#define OBJECTS_INDEX_START_BIT 0
+#define OBJECTS_NODE_START_BIT 16
+#define OBJECTS_CLASS_START_BIT 26
+
+#define OBJECTS_INDEX_MASK 0x0000ffff
+#define OBJECTS_NODE_MASK 0x03ff0000
+#define OBJECTS_CLASS_MASK 0xfc000000
+
+#define OBJECTS_INDEX_VALID_BITS 0x0000ffff
+#define OBJECTS_NODE_VALID_BITS 0x000003ff
+#define OBJECTS_CLASS_VALID_BITS 0x000000cf
+
+/*
+ * This enumerated type is used in the class field of the object ID.
+ */
+
+typedef enum {
+ OBJECTS_NO_CLASS = 0,
+ OBJECTS_INTERNAL_THREADS = 1,
+ OBJECTS_RTEMS_TASKS = 2,
+ OBJECTS_POSIX_THREADS = 3,
+ OBJECTS_RTEMS_TIMERS = 4,
+ OBJECTS_RTEMS_SEMAPHORES = 5,
+ OBJECTS_RTEMS_MESSAGE_QUEUES = 6,
+ OBJECTS_RTEMS_PARTITIONS = 7,
+ OBJECTS_RTEMS_REGIONS = 8,
+ OBJECTS_RTEMS_PORTS = 9,
+ OBJECTS_RTEMS_PERIODS = 10,
+ OBJECTS_RTEMS_EXTENSIONS = 11,
+ OBJECTS_POSIX_KEYS = 12,
+ OBJECTS_POSIX_INTERRUPTS = 13,
+ OBJECTS_POSIX_MESSAGE_QUEUES = 14,
+ OBJECTS_POSIX_MUTEXES = 15,
+ OBJECTS_POSIX_SEMAPHORES = 16,
+ OBJECTS_POSIX_CONDITION_VARIABLES = 17
+} Objects_Classes;
+
+#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS
+#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES
+#define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_MPCI_PACKETS
+#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS
+
+/*
+ * This enumerated type lists the locations which may be returned
+ * by _Objects_Get. These codes indicate the success of locating
+ * an object with the specified ID.
+ */
+
+typedef enum {
+ OBJECTS_LOCAL = 0, /* object is local */
+ OBJECTS_REMOTE = 1, /* object is remote */
+ OBJECTS_ERROR = 2 /* id was invalid */
+} Objects_Locations;
+
+/*
+ * The following defines the Object Control Block used to manage
+ * each object local to this node.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Objects_Id id;
+ Objects_Name name;
+} Objects_Control;
+
+/*
+ * The following defines the structure for the information used to
+ * manage each class of objects.
+ */
+
+typedef struct {
+ Objects_Classes the_class; /* Class of this object */
+ Objects_Id minimum_id; /* minimum valid id of this type */
+ Objects_Id maximum_id; /* maximum valid id of this type */
+ unsigned32 maximum; /* maximum number of objects */
+ Objects_Control **local_table; /* table of local object pointers */
+ Objects_Name *name_table; /* table of local object names */
+ Chain_Control *global_table; /* pointer to global table */
+ Chain_Control Inactive; /* chain of inactive ctl blocks */
+ boolean is_string; /* TRUE if names are strings */
+ unsigned32 name_length; /* maximum length of names */
+ boolean is_thread; /* TRUE if these are threads */
+ /* irregardless of API */
+} Objects_Information;
+
+/*
+ * The following defines the data storage which contains the
+ * node number of the local node.
+ */
+
+EXTERN unsigned32 _Objects_Local_node;
+EXTERN unsigned32 _Objects_Maximum_nodes;
+
+/*
+ * The following is the list of information blocks for each object
+ * class. From the ID, we can go to one of these information blocks,
+ * and obtain a pointer to the appropriate object control block.
+ */
+
+EXTERN Objects_Information
+ *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1];
+
+/*
+ * The following defines the constant which may be used
+ * with _Objects_Get to manipulate the calling task.
+ *
+ */
+
+#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define OBJECTS_SEARCH_ALL_NODES 0
+#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
+#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
+#define OBJECTS_WHO_AM_I 0
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define OBJECTS_ID_INITIAL_INDEX (0)
+#define OBJECTS_ID_FINAL_INDEX (0xffff)
+
+#define OBJECTS_ID_INITIAL(_class, _node) \
+ _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
+
+#define OBJECTS_ID_FINAL ((Objects_Id)~0)
+
+/*
+ * _Objects_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function performs the initialization necessary for this handler.
+ *
+ */
+
+void _Objects_Handler_initialization(
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*
+ * _Objects_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This function initializes an object class information record.
+ * SUPPORTS_GLOBAL is TRUE if the object class supports global
+ * objects, and FALSE otherwise. Maximum indicates the number
+ * of objects required in this class and size indicates the size
+ * in bytes of each control block for this object class. The
+ * name length and string designator are also set. In addition,
+ * the class may be a task, therefore this information is also included.
+ */
+
+void _Objects_Initialize_information (
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_task
+);
+
+/*
+ * _Objects_Clear_name
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Clear_name(
+ void *name,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Copy_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_string(
+ void *source,
+ void *destination
+);
+
+/*
+ * _Objects_Copy_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_raw(
+ void *source,
+ void *destination,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_string(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_raw(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+/*
+ * _Objects_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * This function implements the common portion of the object
+ * identification directives. This directive returns the object
+ * id associated with name. If more than one object of this class
+ * is named name, then the object to which the id belongs is
+ * arbitrary. Node indicates the extent of the search for the
+ * id of the object named name. If the object class supports global
+ * objects, then the search can be limited to a particular node
+ * or allowed to encompass all nodes.
+ *
+ */
+
+typedef enum {
+ OBJECTS_SUCCESSFUL,
+ OBJECTS_INVALID_NAME,
+ OBJECTS_INVALID_NODE
+} Objects_Name_to_id_errors;
+
+#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL
+#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE
+
+Objects_Name_to_id_errors _Objects_Name_to_id(
+ Objects_Information *information,
+ Objects_Name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * _Objects_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps object ids to object control blocks.
+ * If id corresponds to a local object, then it returns
+ * the_object control pointer which maps to id and location
+ * is set to OBJECTS_LOCAL. If the object class supports global
+ * objects and the object id is global and resides on a remote
+ * node, then location is set to OBJECTS_REMOTE, and the_object
+ * is undefined. Otherwise, location is set to OBJECTS_ERROR
+ * and the_object is undefined.
+ *
+ */
+
+Objects_Control *_Objects_Get (
+ Objects_Information *information,
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _Objects_Get_next
+ *
+ * DESCRIPTION:
+ *
+ * Like _Objects_Get, but is used to find "next" open object.
+ *
+ */
+
+Objects_Control *_Objects_Get_next(
+ Objects_Information *information,
+ Objects_Id id,
+ unsigned32 *location_p,
+ Objects_Id *next_id_p
+);
+
+/*
+ * _Objects_Get_information
+ *
+ * DESCRIPTION:
+ *
+ * Returns the information control block for the class of objects
+ * corresponding to this id.
+ */
+
+Objects_Information *_Objects_Get_information(
+ Objects_Id id
+);
+
+/*
+ * Pieces of object.inl are promoted out to the user
+ */
+
+#include <rtems/score/object.inl>
+#include <rtems/score/objectmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/objectmp.h b/c/src/exec/score/include/rtems/score/objectmp.h
new file mode 100644
index 0000000000..96496656df
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/objectmp.h
@@ -0,0 +1,152 @@
+/* objectmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of Global RTEMS Objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OBJECTS_MP_h
+#define __RTEMS_OBJECTS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the Global Object Control Block used to manage
+ * objects resident on other nodes.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ unsigned32 name; /* XXX broken but works */
+ /* XXX If any API is MP with variable length names .. BOOM!!!! */
+} Objects_MP_Control;
+
+/*
+ * _Objects_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine intializes the inactive global object chain
+ * based on the maximum number of global objects configured.
+ */
+
+void _Objects_MP_Handler_initialization (
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*PAGE
+ *
+ * _Objects_MP_Open
+ *
+ * DESCRIPTION:
+ *
+ * This routine place the specified global object in the
+ * specified information table.
+ */
+
+void _Objects_MP_Open (
+ Objects_Information *information,
+ Objects_MP_Control *the_global_object,
+ unsigned32 the_name, /* XXX -- wrong for variable */
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Allocate_and_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a global object control block
+ * and places it in the specified information table. If the
+ * allocation fails, then is_fatal_error determines the
+ * error processing actions taken.
+ */
+
+boolean _Objects_MP_Allocate_and_open (
+ Objects_Information *information,
+ unsigned32 the_name, /* XXX -- wrong for variable length */
+ Objects_Id the_id,
+ boolean is_fatal_error
+);
+
+/*
+ * _Objects_MP_Close
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes a global object from the specified
+ * information table and deallocates the global object control block.
+ */
+
+void _Objects_MP_Close (
+ Objects_Information *information,
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Global_name_search
+ *
+ * DESCRIPTION:
+ *
+ * This routine looks for the object with the_name in the global
+ * object tables indicated by information. It returns the ID of the
+ * object with that name if one is found.
+ */
+
+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
+);
+
+/*
+ * _Objects_MP_Is_remote
+ *
+ * DESCRIPTION:
+ *
+ * This function searches the Global Object Table managed
+ * by information for the object indicated by ID. If the object
+ * is found, then location is set to objects_remote, otherwise
+ * location is set to objects_error. In both cases, the_object
+ * is undefined.
+ */
+
+void _Objects_MP_Is_remote (
+ Objects_Information *information,
+ Objects_Id the_id,
+ Objects_Locations *location,
+ Objects_Control **the_object
+);
+
+/*
+ * The following chain header is used to manage the set of
+ * inactive global object control blocks.
+ */
+
+EXTERN unsigned32 _Objects_MP_Maximum_global_objects;
+EXTERN Chain_Control _Objects_MP_Inactive_global_objects;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/objectmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/priority.h b/c/src/exec/score/include/rtems/score/priority.h
new file mode 100644
index 0000000000..b7de14f0f9
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/priority.h
@@ -0,0 +1,96 @@
+/* priority.h
+ *
+ * This include file contains all thread priority manipulation routines.
+ * This Handler provides mechanisms which can be used to
+ * initialize and manipulate thread priorities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_h
+#define __PRIORITY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * thread priorities.
+ *
+ * NOTE: Priority 0 is reserved for internal threads only.
+ */
+
+typedef unsigned32 Priority_Control;
+
+#define PRIORITY_MINIMUM 0 /* highest thread priority */
+#define PRIORITY_MAXIMUM 255 /* lowest thread priority */
+
+/*
+ * The following record defines the information associated with
+ * each thread to manage its interaction with the priority bit maps.
+ */
+
+typedef struct {
+ Priority_Bit_map_control *minor; /* addr of minor bit map slot */
+ Priority_Bit_map_control ready_major; /* priority bit map ready mask */
+ Priority_Bit_map_control ready_minor; /* priority bit map ready mask */
+ Priority_Bit_map_control block_major; /* priority bit map block mask */
+ Priority_Bit_map_control block_minor; /* priority bit map block mask */
+} Priority_Information;
+
+/*
+ * The following data items are the priority bit map.
+ * Each of the sixteen bits used in the _Priority_Major_bit_map is
+ * associated with one of the sixteen entries in the _Priority_Bit_map.
+ * Each bit in the _Priority_Bit_map indicates whether or not there are
+ * threads ready at a particular priority. The mapping of
+ * individual priority levels to particular bits is processor
+ * dependent as is the value of each bit used to indicate that
+ * threads are ready at that priority.
+ */
+
+EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map;
+EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
+
+/*
+ * The definition of the Priority_Bit_map_control type is CPU dependent.
+ *
+ */
+
+/*
+ * Priority Bitfield Manipulation Routines
+ *
+ * NOTE:
+ *
+ * These may simply be pass throughs to CPU dependent routines.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Priority_Mask( _bit_number ) \
+ _CPU_Priority_Mask( _bit_number )
+
+#define _Priority_Bits_index( _priority ) \
+ _CPU_Priority_bits_index( _priority )
+
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/priority.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/stack.h b/c/src/exec/score/include/rtems/score/stack.h
new file mode 100644
index 0000000000..bf72782b42
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/stack.h
@@ -0,0 +1,50 @@
+/* stack.h
+ *
+ * This include file contains all information about the thread
+ * Stack Handler. This Handler provides mechanisms which can be used to
+ * initialize and utilize stacks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_h
+#define __STACK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the control block used to manage each stack.
+ */
+
+typedef struct {
+ unsigned32 size; /* stack size */
+ void *area; /* low memory addr of stack */
+} Stack_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/stack.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/states.h b/c/src/exec/score/include/rtems/score/states.h
new file mode 100644
index 0000000000..1f8fd49fae
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/states.h
@@ -0,0 +1,78 @@
+/* states.h
+ *
+ * This include file contains thread execution state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATES_h
+#define __RTEMS_STATES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage a
+ * thread's state.
+ */
+
+typedef unsigned32 States_Control;
+
+/*
+ * The following constants define the individual states which may be
+ * be used to compose and manipulate a thread's state.
+ */
+
+#define STATES_ALL_SET 0xffff /* all states */
+#define STATES_READY 0x0000 /* ready to run */
+#define STATES_DORMANT 0x0001 /* created not started */
+#define STATES_SUSPENDED 0x0002 /* waiting for resume */
+#define STATES_TRANSIENT 0x0004 /* thread in transition */
+#define STATES_DELAYING 0x0008 /* wait for timeout */
+#define STATES_WAITING_FOR_TIME 0x0010 /* wait for TOD */
+#define STATES_WAITING_FOR_BUFFER 0x0020
+#define STATES_WAITING_FOR_SEGMENT 0x0040
+#define STATES_WAITING_FOR_MESSAGE 0x0080
+#define STATES_WAITING_FOR_EVENT 0x0100
+#define STATES_WAITING_FOR_SEMAPHORE 0x0200
+#define STATES_WAITING_FOR_MUTEX 0x0400
+#define STATES_WAITING_FOR_CONDITION_VARIABLE 0x0800
+#define STATES_WAITING_FOR_RPC_REPLY 0x1000
+#define STATES_WAITING_FOR_PERIOD 0x2000
+
+#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \
+ STATES_WAITING_FOR_SEGMENT | \
+ STATES_WAITING_FOR_MESSAGE | \
+ STATES_WAITING_FOR_MUTEX | \
+ STATES_WAITING_FOR_CONDITION_VARIABLE | \
+ STATES_WAITING_FOR_SEMAPHORE )
+
+#define STATES_WAITING_ON_THREAD_QUEUE \
+ ( STATES_LOCALLY_BLOCKED | \
+ STATES_WAITING_FOR_RPC_REPLY )
+
+#define STATES_BLOCKED ( STATES_DELAYING | \
+ STATES_WAITING_FOR_TIME | \
+ STATES_WAITING_FOR_PERIOD | \
+ STATES_WAITING_FOR_EVENT | \
+ STATES_WAITING_ON_THREAD_QUEUE )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/states.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/sysstate.h b/c/src/exec/score/include/rtems/score/sysstate.h
new file mode 100644
index 0000000000..d7e43b2356
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/sysstate.h
@@ -0,0 +1,66 @@
+/* sysstates.h
+ *
+ * This include file contains information regarding the system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_STATE_h
+#define __RTEMS_SYSTEM_STATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+/*
+ * The following type defines the possible system states.
+ */
+
+typedef enum {
+ SYSTEM_STATE_BEFORE_INITIALIZATION, /* start -> end of 1st init part */
+ SYSTEM_STATE_BEFORE_MULTITASKING, /* end of 1st -> beginning of 2nd */
+ SYSTEM_STATE_BEGIN_MULTITASKING, /* just before multitasking starts */
+ SYSTEM_STATE_UP, /* normal operation */
+ SYSTEM_STATE_FAILED /* fatal error occurred */
+} System_state_Codes;
+
+#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
+#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
+
+/*
+ * The following variable indicates whether or not this is
+ * an multiprocessing system.
+ */
+
+EXTERN boolean _System_state_Is_multiprocessing;
+
+/*
+ * The following variable contains the current system state.
+ */
+
+EXTERN System_state_Codes _System_state_Current;
+
+/*
+ * Make it possible for the application to get the system state information.
+ */
+
+#include <rtems/score/sysstate.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h
new file mode 100644
index 0000000000..74399545b9
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/thread.h
@@ -0,0 +1,585 @@
+/* thread.h
+ *
+ * This include file contains all constants and structures associated
+ * with the thread control block.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_h
+#define __THREAD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/context.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following defines the "return type" of a thread.
+ */
+
+typedef void Thread;
+
+/*
+ * The following defines the ways in which the entry point for a
+ * thread can be invoked. Basically, it can be passed any
+ * combination/permutation of a pointer and an unsigned32 value.
+ *
+ * NOTE: For now, we are ignoring the return type.
+ */
+
+typedef enum {
+ THREAD_START_NUMERIC,
+ THREAD_START_POINTER,
+ THREAD_START_BOTH_POINTER_FIRST,
+ THREAD_START_BOTH_NUMERIC_FIRST
+} Thread_Start_types;
+
+typedef Thread ( *Thread_Entry )( );
+
+/*
+ * The following structure contains the information which defines
+ * the starting state of a thread.
+ */
+
+typedef struct {
+ Thread_Entry entry_point; /* starting thread address */
+ Thread_Start_types prototype; /* how task is invoked */
+ void *pointer_argument; /* pointer argument */
+ unsigned32 numeric_argument; /* numeric argument */
+ /* initial execution modes */
+ boolean is_preemptible;
+ boolean is_timeslice;
+ unsigned32 isr_level;
+ Priority_Control initial_priority; /* initial priority */
+ Stack_Control Initial_stack; /* stack information */
+ void *fp_context; /* initial FP context area address */
+ void *stack; /* initial FP context area address */
+} Thread_Start_information;
+
+/*
+ * The following structure contains the information necessary to manage
+ * a thread which it is waiting for a resource.
+ */
+
+#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
+
+typedef struct {
+ Objects_Id id; /* waiting on this object */
+ unsigned32 count; /* "generic" fields to be used */
+ void *return_argument; /* when blocking */
+ void *return_argument_1;
+ unsigned32 option;
+
+ /*
+ * NOTE: The following assumes that all API return codes can be
+ * treated as an unsigned32.
+ */
+ unsigned32 return_code; /* status for thread awakened */
+
+ Chain_Control Block2n; /* 2 - n priority blocked chain */
+ Thread_queue_Control *queue; /* pointer to thread queue */
+} Thread_Wait_information;
+
+/*
+ * The following defines the control block used to manage
+ * each thread proxy.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ Chain_Node Active;
+} Thread_Proxy_control;
+
+
+/*
+ * The following record defines the control block used
+ * to manage each thread.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef enum {
+ THREAD_API_RTEMS,
+ THREAD_API_POSIX
+} Thread_APIs;
+
+#define THREAD_API_FIRST THREAD_API_RTEMS
+#define THREAD_API_LAST THREAD_API_POSIX
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ boolean is_global;
+ boolean do_post_task_switch_extension;
+ Chain_Control *ready;
+ Priority_Information Priority_map;
+ Thread_Start_information Start;
+ boolean is_preemptible;
+ boolean is_timeslice;
+ Context_Control Registers;
+ void *fp_context;
+ void *API_Extensions[ THREAD_API_LAST + 1 ];
+ void **extensions;
+} Thread_Control;
+
+/*
+ * The following constants define the stack size requirements for
+ * the idle thread.
+ */
+
+
+#define THREAD_IDLE_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Thread_Internal_information;
+
+/*
+ * The following define the thread control pointers used to access
+ * and manipulate the idle thread.
+ */
+
+EXTERN Thread_Control *_Thread_Idle;
+
+/*
+ * The following context area contains the context of the "thread"
+ * which invoked the start multitasking routine. This context is
+ * restored as the last action of the stop multitasking routine. Thus
+ * control of the processor can be returned to the environment
+ * which initiated the system.
+ */
+
+EXTERN Context_Control _Thread_BSP_context;
+
+/*
+ * The following declares the dispatch critical section nesting
+ * counter which is used to prevent context switches at inopportune
+ * moments.
+ */
+
+EXTERN unsigned32 _Thread_Dispatch_disable_level;
+
+/*
+ * The following holds how many user extensions are in the system. This
+ * is used to determine how many user extension data areas to allocate
+ * per thread.
+ */
+
+EXTERN unsigned32 _Thread_Maximum_extensions;
+
+/*
+ * The following data items are used to manage timeslicing.
+ */
+
+EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
+EXTERN unsigned32 _Thread_Ticks_per_timeslice;
+
+/*
+ * The following points to the array of FIFOs used to manage the
+ * set of ready threads.
+ */
+
+EXTERN Chain_Control *_Thread_Ready_chain;
+
+/*
+ * The following points to the thread which is currently executing.
+ * This thread is implicitly manipulated by numerous directives.
+ */
+
+EXTERN Thread_Control *_Thread_Executing;
+
+/*
+ * The following points to the highest priority ready thread
+ * in the system. Unless the current thread is not preemptibl,
+ * then this thread will be context switched to when the next
+ * dispatch occurs.
+ */
+
+EXTERN Thread_Control *_Thread_Heir;
+
+/*
+ * The following points to the thread whose floating point
+ * context is currently loaded.
+ */
+
+EXTERN Thread_Control *_Thread_Allocated_fp;
+
+/*
+ * _Thread_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Thread_Handler_initialization (
+ unsigned32 ticks_per_timeslice,
+ unsigned32 maximum_extensions,
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_Create_idle
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the idle thread.
+ *
+ * WARNING!! No thread should be created before this one.
+ */
+
+void _Thread_Create_idle( void );
+
+/*
+ * _Thread_Start_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine initiates multitasking. It is invoked only as
+ * part of initialization and its invocation is the last act of
+ * the non-multitasking part of the system initialization.
+ */
+
+void _Thread_Start_multitasking( void );
+
+/*
+ * _Thread_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is responsible for transferring control of the
+ * processor from the executing thread to the heir thread. As part
+ * of this process, it is responsible for the following actions:
+ *
+ * + saving the context of the executing thread
+ * + restoring the context of the heir thread
+ * + dispatching any signals for the resulting executing thread
+ */
+
+void _Thread_Dispatch( void );
+
+/*
+ * _Thread_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Initialize(
+ Objects_Information *information,
+ Thread_Control *the_thread,
+ void *stack_area, /* NULL if to be allocated */
+ unsigned32 stack_size, /* insure it is >= min */
+ boolean is_fp, /* TRUE if thread uses FP */
+ Priority_Control priority,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
+ Objects_Name name
+
+);
+
+/*
+ * _Thread_Start
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Start(
+ Thread_Control *the_thread,
+ Thread_Start_types the_prototype,
+ void *entry_point,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Restart
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+/* XXX multiple task arg profiles */
+
+boolean _Thread_Restart(
+ Thread_Control *the_thread,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Close
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Thread_Close(
+ Objects_Information *information,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Ready
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes any set states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Ready(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Clear_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the indicated STATES for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Clear_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the indicated states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ *
+ */
+
+void _Thread_Set_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_transient
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the TRANSIENT state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Set_transient(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Reset_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked upon expiration of the currently
+ * executing thread's timeslice. If no other thread's are ready
+ * at the priority of the currently executing thread, then the
+ * executing thread's timeslice is reset. Otherwise, the
+ * currently executing thread is placed at the rear of the
+ * FIFO for this priority and a new heir is selected.
+ */
+
+void _Thread_Reset_timeslice( void );
+
+/*
+ * _Thread_Tickle_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked as part of processing each clock tick.
+ * It is responsible for determining if the current thread allows
+ * timeslicing and, if so, when its timeslice expires.
+ */
+
+void _Thread_Tickle_timeslice( void );
+
+/*
+ * _Thread_Yield_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread of equal
+ * or greater priority.
+ */
+
+void _Thread_Yield_processor( void );
+
+/*
+ * _Thread_Load_environment
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the context of the_thread to its
+ * appropriate starting state.
+ */
+
+void _Thread_Load_environment(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the wrapper function for all threads. It is
+ * the starting point for all threads. The user provided thread
+ * entry point is invoked by this routine. Operations
+ * which must be performed immediately before and after the user's
+ * thread executes are found here.
+ */
+
+void _Thread_Handler( void );
+
+/*
+ * _Thread_Delay_ended
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread must be unblocked at the
+ * end of a time based delay (i.e. wake after or wake when).
+ */
+
+void _Thread_Delay_ended(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * _Thread_Change_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the current priority of the_thread to
+ * new_priority. It performs any necessary scheduling operations
+ * including the selection of a new heir thread.
+ */
+
+void _Thread_Change_priority (
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine updates the priority related fields in the_thread
+ * control block to indicate the current priority is now new_priority.
+ */
+
+void _Thread_Set_priority(
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Evaluate_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine XXX
+ */
+
+boolean _Thread_Evaluate_mode( void );
+
+/*
+ * _Thread_Get
+ *
+ * NOTE: If we are not using static inlines, this must be a real
+ * subroutine call.
+ */
+
+#ifndef USE_INLINES
+Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+#endif
+
+/*
+ * _Thread_Idle_body
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the body of the system idle thread.
+ */
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
+Thread _Thread_Idle_body(
+ unsigned32 ignored
+);
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/thread.inl>
+#endif
+#include <rtems/score/threadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/threadmp.h b/c/src/exec/score/include/rtems/score/threadmp.h
new file mode 100644
index 0000000000..0466a04065
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/threadmp.h
@@ -0,0 +1,89 @@
+/* threadmp.h
+ *
+ * This include file contains the specification for all routines
+ * and data specific to the multiprocessing portion of the thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_THREAD_MP_h
+#define __RTEMS_THREAD_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Thread_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the multiprocessing portion of the Thread Handler.
+ */
+
+void _Thread_MP_Handler_initialization (
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_MP_Allocate_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This allocates a proxy control block from
+ * the inactive chain of free proxy control blocks.
+ *
+ * NOTE: This function returns a thread control pointer
+ * because proxies are substitutes for remote threads.
+ */
+
+Thread_Control *_Thread_MP_Allocate_proxy (
+ States_Control the_state
+);
+
+/*
+ * _Thread_MP_Find_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the proxy control block for the specified
+ * id from the active chain of proxy control blocks.
+ */
+
+Thread_Control *_Thread_MP_Find_proxy (
+ Objects_Id the_id
+);
+
+/*
+ * The following is used to determine when the multiprocessing receive
+ * thread is executing so that a proxy can be allocated instead of
+ * blocking the multiprocessing receive thread.
+ */
+
+EXTERN Thread_Control *_Thread_MP_Receive;
+
+/*
+ * The following chains are used to manage proxies.
+ */
+
+EXTERN Chain_Control _Thread_MP_Active_proxies;
+EXTERN Chain_Control _Thread_MP_Inactive_proxies;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/threadmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/threadq.h b/c/src/exec/score/include/rtems/score/threadq.h
new file mode 100644
index 0000000000..6a074daf16
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/threadq.h
@@ -0,0 +1,301 @@
+/* threadq.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_h
+#define __THREAD_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tqdata.h>
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * Constant for indefinite wait.
+ */
+
+#define THREAD_QUEUE_WAIT_FOREVER WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following type defines the callout used when a remote task
+ * is extracted from a local thread queue.
+ */
+
+typedef void ( *Thread_queue_Flush_callout )(
+ Thread_Control *
+ );
+
+/*
+ * The following type defines the callout used when a local task
+ * is extracted from a remote thread queue (i.e. it's proxy must
+ * extracted from the remote queue).
+ */
+
+typedef void ( *Thread_queue_Extract_callout )(
+ Thread_Control *
+ );
+
+EXTERN Thread_queue_Extract_callout
+ _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
+
+/*
+ * _Thread_queue_Dequeue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to a thread waiting on
+ * the_thread_queue. The selection of this thread is based on
+ * the discipline of the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout.
+ */
+
+void _Thread_queue_Enqueue(
+ Thread_queue_Control *the_thread_queue,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_Extract_with_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_thread from the_thread_queue
+ * and insures that if there is a proxy for this task on
+ * another node, it is also dealt with.
+ */
+
+boolean _Thread_queue_Extract_with_proxy(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is selected
+ * based on the discipline of the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine unblocks all threads blocked on the_thread_queue
+ * and cancels any associated timeouts.
+ */
+
+void _Thread_queue_Flush(
+ Thread_queue_Control *the_thread_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ * _Thread_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_thread_queue based on the
+ * discipline indicated in attribute_set. The state set on
+ * threads which block on the_thread_queue is state.
+ */
+
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ Objects_Classes the_class,
+ Thread_queue_Disciplines the_discipline,
+ States_Control state,
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
+);
+
+/*
+ * _Thread_queue_Dequeue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * thread waiting on the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * priority discipline.
+ */
+
+void _Thread_queue_Enqueue_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is the highest
+ * priority thread waiting on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Dequeue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the thread which has
+ * been waiting the longest on the_thread_queue. If no
+ * threads are waiting on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * FIFO discipline.
+ */
+
+void _Thread_queue_Enqueue_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The first thread is the thread
+ * which has been waiting longest on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's request has not
+ * been satisfied after the timeout interval specified to
+ * enqueue. The task represented by ID will be unblocked and
+ * its status code will be set in it's control block to indicate
+ * that a timeout has occurred.
+ */
+
+void _Thread_queue_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/tod.h b/c/src/exec/score/include/rtems/score/tod.h
new file mode 100644
index 0000000000..b0fb686014
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/tod.h
@@ -0,0 +1,260 @@
+/* tod.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_h
+#define __TIME_OF_DAY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following constants are related to the time of day.
+ */
+
+#define TOD_SECONDS_PER_MINUTE 60
+#define TOD_MINUTES_PER_HOUR 60
+#define TOD_MONTHS_PER_YEAR 12
+#define TOD_DAYS_PER_YEAR 365
+#define TOD_HOURS_PER_DAY 24
+#define TOD_SECONDS_PER_DAY (TOD_SECONDS_PER_MINUTE * \
+ TOD_MINUTES_PER_HOUR * \
+ TOD_HOURS_PER_DAY)
+
+#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY)
+
+#define TOD_MICROSECONDS_PER_SECOND 1000000
+#define TOD_MILLISECONDS_PER_SECOND 1000
+
+/*
+ * The following constant define the earliest year to which an
+ * time of day can be initialized. This is considered the
+ * epoch.
+ */
+
+#define TOD_BASE_YEAR 1988
+
+/*
+ * The following record defines the time of control block. This
+ * control block is used to maintain the current time of day.
+ */
+
+typedef struct { /* RTEID style time/date */
+ unsigned32 year; /* year, A.D. */
+ unsigned32 month; /* month, 1 -> 12 */
+ unsigned32 day; /* day, 1 -> 31 */
+ unsigned32 hour; /* hour, 0 -> 23 */
+ unsigned32 minute; /* minute, 0 -> 59 */
+ unsigned32 second; /* second, 0 -> 59 */
+ unsigned32 ticks; /* elapsed ticks between secs */
+} TOD_Control;
+
+/*
+ * The following contains the current time of day.
+ */
+
+EXTERN TOD_Control _TOD_Current;
+
+/*
+ * The following contains the number of seconds from 00:00:00
+ * January 1, TOD_BASE_YEAR until the current time of day.
+ */
+
+EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
+
+/*
+ * The following contains the number of ticks since the
+ * system was booted.
+ */
+
+EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
+
+/*
+ * The following contains the number of microseconds per tick.
+ */
+
+EXTERN unsigned32 _TOD_Microseconds_per_tick;
+
+/*
+ * The following contains the number of clock ticks per second.
+ *
+ * NOTE:
+ *
+ * If one second is NOT evenly divisible by the number of microseconds
+ * per clock tick, this value will contain only the integer portion
+ * of the division. This means that the interval between clock ticks
+ * can be a source of error in the current time of day.
+ */
+
+EXTERN unsigned32 _TOD_Ticks_per_second;
+
+/*
+ * This is the control structure for the watchdog timer which
+ * fires to service the seconds chain.
+ */
+
+EXTERN Watchdog_Control _TOD_Seconds_watchdog;
+
+#ifdef INIT
+
+/*
+ * The following array contains the number of days in all months.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ * The second dimension should range from 1 to 12 for January to
+ * February, respectively.
+ */
+
+const unsigned32 _TOD_Days_per_month[ 2 ][ 13 ] = {
+ { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+/*
+ * The following array contains the number of days in all months
+ * up to the month indicated by the index of the second dimension.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ */
+
+const unsigned16 _TOD_Days_to_date[2][13] = {
+ { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
+ { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
+};
+
+/*
+ * The following array contains the number of days in the years
+ * since the last leap year. The index should be 0 for leap
+ * years, and the number of years since the beginning of a leap
+ * year otherwise.
+ */
+
+const unsigned16 _TOD_Days_since_last_leap_year[4] = { 0, 366, 761, 1126 };
+
+#else
+
+extern const unsigned16 _TOD_Days_to_date[2][13]; /* Julian days */
+extern const unsigned16 _TOD_Days_since_last_leap_year[4];
+extern const unsigned32 _TOD_Days_per_month[2][13];
+
+#endif
+
+/*
+ * _TOD_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _TOD_Handler_initialization(
+ unsigned32 microseconds_per_tick
+);
+
+/*
+ * _TOD_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current time of day to THE_TOD and
+ * the equivalent SECONDS_SINCE_EPOCH.
+ */
+
+void _TOD_Set(
+ TOD_Control *the_tod,
+ Watchdog_Interval seconds_since_epoch
+);
+
+/*
+ * _TOD_Validate
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if THE_TOD contains
+ * a valid time of day, and FALSE otherwise.
+ */
+
+boolean _TOD_Validate(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_To_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number seconds between the epoch and THE_TOD.
+ */
+
+Watchdog_Interval _TOD_To_seconds(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is scheduled as a watchdog function and is invoked at
+ * each second boundary. It updates the current time of day to indicate
+ * that a second has passed and processes the seconds watchdog chain.
+ */
+
+void _TOD_Tickle(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * TOD_MILLISECONDS_TO_MICROSECONDS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to microseconds.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000)
+
+/*
+ * TOD_MILLISECONDS_TO_TICKS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to ticks.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_TICKS(_ms) \
+ (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tod.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/tqdata.h b/c/src/exec/score/include/rtems/score/tqdata.h
new file mode 100644
index 0000000000..c9c9585f7f
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/tqdata.h
@@ -0,0 +1,91 @@
+/* tqdata.h
+ *
+ * This include file contains all the constants and structures
+ * needed to declare a thread queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_h
+#define __THREAD_QUEUE_DATA_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+
+/*
+ * The following enumerated type details all of the disciplines
+ * supported by the Thread Queue Handler.
+ */
+
+typedef enum {
+ THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */
+ THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */
+} Thread_queue_Disciplines;
+
+/*
+ * The following enumerated types indicate what happened while the thread
+ * queue was in the synchronization window.
+ */
+
+typedef enum {
+ THREAD_QUEUE_SYNCHRONIZED,
+ THREAD_QUEUE_NOTHING_HAPPENED,
+ THREAD_QUEUE_TIMEOUT,
+ THREAD_QUEUE_SATISFIED
+} Thread_queue_States;
+
+/*
+ * The following constants are used to manage the priority queues.
+ *
+ * There are four chains used to maintain a priority -- each chain
+ * manages a distinct set of task priorities. The number of chains
+ * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS.
+ * The following set must be consistent.
+ *
+ * The set below configures 4 headers -- each contains 64 priorities.
+ * Header x manages priority range (x*64) through ((x*64)+63). If
+ * the priority is more than half way through the priority range it
+ * is in, then the search is performed from the rear of the chain.
+ * This halves the search time to find the insertion point.
+ */
+
+#define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4
+#define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64
+#define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20
+
+typedef struct {
+ union {
+ Chain_Control Fifo; /* FIFO discipline list */
+ Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS];
+ /* priority discipline list */
+ } Queues;
+ Thread_queue_States sync_state; /* alloc/dealloc critical section */
+ Thread_queue_Disciplines discipline; /* queue discipline */
+ States_Control state; /* state of threads on Thread_q */
+ unsigned32 timeout_status;
+ unsigned32 count;
+} Thread_queue_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tqdata.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/userext.h b/c/src/exec/score/include/rtems/score/userext.h
new file mode 100644
index 0000000000..1a6ac3437e
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/userext.h
@@ -0,0 +1,213 @@
+/* userext.h
+ *
+ * This include file contains all information about user extensions. This
+ * Handler provides mechanisms which can be used to initialize and manipulate
+ * all user extensions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_h
+#define __USER_EXTENSIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/interr.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following records defines the User Extension Table.
+ * This table defines the application dependent routines which
+ * are invoked at critical points in the life of each thread and
+ * the system as a whole.
+ */
+
+typedef void User_extensions_routine;
+
+typedef boolean ( *User_extensions_thread_create_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_delete_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_start_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_restart_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_begin_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_fatal_extension )(
+ Internal_errors_Source /* the_source */,
+ boolean /* is_internal */,
+ unsigned32 /* the_error */
+ );
+
+
+typedef struct {
+ User_extensions_thread_create_extension thread_create;
+ User_extensions_thread_start_extension thread_start;
+ User_extensions_thread_restart_extension thread_restart;
+ User_extensions_thread_delete_extension thread_delete;
+ User_extensions_thread_switch_extension thread_switch;
+ User_extensions_thread_begin_extension thread_begin;
+ User_extensions_thread_exitted_extension thread_exitted;
+ User_extensions_fatal_extension fatal;
+} User_extensions_Table;
+
+/*
+ * The following is used to manage each user extension set.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ User_extensions_Table Callouts;
+} User_extensions_Control;
+
+/*
+ * The following contains the static extension set which may be
+ * configured by the application.
+ */
+
+EXTERN User_extensions_Control _User_extensions_Initial;
+
+/*
+ * The following is used to manage the list of active extensions.
+ */
+
+EXTERN Chain_Control _User_extensions_List;
+
+/*
+ * _User_extensions_Thread_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread creation operate.
+ */
+
+boolean _User_extensions_Thread_create (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread deletion operation.
+ */
+
+void _User_extensions_Thread_delete (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread start operation.
+ */
+
+void _User_extensions_Thread_start (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread restart operation.
+ */
+
+void _User_extensions_Thread_restart (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_begin
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread begins.
+ */
+
+void _User_extensions_Thread_begin (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Thread_exitted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread exits.
+ */
+
+void _User_extensions_Thread_exitted (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Fatal
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension invoked
+ * when a fatal error occurs.
+ */
+
+void _User_extensions_Fatal (
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/userext.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/watchdog.h b/c/src/exec/score/include/rtems/score/watchdog.h
new file mode 100644
index 0000000000..9b13407c8e
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/watchdog.h
@@ -0,0 +1,185 @@
+/* watchdog.h
+ *
+ * This include file contains all the constants and structures associated
+ * with watchdog timers. This Handler provides mechanisms which can be
+ * used to initialize and manipulate watchdog timers.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_h
+#define __WATCHDOG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following type defines the control block used to manage
+ * intervals.
+ */
+
+typedef unsigned32 Watchdog_Interval;
+
+/*
+ * The following types define a pointer to a watchdog service routine.
+ */
+
+typedef void Watchdog_Service_routine;
+
+typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
+ Objects_Id,
+ void *
+ );
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define WATCHDOG_NO_TIMEOUT 0
+
+/*
+ * The following enumerated type lists the states in which a
+ * watchdog timer may be at any given time.
+ */
+
+typedef enum {
+ WATCHDOG_INACTIVE, /* off all chains */
+ WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
+ WATCHDOG_ACTIVE, /* on chain, allowed to fire */
+ WATCHDOG_REMOVE_IT /* on chain, remove without firing if expires */
+} Watchdog_States;
+
+/*
+ * The following enumerated type details the manner in which
+ * a watchdog chain may be adjusted by the Watchdog_Adjust
+ * routine. The direction indicates a movement FORWARD
+ * or BACKWARD in time.
+ */
+
+typedef enum {
+ WATCHDOG_FORWARD, /* adjust delta value forward */
+ WATCHDOG_BACKWARD /* adjust delta value backward */
+} Watchdog_Adjust_directions;
+
+/*
+ * The following record defines the control block used
+ * to manage each watchdog timer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Watchdog_States state;
+ Watchdog_Interval initial;
+ Watchdog_Interval delta_interval;
+ Watchdog_Service_routine_entry routine;
+ Objects_Id id;
+ void *user_data;
+} Watchdog_Control;
+
+/*
+ * The following are used for synchronization purposes
+ * during an insert on a watchdog delta chain.
+ */
+
+EXTERN volatile unsigned32 _Watchdog_Sync_level;
+EXTERN volatile unsigned32 _Watchdog_Sync_count;
+
+/*
+ * The following defines the watchdog chains which are managed
+ * on ticks and second boundaries.
+ */
+
+EXTERN Chain_Control _Watchdog_Ticks_chain;
+EXTERN Chain_Control _Watchdog_Seconds_chain;
+
+/*
+ * _Watchdog_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the watchdog handler. The watchdog
+ * synchronization flag is initialized and the watchdog chains are
+ * initialized and emptied.
+ */
+
+void _Watchdog_Handler_initialization( void );
+
+/*
+ * _Watchdog_Remove
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes THE_WATCHDOG from the watchdog chain on which
+ * it resides and returns the state THE_WATCHDOG timer was in.
+ */
+
+Watchdog_States _Watchdog_Remove (
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Adjust
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the HEADER watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+void _Watchdog_Adjust (
+ Chain_Control *header,
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+);
+
+/*
+ * _Watchdog_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the HEADER watchdog chain
+ * for a time of UNITS. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ *
+ */
+
+void _Watchdog_Insert (
+ Chain_Control *header,
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at appropriate intervals to update
+ * the HEADER watchdog chain.
+ */
+
+void _Watchdog_Tickle (
+ Chain_Control *header
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/watchdog.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/score/wkspace.h b/c/src/exec/score/include/rtems/score/wkspace.h
new file mode 100644
index 0000000000..9814a707b1
--- /dev/null
+++ b/c/src/exec/score/include/rtems/score/wkspace.h
@@ -0,0 +1,71 @@
+/* wkspace.h
+ *
+ * This include file contains information related to the
+ * RAM Workspace. This Handler provides mechanisms which can be used to
+ * define, initialize and manipulate the workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_h
+#define __WORKSPACE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+
+/*
+ * The following is used to manage the Workspace.
+ *
+ */
+
+EXTERN Heap_Control _Workspace_Area; /* executive heap header */
+
+/*
+ * _Workspace_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Workspace_Handler_initialization(
+ void *starting_address,
+ unsigned32 size
+);
+
+/*
+ * _Workspace_Allocate_or_fatal_error
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then the internal error handler is invoked.
+ */
+
+void *_Workspace_Allocate_or_fatal_error(
+ unsigned32 size
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/wkspace.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/include/rtems/system.h b/c/src/exec/score/include/rtems/system.h
new file mode 100644
index 0000000000..9b50159c81
--- /dev/null
+++ b/c/src/exec/score/include/rtems/system.h
@@ -0,0 +1,134 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the executive. This must be the first include file
+ * included in all internal RTEMS files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_h
+#define __RTEMS_SYSTEM_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_USE_INLINE_OR_MACROS" is replaced
+ * with either "USE_INLINES" or "USE_MACROS" based upon the
+ * whether this target configuration uses the inline or
+ * macro implementations of the inlined RTEMS routines.
+ */
+
+
+#define REPLACE_THIS_WITH_USE_INLINE_OR_MACROS
+
+/*
+ * The following insures that all data is declared in the space
+ * of the Initialization Manager. It is referenced as "external"
+ * in every other file.
+ */
+
+#ifdef INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * The following (in conjunction with compiler arguments) are used
+ * to choose between the use of static inline functions and macro
+ * functions. The static inline implementation allows better
+ * type checking with no cost in code size or execution speed.
+ */
+
+#ifdef USE_INLINES
+# define STATIC static
+# ifdef __GNUC__
+# define INLINE __inline__
+# else
+# define INLINE inline
+# endif
+#else
+# define STATIC
+# define INLINE
+#endif
+
+/*
+ * Include a base set of files.
+ */
+
+/*
+ * XXX: Eventually proc_ptr needs to disappear!!!
+ */
+
+typedef void * proc_ptr;
+
+#include <rtems/score/cpu.h> /* processor specific information */
+
+/*
+ * Define NULL
+ */
+
+#ifndef NULL
+#define NULL 0 /* NULL value */
+#endif
+
+/*
+ * Boolean constants
+ */
+
+#if !defined( TRUE ) || (TRUE != 1)
+#undef TRUE
+#define TRUE (1)
+#endif
+
+#if !defined( FALSE ) || (FALSE != 0)
+#undef FALSE
+#define FALSE (0)
+#endif
+
+#define stringify( _x ) # _x
+
+#define RTEMS_offsetof(type, field) \
+ ((unsigned32) &(((type *) 0)->field))
+
+/*
+ * The following is the extern for the RTEMS version string.
+ * The contents of this string are CPU specific.
+ */
+
+extern const char _RTEMS_version[]; /* RTEMS version string */
+extern const char _Copyright_Notice[]; /* RTEMS copyright string */
+
+/*
+ * The following defines the CPU dependent information table.
+ */
+
+EXTERN rtems_cpu_table _CPU_Table; /* CPU dependent info */
+
+/*
+ * XXX weird RTEMS stuff
+ */
+
+#define RTEMS_MAXIMUM_NAME_LENGTH 4
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/address.inl b/c/src/exec/score/inline/address.inl
new file mode 100644
index 0000000000..343123c981
--- /dev/null
+++ b/c/src/exec/score/inline/address.inl
@@ -0,0 +1,120 @@
+/* inline/address.inl
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ADDRESSES_inl
+#define __INLINE_ADDRESSES_inl
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to add an offset to a base address.
+ * It returns the resulting address. This address is typically
+ * converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Add_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base + offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract an offset from a base
+ * address. It returns the resulting address. This address is
+ * typically converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Subtract_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base - offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract two addresses. It returns the
+ * resulting offset.
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+STATIC INLINE unsigned32 _Addresses_Subtract (
+ void *left,
+ void *right
+)
+{
+ return ((char *) left - (char *) right);
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is correctly
+ * aligned for this processor and FALSE otherwise. Proper alignment
+ * is based on correctness and efficiency.
+ */
+
+STATIC INLINE boolean _Addresses_Is_aligned (
+ void *address
+)
+{
+ return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 );
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is within the
+ * memory range specified and FALSE otherwise. base is the address
+ * of the first byte in the memory range and limit is the address
+ * of the last byte in the memory range. The base address is
+ * assumed to be lower than the limit address.
+ */
+
+STATIC INLINE boolean _Addresses_Is_in_range (
+ void *address,
+ void *base,
+ void *limit
+)
+{
+ return ( address >= base && address <= limit );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/chain.inl b/c/src/exec/score/inline/chain.inl
new file mode 100644
index 0000000000..7fd3fef934
--- /dev/null
+++ b/c/src/exec/score/inline/chain.inl
@@ -0,0 +1,390 @@
+/* inline/chain.inl
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * NOTE: The routines in this file are ordered from simple
+ * to complex. No other Chain Handler routine is referenced
+ * unless it has already been defined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CHAIN_inl
+#define __INLINE_CHAIN_inl
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if LEFT and RIGHT are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Are_nodes_equal(
+ Chain_Node *left,
+ Chain_Node *right
+)
+{
+ return left == right;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_chain is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null_node(
+ Chain_Node *the_node
+)
+{
+ return ( the_node == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the first node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Head(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) the_chain;
+}
+
+/*PAGE
+ *
+ * _Chain_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the last node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Tail(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) &the_chain->permanent_null;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there a no nodes on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_empty(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the first node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_first(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->previous == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the last node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_last(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->next == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there is only one node on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Has_only_one_node(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == the_chain->last );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the head of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_head(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Head( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the tail of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_tail(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified chain to contain zero nodes.
+ */
+
+STATIC INLINE void _Chain_Initialize_empty(
+ Chain_Control *the_chain
+)
+{
+ the_chain->first = _Chain_Tail( the_chain );
+ the_chain->permanent_null = NULL;
+ the_chain->last = _Chain_Head( the_chain );
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * extract operation.
+ */
+
+STATIC INLINE void _Chain_Extract_unprotected(
+ Chain_Node *the_node
+)
+{
+ Chain_Node *next;
+ Chain_Node *previous;
+
+ next = the_node->next;
+ previous = the_node->previous;
+ next->previous = previous;
+ previous->next = next;
+}
+
+/*PAGE
+ *
+ * _Chain_Get_first_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. It does NOT disable interrupts to insure
+ * the atomicity of the get operation.
+ */
+
+STATIC INLINE 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;
+}
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * get operation.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Get_unprotected(
+ Chain_Control *the_chain
+)
+{
+ if ( !_Chain_Is_empty( the_chain ) )
+ return _Chain_Get_first_unprotected( the_chain );
+ else
+ return NULL;
+}
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It does NOT disable interrupts to insure the atomicity
+ * of the extract operation.
+ */
+
+STATIC INLINE void _Chain_Insert_unprotected(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *before_node;
+
+ the_node->previous = after_node;
+ before_node = after_node->next;
+ after_node->next = the_node;
+ the_node->next = before_node;
+ before_node->previous = the_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * append operation.
+ */
+
+STATIC INLINE void _Chain_Append_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *old_last_node;
+
+ the_node->next = _Chain_Tail( the_chain );
+ old_last_node = the_chain->last;
+ the_chain->last = the_node;
+ old_last_node->next = the_node;
+ the_node->previous = old_last_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert_unprotected( _Chain_Head( the_chain ), the_node );
+
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert( _Chain_Head( the_chain ), the_node );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/coremsg.inl b/c/src/exec/score/inline/coremsg.inl
new file mode 100644
index 0000000000..84e7250aa7
--- /dev/null
+++ b/c/src/exec/score/inline/coremsg.inl
@@ -0,0 +1,260 @@
+/* coremsg.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+#include <string.h> /* needed for memcpy */
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the end of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_SEND_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the front of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine copies the contents of the source message buffer
+ * to the destination message buffer.
+ */
+
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+ void *source,
+ void *destination,
+ unsigned32 size
+)
+{
+ memcpy(destination, source, size);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message buffer from the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE CORE_message_queue_Buffer_control *
+_CORE_message_queue_Allocate_message_buffer (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get( &the_message_queue->Inactive_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message buffer to the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first message from the_message_queue
+ * and returns a pointer to it.
+ */
+
+STATIC INLINE
+ CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get_unprotected( &the_message_queue->Pending_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+ CORE_message_queue_Attributes *the_attribute
+)
+{
+ return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Append (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the front of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Prepend (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Prepend(
+ &the_message_queue->Pending_messages,
+ &the_message->Node
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is TRUE and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if notification is enabled on this message
+ * queue and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_notify_enabled (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (the_message_queue->notify_handler != NULL);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the notification information for the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Set_notify (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Notify_Handler the_handler,
+ void *the_argument
+)
+{
+ the_message_queue->notify_handler = the_handler;
+ the_message_queue->notify_argument = the_argument;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/coremutex.inl b/c/src/exec/score/inline/coremutex.inl
new file mode 100644
index 0000000000..537d6f7e5f
--- /dev/null
+++ b/c/src/exec/score/inline/coremutex.inl
@@ -0,0 +1,124 @@
+/* inline/coremutex.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_MUTEX_inl
+#define __INLINE_CORE_MUTEX_inl
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex specified is locked and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_locked(
+ CORE_mutex_Control *the_mutex
+)
+{
+ return the_mutex->lock == CORE_MUTEX_LOCKED;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_fifo(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is PRIORITY and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * INHERIT_PRIORITY and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_inherit_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * PRIORITY_CEILING and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex allows a task to obtain a
+ * semaphore more than once and nest.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->allow_nesting == TRUE;
+
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/coresem.inl b/c/src/exec/score/inline/coresem.inl
new file mode 100644
index 0000000000..6f82318d10
--- /dev/null
+++ b/c/src/exec/score/inline/coresem.inl
@@ -0,0 +1,54 @@
+/* inline/coresem.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE semaphore.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_SEMAPHORE_inl
+#define __INLINE_CORE_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_semaphore_Is_priority(
+ CORE_semaphore_Attributes *the_attribute
+)
+{
+ return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Get_count
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current count associated with the semaphore.
+ */
+
+STATIC INLINE unsigned32 _CORE_semaphore_Get_count(
+ CORE_semaphore_Control *the_semaphore
+)
+{
+ return the_semaphore->count;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/heap.inl b/c/src/exec/score/inline/heap.inl
new file mode 100644
index 0000000000..6b4b1af74e
--- /dev/null
+++ b/c/src/exec/score/inline/heap.inl
@@ -0,0 +1,274 @@
+/* heap.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the head of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Head (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->start;
+}
+
+/*PAGE
+ *
+ * _Heap_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the tail of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Tail (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->final;
+}
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * precedes the_block in memory.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Previous_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Subtract_offset(
+ (void *)the_block,
+ the_block->back_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * follows the_block in memory.
+ *
+ * NOTE: Next_block assumes that the block is free.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Next_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset(
+ (void *)the_block,
+ the_block->front_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ *
+ * DESCRIPTION:
+ *
+ * This function calculates and returns a block's location (address)
+ * in the heap based upad a base address and an offset.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Block_at(
+ void *base,
+ unsigned32 offset
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset( (void *)base, offset );
+}
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Heap_Block *_Heap_User_block_at(
+ void *base
+)
+{
+ unsigned32 offset;
+
+ offset = *(((unsigned32 *) base) - 1);
+ return _Heap_Block_at( base, -offset + -HEAP_BLOCK_USED_OVERHEAD);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the previous block of the_block
+ * is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_previous_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->back_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is currently allocated,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_used (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the size of the_block in bytes.
+ */
+
+STATIC INLINE unsigned32 _Heap_Block_size (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & ~HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the portion of the block
+ * which the user may access.
+ */
+
+STATIC INLINE void *_Heap_Start_of_user_area (
+ Heap_Block *the_block
+)
+{
+ return (void *) &the_block->next;
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_block is within the memory area
+ * managed by the_heap, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_in (
+ Heap_Control *the_heap,
+ Heap_Block *the_block
+)
+{
+ return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final );
+}
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function validates a specified heap page size. If the page size
+ * is 0 or if lies outside a page size alignment boundary it is invalid
+ * and FALSE is returned. Otherwise, the page size is valid and TRUE is
+ * returned.
+ */
+
+STATIC INLINE boolean _Heap_Is_page_size_valid(
+ unsigned32 page_size
+)
+{
+ return ((page_size != 0) &&
+ ((page_size % CPU_HEAP_ALIGNMENT) == 0));
+}
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the block flag composed of size and in_use_flag.
+ * The flag returned is suitable for use as a back or front flag in a
+ * heap block.
+ */
+
+STATIC INLINE unsigned32 _Heap_Build_flag (
+ unsigned32 size,
+ unsigned32 in_use_flag
+)
+{
+ return size | in_use_flag;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/isr.inl b/c/src/exec/score/inline/isr.inl
new file mode 100644
index 0000000000..2dd41315bc
--- /dev/null
+++ b/c/src/exec/score/inline/isr.inl
@@ -0,0 +1,73 @@
+/* isr.inl
+ *
+ * This include file contains the static implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+STATIC INLINE boolean _ISR_Is_in_progress( void )
+{
+ return (_ISR_Nest_level != 0);
+}
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the vector is a valid vector number
+ * for this processor and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_vector_number_valid (
+ unsigned32 vector
+)
+{
+ return ( vector <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER );
+}
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if handler is the entry point of a valid
+ * use interrupt service routine and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_valid_user_handler (
+ void *handler
+)
+{
+ return ( handler != NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/mppkt.inl b/c/src/exec/score/inline/mppkt.inl
new file mode 100644
index 0000000000..c8b6ecd117
--- /dev/null
+++ b/c/src/exec/score/inline/mppkt.inl
@@ -0,0 +1,58 @@
+/* inline/mppkt.inl
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_PACKET_inl
+#define __INLINE_MP_PACKET_inl
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is valid,
+ * and FALSE otherwise.
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_valid_packet_class (
+ MP_packet_Classes the_packet_class
+)
+{
+ return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
+}
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is null,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_null (
+ MP_packet_Prefix *the_packet
+)
+{
+ return the_packet == NULL;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/object.inl b/c/src/exec/score/inline/object.inl
new file mode 100644
index 0000000000..249814bacf
--- /dev/null
+++ b/c/src/exec/score/inline/object.inl
@@ -0,0 +1,244 @@
+/* object.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ * DESCRIPTION:
+ *
+ * This function builds an object's id from the processor node and index
+ * values specified.
+ */
+
+STATIC INLINE Objects_Id _Objects_Build_id(
+ Objects_Classes the_class,
+ unsigned32 node,
+ unsigned32 index
+)
+{
+ return ( (the_class << OBJECTS_CLASS_START_BIT) |
+ (node << OBJECTS_NODE_START_BIT) |
+ (index << OBJECTS_INDEX_START_BIT) );
+}
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ */
+
+STATIC INLINE Objects_Classes _Objects_Get_class(
+ Objects_Id id
+)
+{
+ return (Objects_Classes)
+ ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
+}
+
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_node(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_index(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is valid.
+ */
+
+STATIC INLINE boolean _Objects_Is_class_valid(
+ Objects_Classes the_class
+)
+{
+ return the_class <= OBJECTS_CLASSES_LAST;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the node is of the local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_node(
+ unsigned32 node
+)
+{
+ return ( node == _Objects_Local_node );
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the id is of a local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_id(
+ Objects_Id id
+)
+{
+ return _Objects_Is_local_node( _Objects_Get_node(id) );
+}
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if left and right are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Are_ids_equal(
+ Objects_Id left,
+ Objects_Id right
+)
+{
+ return ( left == right );
+}
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a object control block from
+ * the inactive chain of free object control blocks.
+ */
+
+STATIC INLINE Objects_Control *_Objects_Allocate(
+ Objects_Information *information
+)
+{
+ return (Objects_Control *) _Chain_Get( &information->Inactive );
+}
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees a object control block to the
+ * inactive chain of free object control blocks.
+ */
+
+STATIC INLINE void _Objects_Free(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ _Chain_Append( &information->Inactive, &the_object->Node );
+}
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables, respectively.
+ */
+
+STATIC INLINE void _Objects_Open(
+ Objects_Information *information,
+ Objects_Control *the_object,
+ Objects_Name name
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = the_object;
+
+ if ( information->is_string )
+ _Objects_Copy_name_string( name, the_object->name );
+ else
+ _Objects_Copy_name_raw( name, the_object->name, information->name_length );
+}
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables.
+ */
+
+STATIC INLINE void _Objects_Close(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = NULL;
+ _Objects_Clear_name( the_object->name, information->name_length );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/objectmp.inl b/c/src/exec/score/inline/objectmp.inl
new file mode 100644
index 0000000000..dda2799643
--- /dev/null
+++ b/c/src/exec/score/inline/objectmp.inl
@@ -0,0 +1,73 @@
+/* inline/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_OBJECTS_inl
+#define __INLINE_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a Global Object control block.
+ */
+
+STATIC INLINE Objects_MP_Control *_Objects_MP_Allocate_global_object (
+ void
+)
+{
+ return (Objects_MP_Control *)
+ _Chain_Get( &_Objects_MP_Inactive_global_objects );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Free_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a Global Object control block.
+ */
+
+STATIC INLINE void _Objects_MP_Free_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ _Chain_Append(
+ &_Objects_MP_Inactive_global_objects,
+ &the_object->Object.Node
+ );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Is_null_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function returns whether the global object is NULL or not.
+ */
+
+STATIC INLINE boolean _Objects_MP_Is_null_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ return( the_object == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/priority.inl b/c/src/exec/score/inline/priority.inl
new file mode 100644
index 0000000000..d65056057b
--- /dev/null
+++ b/c/src/exec/score/inline/priority.inl
@@ -0,0 +1,247 @@
+/* priority.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _Priority_Handler_initialization( void )
+{
+ unsigned32 index;
+
+ _Priority_Major_bit_map = 0;
+ for ( index=0 ; index <16 ; index++ )
+ _Priority_Bit_map[ index ] = 0;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority if valid for a
+ * user task, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_valid (
+ Priority_Control the_priority
+)
+{
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+ return ( the_priority <= PRIORITY_MAXIMUM );
+}
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the major portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Major (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority / 16 );
+}
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the minor portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Minor (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority % 16 );
+}
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the mask associated with the major or minor
+ * number passed to it.
+ */
+
+STATIC INLINE unsigned32 _Priority_Mask (
+ unsigned32 bit_number
+)
+{
+ return (0x8000 >> bit_number);
+}
+
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ * DESCRIPTION:
+ *
+ * This function translates the bit numbers returned by the bit scan
+ * of a priority bit field into something suitable for use as
+ * a major or minor component of a priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Bits_index (
+ unsigned32 bit_number
+)
+{
+ return bit_number;
+}
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been readied.
+ */
+
+STATIC INLINE void _Priority_Add_to_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor |= the_priority_map->ready_minor;
+ _Priority_Major_bit_map |= the_priority_map->ready_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been removed from the
+ * ready state.
+ */
+
+STATIC INLINE void _Priority_Remove_from_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor &= the_priority_map->block_minor;
+ if ( *the_priority_map->minor == 0 )
+ _Priority_Major_bit_map &= the_priority_map->block_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the priority of the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE Priority_Control _Priority_Get_highest( void )
+{
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control major;
+
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major );
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor );
+
+ return (_Priority_Bits_index( major ) << 4) +
+ _Priority_Bits_index( minor );
+}
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_priority_map so that it
+ * contains the information necessary to manage a thread
+ * at new_priority.
+ */
+
+STATIC INLINE void _Priority_Initialize_information(
+ Priority_Information *the_priority_map,
+ Priority_Control new_priority
+)
+{
+ Priority_Bit_map_control major;
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control mask;
+
+ major = _Priority_Major( new_priority );
+ minor = _Priority_Minor( new_priority );
+
+ the_priority_map->minor =
+ &_Priority_Bit_map[ _Priority_Bits_index(major) ];
+
+ mask = _Priority_Mask( major );
+ the_priority_map->ready_major = mask;
+ the_priority_map->block_major = ~mask;
+
+ mask = _Priority_Mask( minor );
+ the_priority_map->ready_minor = mask;
+ the_priority_map->block_minor = ~mask;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority GROUP is empty, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_group_empty (
+ Priority_Control the_priority
+)
+{
+ return the_priority == 0;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/address.inl b/c/src/exec/score/inline/rtems/score/address.inl
new file mode 100644
index 0000000000..343123c981
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/address.inl
@@ -0,0 +1,120 @@
+/* inline/address.inl
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ADDRESSES_inl
+#define __INLINE_ADDRESSES_inl
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to add an offset to a base address.
+ * It returns the resulting address. This address is typically
+ * converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Add_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base + offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract an offset from a base
+ * address. It returns the resulting address. This address is
+ * typically converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Subtract_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base - offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract two addresses. It returns the
+ * resulting offset.
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+STATIC INLINE unsigned32 _Addresses_Subtract (
+ void *left,
+ void *right
+)
+{
+ return ((char *) left - (char *) right);
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is correctly
+ * aligned for this processor and FALSE otherwise. Proper alignment
+ * is based on correctness and efficiency.
+ */
+
+STATIC INLINE boolean _Addresses_Is_aligned (
+ void *address
+)
+{
+ return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 );
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is within the
+ * memory range specified and FALSE otherwise. base is the address
+ * of the first byte in the memory range and limit is the address
+ * of the last byte in the memory range. The base address is
+ * assumed to be lower than the limit address.
+ */
+
+STATIC INLINE boolean _Addresses_Is_in_range (
+ void *address,
+ void *base,
+ void *limit
+)
+{
+ return ( address >= base && address <= limit );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/chain.inl b/c/src/exec/score/inline/rtems/score/chain.inl
new file mode 100644
index 0000000000..7fd3fef934
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/chain.inl
@@ -0,0 +1,390 @@
+/* inline/chain.inl
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * NOTE: The routines in this file are ordered from simple
+ * to complex. No other Chain Handler routine is referenced
+ * unless it has already been defined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CHAIN_inl
+#define __INLINE_CHAIN_inl
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if LEFT and RIGHT are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Are_nodes_equal(
+ Chain_Node *left,
+ Chain_Node *right
+)
+{
+ return left == right;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_chain is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null_node(
+ Chain_Node *the_node
+)
+{
+ return ( the_node == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the first node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Head(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) the_chain;
+}
+
+/*PAGE
+ *
+ * _Chain_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the last node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Tail(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) &the_chain->permanent_null;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there a no nodes on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_empty(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the first node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_first(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->previous == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the last node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_last(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->next == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there is only one node on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Has_only_one_node(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == the_chain->last );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the head of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_head(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Head( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the tail of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_tail(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified chain to contain zero nodes.
+ */
+
+STATIC INLINE void _Chain_Initialize_empty(
+ Chain_Control *the_chain
+)
+{
+ the_chain->first = _Chain_Tail( the_chain );
+ the_chain->permanent_null = NULL;
+ the_chain->last = _Chain_Head( the_chain );
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * extract operation.
+ */
+
+STATIC INLINE void _Chain_Extract_unprotected(
+ Chain_Node *the_node
+)
+{
+ Chain_Node *next;
+ Chain_Node *previous;
+
+ next = the_node->next;
+ previous = the_node->previous;
+ next->previous = previous;
+ previous->next = next;
+}
+
+/*PAGE
+ *
+ * _Chain_Get_first_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. It does NOT disable interrupts to insure
+ * the atomicity of the get operation.
+ */
+
+STATIC INLINE 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;
+}
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * get operation.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Get_unprotected(
+ Chain_Control *the_chain
+)
+{
+ if ( !_Chain_Is_empty( the_chain ) )
+ return _Chain_Get_first_unprotected( the_chain );
+ else
+ return NULL;
+}
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It does NOT disable interrupts to insure the atomicity
+ * of the extract operation.
+ */
+
+STATIC INLINE void _Chain_Insert_unprotected(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *before_node;
+
+ the_node->previous = after_node;
+ before_node = after_node->next;
+ after_node->next = the_node;
+ the_node->next = before_node;
+ before_node->previous = the_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * append operation.
+ */
+
+STATIC INLINE void _Chain_Append_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *old_last_node;
+
+ the_node->next = _Chain_Tail( the_chain );
+ old_last_node = the_chain->last;
+ the_chain->last = the_node;
+ old_last_node->next = the_node;
+ the_node->previous = old_last_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert_unprotected( _Chain_Head( the_chain ), the_node );
+
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert( _Chain_Head( the_chain ), the_node );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/coremsg.inl b/c/src/exec/score/inline/rtems/score/coremsg.inl
new file mode 100644
index 0000000000..84e7250aa7
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/coremsg.inl
@@ -0,0 +1,260 @@
+/* coremsg.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+#include <string.h> /* needed for memcpy */
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the end of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_SEND_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the front of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine copies the contents of the source message buffer
+ * to the destination message buffer.
+ */
+
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+ void *source,
+ void *destination,
+ unsigned32 size
+)
+{
+ memcpy(destination, source, size);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message buffer from the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE CORE_message_queue_Buffer_control *
+_CORE_message_queue_Allocate_message_buffer (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get( &the_message_queue->Inactive_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message buffer to the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first message from the_message_queue
+ * and returns a pointer to it.
+ */
+
+STATIC INLINE
+ CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get_unprotected( &the_message_queue->Pending_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+ CORE_message_queue_Attributes *the_attribute
+)
+{
+ return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Append (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the front of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Prepend (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Prepend(
+ &the_message_queue->Pending_messages,
+ &the_message->Node
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is TRUE and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if notification is enabled on this message
+ * queue and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_notify_enabled (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (the_message_queue->notify_handler != NULL);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the notification information for the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Set_notify (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Notify_Handler the_handler,
+ void *the_argument
+)
+{
+ the_message_queue->notify_handler = the_handler;
+ the_message_queue->notify_argument = the_argument;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/coremutex.inl b/c/src/exec/score/inline/rtems/score/coremutex.inl
new file mode 100644
index 0000000000..537d6f7e5f
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/coremutex.inl
@@ -0,0 +1,124 @@
+/* inline/coremutex.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_MUTEX_inl
+#define __INLINE_CORE_MUTEX_inl
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex specified is locked and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_locked(
+ CORE_mutex_Control *the_mutex
+)
+{
+ return the_mutex->lock == CORE_MUTEX_LOCKED;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_fifo(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is PRIORITY and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * INHERIT_PRIORITY and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_inherit_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * PRIORITY_CEILING and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex allows a task to obtain a
+ * semaphore more than once and nest.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->allow_nesting == TRUE;
+
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/coresem.inl b/c/src/exec/score/inline/rtems/score/coresem.inl
new file mode 100644
index 0000000000..6f82318d10
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/coresem.inl
@@ -0,0 +1,54 @@
+/* inline/coresem.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE semaphore.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_SEMAPHORE_inl
+#define __INLINE_CORE_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_semaphore_Is_priority(
+ CORE_semaphore_Attributes *the_attribute
+)
+{
+ return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Get_count
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current count associated with the semaphore.
+ */
+
+STATIC INLINE unsigned32 _CORE_semaphore_Get_count(
+ CORE_semaphore_Control *the_semaphore
+)
+{
+ return the_semaphore->count;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/heap.inl b/c/src/exec/score/inline/rtems/score/heap.inl
new file mode 100644
index 0000000000..6b4b1af74e
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/heap.inl
@@ -0,0 +1,274 @@
+/* heap.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the head of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Head (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->start;
+}
+
+/*PAGE
+ *
+ * _Heap_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the tail of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Tail (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->final;
+}
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * precedes the_block in memory.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Previous_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Subtract_offset(
+ (void *)the_block,
+ the_block->back_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * follows the_block in memory.
+ *
+ * NOTE: Next_block assumes that the block is free.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Next_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset(
+ (void *)the_block,
+ the_block->front_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ *
+ * DESCRIPTION:
+ *
+ * This function calculates and returns a block's location (address)
+ * in the heap based upad a base address and an offset.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Block_at(
+ void *base,
+ unsigned32 offset
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset( (void *)base, offset );
+}
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Heap_Block *_Heap_User_block_at(
+ void *base
+)
+{
+ unsigned32 offset;
+
+ offset = *(((unsigned32 *) base) - 1);
+ return _Heap_Block_at( base, -offset + -HEAP_BLOCK_USED_OVERHEAD);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the previous block of the_block
+ * is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_previous_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->back_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is currently allocated,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_used (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the size of the_block in bytes.
+ */
+
+STATIC INLINE unsigned32 _Heap_Block_size (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & ~HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the portion of the block
+ * which the user may access.
+ */
+
+STATIC INLINE void *_Heap_Start_of_user_area (
+ Heap_Block *the_block
+)
+{
+ return (void *) &the_block->next;
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_block is within the memory area
+ * managed by the_heap, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_in (
+ Heap_Control *the_heap,
+ Heap_Block *the_block
+)
+{
+ return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final );
+}
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function validates a specified heap page size. If the page size
+ * is 0 or if lies outside a page size alignment boundary it is invalid
+ * and FALSE is returned. Otherwise, the page size is valid and TRUE is
+ * returned.
+ */
+
+STATIC INLINE boolean _Heap_Is_page_size_valid(
+ unsigned32 page_size
+)
+{
+ return ((page_size != 0) &&
+ ((page_size % CPU_HEAP_ALIGNMENT) == 0));
+}
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the block flag composed of size and in_use_flag.
+ * The flag returned is suitable for use as a back or front flag in a
+ * heap block.
+ */
+
+STATIC INLINE unsigned32 _Heap_Build_flag (
+ unsigned32 size,
+ unsigned32 in_use_flag
+)
+{
+ return size | in_use_flag;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/isr.inl b/c/src/exec/score/inline/rtems/score/isr.inl
new file mode 100644
index 0000000000..2dd41315bc
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/isr.inl
@@ -0,0 +1,73 @@
+/* isr.inl
+ *
+ * This include file contains the static implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+STATIC INLINE boolean _ISR_Is_in_progress( void )
+{
+ return (_ISR_Nest_level != 0);
+}
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the vector is a valid vector number
+ * for this processor and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_vector_number_valid (
+ unsigned32 vector
+)
+{
+ return ( vector <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER );
+}
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if handler is the entry point of a valid
+ * use interrupt service routine and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_valid_user_handler (
+ void *handler
+)
+{
+ return ( handler != NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/mppkt.inl b/c/src/exec/score/inline/rtems/score/mppkt.inl
new file mode 100644
index 0000000000..c8b6ecd117
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/mppkt.inl
@@ -0,0 +1,58 @@
+/* inline/mppkt.inl
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_PACKET_inl
+#define __INLINE_MP_PACKET_inl
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is valid,
+ * and FALSE otherwise.
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_valid_packet_class (
+ MP_packet_Classes the_packet_class
+)
+{
+ return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
+}
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is null,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_null (
+ MP_packet_Prefix *the_packet
+)
+{
+ return the_packet == NULL;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/object.inl b/c/src/exec/score/inline/rtems/score/object.inl
new file mode 100644
index 0000000000..249814bacf
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/object.inl
@@ -0,0 +1,244 @@
+/* object.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ * DESCRIPTION:
+ *
+ * This function builds an object's id from the processor node and index
+ * values specified.
+ */
+
+STATIC INLINE Objects_Id _Objects_Build_id(
+ Objects_Classes the_class,
+ unsigned32 node,
+ unsigned32 index
+)
+{
+ return ( (the_class << OBJECTS_CLASS_START_BIT) |
+ (node << OBJECTS_NODE_START_BIT) |
+ (index << OBJECTS_INDEX_START_BIT) );
+}
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ */
+
+STATIC INLINE Objects_Classes _Objects_Get_class(
+ Objects_Id id
+)
+{
+ return (Objects_Classes)
+ ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
+}
+
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_node(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_index(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is valid.
+ */
+
+STATIC INLINE boolean _Objects_Is_class_valid(
+ Objects_Classes the_class
+)
+{
+ return the_class <= OBJECTS_CLASSES_LAST;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the node is of the local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_node(
+ unsigned32 node
+)
+{
+ return ( node == _Objects_Local_node );
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the id is of a local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_id(
+ Objects_Id id
+)
+{
+ return _Objects_Is_local_node( _Objects_Get_node(id) );
+}
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if left and right are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Are_ids_equal(
+ Objects_Id left,
+ Objects_Id right
+)
+{
+ return ( left == right );
+}
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a object control block from
+ * the inactive chain of free object control blocks.
+ */
+
+STATIC INLINE Objects_Control *_Objects_Allocate(
+ Objects_Information *information
+)
+{
+ return (Objects_Control *) _Chain_Get( &information->Inactive );
+}
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees a object control block to the
+ * inactive chain of free object control blocks.
+ */
+
+STATIC INLINE void _Objects_Free(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ _Chain_Append( &information->Inactive, &the_object->Node );
+}
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables, respectively.
+ */
+
+STATIC INLINE void _Objects_Open(
+ Objects_Information *information,
+ Objects_Control *the_object,
+ Objects_Name name
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = the_object;
+
+ if ( information->is_string )
+ _Objects_Copy_name_string( name, the_object->name );
+ else
+ _Objects_Copy_name_raw( name, the_object->name, information->name_length );
+}
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables.
+ */
+
+STATIC INLINE void _Objects_Close(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = NULL;
+ _Objects_Clear_name( the_object->name, information->name_length );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/objectmp.inl b/c/src/exec/score/inline/rtems/score/objectmp.inl
new file mode 100644
index 0000000000..dda2799643
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/objectmp.inl
@@ -0,0 +1,73 @@
+/* inline/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_OBJECTS_inl
+#define __INLINE_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a Global Object control block.
+ */
+
+STATIC INLINE Objects_MP_Control *_Objects_MP_Allocate_global_object (
+ void
+)
+{
+ return (Objects_MP_Control *)
+ _Chain_Get( &_Objects_MP_Inactive_global_objects );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Free_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a Global Object control block.
+ */
+
+STATIC INLINE void _Objects_MP_Free_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ _Chain_Append(
+ &_Objects_MP_Inactive_global_objects,
+ &the_object->Object.Node
+ );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Is_null_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function returns whether the global object is NULL or not.
+ */
+
+STATIC INLINE boolean _Objects_MP_Is_null_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ return( the_object == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/priority.inl b/c/src/exec/score/inline/rtems/score/priority.inl
new file mode 100644
index 0000000000..d65056057b
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/priority.inl
@@ -0,0 +1,247 @@
+/* priority.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _Priority_Handler_initialization( void )
+{
+ unsigned32 index;
+
+ _Priority_Major_bit_map = 0;
+ for ( index=0 ; index <16 ; index++ )
+ _Priority_Bit_map[ index ] = 0;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority if valid for a
+ * user task, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_valid (
+ Priority_Control the_priority
+)
+{
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+ return ( the_priority <= PRIORITY_MAXIMUM );
+}
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the major portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Major (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority / 16 );
+}
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the minor portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Minor (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority % 16 );
+}
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the mask associated with the major or minor
+ * number passed to it.
+ */
+
+STATIC INLINE unsigned32 _Priority_Mask (
+ unsigned32 bit_number
+)
+{
+ return (0x8000 >> bit_number);
+}
+
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ * DESCRIPTION:
+ *
+ * This function translates the bit numbers returned by the bit scan
+ * of a priority bit field into something suitable for use as
+ * a major or minor component of a priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Bits_index (
+ unsigned32 bit_number
+)
+{
+ return bit_number;
+}
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been readied.
+ */
+
+STATIC INLINE void _Priority_Add_to_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor |= the_priority_map->ready_minor;
+ _Priority_Major_bit_map |= the_priority_map->ready_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been removed from the
+ * ready state.
+ */
+
+STATIC INLINE void _Priority_Remove_from_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor &= the_priority_map->block_minor;
+ if ( *the_priority_map->minor == 0 )
+ _Priority_Major_bit_map &= the_priority_map->block_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the priority of the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE Priority_Control _Priority_Get_highest( void )
+{
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control major;
+
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major );
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor );
+
+ return (_Priority_Bits_index( major ) << 4) +
+ _Priority_Bits_index( minor );
+}
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_priority_map so that it
+ * contains the information necessary to manage a thread
+ * at new_priority.
+ */
+
+STATIC INLINE void _Priority_Initialize_information(
+ Priority_Information *the_priority_map,
+ Priority_Control new_priority
+)
+{
+ Priority_Bit_map_control major;
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control mask;
+
+ major = _Priority_Major( new_priority );
+ minor = _Priority_Minor( new_priority );
+
+ the_priority_map->minor =
+ &_Priority_Bit_map[ _Priority_Bits_index(major) ];
+
+ mask = _Priority_Mask( major );
+ the_priority_map->ready_major = mask;
+ the_priority_map->block_major = ~mask;
+
+ mask = _Priority_Mask( minor );
+ the_priority_map->ready_minor = mask;
+ the_priority_map->block_minor = ~mask;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority GROUP is empty, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_group_empty (
+ Priority_Control the_priority
+)
+{
+ return the_priority == 0;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/stack.inl b/c/src/exec/score/inline/rtems/score/stack.inl
new file mode 100644
index 0000000000..d29874a7dd
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/stack.inl
@@ -0,0 +1,81 @@
+/* stack.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_stack record to indicate that
+ * size bytes of memory starting at starting_address have been
+ * reserved for a stack.
+ */
+
+STATIC INLINE void _Stack_Initialize (
+ Stack_Control *the_stack,
+ void *starting_address,
+ unsigned32 size
+)
+{
+ the_stack->area = starting_address;
+ the_stack->size = size;
+}
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if size bytes is enough memory for
+ * a valid stack area on this processor, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Stack_Is_enough (
+ unsigned32 size
+)
+{
+ return ( size >= STACK_MINIMUM_SIZE );
+}
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ *
+ * DESCRIPTION:
+ *
+ * This function increases the stack size to insure that the thread
+ * has the desired amount of stack space after the initial stack
+ * pointer is determined based on alignment restrictions.
+ *
+ * NOTE:
+ *
+ * The amount of adjustment for alignment is CPU dependent.
+ */
+
+STATIC INLINE unsigned32 _Stack_Adjust_size (
+ unsigned32 size
+)
+{
+ return size + CPU_STACK_ALIGNMENT;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/states.inl b/c/src/exec/score/inline/rtems/score/states.inl
new file mode 100644
index 0000000000..fad8ce727c
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/states.inl
@@ -0,0 +1,384 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the given states_to_set into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Set (
+ States_Control states_to_set,
+ States_Control current_state
+)
+{
+ return (current_state | states_to_set);
+}
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the given states_to_clear into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Clear (
+ States_Control states_to_clear,
+ States_Control current_state
+)
+{
+ return (current_state & ~states_to_clear);
+}
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_states indicates that the
+ * state is READY, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_ready (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_READY);
+}
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is the ONLY state
+ * set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_only_dormant (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_dormant (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the SUSPENDED state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_suspended (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_SUSPENDED);
+}
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the TRANSIENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_transient (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_TRANSIENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DELAYING state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_delaying (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DELAYING);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_BUFFER state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_buffer (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_BUFFER);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_segment (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEGMENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_message (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MESSAGE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_EVENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_event (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_EVENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MUTEX state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_mutex (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MUTEX);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEMAPHORE state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_semaphore (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEMAPHORE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_time (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_TIME);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_rpc_reply (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_RPC_REPLY);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_PERIOD state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_period (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_PERIOD);
+}
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_locally_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_LOCALLY_BLOCKED);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_on_thread_queue (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_ON_THREAD_QUEUE);
+}
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_BLOCKED);
+}
+
+/*PAGE
+ *
+ *
+ * _States_Are_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the states in the mask
+ * are set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Are_set (
+ States_Control the_states,
+ States_Control mask
+)
+{
+ return ( (the_states & mask) != STATES_READY);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/sysstate.inl b/c/src/exec/score/inline/rtems/score/sysstate.inl
new file mode 100644
index 0000000000..08f8b9c513
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/sysstate.inl
@@ -0,0 +1,154 @@
+/* sysstates.inl
+ *
+ * This file contains the inline implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the system state handler.
+ */
+
+STATIC INLINE void _System_state_Handler_initialization (
+ boolean is_multiprocessing
+)
+{
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION;
+ _System_state_Is_multiprocessing = is_multiprocessing;
+}
+
+/*PAGE
+ *
+ * _System_state_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current system state to that specified by
+ * the called.
+ */
+
+STATIC INLINE void _System_state_Set (
+ System_state_Codes state
+)
+{
+ _System_state_Current = state;
+}
+
+/*PAGE
+ *
+ * _System_state_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the current system state.
+ */
+
+STATIC INLINE System_state_Codes _System_state_Get ( void )
+{
+ return _System_state_Current;
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before initialization" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_initialization (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "begin multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_begin_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEGIN_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "up" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_up (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_UP);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "failed" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_failed (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_FAILED);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/thread.inl b/c/src/exec/score/inline/rtems/score/thread.inl
new file mode 100644
index 0000000000..53d5d41751
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/thread.inl
@@ -0,0 +1,404 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine halts multitasking and returns control to
+ * the "thread" (i.e. the BSP) which initially invoked the
+ * routine which initialized the system.
+ */
+
+STATIC INLINE void _Thread_Stop_multitasking( void )
+{
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the currently executing
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Executing );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the heir
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_heir (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the currently executing thread
+ * is also the heir thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void )
+{
+ return ( _Thread_Executing == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the SUSPENDED state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Resume (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_SUSPENDED );
+}
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears any blocking state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Unblock (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_BLOCKED );
+}
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets the current context of the calling thread
+ * to that of its initial state.
+ */
+
+STATIC INLINE void _Thread_Restart_self( void )
+{
+ if ( _Thread_Executing->fp_context != NULL )
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers );
+}
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE void _Thread_Calculate_heir( void )
+{
+ _Thread_Heir = (Thread_Control *)
+ _Thread_Ready_chain[ _Priority_Get_highest() ].first;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point context of
+ * the_thread is currently loaded in the floating point unit, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_allocated_fp (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Allocated_fp );
+}
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the currently loaded floating
+ * point context is now longer associated with an active thread.
+ */
+
+STATIC INLINE void _Thread_Deallocate_fp( void )
+{
+ _Thread_Allocated_fp = NULL;
+}
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine prevents dispatching.
+ */
+
+STATIC INLINE void _Thread_Disable_dispatch( void )
+{
+ _Thread_Dispatch_disable_level += 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. If this is
+ * the outer most dispatching critical section, then a dispatching
+ * operation will be performed and, if necessary, control of the
+ * processor will be transferred to the heir thread.
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+STATIC INLINE void _Thread_Enable_dispatch()
+{
+ if ( (--_Thread_Dispatch_disable_level) == 0 )
+ _Thread_Dispatch();
+}
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. However,
+ * no dispatching operation is performed even if this is the outer
+ * most dispatching critical section.
+ */
+
+STATIC INLINE void _Thread_Unnest_dispatch( void )
+{
+ _Thread_Dispatch_disable_level -= 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_dispatching_enabled( void )
+{
+ return ( _Thread_Dispatch_disable_level == 0 );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_context_switch_necessary( void )
+{
+ return ( _Context_Switch_necessary );
+}
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the thread dispatching subsystem.
+ */
+
+STATIC INLINE void _Thread_Dispatch_initialization( void )
+{
+ _Thread_Dispatch_disable_level = 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_null (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == NULL );
+}
+
+/*PAGE
+ *
+ * _Thread_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps thread IDs to thread control
+ * blocks. If ID corresponds to a local thread, then it
+ * returns the_thread control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the thread ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_thread is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_thread is undefined.
+ *
+ * NOTE: XXX... This routine may be able to be optimized.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ Objects_Classes 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_class = _Objects_Get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ tp = (Thread_Control *) _Objects_Get( information, id, location );
+
+done:
+ return tp;
+}
+
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to the
+ * status which indicates that a proxy is blocking, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_proxy_blocking (
+ unsigned32 code
+)
+{
+ return (code == THREAD_STATUS_PROXY_BLOCKING);
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates an internal thread.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Internal_allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information );
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees an internal thread.
+ */
+
+STATIC INLINE void _Thread_Internal_free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free( &_Thread_Internal_information, &the_task->Object );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/threadmp.inl b/c/src/exec/score/inline/rtems/score/threadmp.inl
new file mode 100644
index 0000000000..f16f64e48a
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/threadmp.inl
@@ -0,0 +1,61 @@
+/* inline/threadmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_THREAD_inl
+#define __INLINE_MP_THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns true if the thread in question is the
+ * multiprocessing receive thread.
+ */
+
+STATIC INLINE boolean _Thread_MP_Is_receive (
+ Thread_Control *the_thread
+)
+{
+ return the_thread == _Thread_MP_Receive;
+}
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a proxy control block to the
+ * inactive chain of free proxy control blocks.
+ */
+
+STATIC INLINE void _Thread_MP_Free_proxy (
+ Thread_Control *the_thread
+)
+{
+ Thread_Proxy_control *the_proxy;
+
+ the_proxy = (Thread_Proxy_control *) the_thread;
+
+ _Chain_Extract( &the_proxy->Active );
+
+ _Chain_Append( &_Thread_MP_Inactive_proxies, &the_thread->Object.Node );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/tod.inl b/c/src/exec/score/inline/rtems/score/tod.inl
new file mode 100644
index 0000000000..5ed1e76d8f
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/tod.inl
@@ -0,0 +1,82 @@
+/* tod.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the application has set the current
+ * time of day, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _TOD_Is_set( void )
+{
+ return _Watchdog_Is_active( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine increments the ticks field of the current time of
+ * day at each clock tick.
+ */
+
+STATIC INLINE void _TOD_Tickle_ticks( void )
+{
+ _TOD_Current.ticks += 1;
+ _TOD_Ticks_since_boot += 1;
+}
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Deactivate( void )
+{
+ _Watchdog_Remove( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Activate(
+ Watchdog_Interval ticks
+)
+{
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, ticks );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/tqdata.inl b/c/src/exec/score/inline/rtems/score/tqdata.inl
new file mode 100644
index 0000000000..c7d8630062
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/tqdata.inl
@@ -0,0 +1,89 @@
+/* tqdata.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index of the priority chain on which
+ * a thread of the_priority should be placed.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Header_number (
+ Priority_Control the_priority
+)
+{
+ return (the_priority / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER);
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority indicates that the
+ * enqueue search should start at the front of this priority
+ * group chain, and FALSE if the search should start at the rear.
+ */
+
+STATIC INLINE boolean _Thread_queue_Is_reverse_search (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number of threads waiting on this thread queue.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Get_number_waiting (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ return ( the_thread_queue->count );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to indicate that the specified thread queue is
+ * entering a critical section.
+ */
+
+STATIC INLINE void _Thread_queue_Enter_critical_section (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ the_thread_queue->sync_state = THREAD_QUEUE_NOTHING_HAPPENED;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/userext.inl b/c/src/exec/score/inline/rtems/score/userext.inl
new file mode 100644
index 0000000000..a9a858b2e2
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/userext.inl
@@ -0,0 +1,121 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _User_extensions_Handler_initialization (
+ User_extensions_Table *initial_extensions
+)
+{
+ _Chain_Initialize_empty( &_User_extensions_List );
+
+ if ( initial_extensions ) {
+ _User_extensions_Initial.Callouts = *initial_extensions;
+ _Chain_Append( &_User_extensions_List, &_User_extensions_Initial.Node );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to add a user extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+)
+{
+ the_extension->Callouts = *extension_table;
+
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ * DESCRIPTION:
+ *
+ * This routine is used to add an API extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Prepend( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to remove a user extension set from the active list.
+ */
+
+STATIC INLINE void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Extract( &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ */
+
+STATIC INLINE void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+)
+{
+ 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_switch != NULL )
+ (*the_extension->Callouts.thread_switch)( executing, heir );
+ }
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/watchdog.inl b/c/src/exec/score/inline/rtems/score/watchdog.inl
new file mode 100644
index 0000000000..75fb662dfc
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/watchdog.inl
@@ -0,0 +1,324 @@
+/* watchdog.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified watchdog. The watchdog is
+ * made inactive, the watchdog id and handler routine are set to the
+ * specified values.
+ */
+
+STATIC INLINE void _Watchdog_Initialize(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Service_routine_entry routine,
+ Objects_Id id,
+ void *user_data
+)
+{
+ the_watchdog->state = WATCHDOG_INACTIVE;
+ the_watchdog->routine = routine;
+ the_watchdog->id = id;
+ the_watchdog->user_data = user_data;
+}
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the watchdog timer is in the ACTIVE
+ * state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Watchdog_Is_active(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( the_watchdog->state == WATCHDOG_ACTIVE );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates THE_WATCHDOG timer which is already
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Activate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_ACTIVE;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates THE_WATCHDOG timer which will remain
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Deactivate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_REMOVE_IT;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the ticks
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_ticks( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the seconds
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_seconds( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the ticks watchdog chain
+ * for a time of UNITS ticks. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_ticks(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the seconds watchdog chain
+ * for a time of UNITS seconds. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_seconds(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the seconds watchdog chain in the forward
+ * or backward DIRECTION for UNITS seconds. This is invoked when the
+ * current time of day is changed.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_seconds(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the ticks watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_ticks(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets THE_WATCHDOG timer to its state at INSERT
+ * time. This routine is valid only on interval watchdog timers
+ * and is used to make an interval watchdog timer fire "every" so
+ * many ticks.
+ */
+
+STATIC INLINE void _Watchdog_Reset(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ (void) _Watchdog_Remove( the_watchdog );
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer following
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Next(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.next );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer preceding
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Previous(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.previous );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the first watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_First(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->first );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the last watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Last(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->last );
+
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/rtems/score/wkspace.inl b/c/src/exec/score/inline/rtems/score/wkspace.inl
new file mode 100644
index 0000000000..47174a9c9d
--- /dev/null
+++ b/c/src/exec/score/inline/rtems/score/wkspace.inl
@@ -0,0 +1,57 @@
+/* wkspace.inl
+ *
+ * This include file contains the bodies of the routines which contains
+ * information related to the RAM Workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then NULL is returned.
+ */
+
+STATIC INLINE void *_Workspace_Allocate(
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &_Workspace_Area, size );
+}
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the specified block of memory. If the block
+ * belongs to the Workspace and can be successfully freed, then
+ * TRUE is returned. Otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Workspace_Free(
+ void *block
+)
+{
+ return _Heap_Free( &_Workspace_Area, block );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/stack.inl b/c/src/exec/score/inline/stack.inl
new file mode 100644
index 0000000000..d29874a7dd
--- /dev/null
+++ b/c/src/exec/score/inline/stack.inl
@@ -0,0 +1,81 @@
+/* stack.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_stack record to indicate that
+ * size bytes of memory starting at starting_address have been
+ * reserved for a stack.
+ */
+
+STATIC INLINE void _Stack_Initialize (
+ Stack_Control *the_stack,
+ void *starting_address,
+ unsigned32 size
+)
+{
+ the_stack->area = starting_address;
+ the_stack->size = size;
+}
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if size bytes is enough memory for
+ * a valid stack area on this processor, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Stack_Is_enough (
+ unsigned32 size
+)
+{
+ return ( size >= STACK_MINIMUM_SIZE );
+}
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ *
+ * DESCRIPTION:
+ *
+ * This function increases the stack size to insure that the thread
+ * has the desired amount of stack space after the initial stack
+ * pointer is determined based on alignment restrictions.
+ *
+ * NOTE:
+ *
+ * The amount of adjustment for alignment is CPU dependent.
+ */
+
+STATIC INLINE unsigned32 _Stack_Adjust_size (
+ unsigned32 size
+)
+{
+ return size + CPU_STACK_ALIGNMENT;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/states.inl b/c/src/exec/score/inline/states.inl
new file mode 100644
index 0000000000..fad8ce727c
--- /dev/null
+++ b/c/src/exec/score/inline/states.inl
@@ -0,0 +1,384 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the given states_to_set into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Set (
+ States_Control states_to_set,
+ States_Control current_state
+)
+{
+ return (current_state | states_to_set);
+}
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the given states_to_clear into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Clear (
+ States_Control states_to_clear,
+ States_Control current_state
+)
+{
+ return (current_state & ~states_to_clear);
+}
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_states indicates that the
+ * state is READY, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_ready (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_READY);
+}
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is the ONLY state
+ * set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_only_dormant (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_dormant (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the SUSPENDED state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_suspended (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_SUSPENDED);
+}
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the TRANSIENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_transient (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_TRANSIENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DELAYING state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_delaying (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DELAYING);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_BUFFER state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_buffer (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_BUFFER);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_segment (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEGMENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_message (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MESSAGE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_EVENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_event (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_EVENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MUTEX state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_mutex (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MUTEX);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEMAPHORE state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_semaphore (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEMAPHORE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_time (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_TIME);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_rpc_reply (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_RPC_REPLY);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_PERIOD state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_period (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_PERIOD);
+}
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_locally_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_LOCALLY_BLOCKED);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_on_thread_queue (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_ON_THREAD_QUEUE);
+}
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_BLOCKED);
+}
+
+/*PAGE
+ *
+ *
+ * _States_Are_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the states in the mask
+ * are set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Are_set (
+ States_Control the_states,
+ States_Control mask
+)
+{
+ return ( (the_states & mask) != STATES_READY);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/sysstate.inl b/c/src/exec/score/inline/sysstate.inl
new file mode 100644
index 0000000000..08f8b9c513
--- /dev/null
+++ b/c/src/exec/score/inline/sysstate.inl
@@ -0,0 +1,154 @@
+/* sysstates.inl
+ *
+ * This file contains the inline implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the system state handler.
+ */
+
+STATIC INLINE void _System_state_Handler_initialization (
+ boolean is_multiprocessing
+)
+{
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION;
+ _System_state_Is_multiprocessing = is_multiprocessing;
+}
+
+/*PAGE
+ *
+ * _System_state_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current system state to that specified by
+ * the called.
+ */
+
+STATIC INLINE void _System_state_Set (
+ System_state_Codes state
+)
+{
+ _System_state_Current = state;
+}
+
+/*PAGE
+ *
+ * _System_state_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the current system state.
+ */
+
+STATIC INLINE System_state_Codes _System_state_Get ( void )
+{
+ return _System_state_Current;
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before initialization" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_initialization (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "begin multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_begin_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEGIN_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "up" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_up (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_UP);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "failed" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_failed (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_FAILED);
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/thread.inl b/c/src/exec/score/inline/thread.inl
new file mode 100644
index 0000000000..53d5d41751
--- /dev/null
+++ b/c/src/exec/score/inline/thread.inl
@@ -0,0 +1,404 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine halts multitasking and returns control to
+ * the "thread" (i.e. the BSP) which initially invoked the
+ * routine which initialized the system.
+ */
+
+STATIC INLINE void _Thread_Stop_multitasking( void )
+{
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the currently executing
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Executing );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the heir
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_heir (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the currently executing thread
+ * is also the heir thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void )
+{
+ return ( _Thread_Executing == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the SUSPENDED state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Resume (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_SUSPENDED );
+}
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears any blocking state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Unblock (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_BLOCKED );
+}
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets the current context of the calling thread
+ * to that of its initial state.
+ */
+
+STATIC INLINE void _Thread_Restart_self( void )
+{
+ if ( _Thread_Executing->fp_context != NULL )
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers );
+}
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE void _Thread_Calculate_heir( void )
+{
+ _Thread_Heir = (Thread_Control *)
+ _Thread_Ready_chain[ _Priority_Get_highest() ].first;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point context of
+ * the_thread is currently loaded in the floating point unit, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_allocated_fp (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Allocated_fp );
+}
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the currently loaded floating
+ * point context is now longer associated with an active thread.
+ */
+
+STATIC INLINE void _Thread_Deallocate_fp( void )
+{
+ _Thread_Allocated_fp = NULL;
+}
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine prevents dispatching.
+ */
+
+STATIC INLINE void _Thread_Disable_dispatch( void )
+{
+ _Thread_Dispatch_disable_level += 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. If this is
+ * the outer most dispatching critical section, then a dispatching
+ * operation will be performed and, if necessary, control of the
+ * processor will be transferred to the heir thread.
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+STATIC INLINE void _Thread_Enable_dispatch()
+{
+ if ( (--_Thread_Dispatch_disable_level) == 0 )
+ _Thread_Dispatch();
+}
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. However,
+ * no dispatching operation is performed even if this is the outer
+ * most dispatching critical section.
+ */
+
+STATIC INLINE void _Thread_Unnest_dispatch( void )
+{
+ _Thread_Dispatch_disable_level -= 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_dispatching_enabled( void )
+{
+ return ( _Thread_Dispatch_disable_level == 0 );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_context_switch_necessary( void )
+{
+ return ( _Context_Switch_necessary );
+}
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the thread dispatching subsystem.
+ */
+
+STATIC INLINE void _Thread_Dispatch_initialization( void )
+{
+ _Thread_Dispatch_disable_level = 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_null (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == NULL );
+}
+
+/*PAGE
+ *
+ * _Thread_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps thread IDs to thread control
+ * blocks. If ID corresponds to a local thread, then it
+ * returns the_thread control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the thread ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_thread is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_thread is undefined.
+ *
+ * NOTE: XXX... This routine may be able to be optimized.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ Objects_Classes 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_class = _Objects_Get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ tp = (Thread_Control *) _Objects_Get( information, id, location );
+
+done:
+ return tp;
+}
+
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to the
+ * status which indicates that a proxy is blocking, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_proxy_blocking (
+ unsigned32 code
+)
+{
+ return (code == THREAD_STATUS_PROXY_BLOCKING);
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates an internal thread.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Internal_allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information );
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees an internal thread.
+ */
+
+STATIC INLINE void _Thread_Internal_free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free( &_Thread_Internal_information, &the_task->Object );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/threadmp.inl b/c/src/exec/score/inline/threadmp.inl
new file mode 100644
index 0000000000..f16f64e48a
--- /dev/null
+++ b/c/src/exec/score/inline/threadmp.inl
@@ -0,0 +1,61 @@
+/* inline/threadmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_THREAD_inl
+#define __INLINE_MP_THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns true if the thread in question is the
+ * multiprocessing receive thread.
+ */
+
+STATIC INLINE boolean _Thread_MP_Is_receive (
+ Thread_Control *the_thread
+)
+{
+ return the_thread == _Thread_MP_Receive;
+}
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a proxy control block to the
+ * inactive chain of free proxy control blocks.
+ */
+
+STATIC INLINE void _Thread_MP_Free_proxy (
+ Thread_Control *the_thread
+)
+{
+ Thread_Proxy_control *the_proxy;
+
+ the_proxy = (Thread_Proxy_control *) the_thread;
+
+ _Chain_Extract( &the_proxy->Active );
+
+ _Chain_Append( &_Thread_MP_Inactive_proxies, &the_thread->Object.Node );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/tod.inl b/c/src/exec/score/inline/tod.inl
new file mode 100644
index 0000000000..5ed1e76d8f
--- /dev/null
+++ b/c/src/exec/score/inline/tod.inl
@@ -0,0 +1,82 @@
+/* tod.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the application has set the current
+ * time of day, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _TOD_Is_set( void )
+{
+ return _Watchdog_Is_active( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine increments the ticks field of the current time of
+ * day at each clock tick.
+ */
+
+STATIC INLINE void _TOD_Tickle_ticks( void )
+{
+ _TOD_Current.ticks += 1;
+ _TOD_Ticks_since_boot += 1;
+}
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Deactivate( void )
+{
+ _Watchdog_Remove( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Activate(
+ Watchdog_Interval ticks
+)
+{
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, ticks );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/tqdata.inl b/c/src/exec/score/inline/tqdata.inl
new file mode 100644
index 0000000000..c7d8630062
--- /dev/null
+++ b/c/src/exec/score/inline/tqdata.inl
@@ -0,0 +1,89 @@
+/* tqdata.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index of the priority chain on which
+ * a thread of the_priority should be placed.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Header_number (
+ Priority_Control the_priority
+)
+{
+ return (the_priority / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER);
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority indicates that the
+ * enqueue search should start at the front of this priority
+ * group chain, and FALSE if the search should start at the rear.
+ */
+
+STATIC INLINE boolean _Thread_queue_Is_reverse_search (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number of threads waiting on this thread queue.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Get_number_waiting (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ return ( the_thread_queue->count );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to indicate that the specified thread queue is
+ * entering a critical section.
+ */
+
+STATIC INLINE void _Thread_queue_Enter_critical_section (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ the_thread_queue->sync_state = THREAD_QUEUE_NOTHING_HAPPENED;
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/userext.inl b/c/src/exec/score/inline/userext.inl
new file mode 100644
index 0000000000..a9a858b2e2
--- /dev/null
+++ b/c/src/exec/score/inline/userext.inl
@@ -0,0 +1,121 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _User_extensions_Handler_initialization (
+ User_extensions_Table *initial_extensions
+)
+{
+ _Chain_Initialize_empty( &_User_extensions_List );
+
+ if ( initial_extensions ) {
+ _User_extensions_Initial.Callouts = *initial_extensions;
+ _Chain_Append( &_User_extensions_List, &_User_extensions_Initial.Node );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to add a user extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+)
+{
+ the_extension->Callouts = *extension_table;
+
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ * DESCRIPTION:
+ *
+ * This routine is used to add an API extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Prepend( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to remove a user extension set from the active list.
+ */
+
+STATIC INLINE void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Extract( &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ */
+
+STATIC INLINE void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+)
+{
+ 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_switch != NULL )
+ (*the_extension->Callouts.thread_switch)( executing, heir );
+ }
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/watchdog.inl b/c/src/exec/score/inline/watchdog.inl
new file mode 100644
index 0000000000..75fb662dfc
--- /dev/null
+++ b/c/src/exec/score/inline/watchdog.inl
@@ -0,0 +1,324 @@
+/* watchdog.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified watchdog. The watchdog is
+ * made inactive, the watchdog id and handler routine are set to the
+ * specified values.
+ */
+
+STATIC INLINE void _Watchdog_Initialize(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Service_routine_entry routine,
+ Objects_Id id,
+ void *user_data
+)
+{
+ the_watchdog->state = WATCHDOG_INACTIVE;
+ the_watchdog->routine = routine;
+ the_watchdog->id = id;
+ the_watchdog->user_data = user_data;
+}
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the watchdog timer is in the ACTIVE
+ * state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Watchdog_Is_active(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( the_watchdog->state == WATCHDOG_ACTIVE );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates THE_WATCHDOG timer which is already
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Activate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_ACTIVE;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates THE_WATCHDOG timer which will remain
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Deactivate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_REMOVE_IT;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the ticks
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_ticks( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the seconds
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_seconds( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the ticks watchdog chain
+ * for a time of UNITS ticks. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_ticks(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the seconds watchdog chain
+ * for a time of UNITS seconds. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_seconds(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the seconds watchdog chain in the forward
+ * or backward DIRECTION for UNITS seconds. This is invoked when the
+ * current time of day is changed.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_seconds(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the ticks watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_ticks(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets THE_WATCHDOG timer to its state at INSERT
+ * time. This routine is valid only on interval watchdog timers
+ * and is used to make an interval watchdog timer fire "every" so
+ * many ticks.
+ */
+
+STATIC INLINE void _Watchdog_Reset(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ (void) _Watchdog_Remove( the_watchdog );
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer following
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Next(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.next );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer preceding
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Previous(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.previous );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the first watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_First(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->first );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the last watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Last(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->last );
+
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/inline/wkspace.inl b/c/src/exec/score/inline/wkspace.inl
new file mode 100644
index 0000000000..47174a9c9d
--- /dev/null
+++ b/c/src/exec/score/inline/wkspace.inl
@@ -0,0 +1,57 @@
+/* wkspace.inl
+ *
+ * This include file contains the bodies of the routines which contains
+ * information related to the RAM Workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then NULL is returned.
+ */
+
+STATIC INLINE void *_Workspace_Allocate(
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &_Workspace_Area, size );
+}
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the specified block of memory. If the block
+ * belongs to the Workspace and can be successfully freed, then
+ * TRUE is returned. Otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Workspace_Free(
+ void *block
+)
+{
+ return _Heap_Free( &_Workspace_Area, block );
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/README b/c/src/exec/score/macros/README
new file mode 100644
index 0000000000..b2f0c4d481
--- /dev/null
+++ b/c/src/exec/score/macros/README
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+The files in this directory are not considered the "primary" source
+of inlined routines for RTEMS. The "inline" directory contains
+the implementations of the inlined basis which are regularly
+tested. In general, an effort is made to keep the contents of
+this directory up to date but testing is only performed irregularly
+and even then it is usually with a single target processor and BSP.
+
+The primary purpose of the code in this directory is to insure
+that RTEMS can be compiled using a C compiler which does not support
+static inline routines.
+
+These were last successfully tested on 2/1/95 on a prerelease version
+of 3.2.0. The testing was done only on the Force CPU386 i386 target board.
+No testing was done on version of the code in the final release.
diff --git a/c/src/exec/score/macros/address.inl b/c/src/exec/score/macros/address.inl
new file mode 100644
index 0000000000..c0d45c3c6b
--- /dev/null
+++ b/c/src/exec/score/macros/address.inl
@@ -0,0 +1,68 @@
+/* macros/address.h
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ADDRESSES_h
+#define __MACROS_ADDRESSES_h
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ */
+
+#define _Addresses_Add_offset( _base, _offset ) \
+ ((void *)((char *)(_base) + (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ */
+
+#define _Addresses_Subtract_offset( _base, _offset ) \
+ ((void *)((char *)(_base) - (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+#define _Addresses_Subtract( _left, _right ) \
+ ((void *)(_left) - (void *)(_right))
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ */
+
+#define _Addresses_Is_aligned( _address ) \
+ ( ( (unsigned32)(_address) % 4 ) == 0 )
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ */
+
+#define _Addresses_Is_in_range( _address, _base, _limit ) \
+ ( (_address) >= (_base) && (_address) <= (_limit) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/chain.inl b/c/src/exec/score/macros/chain.inl
new file mode 100644
index 0000000000..0f09499f1d
--- /dev/null
+++ b/c/src/exec/score/macros/chain.inl
@@ -0,0 +1,200 @@
+/* macros/chain.h
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CHAIN_h
+#define __MACROS_CHAIN_h
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ */
+
+#define _Chain_Are_nodes_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ */
+
+#define _Chain_Is_null( _the_chain ) \
+ ( (_the_chain) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ */
+
+#define _Chain_Is_null_node( _the_node ) \
+ ( (_the_node) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Head
+ */
+
+#define _Chain_Head( _the_chain ) \
+ ((Chain_Node *) (_the_chain))
+
+/*PAGE
+ *
+ * _Chain_Tail
+ */
+
+#define _Chain_Tail( _the_chain ) \
+ ((Chain_Node *) &(_the_chain)->permanent_null)
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ */
+
+#define _Chain_Is_empty( _the_chain ) \
+ ( (_the_chain)->first == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ */
+
+#define _Chain_Is_first( _the_node ) \
+ ( (the_node)->previous == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ */
+
+#define _Chain_Is_last( _the_node ) \
+ ( (_the_node)->next == NULL )
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ */
+
+#define _Chain_Has_only_one_node( _the_chain ) \
+ ( (_the_chain)->first == (_the_chain)->last )
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ */
+
+#define _Chain_Is_head( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Head( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ */
+
+#define _Chain_Is_tail( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ */
+
+#define _Chain_Initialize_empty( _the_chain ) \
+{ \
+ (_the_chain)->first = _Chain_Tail( (_the_chain) ); \
+ (_the_chain)->permanent_null = NULL; \
+ (_the_chain)->last = _Chain_Head( (_the_chain) ); \
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ */
+
+#define _Chain_Extract_unprotected( _the_node ) \
+{ \
+ Chain_Node *_next; \
+ Chain_Node *_previous; \
+ \
+ _next = (_the_node)->next; \
+ _previous = (_the_node)->previous; \
+ _next->previous = _previous; \
+ _previous->next = _next; \
+}
+
+/*PAGE
+ *
+ * _Chain_Get_unprotected
+ */
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ */
+
+#define _Chain_Get_unprotected( _the_chain ) \
+ (( !_Chain_Is_empty( (_the_chain) ) ) \
+ ? _Chain_Get_first_unprotected( (_the_chain) ) \
+ : NULL)
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ */
+
+#define _Chain_Insert_unprotected( _after_node, _the_node ) \
+{ \
+ Chain_Node *_before_node; \
+ \
+ (_the_node)->previous = (_after_node); \
+ _before_node = (_after_node)->next; \
+ (_after_node)->next = (_the_node); \
+ (_the_node)->next = _before_node; \
+ _before_node->previous = (_the_node); \
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ */
+
+#define _Chain_Append_unprotected( _the_chain, _the_node ) \
+{ \
+ Chain_Node *_old_last_node; \
+ \
+ (_the_node)->next = _Chain_Tail( (_the_chain) ); \
+ _old_last_node = (_the_chain)->last; \
+ (_the_chain)->last = (_the_node); \
+ _old_last_node->next = (_the_node); \
+ (_the_node)->previous = _old_last_node; \
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ */
+
+#define _Chain_Prepend_unprotected( _the_chain, _the_node ) \
+ _Chain_Insert_unprotected( _Chain_Head( (_the_chain) ), (_the_node) )
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ */
+
+#define _Chain_Prepend( _the_chain, _the_node ) \
+ _Chain_Insert( _Chain_Head( (_the_chain) ), (_the_node) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/coremsg.inl b/c/src/exec/score/macros/coremsg.inl
new file mode 100644
index 0000000000..90bef885ed
--- /dev/null
+++ b/c/src/exec/score/macros/coremsg.inl
@@ -0,0 +1,143 @@
+/* coremsg.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ */
+
+#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ */
+
+#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ */
+
+#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \
+ memcpy( _destination, _source, _size)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get( &(_the_message_queue)->Inactive_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
+ _Chain_Append( \
+ &(_the_message_queue)->Inactive_messages, \
+ &(_the_message)->Node \
+ )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ */
+
+#define _CORE_message_queue_Is_priority( _the_attribute ) \
+ ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ */
+
+#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ */
+
+#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
+ _Chain_Append( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ */
+
+#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
+ _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ */
+
+#define _CORE_message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ */
+
+#define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \
+ ( (_the_message_queue)->notify_handler != NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ */
+
+#define _CORE_message_queue_Set_notify( \
+ _the_message_queue, _the_handler, _the_argument ) \
+ do { \
+ (_the_message_queue)->notify_handler = (_the_handler); \
+ (_the_message_queue)->notify_argument = (_the_argument); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/coremutex.inl b/c/src/exec/score/macros/coremutex.inl
new file mode 100644
index 0000000000..e8dbc9322c
--- /dev/null
+++ b/c/src/exec/score/macros/coremutex.inl
@@ -0,0 +1,77 @@
+/* macros/coremutex.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_MUTEX_h
+#define __MACROS_CORE_MUTEX_h
+
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ */
+
+#define _CORE_mutex_Is_locked( _the_mutex ) \
+ ( (_the_mutex)->lock == CORE_MUTEX_LOCKED )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ */
+
+#define _CORE_mutex_Is_fifo( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ */
+
+#define _CORE_mutex_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ */
+
+#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == \
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ */
+
+#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ */
+
+#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \
+ ( (_the_attribute)->allow_nesting == TRUE )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/coresem.inl b/c/src/exec/score/macros/coresem.inl
new file mode 100644
index 0000000000..499b4a1433
--- /dev/null
+++ b/c/src/exec/score/macros/coresem.inl
@@ -0,0 +1,40 @@
+/* macros/coresem.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_SEMAPHORE_h
+#define __MACROS_CORE_SEMAPHORE_h
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ */
+
+#define _CORE_semaphore_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _Core_semaphore_Get_count
+ *
+ */
+
+#define _Core_semaphore_Get_count( _the_semaphore ) \
+ ( (_the_semaphore)->count )
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/heap.inl b/c/src/exec/score/macros/heap.inl
new file mode 100644
index 0000000000..94f4ff9194
--- /dev/null
+++ b/c/src/exec/score/macros/heap.inl
@@ -0,0 +1,150 @@
+/* heap.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ */
+
+#define _Heap_Head( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->start)
+
+/*PAGE
+ *
+ * _Heap_Tail
+ */
+
+#define _Heap_Tail( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->final)
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ */
+
+#define _Heap_Previous_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Subtract_offset( \
+ (void *)(_the_block), \
+ (_the_block)->back_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ */
+
+#define _Heap_Next_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Add_offset( \
+ (void *)(_the_block), \
+ (_the_block)->front_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ */
+
+#define _Heap_Block_at( _base, _offset ) \
+ ( (Heap_Block *) \
+ _Addresses_Add_offset( (void *)(_base), (_offset) ) )
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ */
+
+#define _Heap_User_block_at( _base ) \
+ _Heap_Block_at( \
+ (_base), \
+ -*(((unsigned32 *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \
+ )
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ */
+
+#define _Heap_Is_previous_block_free( _the_block ) \
+ ( !((_the_block)->back_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ */
+
+#define _Heap_Is_block_free( _the_block ) \
+ ( !((_the_block)->front_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ */
+
+#define _Heap_Is_block_used( _the_block ) \
+ ((_the_block)->front_flag & HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ */
+
+#define _Heap_Block_size( _the_block ) \
+ ((_the_block)->front_flag & ~HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ */
+
+#define _Heap_Start_of_user_area( _the_block ) \
+ ((void *) &(_the_block)->next)
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ */
+
+#define _Heap_Is_block_in( _the_heap, _the_block ) \
+ ( ((_the_block) >= (_the_heap)->start) && \
+ ((_the_block) <= (_the_heap)->final) )
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ */
+
+#define _Heap_Is_page_size_valid( _page_size ) \
+ ( ((_page_size) != 0) && \
+ (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) )
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ */
+
+#define _Heap_Build_flag( _size, _in_use_flag ) \
+ ( (_size) | (_in_use_flag))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/isr.inl b/c/src/exec/score/macros/isr.inl
new file mode 100644
index 0000000000..95f0319396
--- /dev/null
+++ b/c/src/exec/score/macros/isr.inl
@@ -0,0 +1,48 @@
+/* isr.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ */
+
+#define _ISR_Is_in_progress() \
+ (_ISR_Nest_level != 0)
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ */
+
+#define _ISR_Is_vector_number_valid( _vector ) \
+ ( (_vector) <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER )
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ */
+
+#define _ISR_Is_valid_user_handler( _handler ) \
+ ((_handler) != NULL)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/mppkt.inl b/c/src/exec/score/macros/mppkt.inl
new file mode 100644
index 0000000000..ff1d51034b
--- /dev/null
+++ b/c/src/exec/score/macros/mppkt.inl
@@ -0,0 +1,41 @@
+/* macros/mppkt.h
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_PACKET_h
+#define __MACROS_MP_PACKET_h
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+#define _Mp_packet_Is_valid_packet_class( _the_packet_class ) \
+ ( (_the_packet_class) <= MP_PACKET_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ */
+
+#define _Mp_packet_Is_null ( _the_packet ) \
+ ( (_the_packet) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/object.inl b/c/src/exec/score/macros/object.inl
new file mode 100644
index 0000000000..8a5a0a3411
--- /dev/null
+++ b/c/src/exec/score/macros/object.inl
@@ -0,0 +1,148 @@
+/* object.inl
+ *
+ * This include file contains the macro implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ */
+
+#define _Objects_Build_id( _the_class, _node, _index ) \
+ ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
+ ((_node) << OBJECTS_NODE_START_BIT) | \
+ ((_index) << OBJECTS_INDEX_START_BIT) )
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ */
+
+#define _Objects_Get_class( _id ) \
+ (Objects_Classes) \
+ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ */
+
+#define _Objects_Get_node( _id ) \
+ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ */
+
+#define _Objects_Get_index( _id ) \
+ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ */
+
+#define _Objects_Is_class_valid( _the_class ) \
+ ( (_the_class) <= OBJECTS_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ */
+
+#define _Objects_Is_local_node( _node ) \
+ ( (_node) == _Objects_Local_node )
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ */
+
+#define _Objects_Is_local_id( _id ) \
+ _Objects_Is_local_node( _Objects_Get_node(_id) )
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ */
+
+#define _Objects_Are_ids_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ */
+
+#define _Objects_Allocate( _information ) \
+ (Objects_Control *) _Chain_Get( &(_information)->Inactive )
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ */
+
+#define _Objects_Free( _information, _the_object ) \
+ _Chain_Append( &(_information)->Inactive, &(_the_object)->Node )
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ */
+
+#define _Objects_Open( _information, _the_object, _name ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = (_the_object); \
+ \
+ if ( (_information)->is_string ) \
+ _Objects_Copy_name_string( (_name), (_the_object)->name ); \
+ else \
+ _Objects_Copy_name_raw( \
+ (_name), (_the_object)->name, (_information)->name_length ); \
+ }
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ */
+
+#define _Objects_Close( _information, _the_object ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = NULL; \
+ _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/objectmp.inl b/c/src/exec/score/macros/objectmp.inl
new file mode 100644
index 0000000000..2f1c5ac7fa
--- /dev/null
+++ b/c/src/exec/score/macros/objectmp.inl
@@ -0,0 +1,50 @@
+/* macros/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_OBJECTS_inl
+#define __MACROS_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ */
+
+#define _Objects_MP_Allocate_global_object() \
+ (Objects_MP_Control *) \
+ _Chain_Get( &_Objects_MP_Inactive_global_objects )
+
+/*PAGE
+ * _Objects_MP_Free_global_object
+ *
+ */
+
+#define _Objects_MP_Free_global_object( _the_object ) \
+ _Chain_Append( \
+ &_Objects_MP_Inactive_global_objects, \
+ &(_the_object)->Object.Node \
+ )
+
+/*PAGE
+ * _Objects_MP_Is_null_global_object
+ *
+ */
+
+#define _Objects_MP_Is_null_global_object( _the_object ) \
+ ( (_the_object) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/priority.inl b/c/src/exec/score/macros/priority.inl
new file mode 100644
index 0000000000..4c5d32b3b3
--- /dev/null
+++ b/c/src/exec/score/macros/priority.inl
@@ -0,0 +1,170 @@
+/* priority.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ */
+
+#define _Priority_Handler_initialization() \
+ { \
+ unsigned32 index; \
+ \
+ _Priority_Major_bit_map = 0; \
+ for ( index=0 ; index <16 ; index++ ) \
+ _Priority_Bit_map[ index ] = 0; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ */
+
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+#define _Priority_Is_valid( _the_priority ) \
+ ( (_the_priority) <= PRIORITY_MAXIMUM )
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ */
+
+#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 )
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ */
+
+#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 )
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ */
+
+#define _Priority_Mask( _bit_number ) \
+ (0x8000 >> _bit_number)
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ */
+
+#define _Priority_Bits_index( _bit_number ) \
+ (_bit_number)
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ */
+
+#define _Priority_Add_to_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \
+ _Priority_Major_bit_map |= (_the_priority_map)->ready_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ */
+
+#define _Priority_Remove_from_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \
+ if ( *(_the_priority_map)->minor == 0 ) \
+ _Priority_Major_bit_map &= (_the_priority_map)->block_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ */
+
+#define _Priority_Get_highest( _high_priority ) \
+ { \
+ Priority_Bit_map_control minor; \
+ Priority_Bit_map_control major; \
+ \
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \
+ \
+ (_high_priority) = (_Priority_Bits_index( major ) * 16) + \
+ _Priority_Bits_index( minor ); \
+ }
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ */
+
+#define _Priority_Initialize_information( \
+ _the_priority_map, _new_priority ) \
+ { \
+ Priority_Bit_map_control _major; \
+ Priority_Bit_map_control _minor; \
+ Priority_Bit_map_control _mask; \
+ \
+ _major = _Priority_Major( (_new_priority) ); \
+ _minor = _Priority_Minor( (_new_priority) ); \
+ \
+ (_the_priority_map)->minor = \
+ &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \
+ \
+ _mask = _Priority_Mask( _major ); \
+ (_the_priority_map)->ready_major = _mask; \
+ (_the_priority_map)->block_major = ~_mask; \
+ \
+ _mask = _Priority_Mask( _minor ); \
+ (_the_priority_map)->ready_minor = _mask; \
+ (_the_priority_map)->block_minor = ~_mask; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ */
+
+#define _Priority_Is_group_empty ( _the_priority ) \
+ ( (_the_priority) == 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/README b/c/src/exec/score/macros/rtems/score/README
new file mode 100644
index 0000000000..b2f0c4d481
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/README
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+The files in this directory are not considered the "primary" source
+of inlined routines for RTEMS. The "inline" directory contains
+the implementations of the inlined basis which are regularly
+tested. In general, an effort is made to keep the contents of
+this directory up to date but testing is only performed irregularly
+and even then it is usually with a single target processor and BSP.
+
+The primary purpose of the code in this directory is to insure
+that RTEMS can be compiled using a C compiler which does not support
+static inline routines.
+
+These were last successfully tested on 2/1/95 on a prerelease version
+of 3.2.0. The testing was done only on the Force CPU386 i386 target board.
+No testing was done on version of the code in the final release.
diff --git a/c/src/exec/score/macros/rtems/score/address.inl b/c/src/exec/score/macros/rtems/score/address.inl
new file mode 100644
index 0000000000..c0d45c3c6b
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/address.inl
@@ -0,0 +1,68 @@
+/* macros/address.h
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ADDRESSES_h
+#define __MACROS_ADDRESSES_h
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ */
+
+#define _Addresses_Add_offset( _base, _offset ) \
+ ((void *)((char *)(_base) + (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ */
+
+#define _Addresses_Subtract_offset( _base, _offset ) \
+ ((void *)((char *)(_base) - (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+#define _Addresses_Subtract( _left, _right ) \
+ ((void *)(_left) - (void *)(_right))
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ */
+
+#define _Addresses_Is_aligned( _address ) \
+ ( ( (unsigned32)(_address) % 4 ) == 0 )
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ */
+
+#define _Addresses_Is_in_range( _address, _base, _limit ) \
+ ( (_address) >= (_base) && (_address) <= (_limit) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/chain.inl b/c/src/exec/score/macros/rtems/score/chain.inl
new file mode 100644
index 0000000000..0f09499f1d
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/chain.inl
@@ -0,0 +1,200 @@
+/* macros/chain.h
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CHAIN_h
+#define __MACROS_CHAIN_h
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ */
+
+#define _Chain_Are_nodes_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ */
+
+#define _Chain_Is_null( _the_chain ) \
+ ( (_the_chain) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ */
+
+#define _Chain_Is_null_node( _the_node ) \
+ ( (_the_node) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Head
+ */
+
+#define _Chain_Head( _the_chain ) \
+ ((Chain_Node *) (_the_chain))
+
+/*PAGE
+ *
+ * _Chain_Tail
+ */
+
+#define _Chain_Tail( _the_chain ) \
+ ((Chain_Node *) &(_the_chain)->permanent_null)
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ */
+
+#define _Chain_Is_empty( _the_chain ) \
+ ( (_the_chain)->first == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ */
+
+#define _Chain_Is_first( _the_node ) \
+ ( (the_node)->previous == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ */
+
+#define _Chain_Is_last( _the_node ) \
+ ( (_the_node)->next == NULL )
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ */
+
+#define _Chain_Has_only_one_node( _the_chain ) \
+ ( (_the_chain)->first == (_the_chain)->last )
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ */
+
+#define _Chain_Is_head( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Head( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ */
+
+#define _Chain_Is_tail( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ */
+
+#define _Chain_Initialize_empty( _the_chain ) \
+{ \
+ (_the_chain)->first = _Chain_Tail( (_the_chain) ); \
+ (_the_chain)->permanent_null = NULL; \
+ (_the_chain)->last = _Chain_Head( (_the_chain) ); \
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ */
+
+#define _Chain_Extract_unprotected( _the_node ) \
+{ \
+ Chain_Node *_next; \
+ Chain_Node *_previous; \
+ \
+ _next = (_the_node)->next; \
+ _previous = (_the_node)->previous; \
+ _next->previous = _previous; \
+ _previous->next = _next; \
+}
+
+/*PAGE
+ *
+ * _Chain_Get_unprotected
+ */
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ */
+
+#define _Chain_Get_unprotected( _the_chain ) \
+ (( !_Chain_Is_empty( (_the_chain) ) ) \
+ ? _Chain_Get_first_unprotected( (_the_chain) ) \
+ : NULL)
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ */
+
+#define _Chain_Insert_unprotected( _after_node, _the_node ) \
+{ \
+ Chain_Node *_before_node; \
+ \
+ (_the_node)->previous = (_after_node); \
+ _before_node = (_after_node)->next; \
+ (_after_node)->next = (_the_node); \
+ (_the_node)->next = _before_node; \
+ _before_node->previous = (_the_node); \
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ */
+
+#define _Chain_Append_unprotected( _the_chain, _the_node ) \
+{ \
+ Chain_Node *_old_last_node; \
+ \
+ (_the_node)->next = _Chain_Tail( (_the_chain) ); \
+ _old_last_node = (_the_chain)->last; \
+ (_the_chain)->last = (_the_node); \
+ _old_last_node->next = (_the_node); \
+ (_the_node)->previous = _old_last_node; \
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ */
+
+#define _Chain_Prepend_unprotected( _the_chain, _the_node ) \
+ _Chain_Insert_unprotected( _Chain_Head( (_the_chain) ), (_the_node) )
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ */
+
+#define _Chain_Prepend( _the_chain, _the_node ) \
+ _Chain_Insert( _Chain_Head( (_the_chain) ), (_the_node) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/coremsg.inl b/c/src/exec/score/macros/rtems/score/coremsg.inl
new file mode 100644
index 0000000000..90bef885ed
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/coremsg.inl
@@ -0,0 +1,143 @@
+/* coremsg.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ */
+
+#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ */
+
+#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ */
+
+#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \
+ memcpy( _destination, _source, _size)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get( &(_the_message_queue)->Inactive_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
+ _Chain_Append( \
+ &(_the_message_queue)->Inactive_messages, \
+ &(_the_message)->Node \
+ )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ */
+
+#define _CORE_message_queue_Is_priority( _the_attribute ) \
+ ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ */
+
+#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ */
+
+#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
+ _Chain_Append( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ */
+
+#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
+ _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ */
+
+#define _CORE_message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ */
+
+#define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \
+ ( (_the_message_queue)->notify_handler != NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ */
+
+#define _CORE_message_queue_Set_notify( \
+ _the_message_queue, _the_handler, _the_argument ) \
+ do { \
+ (_the_message_queue)->notify_handler = (_the_handler); \
+ (_the_message_queue)->notify_argument = (_the_argument); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/coremutex.inl b/c/src/exec/score/macros/rtems/score/coremutex.inl
new file mode 100644
index 0000000000..e8dbc9322c
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/coremutex.inl
@@ -0,0 +1,77 @@
+/* macros/coremutex.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_MUTEX_h
+#define __MACROS_CORE_MUTEX_h
+
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ */
+
+#define _CORE_mutex_Is_locked( _the_mutex ) \
+ ( (_the_mutex)->lock == CORE_MUTEX_LOCKED )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ */
+
+#define _CORE_mutex_Is_fifo( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ */
+
+#define _CORE_mutex_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ */
+
+#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == \
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ */
+
+#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ */
+
+#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \
+ ( (_the_attribute)->allow_nesting == TRUE )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/coresem.inl b/c/src/exec/score/macros/rtems/score/coresem.inl
new file mode 100644
index 0000000000..499b4a1433
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/coresem.inl
@@ -0,0 +1,40 @@
+/* macros/coresem.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_SEMAPHORE_h
+#define __MACROS_CORE_SEMAPHORE_h
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ */
+
+#define _CORE_semaphore_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _Core_semaphore_Get_count
+ *
+ */
+
+#define _Core_semaphore_Get_count( _the_semaphore ) \
+ ( (_the_semaphore)->count )
+
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/heap.inl b/c/src/exec/score/macros/rtems/score/heap.inl
new file mode 100644
index 0000000000..94f4ff9194
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/heap.inl
@@ -0,0 +1,150 @@
+/* heap.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ */
+
+#define _Heap_Head( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->start)
+
+/*PAGE
+ *
+ * _Heap_Tail
+ */
+
+#define _Heap_Tail( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->final)
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ */
+
+#define _Heap_Previous_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Subtract_offset( \
+ (void *)(_the_block), \
+ (_the_block)->back_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ */
+
+#define _Heap_Next_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Add_offset( \
+ (void *)(_the_block), \
+ (_the_block)->front_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ */
+
+#define _Heap_Block_at( _base, _offset ) \
+ ( (Heap_Block *) \
+ _Addresses_Add_offset( (void *)(_base), (_offset) ) )
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ */
+
+#define _Heap_User_block_at( _base ) \
+ _Heap_Block_at( \
+ (_base), \
+ -*(((unsigned32 *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \
+ )
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ */
+
+#define _Heap_Is_previous_block_free( _the_block ) \
+ ( !((_the_block)->back_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ */
+
+#define _Heap_Is_block_free( _the_block ) \
+ ( !((_the_block)->front_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ */
+
+#define _Heap_Is_block_used( _the_block ) \
+ ((_the_block)->front_flag & HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ */
+
+#define _Heap_Block_size( _the_block ) \
+ ((_the_block)->front_flag & ~HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ */
+
+#define _Heap_Start_of_user_area( _the_block ) \
+ ((void *) &(_the_block)->next)
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ */
+
+#define _Heap_Is_block_in( _the_heap, _the_block ) \
+ ( ((_the_block) >= (_the_heap)->start) && \
+ ((_the_block) <= (_the_heap)->final) )
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ */
+
+#define _Heap_Is_page_size_valid( _page_size ) \
+ ( ((_page_size) != 0) && \
+ (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) )
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ */
+
+#define _Heap_Build_flag( _size, _in_use_flag ) \
+ ( (_size) | (_in_use_flag))
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/isr.inl b/c/src/exec/score/macros/rtems/score/isr.inl
new file mode 100644
index 0000000000..95f0319396
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/isr.inl
@@ -0,0 +1,48 @@
+/* isr.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ */
+
+#define _ISR_Is_in_progress() \
+ (_ISR_Nest_level != 0)
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ */
+
+#define _ISR_Is_vector_number_valid( _vector ) \
+ ( (_vector) <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER )
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ */
+
+#define _ISR_Is_valid_user_handler( _handler ) \
+ ((_handler) != NULL)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/mppkt.inl b/c/src/exec/score/macros/rtems/score/mppkt.inl
new file mode 100644
index 0000000000..ff1d51034b
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/mppkt.inl
@@ -0,0 +1,41 @@
+/* macros/mppkt.h
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_PACKET_h
+#define __MACROS_MP_PACKET_h
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+#define _Mp_packet_Is_valid_packet_class( _the_packet_class ) \
+ ( (_the_packet_class) <= MP_PACKET_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ */
+
+#define _Mp_packet_Is_null ( _the_packet ) \
+ ( (_the_packet) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/object.inl b/c/src/exec/score/macros/rtems/score/object.inl
new file mode 100644
index 0000000000..8a5a0a3411
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/object.inl
@@ -0,0 +1,148 @@
+/* object.inl
+ *
+ * This include file contains the macro implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ */
+
+#define _Objects_Build_id( _the_class, _node, _index ) \
+ ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
+ ((_node) << OBJECTS_NODE_START_BIT) | \
+ ((_index) << OBJECTS_INDEX_START_BIT) )
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ */
+
+#define _Objects_Get_class( _id ) \
+ (Objects_Classes) \
+ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ */
+
+#define _Objects_Get_node( _id ) \
+ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ */
+
+#define _Objects_Get_index( _id ) \
+ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ */
+
+#define _Objects_Is_class_valid( _the_class ) \
+ ( (_the_class) <= OBJECTS_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ */
+
+#define _Objects_Is_local_node( _node ) \
+ ( (_node) == _Objects_Local_node )
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ */
+
+#define _Objects_Is_local_id( _id ) \
+ _Objects_Is_local_node( _Objects_Get_node(_id) )
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ */
+
+#define _Objects_Are_ids_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ */
+
+#define _Objects_Allocate( _information ) \
+ (Objects_Control *) _Chain_Get( &(_information)->Inactive )
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ */
+
+#define _Objects_Free( _information, _the_object ) \
+ _Chain_Append( &(_information)->Inactive, &(_the_object)->Node )
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ */
+
+#define _Objects_Open( _information, _the_object, _name ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = (_the_object); \
+ \
+ if ( (_information)->is_string ) \
+ _Objects_Copy_name_string( (_name), (_the_object)->name ); \
+ else \
+ _Objects_Copy_name_raw( \
+ (_name), (_the_object)->name, (_information)->name_length ); \
+ }
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ */
+
+#define _Objects_Close( _information, _the_object ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = NULL; \
+ _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
+ }
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/objectmp.inl b/c/src/exec/score/macros/rtems/score/objectmp.inl
new file mode 100644
index 0000000000..2f1c5ac7fa
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/objectmp.inl
@@ -0,0 +1,50 @@
+/* macros/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_OBJECTS_inl
+#define __MACROS_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ */
+
+#define _Objects_MP_Allocate_global_object() \
+ (Objects_MP_Control *) \
+ _Chain_Get( &_Objects_MP_Inactive_global_objects )
+
+/*PAGE
+ * _Objects_MP_Free_global_object
+ *
+ */
+
+#define _Objects_MP_Free_global_object( _the_object ) \
+ _Chain_Append( \
+ &_Objects_MP_Inactive_global_objects, \
+ &(_the_object)->Object.Node \
+ )
+
+/*PAGE
+ * _Objects_MP_Is_null_global_object
+ *
+ */
+
+#define _Objects_MP_Is_null_global_object( _the_object ) \
+ ( (_the_object) == NULL )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/priority.inl b/c/src/exec/score/macros/rtems/score/priority.inl
new file mode 100644
index 0000000000..4c5d32b3b3
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/priority.inl
@@ -0,0 +1,170 @@
+/* priority.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ */
+
+#define _Priority_Handler_initialization() \
+ { \
+ unsigned32 index; \
+ \
+ _Priority_Major_bit_map = 0; \
+ for ( index=0 ; index <16 ; index++ ) \
+ _Priority_Bit_map[ index ] = 0; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ */
+
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+#define _Priority_Is_valid( _the_priority ) \
+ ( (_the_priority) <= PRIORITY_MAXIMUM )
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ */
+
+#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 )
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ */
+
+#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 )
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ */
+
+#define _Priority_Mask( _bit_number ) \
+ (0x8000 >> _bit_number)
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ */
+
+#define _Priority_Bits_index( _bit_number ) \
+ (_bit_number)
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ */
+
+#define _Priority_Add_to_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \
+ _Priority_Major_bit_map |= (_the_priority_map)->ready_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ */
+
+#define _Priority_Remove_from_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \
+ if ( *(_the_priority_map)->minor == 0 ) \
+ _Priority_Major_bit_map &= (_the_priority_map)->block_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ */
+
+#define _Priority_Get_highest( _high_priority ) \
+ { \
+ Priority_Bit_map_control minor; \
+ Priority_Bit_map_control major; \
+ \
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \
+ \
+ (_high_priority) = (_Priority_Bits_index( major ) * 16) + \
+ _Priority_Bits_index( minor ); \
+ }
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ */
+
+#define _Priority_Initialize_information( \
+ _the_priority_map, _new_priority ) \
+ { \
+ Priority_Bit_map_control _major; \
+ Priority_Bit_map_control _minor; \
+ Priority_Bit_map_control _mask; \
+ \
+ _major = _Priority_Major( (_new_priority) ); \
+ _minor = _Priority_Minor( (_new_priority) ); \
+ \
+ (_the_priority_map)->minor = \
+ &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \
+ \
+ _mask = _Priority_Mask( _major ); \
+ (_the_priority_map)->ready_major = _mask; \
+ (_the_priority_map)->block_major = ~_mask; \
+ \
+ _mask = _Priority_Mask( _minor ); \
+ (_the_priority_map)->ready_minor = _mask; \
+ (_the_priority_map)->block_minor = ~_mask; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ */
+
+#define _Priority_Is_group_empty ( _the_priority ) \
+ ( (_the_priority) == 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/stack.inl b/c/src/exec/score/macros/rtems/score/stack.inl
new file mode 100644
index 0000000000..d20eebd0b9
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/stack.inl
@@ -0,0 +1,50 @@
+/* stack.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ */
+
+#define _Stack_Initialize( _the_stack, _starting_address, _size ) \
+ { \
+ (_the_stack)->area = (_starting_address); \
+ (_the_stack)->size = (_size); \
+ }
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ */
+
+#define _Stack_Is_enough( _size ) \
+ ( (_size) >= STACK_MINIMUM_SIZE )
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ */
+
+#define _Stack_Adjust_size( _size ) \
+ ((_size) + CPU_STACK_ALIGNMENT)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/states.inl b/c/src/exec/score/macros/rtems/score/states.inl
new file mode 100644
index 0000000000..4fa138d107
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/states.inl
@@ -0,0 +1,210 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ */
+
+#define _States_Set( _states_to_set, _current_state ) \
+ ((_current_state) | (_states_to_set))
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ */
+
+#define _States_Clear( _states_to_clear, _current_state ) \
+ ((_current_state) & ~(_states_to_clear))
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ */
+
+#define _States_Is_ready( _the_states ) \
+ ( (_the_states) == STATES_READY )
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ */
+
+#define _States_Is_only_dormant( _the_states ) \
+ ( (_the_states) == STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ */
+
+#define _States_Is_dormant( _the_states ) \
+ ( (_the_states) & STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ */
+
+#define _States_Is_suspended( _the_states ) \
+ ( (_the_states) & STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ */
+
+#define _States_Is_transient( _the_states ) \
+ ( (_the_states) & STATES_TRANSIENT )
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ */
+
+#define _States_Is_delaying( _the_states ) \
+ ( (_the_states) & STATES_DELAYING )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ */
+
+#define _States_Is_waiting_for_buffer( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_BUFFER )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ */
+
+#define _States_Is_waiting_for_segment( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEGMENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ */
+
+#define _States_Is_waiting_for_message( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MESSAGE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ */
+
+#define _States_Is_waiting_for_event( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_EVENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ */
+
+#define _States_Is_waiting_for_mutex( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MUTEX )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ */
+
+#define _States_Is_waiting_for_semaphore( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEMAPHORE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ */
+
+#define _States_Is_waiting_for_time( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_TIME )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ */
+
+#define _States_Is_waiting_for_rpc_reply( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_RPC_REPLY )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ */
+
+#define _States_Is_waiting_for_period( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_PERIOD )
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ */
+
+#define _States_Is_locally_blocked( _the_states ) \
+ ( (_the_states) & STATES_LOCALLY_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ */
+
+#define _States_Is_waiting_on_thread_queue( _the_states ) \
+ ( (_the_states) & STATES_WAITING_ON_THREAD_QUEUE )
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ */
+
+#define _States_Is_blocked( _the_states ) \
+ ( (_the_states) & STATES_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Are_set
+ *
+ */
+
+#define _States_Are_set( _the_states, _mask ) \
+ ( ((_the_states) & (_mask)) != STATES_READY )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/sysstate.inl b/c/src/exec/score/macros/rtems/score/sysstate.inl
new file mode 100644
index 0000000000..d0cb932924
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/sysstate.inl
@@ -0,0 +1,90 @@
+/* sysstates.inl
+ *
+ * This file contains the macro implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ */
+
+#define _System_state_Handler_initialization( _is_multiprocessing ) \
+ do { \
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \
+ _System_state_Is_multiprocessing = (_is_multiprocessing); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Set
+ */
+
+#define _System_state_Set( _state ) \
+ do { \
+ _System_state_Current = (_state); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Get
+ */
+
+#define _System_state_Get() \
+ (_System_state_Current)
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ */
+
+#define _System_state_Is_before_initialization( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_INITIALIZATION)
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ */
+
+#define _System_state_Is_before_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ */
+
+#define _System_state_Is_begin_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEGIN_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ */
+
+#define _System_state_Is_up( _state ) \
+ ((_state) == SYSTEM_STATE_UP)
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ */
+
+#define _System_state_Is_failed( _state ) \
+ ((_state) == SYSTEM_STATE_FAILED)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/thread.inl b/c/src/exec/score/macros/rtems/score/thread.inl
new file mode 100644
index 0000000000..735686aa20
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/thread.inl
@@ -0,0 +1,217 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ */
+
+#define _Thread_Stop_multitasking() \
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ */
+
+#define _Thread_Is_executing( _the_thread ) \
+ ( (_the_thread) == _Thread_Executing )
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ */
+
+#define _Thread_Is_heir( _the_thread ) \
+ ( (_the_thread) == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ */
+
+#define _Thread_Is_executing_also_the_heir() \
+ ( _Thread_Executing == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ */
+
+#define _Thread_Resume( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ */
+
+#define _Thread_Unblock( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_BLOCKED );
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ */
+
+#define _Thread_Restart_self() \
+ { \
+ if ( _Thread_Executing->fp_context != NULL ) \
+ _Context_Restore_fp( &_Thread_Executing->fp_context ); \
+ \
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \
+ }
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ */
+
+#define _Thread_Calculate_heir() \
+ { \
+ Priority_Control highest; \
+ \
+ _Priority_Get_highest( highest ); \
+ \
+ _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \
+ }
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ */
+
+#define _Thread_Is_allocated_fp( _the_thread ) \
+ ( (_the_thread) == _Thread_Allocated_fp )
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ */
+
+#define _Thread_Deallocate_fp() \
+ _Thread_Allocated_fp = NULL
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ */
+
+#define _Thread_Disable_dispatch() \
+ _Thread_Dispatch_disable_level += 1
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+#define _Thread_Enable_dispatch() \
+ { if ( (--_Thread_Dispatch_disable_level) == 0 ) \
+ _Thread_Dispatch(); \
+ }
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ */
+
+#define _Thread_Unnest_dispatch() \
+ _Thread_Dispatch_disable_level -= 1
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ */
+
+#define _Thread_Is_dispatching_enabled() \
+ ( _Thread_Dispatch_disable_level == 0 )
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ */
+
+#define _Thread_Is_context_switch_necessary() \
+ ( _Context_Switch_necessary == TRUE )
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ */
+
+#define _Thread_Dispatch_initialization() \
+ _Thread_Dispatch_disable_level = 1
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ */
+
+#define _Thread_Is_null( _the_thread ) \
+ ( (_the_thread) == NULL )
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ */
+
+#define _Thread_Is_proxy_blocking( _code ) \
+ ( (_code) == THREAD_STATUS_PROXY_BLOCKING )
+
+/*
+ * _Thread_Internal_allocate
+ *
+ */
+
+#define _Thread_Internal_allocate() \
+ ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information ))
+
+/*
+ * _Thread_Internal_free
+ *
+ */
+
+#define _Thread_Internal_free( _the_task ) \
+ _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/threadmp.inl b/c/src/exec/score/macros/rtems/score/threadmp.inl
new file mode 100644
index 0000000000..c601862f96
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/threadmp.inl
@@ -0,0 +1,50 @@
+/* macros/threadmp.h
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_THREAD_h
+#define __MACROS_MP_THREAD_h
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ */
+
+#define _Thread_MP_Is_receive( _the_thread ) \
+ ( (_the_thread) == _Thread_MP_Receive)
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ */
+
+#define _Thread_MP_Free_proxy( _the_thread ) \
+{ \
+ Thread_Proxy_control *_the_proxy; \
+ \
+ _the_proxy = (Thread_Proxy_control *) (_the_thread); \
+ \
+ _Chain_Extract( &_the_proxy->Active ); \
+ \
+ _Chain_Append( \
+ &_Thread_MP_Inactive_proxies, \
+ &(_the_thread)->Object.Node \
+ ); \
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/tod.inl b/c/src/exec/score/macros/rtems/score/tod.inl
new file mode 100644
index 0000000000..ecab4e6eae
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/tod.inl
@@ -0,0 +1,58 @@
+/* tod.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ */
+
+#define _TOD_Is_set() \
+ _Watchdog_Is_active( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ */
+
+#define _TOD_Tickle_ticks() \
+ _TOD_Current.ticks++; \
+ _TOD_Ticks_since_boot++
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ */
+
+#define _TOD_Deactivate() \
+ _Watchdog_Remove( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ */
+
+#define _TOD_Activate( _ticks ) \
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, (_ticks) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/tqdata.inl b/c/src/exec/score/macros/rtems/score/tqdata.inl
new file mode 100644
index 0000000000..5ffb79bcb1
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/tqdata.inl
@@ -0,0 +1,59 @@
+/* tqdata.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ */
+
+#define _Thread_queue_Header_number( _the_priority ) \
+ ((_the_priority) / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER)
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ */
+
+#define _Thread_queue_Is_reverse_search( _the_priority ) \
+ ( (_the_priority) & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK )
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ */
+
+#define _Thread_queue_Get_number_waiting( _the_thread_queue ) \
+ ( (_the_thread_queue)->count )
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ */
+
+#define _Thread_queue_Enter_critical_section( _the_thread_queue ) \
+ do { \
+ (_the_thread_queue)->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/userext.inl b/c/src/exec/score/macros/rtems/score/userext.inl
new file mode 100644
index 0000000000..4b5b8083bf
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/userext.inl
@@ -0,0 +1,126 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ */
+
+#define _User_extensions_Handler_initialization( _initial_extensions ) \
+ { \
+ _Chain_Initialize_empty( &_User_extensions_List ); \
+ \
+ if ( (_initial_extensions) ) { \
+ _User_extensions_Initial.Callouts = *(_initial_extensions); \
+ _Chain_Append( \
+ &_User_extensions_List, &_User_extensions_Initial.Node ); \
+ } \
+ }
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ */
+
+#define _User_extensions_Add_set( _the_extension, _extension_table ) \
+ do { \
+ (_the_extension)->Callouts = *(_extension_table); \
+ \
+ _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ */
+
+#define _User_extensions_Add_API_set( _the_extension ) \
+ _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node )
+
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ */
+
+#define _User_extensions_Remove_set( _the_extension ) \
+ _Chain_Extract( &(_the_extension)->Node )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_forward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_forward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_backward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_backward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ */
+
+#define _User_extensions_Thread_switch( _executing, _heir ) \
+ _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/watchdog.inl b/c/src/exec/score/macros/rtems/score/watchdog.inl
new file mode 100644
index 0000000000..d24224f93d
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/watchdog.inl
@@ -0,0 +1,172 @@
+/* watchdog.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ */
+
+#define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \
+ { \
+ (_the_watchdog)->state = WATCHDOG_INACTIVE; \
+ (_the_watchdog)->routine = (_routine); \
+ (_the_watchdog)->id = (_id); \
+ (_the_watchdog)->user_data = (_user_data); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ */
+
+#define _Watchdog_Is_active( _the_watchdog ) \
+ ( (_the_watchdog)->state == WATCHDOG_ACTIVE )
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ */
+
+#define _Watchdog_Activate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_ACTIVE
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ */
+
+#define _Watchdog_Deactivate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_REMOVE_IT
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ */
+
+#define _Watchdog_Tickle_ticks() \
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ */
+
+#define _Watchdog_Tickle_seconds() \
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ */
+
+#define _Watchdog_Insert_ticks( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ */
+
+#define _Watchdog_Insert_seconds( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ */
+
+#define _Watchdog_Adjust_seconds( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ */
+
+#define _Watchdog_Adjust_ticks( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ */
+
+#define _Watchdog_Reset( _the_watchdog ) \
+ { \
+ (void) _Watchdog_Remove( (_the_watchdog) ); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ */
+
+#define _Watchdog_Next( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.next)
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ */
+
+#define _Watchdog_Previous( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.previous)
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ */
+
+#define _Watchdog_First( _header ) \
+ ((Watchdog_Control *) (_header)->first)
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ */
+
+#define _Watchdog_Last( _header ) \
+ ((Watchdog_Control *) (_header)->last)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/rtems/score/wkspace.inl b/c/src/exec/score/macros/rtems/score/wkspace.inl
new file mode 100644
index 0000000000..5efe247fb1
--- /dev/null
+++ b/c/src/exec/score/macros/rtems/score/wkspace.inl
@@ -0,0 +1,39 @@
+/* wkspace.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the RAM Workspace Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ */
+
+#define _Workspace_Allocate( _size ) \
+ _Heap_Allocate( &_Workspace_Area, (_size) )
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ */
+
+#define _Workspace_Free( _block ) \
+ _Heap_Free( &_Workspace_Area, (_block) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/stack.inl b/c/src/exec/score/macros/stack.inl
new file mode 100644
index 0000000000..d20eebd0b9
--- /dev/null
+++ b/c/src/exec/score/macros/stack.inl
@@ -0,0 +1,50 @@
+/* stack.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ */
+
+#define _Stack_Initialize( _the_stack, _starting_address, _size ) \
+ { \
+ (_the_stack)->area = (_starting_address); \
+ (_the_stack)->size = (_size); \
+ }
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ */
+
+#define _Stack_Is_enough( _size ) \
+ ( (_size) >= STACK_MINIMUM_SIZE )
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ */
+
+#define _Stack_Adjust_size( _size ) \
+ ((_size) + CPU_STACK_ALIGNMENT)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/states.inl b/c/src/exec/score/macros/states.inl
new file mode 100644
index 0000000000..4fa138d107
--- /dev/null
+++ b/c/src/exec/score/macros/states.inl
@@ -0,0 +1,210 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ */
+
+#define _States_Set( _states_to_set, _current_state ) \
+ ((_current_state) | (_states_to_set))
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ */
+
+#define _States_Clear( _states_to_clear, _current_state ) \
+ ((_current_state) & ~(_states_to_clear))
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ */
+
+#define _States_Is_ready( _the_states ) \
+ ( (_the_states) == STATES_READY )
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ */
+
+#define _States_Is_only_dormant( _the_states ) \
+ ( (_the_states) == STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ */
+
+#define _States_Is_dormant( _the_states ) \
+ ( (_the_states) & STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ */
+
+#define _States_Is_suspended( _the_states ) \
+ ( (_the_states) & STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ */
+
+#define _States_Is_transient( _the_states ) \
+ ( (_the_states) & STATES_TRANSIENT )
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ */
+
+#define _States_Is_delaying( _the_states ) \
+ ( (_the_states) & STATES_DELAYING )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ */
+
+#define _States_Is_waiting_for_buffer( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_BUFFER )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ */
+
+#define _States_Is_waiting_for_segment( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEGMENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ */
+
+#define _States_Is_waiting_for_message( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MESSAGE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ */
+
+#define _States_Is_waiting_for_event( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_EVENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ */
+
+#define _States_Is_waiting_for_mutex( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MUTEX )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ */
+
+#define _States_Is_waiting_for_semaphore( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEMAPHORE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ */
+
+#define _States_Is_waiting_for_time( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_TIME )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ */
+
+#define _States_Is_waiting_for_rpc_reply( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_RPC_REPLY )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ */
+
+#define _States_Is_waiting_for_period( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_PERIOD )
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ */
+
+#define _States_Is_locally_blocked( _the_states ) \
+ ( (_the_states) & STATES_LOCALLY_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ */
+
+#define _States_Is_waiting_on_thread_queue( _the_states ) \
+ ( (_the_states) & STATES_WAITING_ON_THREAD_QUEUE )
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ */
+
+#define _States_Is_blocked( _the_states ) \
+ ( (_the_states) & STATES_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Are_set
+ *
+ */
+
+#define _States_Are_set( _the_states, _mask ) \
+ ( ((_the_states) & (_mask)) != STATES_READY )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/sysstate.inl b/c/src/exec/score/macros/sysstate.inl
new file mode 100644
index 0000000000..d0cb932924
--- /dev/null
+++ b/c/src/exec/score/macros/sysstate.inl
@@ -0,0 +1,90 @@
+/* sysstates.inl
+ *
+ * This file contains the macro implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ */
+
+#define _System_state_Handler_initialization( _is_multiprocessing ) \
+ do { \
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \
+ _System_state_Is_multiprocessing = (_is_multiprocessing); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Set
+ */
+
+#define _System_state_Set( _state ) \
+ do { \
+ _System_state_Current = (_state); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Get
+ */
+
+#define _System_state_Get() \
+ (_System_state_Current)
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ */
+
+#define _System_state_Is_before_initialization( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_INITIALIZATION)
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ */
+
+#define _System_state_Is_before_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ */
+
+#define _System_state_Is_begin_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEGIN_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ */
+
+#define _System_state_Is_up( _state ) \
+ ((_state) == SYSTEM_STATE_UP)
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ */
+
+#define _System_state_Is_failed( _state ) \
+ ((_state) == SYSTEM_STATE_FAILED)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/thread.inl b/c/src/exec/score/macros/thread.inl
new file mode 100644
index 0000000000..735686aa20
--- /dev/null
+++ b/c/src/exec/score/macros/thread.inl
@@ -0,0 +1,217 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ */
+
+#define _Thread_Stop_multitasking() \
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ */
+
+#define _Thread_Is_executing( _the_thread ) \
+ ( (_the_thread) == _Thread_Executing )
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ */
+
+#define _Thread_Is_heir( _the_thread ) \
+ ( (_the_thread) == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ */
+
+#define _Thread_Is_executing_also_the_heir() \
+ ( _Thread_Executing == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ */
+
+#define _Thread_Resume( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ */
+
+#define _Thread_Unblock( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_BLOCKED );
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ */
+
+#define _Thread_Restart_self() \
+ { \
+ if ( _Thread_Executing->fp_context != NULL ) \
+ _Context_Restore_fp( &_Thread_Executing->fp_context ); \
+ \
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \
+ }
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ */
+
+#define _Thread_Calculate_heir() \
+ { \
+ Priority_Control highest; \
+ \
+ _Priority_Get_highest( highest ); \
+ \
+ _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \
+ }
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ */
+
+#define _Thread_Is_allocated_fp( _the_thread ) \
+ ( (_the_thread) == _Thread_Allocated_fp )
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ */
+
+#define _Thread_Deallocate_fp() \
+ _Thread_Allocated_fp = NULL
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ */
+
+#define _Thread_Disable_dispatch() \
+ _Thread_Dispatch_disable_level += 1
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+#define _Thread_Enable_dispatch() \
+ { if ( (--_Thread_Dispatch_disable_level) == 0 ) \
+ _Thread_Dispatch(); \
+ }
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ */
+
+#define _Thread_Unnest_dispatch() \
+ _Thread_Dispatch_disable_level -= 1
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ */
+
+#define _Thread_Is_dispatching_enabled() \
+ ( _Thread_Dispatch_disable_level == 0 )
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ */
+
+#define _Thread_Is_context_switch_necessary() \
+ ( _Context_Switch_necessary == TRUE )
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ */
+
+#define _Thread_Dispatch_initialization() \
+ _Thread_Dispatch_disable_level = 1
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ */
+
+#define _Thread_Is_null( _the_thread ) \
+ ( (_the_thread) == NULL )
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ */
+
+#define _Thread_Is_proxy_blocking( _code ) \
+ ( (_code) == THREAD_STATUS_PROXY_BLOCKING )
+
+/*
+ * _Thread_Internal_allocate
+ *
+ */
+
+#define _Thread_Internal_allocate() \
+ ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information ))
+
+/*
+ * _Thread_Internal_free
+ *
+ */
+
+#define _Thread_Internal_free( _the_task ) \
+ _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/threadmp.inl b/c/src/exec/score/macros/threadmp.inl
new file mode 100644
index 0000000000..c601862f96
--- /dev/null
+++ b/c/src/exec/score/macros/threadmp.inl
@@ -0,0 +1,50 @@
+/* macros/threadmp.h
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_THREAD_h
+#define __MACROS_MP_THREAD_h
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ */
+
+#define _Thread_MP_Is_receive( _the_thread ) \
+ ( (_the_thread) == _Thread_MP_Receive)
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ */
+
+#define _Thread_MP_Free_proxy( _the_thread ) \
+{ \
+ Thread_Proxy_control *_the_proxy; \
+ \
+ _the_proxy = (Thread_Proxy_control *) (_the_thread); \
+ \
+ _Chain_Extract( &_the_proxy->Active ); \
+ \
+ _Chain_Append( \
+ &_Thread_MP_Inactive_proxies, \
+ &(_the_thread)->Object.Node \
+ ); \
+}
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/tod.inl b/c/src/exec/score/macros/tod.inl
new file mode 100644
index 0000000000..ecab4e6eae
--- /dev/null
+++ b/c/src/exec/score/macros/tod.inl
@@ -0,0 +1,58 @@
+/* tod.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ */
+
+#define _TOD_Is_set() \
+ _Watchdog_Is_active( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ */
+
+#define _TOD_Tickle_ticks() \
+ _TOD_Current.ticks++; \
+ _TOD_Ticks_since_boot++
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ */
+
+#define _TOD_Deactivate() \
+ _Watchdog_Remove( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ */
+
+#define _TOD_Activate( _ticks ) \
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, (_ticks) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/tqdata.inl b/c/src/exec/score/macros/tqdata.inl
new file mode 100644
index 0000000000..5ffb79bcb1
--- /dev/null
+++ b/c/src/exec/score/macros/tqdata.inl
@@ -0,0 +1,59 @@
+/* tqdata.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ */
+
+#define _Thread_queue_Header_number( _the_priority ) \
+ ((_the_priority) / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER)
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ */
+
+#define _Thread_queue_Is_reverse_search( _the_priority ) \
+ ( (_the_priority) & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK )
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ */
+
+#define _Thread_queue_Get_number_waiting( _the_thread_queue ) \
+ ( (_the_thread_queue)->count )
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ */
+
+#define _Thread_queue_Enter_critical_section( _the_thread_queue ) \
+ do { \
+ (_the_thread_queue)->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/userext.inl b/c/src/exec/score/macros/userext.inl
new file mode 100644
index 0000000000..4b5b8083bf
--- /dev/null
+++ b/c/src/exec/score/macros/userext.inl
@@ -0,0 +1,126 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ */
+
+#define _User_extensions_Handler_initialization( _initial_extensions ) \
+ { \
+ _Chain_Initialize_empty( &_User_extensions_List ); \
+ \
+ if ( (_initial_extensions) ) { \
+ _User_extensions_Initial.Callouts = *(_initial_extensions); \
+ _Chain_Append( \
+ &_User_extensions_List, &_User_extensions_Initial.Node ); \
+ } \
+ }
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ */
+
+#define _User_extensions_Add_set( _the_extension, _extension_table ) \
+ do { \
+ (_the_extension)->Callouts = *(_extension_table); \
+ \
+ _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ */
+
+#define _User_extensions_Add_API_set( _the_extension ) \
+ _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node )
+
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ */
+
+#define _User_extensions_Remove_set( _the_extension ) \
+ _Chain_Extract( &(_the_extension)->Node )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_forward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_forward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_backward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_backward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ */
+
+#define _User_extensions_Thread_switch( _executing, _heir ) \
+ _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/watchdog.inl b/c/src/exec/score/macros/watchdog.inl
new file mode 100644
index 0000000000..d24224f93d
--- /dev/null
+++ b/c/src/exec/score/macros/watchdog.inl
@@ -0,0 +1,172 @@
+/* watchdog.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ */
+
+#define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \
+ { \
+ (_the_watchdog)->state = WATCHDOG_INACTIVE; \
+ (_the_watchdog)->routine = (_routine); \
+ (_the_watchdog)->id = (_id); \
+ (_the_watchdog)->user_data = (_user_data); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ */
+
+#define _Watchdog_Is_active( _the_watchdog ) \
+ ( (_the_watchdog)->state == WATCHDOG_ACTIVE )
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ */
+
+#define _Watchdog_Activate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_ACTIVE
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ */
+
+#define _Watchdog_Deactivate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_REMOVE_IT
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ */
+
+#define _Watchdog_Tickle_ticks() \
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ */
+
+#define _Watchdog_Tickle_seconds() \
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ */
+
+#define _Watchdog_Insert_ticks( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ */
+
+#define _Watchdog_Insert_seconds( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ */
+
+#define _Watchdog_Adjust_seconds( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ */
+
+#define _Watchdog_Adjust_ticks( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ */
+
+#define _Watchdog_Reset( _the_watchdog ) \
+ { \
+ (void) _Watchdog_Remove( (_the_watchdog) ); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ */
+
+#define _Watchdog_Next( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.next)
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ */
+
+#define _Watchdog_Previous( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.previous)
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ */
+
+#define _Watchdog_First( _header ) \
+ ((Watchdog_Control *) (_header)->first)
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ */
+
+#define _Watchdog_Last( _header ) \
+ ((Watchdog_Control *) (_header)->last)
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/macros/wkspace.inl b/c/src/exec/score/macros/wkspace.inl
new file mode 100644
index 0000000000..5efe247fb1
--- /dev/null
+++ b/c/src/exec/score/macros/wkspace.inl
@@ -0,0 +1,39 @@
+/* wkspace.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the RAM Workspace Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ */
+
+#define _Workspace_Allocate( _size ) \
+ _Heap_Allocate( &_Workspace_Area, (_size) )
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ */
+
+#define _Workspace_Free( _block ) \
+ _Heap_Free( &_Workspace_Area, (_block) )
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/score/src/apiext.c b/c/src/exec/score/src/apiext.c
new file mode 100644
index 0000000000..6e82b49a53
--- /dev/null
+++ b/c/src/exec/score/src/apiext.c
@@ -0,0 +1,105 @@
+/* apiext.c
+ *
+ * XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+
+/*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
new file mode 100644
index 0000000000..5ef56ed5ad
--- /dev/null
+++ b/c/src/exec/score/src/chain.c
@@ -0,0 +1,202 @@
+/*
+ * 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, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*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
new file mode 100644
index 0000000000..05e4fb799d
--- /dev/null
+++ b/c/src/exec/score/src/coremsg.c
@@ -0,0 +1,432 @@
+/*
+ * 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, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/coremsg.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/mpci.h>
+
+/*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
+ * proxy_extract_callout - remote extract support
+ *
+ * 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,
+ Objects_Classes the_class,
+ CORE_message_queue_Attributes *the_message_queue_attributes,
+ unsigned32 maximum_pending_messages,
+ unsigned32 maximum_message_size,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+ 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,
+ the_class,
+ _CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_MESSAGE,
+ proxy_extract_callout,
+ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+ );
+
+ return TRUE;
+}
+
+/*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
+)
+{
+
+ if ( the_message_queue->number_of_pending_messages != 0 )
+ (void) _CORE_message_queue_Flush_support( the_message_queue );
+ else
+ _Thread_queue_Flush(
+ &the_message_queue->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+ (void) _Workspace_Free( the_message_queue->message_buffers );
+
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Flush
+ *
+ * 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
+ */
+
+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;
+}
+
+/*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;
+
+ 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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_message_queue_mp_support) ( the_thread, id );
+
+ }
+ *count = number_broadcasted;
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
+
+/*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;
+
+ 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;
+ _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size );
+ _CORE_message_queue_Free_message_buffer(the_message_queue, the_message );
+ 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;
+ _ISR_Enable( level );
+
+ _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
+}
+
+/*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;
+
+ _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;
+}
+
+/*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
+)
+{
+ 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?
+ */
+
+ 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;
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_message_queue_mp_support) ( the_thread, id );
+
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ }
+
+ /*
+ * No one waiting on this one currently.
+ * Allocate a message buffer and store it away
+ */
+
+ if ( the_message_queue->number_of_pending_messages ==
+ the_message_queue->maximum_pending_messages ) {
+ return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
+ }
+
+ the_message = _CORE_message_queue_Allocate_message_buffer(the_message_queue);
+ if ( the_message == 0)
+ return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
+
+ _CORE_message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size );
+ the_message->Contents.size = size;
+
+ the_message_queue->number_of_pending_messages += 1;
+
+ 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;
+ }
+
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
diff --git a/c/src/exec/score/src/coremutex.c b/c/src/exec/score/src/coremutex.c
new file mode 100644
index 0000000000..a0c3fd0264
--- /dev/null
+++ b/c/src/exec/score/src/coremutex.c
@@ -0,0 +1,269 @@
+/*
+ * Mutex Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the Mutex Handler.
+ * This handler provides synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+
+/*PAGE
+ *
+ * _CORE_mutex_Initialize
+ *
+ * This routine initializes a mutex at create time and set the control
+ * structure according to the values passed.
+ *
+ * Input parameters:
+ * the_mutex - the mutex control block to initialize
+ * the_class - the API class of the object
+ * the_mutex_attributes - the mutex attributes specified at create time
+ * initial_lock - mutex initial lock or unlocked status
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+/* Add this to the RTEMS environment later ?????????
+ rtems_assert( initial_lock == CORE_MUTEX_LOCKED ||
+ initial_lock == CORE_MUTEX_UNLOCKED );
+ */
+
+ the_mutex->Attributes = *the_mutex_attributes;
+ the_mutex->lock = initial_lock;
+
+ if ( initial_lock == CORE_MUTEX_LOCKED ) {
+ the_mutex->nest_count = 1;
+ the_mutex->holder = _Thread_Executing;
+ the_mutex->holder_id = _Thread_Executing->Object.id;
+ _Thread_Executing->resource_count++;
+ } else {
+ the_mutex->nest_count = 0;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+ }
+
+ _Thread_queue_Initialize(
+ &the_mutex->Wait_queue,
+ the_class,
+ _CORE_mutex_Is_priority( the_mutex_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_MUTEX,
+ proxy_extract_callout,
+ CORE_MUTEX_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Seize
+ *
+ * This routine attempts to allocate a mutex to the calling thread.
+ *
+ * Input parameters:
+ * the_mutex - pointer to mutex control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( ! _CORE_mutex_Is_locked( the_mutex ) ) {
+ the_mutex->lock = CORE_MUTEX_LOCKED;
+ the_mutex->holder = executing;
+ the_mutex->holder_id = executing->Object.id;
+ the_mutex->nest_count = 1;
+ executing->resource_count++;
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( _Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
+ if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) )
+ the_mutex->nest_count++;
+ else
+ executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
+
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( !wait ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
+ return;
+ }
+
+ _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue );
+ executing->Wait.queue = &the_mutex->Wait_queue;
+ executing->Wait.id = id;
+ _ISR_Enable( level );
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ the_mutex->holder->current_priority >
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ the_mutex->holder, _Thread_Executing->current_priority );
+ }
+
+ _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
+}
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * id - id of parent mutex
+ * api_mutex_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_MUTEX_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( !_Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) )
+ return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
+
+ the_mutex->nest_count--;
+
+ if ( the_mutex->nest_count != 0 )
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+
+ _Thread_Executing->resource_count--;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+
+ /*
+ * Whether or not someone is waiting for the mutex, an
+ * inherited priority must be lowered if this is the last
+ * mutex (i.e. resource) this task has.
+ */
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ _Thread_Executing->resource_count == 0 &&
+ _Thread_Executing->real_priority !=
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ _Thread_Executing,
+ _Thread_Executing->real_priority
+ );
+ }
+
+ if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
+
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_mutex->nest_count = 1;
+
+ ( *api_mutex_mp_support)( the_thread, id );
+
+ } else {
+
+ the_mutex->holder = the_thread;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_thread->resource_count++;
+ the_mutex->nest_count = 1;
+
+ /*
+ * No special action for priority inheritance because the_thread
+ * is guaranteed to be the highest priority thread waiting for
+ * the mutex.
+ */
+ }
+ } else
+ the_mutex->lock = CORE_MUTEX_UNLOCKED;
+
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Flush
+ *
+ * This function a flushes the mutex's task wait queue.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * remote_extract_callout - function to invoke remotely
+ * status - status to pass to thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+)
+{
+
+ _Thread_queue_Flush(
+ &the_mutex->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+}
diff --git a/c/src/exec/score/src/coresem.c b/c/src/exec/score/src/coresem.c
new file mode 100644
index 0000000000..0e55926304
--- /dev/null
+++ b/c/src/exec/score/src/coresem.c
@@ -0,0 +1,184 @@
+/*
+ * CORE Semaphore Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the CORE Semaphore Handler.
+ * This core object utilizes standard Dijkstra counting semaphores to provide
+ * synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/mpci.h>
+
+/*PAGE
+ *
+ * CORE_semaphore_Initialize
+ *
+ * This function initialize a semaphore and sets the initial value based
+ * on the given count.
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore control block to initialize
+ * the_class - the API class of the object
+ * the_semaphore_attributes - the attributes specified at create time
+ * initial_value - semaphore's initial value
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+ the_semaphore->Attributes = *the_semaphore_attributes;
+ the_semaphore->count = initial_value;
+
+ _Thread_queue_Initialize(
+ &the_semaphore->Wait_queue,
+ the_class,
+ _CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_SEMAPHORE,
+ proxy_extract_callout,
+ CORE_SEMAPHORE_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Surrender
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore to be flushed
+ * id - id of parent semaphore
+ * api_semaphore_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ *
+ * Output parameters:
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_semaphore_mp_support) ( the_thread, id );
+
+ } else
+ the_semaphore->count += 1;
+
+ return( CORE_SEMAPHORE_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Seize
+ *
+ * This routine attempts to allocate a core semaphore to the calling thread.
+ *
+ * Input parameters:
+ * the_semaphore - pointer to semaphore control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( the_semaphore->count != 0 ) {
+ the_semaphore->count -= 1;
+ _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 );
+}
+
+
+/*PAGE
+ *
+ * _CORE_semaphore_Flush
+ *
+ * This function a flushes the semaphore's task wait queue.
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore to be flushed
+ * remote_extract_callout - function to invoke remotely
+ * status - status to pass to thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_semaphore_Flush(
+ CORE_semaphore_Control *the_semaphore,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+)
+{
+
+ _Thread_queue_Flush(
+ &the_semaphore->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+}
diff --git a/c/src/exec/score/src/coretod.c b/c/src/exec/score/src/coretod.c
new file mode 100644
index 0000000000..1a11034ceb
--- /dev/null
+++ b/c/src/exec/score/src/coretod.c
@@ -0,0 +1,235 @@
+/*
+ * Time of Day (TOD) Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*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_Ticks_since_boot = 0;
+ _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 );
+}
+
+/*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_Activate( ticks_until_next_second );
+
+ _Thread_Enable_dispatch();
+}
+
+/*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;
+}
+
+/*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 );
+}
+
+/*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/heap.c b/c/src/exec/score/src/heap.c
new file mode 100644
index 0000000000..11d8a31cee
--- /dev/null
+++ b/c/src/exec/score/src/heap.c
@@ -0,0 +1,537 @@
+/*
+ * Heap Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/heap.h>
+
+/*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 );
+}
+
+/*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 *) (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;
+}
+
+/*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;
+
+ 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 += 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;
+}
+
+/*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 );
+}
+
+/*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 );
+}
+
+/*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 <stdio.h>
+#include <unistd.h>
+
+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: Back - %d, Front - %d",
+ 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: Back - %d, Front - %d",
+ 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
new file mode 100644
index 0000000000..04a77fbe37
--- /dev/null
+++ b/c/src/exec/score/src/interr.c
@@ -0,0 +1,61 @@
+/*
+ * Internal Error Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _Internal_error_Occurred
+ *
+ * This routine will invoke the fatal error handler supplied by the user
+ * followed by the the default one provided by the executive. The default
+ * error handler assumes no hardware is present to help inform the user
+ * of the problem. Halt stores the error code in a known register,
+ * disables interrupts, and halts the CPU. If the CPU does not have a
+ * halt instruction, it will loop to itself.
+ *
+ * Input parameters:
+ * the_source - what subsystem the error originated in
+ * is_internal - if the error was internally generated
+ * the_error - fatal error status code
+ *
+ * Output parameters:
+ * As much information as possible is stored in a CPU dependent fashion.
+ * See the CPU dependent code for more information.
+ *
+ * NOTE: The the_error is not necessarily a directive status code.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+)
+{
+
+ Internal_errors_What_happened.the_source = the_source;
+ Internal_errors_What_happened.is_internal = is_internal;
+ Internal_errors_What_happened.the_error = the_error;
+
+ _User_extensions_Fatal( the_source, is_internal, the_error );
+
+ _System_state_Set( SYSTEM_STATE_FAILED );
+
+ _CPU_Fatal_halt( the_error );
+
+ /* will not return from this routine */
+}
diff --git a/c/src/exec/score/src/isr.c b/c/src/exec/score/src/isr.c
new file mode 100644
index 0000000000..afc4cdcf38
--- /dev/null
+++ b/c/src/exec/score/src/isr.c
@@ -0,0 +1,60 @@
+/*
+ * ISR Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/wkspace.h>
+
+/* _ISR_Handler_initialization
+ *
+ * This routine initializes the ISR handler.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _ISR_Handler_initialization( void )
+{
+ _ISR_Signals_to_thread_executing = FALSE;
+
+ _ISR_Nest_level = 0;
+
+#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
+
+ if ( _CPU_Table.interrupt_stack_size < STACK_MINIMUM_SIZE )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
+ );
+
+ _CPU_Interrupt_stack_low =
+ _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );
+
+ _CPU_Interrupt_stack_high = _Addresses_Add_offset(
+ _CPU_Interrupt_stack_low,
+ _CPU_Table.interrupt_stack_size
+ );
+
+#endif
+
+#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
+ _CPU_Install_interrupt_stack();
+#endif
+
+}
diff --git a/c/src/exec/score/src/mpci.c b/c/src/exec/score/src/mpci.c
new file mode 100644
index 0000000000..c3090aacc1
--- /dev/null
+++ b/c/src/exec/score/src/mpci.c
@@ -0,0 +1,524 @@
+/*
+ * Multiprocessing Communications Interface (MPCI) Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/coresem.h>
+
+/*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,
+ OBJECTS_NO_CLASS, /* free floating semaphore */
+ &attributes, /* the_semaphore_attributes */
+ 0, /* initial_value */
+ NULL /* proxy_extract_callout */
+ );
+
+ _Thread_queue_Initialize(
+ &_MPCI_Remote_blocked_threads,
+ OBJECTS_NO_CLASS,
+ THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_RPC_REPLY,
+ NULL,
+ 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 */
+ FALSE, /* not timesliced */
+ 0, /* all interrupts enabled */
+ _MPCI_Internal_name
+ );
+
+ _Thread_Start(
+ _MPCI_Receive_server_tcb,
+ THREAD_START_NUMERIC,
+ _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(
+ Objects_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
new file mode 100644
index 0000000000..4f672086fe
--- /dev/null
+++ b/c/src/exec/score/src/object.c
@@ -0,0 +1,512 @@
+/*
+ * Object Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#include <rtems/score/objectmp.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/sysstate.h>
+
+/*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;
+
+ _Objects_MP_Handler_initialization(
+ node,
+ maximum_nodes,
+ maximum_global_objects
+ );
+}
+
+/*PAGE
+ *
+ * _Objects_Initialize_information
+ *
+ * This routine initializes all object information related data structures.
+ *
+ * Input parameters:
+ * information - object information table
+ * the_class - object class
+ * supports_global - TRUE if this is a global object class
+ * maximum - maximum objects of this class
+ * is_string - TRUE if names for this object are strings
+ * size - size of this object's control block
+ *
+ * Output parameters: NONE
+ */
+
+void _Objects_Initialize_information(
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_thread
+)
+{
+ unsigned32 minimum_index;
+ unsigned32 index;
+ Objects_Control *the_object;
+ unsigned32 name_length;
+ void *name_area;
+
+ information->maximum = maximum;
+ information->the_class = the_class;
+ information->is_string = is_string;
+ information->is_thread = is_thread;
+
+ /*
+ * Set the entry in the object information table.
+ */
+
+ _Objects_Information_table[ the_class ] = information;
+
+ /*
+ * Calculate minimum and maximum Id's
+ */
+
+ if ( maximum == 0 ) minimum_index = 0;
+ else minimum_index = 1;
+
+ information->minimum_id =
+ _Objects_Build_id( the_class, _Objects_Local_node, minimum_index );
+
+ information->maximum_id =
+ _Objects_Build_id( the_class, _Objects_Local_node, maximum );
+
+ /*
+ * Allocate local pointer table
+ */
+
+ information->local_table = _Workspace_Allocate_or_fatal_error(
+ (maximum + 1) * sizeof(Objects_Control *)
+ );
+
+ /*
+ * Allocate name table
+ */
+
+ 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;
+
+ name_area = _Workspace_Allocate_or_fatal_error( (maximum + 1) * name_length );
+ information->name_table = name_area;
+
+ /*
+ * Initialize local pointer table
+ */
+
+ for ( index=0 ; index <= maximum ; index++ ) {
+ information->local_table[ index ] = NULL;
+ }
+
+ /*
+ * Initialize objects .. if there are any
+ */
+
+ if ( maximum == 0 ) {
+ _Chain_Initialize_empty( &information->Inactive );
+ } else {
+
+ _Chain_Initialize(
+ &information->Inactive,
+ _Workspace_Allocate_or_fatal_error( maximum * size ),
+ maximum,
+ size
+ );
+
+ the_object = (Objects_Control *) information->Inactive.first;
+ for ( index=1; index <= maximum ; index++ ) {
+ the_object->id =
+ _Objects_Build_id( the_class, _Objects_Local_node, index );
+
+ the_object->name = (void *) name_area;
+
+ name_area = _Addresses_Add_offset( name_area, name_length );
+
+ the_object = (Objects_Control *) the_object->Node.next;
+ }
+
+ }
+
+ /*
+ * Take care of multiprocessing
+ */
+
+ if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
+
+ information->global_table = _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;
+}
+
+/*PAGE
+ *
+ * _Objects_Clear_name
+ *
+ * XXX
+ */
+
+void _Objects_Clear_name(
+ void *name,
+ unsigned32 length
+)
+{
+ unsigned32 index;
+ unsigned32 maximum = length / OBJECTS_NAME_ALIGNMENT;
+ unsigned32 *name_ptr = name;
+
+ for ( index=0 ; index < maximum ; index++ )
+ *name_ptr++ = 0;
+}
+
+/*PAGE
+ *
+ * _Objects_Copy_name_string
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_string(
+ void *source,
+ void *destination
+)
+{
+ unsigned8 *source_p = source;
+ unsigned8 *destination_p = destination;
+
+ do {
+ *destination_p++ = *source_p;
+ } while ( *source_p++ );
+}
+
+/*PAGE
+ *
+ * _Objects_Copy_name_raw
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_raw(
+ void *source,
+ void *destination,
+ unsigned32 length
+)
+{
+ unsigned32 *source_p = source;
+ unsigned32 *destination_p = destination;
+ unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT;
+
+ while ( tmp_length-- )
+ *destination_p++ = *source_p++;
+}
+
+/*PAGE
+ *
+ * _Objects_Compare_name_string
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_string(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+)
+{
+ unsigned8 *name_1_p = name_1;
+ unsigned8 *name_2_p = name_2;
+ unsigned32 tmp_length = length;
+
+ do {
+ if ( *name_1_p++ != *name_2_p++ )
+ return FALSE;
+ if ( !tmp_length-- )
+ return FALSE;
+ } while ( *name_1_p );
+
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * _Objects_Compare_name_raw
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_raw(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+)
+{
+ unsigned32 *name_1_p = name_1;
+ unsigned32 *name_2_p = name_2;
+ unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT;
+
+ while ( tmp_length-- )
+ if ( *name_1_p++ != *name_2_p++ )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*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 **objects;
+ 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 ) {
+ objects = information->local_table;
+
+ 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 = objects[ 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;
+
+ return ( _Objects_MP_Global_name_search( information, name, node, id ) );
+}
+
+/*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;
+
+ index = id - information->minimum_id;
+
+ if ( information->maximum >= index ) {
+ _Thread_Disable_dispatch();
+ if ( (the_object = information->local_table[index+1]) != NULL ) {
+ *location = OBJECTS_LOCAL;
+ return( the_object );
+ }
+ _Thread_Enable_dispatch();
+ *location = OBJECTS_ERROR;
+ return( NULL );
+ }
+ *location = OBJECTS_ERROR;
+ _Objects_MP_Is_remote( information, id, location, &the_object );
+ return the_object;
+}
+
+
+/*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,
+ unsigned32 *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;
+}
+
+/*PAGE
+ *
+ * _Objects_Get_information
+ *
+ * XXX
+ */
+
+Objects_Information *_Objects_Get_information(
+ Objects_Id id
+)
+{
+ Objects_Classes the_class;
+
+ the_class = _Objects_Get_class( id );
+
+ if ( !_Objects_Is_class_valid( the_class ) )
+ return NULL;
+
+ return _Objects_Information_table[ the_class ];
+}
+
diff --git a/c/src/exec/score/src/objectmp.c b/c/src/exec/score/src/objectmp.c
new file mode 100644
index 0000000000..7546c33585
--- /dev/null
+++ b/c/src/exec/score/src/objectmp.c
@@ -0,0 +1,275 @@
+/*
+ * Multiprocessing Support for the Object Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/thread.h>
+
+/*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/thread.c b/c/src/exec/score/src/thread.c
new file mode 100644
index 0000000000..afd36a0fd8
--- /dev/null
+++ b/c/src/exec/score/src/thread.c
@@ -0,0 +1,1257 @@
+/*
+ * Thread Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+
+/*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
+ */
+
+char *_Thread_Idle_name = "IDLE";
+
+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;
+ _Thread_Allocated_fp = NULL;
+
+ _Thread_Maximum_extensions = maximum_extensions;
+
+ _Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
+ _Thread_Ticks_per_timeslice = ticks_per_timeslice;
+
+ _Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
+ (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
+ );
+
+ for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
+ _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
+
+ _Thread_MP_Handler_initialization( maximum_proxies );
+
+ /*
+ * Initialize this class of objects.
+ */
+
+ _Objects_Initialize_information(
+ &_Thread_Internal_information,
+ OBJECTS_INTERNAL_THREADS,
+ FALSE,
+ ( _System_state_Is_multiprocessing ) ? 2 : 1,
+ sizeof( Thread_Control ),
+ TRUE,
+ 8,
+ TRUE
+ );
+
+}
+
+/*PAGE
+ *
+ * _Thread_Create_idle
+ */
+
+void _Thread_Create_idle( void )
+{
+ void *idle;
+
+ /*
+ * 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 = _CPU_Thread_Idle_body;
+#else
+ idle = _Thread_Idle_body;
+#endif
+
+ if ( _CPU_Table.idle_task )
+ idle = _CPU_Table.idle_task;
+
+ _Thread_Initialize(
+ &_Thread_Internal_information,
+ _Thread_Idle,
+ NULL, /* allocate the stack */
+ THREAD_IDLE_STACK_SIZE,
+ CPU_IDLE_TASK_IS_FP,
+ PRIORITY_MAXIMUM,
+ TRUE, /* preemptable */
+ FALSE, /* not timesliced */
+ 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
+ );
+
+}
+
+/*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;
+
+ _Context_Switch( &_Thread_BSP_context, &_Thread_Executing->Registers );
+}
+
+/*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;
+ _ISR_Enable( level );
+
+ _User_extensions_Thread_switch( executing, heir );
+
+ _Thread_Ticks_remaining_in_timeslice = _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 )
+#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
+ if ( (heir->fp_context != NULL) && !_Thread_Is_allocated_fp( heir ) ) {
+ if ( _Thread_Allocated_fp != NULL )
+ _Context_Save_fp( &_Thread_Allocated_fp->fp_context );
+ _Context_Restore_fp( &heir->fp_context );
+ _Thread_Allocated_fp = heir;
+ }
+#else
+ if ( executing->fp_context != NULL )
+ _Context_Save_fp( &executing->fp_context );
+
+ if ( heir->fp_context != NULL )
+ _Context_Restore_fp( &heir->fp_context );
+#endif
+#endif
+
+ _Context_Switch( &executing->Registers, &heir->Registers );
+
+ executing = _Thread_Executing;
+
+ _ISR_Disable( level );
+ }
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _ISR_Enable( level );
+
+ if ( executing->do_post_task_switch_extension ) {
+ executing->do_post_task_switch_extension = FALSE;
+ _API_extensions_Run_postswitch();
+ }
+
+}
+
+/*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
+ */
+
+static 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;
+}
+
+/*
+ * _Thread_Stack_Free
+ *
+ * Deallocate the Thread's stack.
+ */
+
+static void _Thread_Stack_Free(void *stack_addr)
+{
+ /*
+ * 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)( stack_addr );
+ else
+ _Workspace_Free( stack_addr );
+}
+
+/*PAGE
+ *
+ * _Thread_Initialize
+ *
+ * XXX
+ */
+
+boolean _Thread_Initialize(
+ Objects_Information *information,
+ Thread_Control *the_thread,
+ void *stack_area, /* NULL if to be allocated */
+ unsigned32 stack_size, /* insure it is >= min */
+ boolean is_fp, /* TRUE if thread uses FP */
+ Priority_Control priority,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
+ Objects_Name name
+
+)
+{
+ unsigned32 actual_stack_size;
+ void *stack;
+ void *fp_area;
+ void *extensions_area;
+
+ /*
+ * Allocate and Initialize the stack for this thread.
+ */
+
+ if ( !_Stack_Is_enough( stack_size ) )
+ actual_stack_size = STACK_MINIMUM_SIZE;
+ else
+ actual_stack_size = stack_size;
+
+ actual_stack_size = _Stack_Adjust_size( actual_stack_size );
+ stack = stack_area;
+
+ if ( !stack ) {
+ actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size );
+
+ if ( !actual_stack_size )
+ return FALSE; /* stack allocation failed */
+
+ stack = the_thread->Start.stack;
+ } else
+ the_thread->Start.stack = NULL;
+
+ _Stack_Initialize(
+ &the_thread->Start.Initial_stack,
+ stack,
+ actual_stack_size
+ );
+
+ /*
+ * Allocate the floating point area for this thread
+ */
+
+ if ( is_fp ) {
+
+ fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
+ if ( !fp_area ) {
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+ 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;
+
+
+ /*
+ * 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 ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
+ } else
+ extensions_area = NULL;
+
+ the_thread->extensions = extensions_area;
+
+ /*
+ * General initialization
+ */
+
+ the_thread->Start.is_preemptible = is_preemptible;
+ the_thread->Start.is_timeslice = is_timeslice;
+ the_thread->Start.isr_level = isr_level;
+
+ the_thread->current_state = STATES_DORMANT;
+ the_thread->resource_count = 0;
+ the_thread->real_priority = priority;
+ the_thread->Start.initial_priority = priority;
+
+ _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 ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
+
+ return TRUE;
+
+}
+
+/*
+ * _Thread_Start
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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 = 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;
+
+}
+
+/*
+ * _Thread_Restart
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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 );
+ the_thread->resource_count = 0;
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
+
+ the_thread->Start.pointer_argument = pointer_argument;
+ the_thread->Start.numeric_argument = numeric_argument;
+
+ 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 );
+ }
+
+ _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;
+}
+
+/*
+ * _Thread_Close
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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_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 );
+
+ if ( the_thread->Start.stack )
+ (void) _Workspace_Free( the_thread->Start.stack );
+
+ if ( the_thread->extensions )
+ (void) _Workspace_Free( the_thread->extensions );
+
+ the_thread->Start.stack = NULL;
+ the_thread->extensions = NULL;
+}
+
+/*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 );
+}
+
+/*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;
+
+ _ISR_Disable( level );
+ the_thread->current_state =
+ _States_Clear( state, the_thread->current_state );
+
+ if ( _States_Is_ready( the_thread->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 );
+}
+
+/*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 );
+}
+
+/*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 );
+
+}
+
+/*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 ) ) {
+ _Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
+ _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 );
+}
+
+/*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 )
+{
+ if ( !_Thread_Executing->is_timeslice ||
+ !_Thread_Executing->is_preemptible ||
+ !_States_Is_ready( _Thread_Executing->current_state ) )
+ return;
+
+ if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
+ _Thread_Reset_timeslice();
+ }
+}
+
+/*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 );
+}
+
+/*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 ( the_thread->Start.fp_context ) {
+ the_thread->fp_context = the_thread->Start.fp_context;
+ _Context_Initialize_fp( &the_thread->fp_context );
+ is_fp = TRUE;
+ }
+
+ the_thread->do_post_task_switch_extension = FALSE;
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
+
+ _Context_Initialize(
+ &the_thread->Registers,
+ the_thread->Start.Initial_stack.area,
+ the_thread->Start.Initial_stack.size,
+ the_thread->Start.isr_level,
+ _Thread_Handler,
+ is_fp
+ );
+
+}
+
+/*PAGE
+ *
+ * _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.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Thread_Handler( void )
+{
+ Thread_Control *executing;
+
+ executing = _Thread_Executing;
+
+ /*
+ * 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();
+
+ switch ( executing->Start.prototype ) {
+ case THREAD_START_NUMERIC:
+ (*executing->Start.entry_point)( executing->Start.numeric_argument );
+ break;
+ case THREAD_START_POINTER:
+ (*executing->Start.entry_point)( executing->Start.pointer_argument );
+ break;
+ case THREAD_START_BOTH_POINTER_FIRST:
+ (*executing->Start.entry_point)(
+ executing->Start.pointer_argument,
+ executing->Start.numeric_argument
+ );
+ break;
+ case THREAD_START_BOTH_NUMERIC_FIRST:
+ (*executing->Start.entry_point)(
+ executing->Start.numeric_argument,
+ executing->Start.pointer_argument
+ );
+ break;
+ }
+
+ _User_extensions_Thread_exitted( executing );
+
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_THREAD_EXITTED
+ );
+}
+
+/*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;
+ }
+}
+
+/*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
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * ready chain
+ * select heir
+ */
+
+void _Thread_Change_priority(
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+)
+{
+ ISR_Level level;
+
+ _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 ) ) {
+ _ISR_Enable( level );
+ return;
+ }
+
+ _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();
+
+ if ( !_Thread_Is_executing_also_the_heir() &&
+ _Thread_Executing->is_preemptible )
+ _Context_Switch_necessary = TRUE;
+
+ _ISR_Enable( level );
+}
+
+/*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 );
+}
+
+/*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;
+}
+
+/*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
+)
+{
+ Objects_Classes the_class;
+ Objects_Information *information;
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
+ _Thread_Disable_dispatch();
+ *location = OBJECTS_LOCAL;
+ return( _Thread_Executing );
+ }
+
+ the_class = _Objects_Get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ return (Thread_Control *) _Objects_Get( information, id, location );
+}
+
+#endif
+
+/*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/threadmp.c b/c/src/exec/score/src/threadmp.c
new file mode 100644
index 0000000000..31f7e5ff62
--- /dev/null
+++ b/c/src/exec/score/src/threadmp.c
@@ -0,0 +1,164 @@
+/*
+ * Multiprocessing Support for the Thread Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/isr.h>
+
+/*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 = _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
new file mode 100644
index 0000000000..c02de10ee0
--- /dev/null
+++ b/c/src/exec/score/src/threadq.c
@@ -0,0 +1,967 @@
+/*
+ * Thread Queue Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+
+/*PAGE
+ *
+ * _Thread_queue_Initialize
+ *
+ * This routine initializes the specified threadq.
+ *
+ * Input parameters:
+ * the_thread_queue - pointer to a threadq header
+ * the_class - class of the object to which this belongs
+ * discipline - queueing discipline
+ * state - state of waiting threads
+ * proxy_extract_callout - MP specific callout
+ * timeout_status - return on a timeout
+ *
+ * Output parameters: NONE
+ */
+
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ Objects_Classes the_class,
+ Thread_queue_Disciplines the_discipline,
+ States_Control state,
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
+)
+{
+ unsigned32 index;
+
+ _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
+
+ the_thread_queue->state = state;
+ the_thread_queue->discipline = the_discipline;
+ the_thread_queue->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;
+ }
+
+}
+
+/*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 ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
+ the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );
+ else
+ _Thread_Set_state( the_thread, the_thread_queue->state );
+
+ 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;
+ }
+}
+
+/*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 );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Extract_with_proxy
+ *
+ * This routine extracts the_thread from the_thread_queue
+ * and insures 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_Classes the_class;
+ 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_class = _Objects_Get_class( the_thread->Wait.id );
+
+ proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
+
+ if ( proxy_extract_callout )
+ (*proxy_extract_callout)( the_thread );
+ }
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*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;
+ }
+}
+
+/*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 ( _Objects_Is_local_id( the_thread->Object.id ) )
+ the_thread->Wait.return_code = status;
+ else
+ ( *remote_extract_callout )( the_thread );
+ }
+}
+
+/*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;
+}
+
+/*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;
+ }
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+ 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 */
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+}
+
+/*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;
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+ return( the_thread );
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+ }
+ else
+ _ISR_Enable( level );
+}
+
+/*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/tod.c b/c/src/exec/score/src/tod.c
new file mode 100644
index 0000000000..1a11034ceb
--- /dev/null
+++ b/c/src/exec/score/src/tod.c
@@ -0,0 +1,235 @@
+/*
+ * Time of Day (TOD) Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*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_Ticks_since_boot = 0;
+ _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 );
+}
+
+/*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_Activate( ticks_until_next_second );
+
+ _Thread_Enable_dispatch();
+}
+
+/*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;
+}
+
+/*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 );
+}
+
+/*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/userext.c b/c/src/exec/score/src/userext.c
new file mode 100644
index 0000000000..6261220d58
--- /dev/null
+++ b/c/src/exec/score/src/userext.c
@@ -0,0 +1,204 @@
+/*
+ * User Extension Handler
+ *
+ * NOTE: XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*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
new file mode 100644
index 0000000000..0f72bd3d5c
--- /dev/null
+++ b/c/src/exec/score/src/watchdog.c
@@ -0,0 +1,267 @@
+/*
+ * Watchdog Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/watchdog.h>
+
+/*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;
+ _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
+ _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
+}
+
+/*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;
+ }
+ _ISR_Enable( level );
+ return( previous_state );
+}
+
+/*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;
+ }
+ }
+}
+
+/*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 );
+
+exit_insert:
+ _Watchdog_Sync_level = insert_isr_nest_level;
+ _Watchdog_Sync_count--;
+ _ISR_Enable( level );
+}
+
+/*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
new file mode 100644
index 0000000000..1dda9408bb
--- /dev/null
+++ b/c/src/exec/score/src/wkspace.c
@@ -0,0 +1,88 @@
+/*
+ * Workspace Handler
+ *
+ * XXX
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/interr.h>
+
+/*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 / 4 ;
+ 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;
+}
diff --git a/c/src/exec/score/tools/hppa1.1/genoffsets.c b/c/src/exec/score/tools/hppa1.1/genoffsets.c
new file mode 100644
index 0000000000..39f900b48a
--- /dev/null
+++ b/c/src/exec/score/tools/hppa1.1/genoffsets.c
@@ -0,0 +1,346 @@
+/*
+ * genoffsets.c
+ *
+ * This file generates the offsets.h for the HP PA-RISC port of RTEMS.
+ *
+ * NOTE: It only prints the offset for structures actually used
+ * by the assembly code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+
+#if defined(__hpux__) && defined(__hppa__)
+#include <rtems/system.h>
+#endif
+
+void print_information( void );
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ unsigned int size = 0;
+
+ /*
+ * Print the file header
+ */
+
+printf(
+ "/* offsets.h\n"
+ " *\n"
+ " * This include file contains the offsets of elements in the\n"
+ " * C data structures used by the assembly language code for the\n"
+ " * HP PA-RISC 1.1 port of RTEMS.\n"
+ " *\n"
+ " * NOTE: THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
+ " * DO NOT EDIT THIS BY HAND!!!!\n"
+ " *\n"
+ " * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
+ " * On-Line Applications Research Corporation (OAR).\n"
+ " * All rights assigned to U.S. Government, 1994.\n"
+ " *\n"
+ " * This material may be reproduced by or for the U.S. Government pursuant\n"
+ " * to the copyright license under the clause at DFARS 252.227-7013. This\n"
+ " * notice must appear in all copies of this file and its derivatives.\n"
+ " */\n"
+ "\n"
+ "#ifndef __OFFSETS_h\n"
+ "#define __OFFSETS_h\n"
+ "\n"
+);
+
+#define PRINT_IT( STRING, TYPE, FIELD ) \
+ printf( "#define\t%s\t0x%p\t\t/* %d */\n", \
+ STRING, \
+ &((TYPE)0)->FIELD, \
+ (int) &((TYPE)0)->FIELD );
+
+#define PRINT_SIZE( STRING, item ) \
+ printf( "#ifdef ASM\n#define\t%s\t%d\t\t/* 0x%x */\n#endif\n", \
+ STRING, \
+ sizeof(item), \
+ sizeof(item) );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+#if defined(__hpux__) && defined(__hppa__)
+
+/*
+ * Offsets of elements in the Context_control structure.
+ */
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_IT( "FLAGS_OFFSET", Context_Control *, flags );
+ PRINT_IT( "R1_OFFSET", Context_Control *, gr1 );
+ PRINT_IT( "R2_OFFSET", Context_Control *, gr2 );
+ PRINT_IT( "R3_OFFSET", Context_Control *, gr3 );
+ PRINT_IT( "R4_OFFSET", Context_Control *, gr4 );
+ PRINT_IT( "R5_OFFSET", Context_Control *, gr5 );
+ PRINT_IT( "R6_OFFSET", Context_Control *, gr6 );
+ PRINT_IT( "R7_OFFSET", Context_Control *, gr7 );
+ PRINT_IT( "R8_OFFSET", Context_Control *, gr8 );
+ PRINT_IT( "R9_OFFSET", Context_Control *, gr9 );
+ PRINT_IT( "R10_OFFSET", Context_Control *, gr10 );
+ PRINT_IT( "R11_OFFSET", Context_Control *, gr11 );
+ PRINT_IT( "R12_OFFSET", Context_Control *, gr12 );
+ PRINT_IT( "R13_OFFSET", Context_Control *, gr13 );
+ PRINT_IT( "R14_OFFSET", Context_Control *, gr14 );
+ PRINT_IT( "R15_OFFSET", Context_Control *, gr15 );
+ PRINT_IT( "R16_OFFSET", Context_Control *, gr16 );
+ PRINT_IT( "R17_OFFSET", Context_Control *, gr17 );
+ PRINT_IT( "R18_OFFSET", Context_Control *, gr18 );
+ PRINT_IT( "R19_OFFSET", Context_Control *, gr19 );
+ PRINT_IT( "R20_OFFSET", Context_Control *, gr20 );
+ PRINT_IT( "R21_OFFSET", Context_Control *, gr21 );
+ PRINT_IT( "R22_OFFSET", Context_Control *, gr22 );
+ PRINT_IT( "R23_OFFSET", Context_Control *, gr23 );
+ PRINT_IT( "R24_OFFSET", Context_Control *, gr24 );
+ PRINT_IT( "R25_OFFSET", Context_Control *, gr25 );
+ PRINT_IT( "R26_OFFSET", Context_Control *, gr26 );
+ PRINT_IT( "R27_OFFSET", Context_Control *, gr27 );
+ PRINT_IT( "R28_OFFSET", Context_Control *, gr28 );
+ PRINT_IT( "R29_OFFSET", Context_Control *, gr29 );
+ PRINT_IT( "R30_OFFSET", Context_Control *, sp );
+ PRINT_IT( "R31_OFFSET", Context_Control *, gr31 );
+
+ /*
+ * And common aliases for the above
+ */
+
+ PRINT_COMMENT("Common aliases for above");
+
+ PRINT_IT( "RP_OFFSET", Context_Control *, gr2 );
+ PRINT_IT( "ARG3_OFFSET", Context_Control *, gr23 );
+ PRINT_IT( "ARG2_OFFSET", Context_Control *, gr24 );
+ PRINT_IT( "ARG1_OFFSET", Context_Control *, gr25 );
+ PRINT_IT( "ARG0_OFFSET", Context_Control *, gr26 );
+ PRINT_IT( "SP_OFFSET", Context_Control *, sp );
+ PRINT_IT( "DP_OFFSET", Context_Control *, gr27 );
+ PRINT_IT( "RET0_OFFSET", Context_Control *, gr28 );
+ PRINT_IT( "RET1_OFFSET", Context_Control *, gr29 );
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE", Context_Control);
+
+ PRINT_COMMENT("Context_Control_fp information");
+
+ PRINT_IT( "FR0_OFFSET", Context_Control_fp *, fr0 );
+ PRINT_IT( "FR1_OFFSET", Context_Control_fp *, fr1 );
+ PRINT_IT( "FR2_OFFSET", Context_Control_fp *, fr2 );
+ PRINT_IT( "FR3_OFFSET", Context_Control_fp *, fr3 );
+ PRINT_IT( "FR4_OFFSET", Context_Control_fp *, fr4 );
+ PRINT_IT( "FR5_OFFSET", Context_Control_fp *, fr5 );
+ PRINT_IT( "FR6_OFFSET", Context_Control_fp *, fr6 );
+ PRINT_IT( "FR7_OFFSET", Context_Control_fp *, fr7 );
+ PRINT_IT( "FR8_OFFSET", Context_Control_fp *, fr8 );
+ PRINT_IT( "FR9_OFFSET", Context_Control_fp *, fr9 );
+ PRINT_IT( "FR10_OFFSET", Context_Control_fp *, fr10 );
+ PRINT_IT( "FR11_OFFSET", Context_Control_fp *, fr11 );
+ PRINT_IT( "FR12_OFFSET", Context_Control_fp *, fr12 );
+ PRINT_IT( "FR13_OFFSET", Context_Control_fp *, fr13 );
+ PRINT_IT( "FR14_OFFSET", Context_Control_fp *, fr14 );
+ PRINT_IT( "FR15_OFFSET", Context_Control_fp *, fr15 );
+ PRINT_IT( "FR16_OFFSET", Context_Control_fp *, fr16 );
+ PRINT_IT( "FR17_OFFSET", Context_Control_fp *, fr17 );
+ PRINT_IT( "FR18_OFFSET", Context_Control_fp *, fr18 );
+ PRINT_IT( "FR19_OFFSET", Context_Control_fp *, fr19 );
+ PRINT_IT( "FR20_OFFSET", Context_Control_fp *, fr20 );
+ PRINT_IT( "FR21_OFFSET", Context_Control_fp *, fr21 );
+ PRINT_IT( "FR22_OFFSET", Context_Control_fp *, fr22 );
+ PRINT_IT( "FR23_OFFSET", Context_Control_fp *, fr23 );
+ PRINT_IT( "FR24_OFFSET", Context_Control_fp *, fr24 );
+ PRINT_IT( "FR25_OFFSET", Context_Control_fp *, fr25 );
+ PRINT_IT( "FR26_OFFSET", Context_Control_fp *, fr26 );
+ PRINT_IT( "FR27_OFFSET", Context_Control_fp *, fr27 );
+ PRINT_IT( "FR28_OFFSET", Context_Control_fp *, fr28 );
+ PRINT_IT( "FR29_OFFSET", Context_Control_fp *, fr29 );
+ PRINT_IT( "FR30_OFFSET", Context_Control_fp *, fr30 );
+ PRINT_IT( "FR31_OFFSET", Context_Control_fp *, fr31 );
+
+ PRINT_SIZE("CPU_CONTEXT_FP_SIZE", Context_Control_fp);
+
+ /*
+ * And the control registers
+ */
+
+ PRINT_COMMENT("Control register portion of context");
+
+ PRINT_IT( "SAR_OFFSET", Context_Control *, sar );
+ PRINT_IT( "IPSW_OFFSET", Context_Control *, ipsw );
+ PRINT_IT( "IIR_OFFSET", Context_Control *, iir );
+ PRINT_IT( "IOR_OFFSET", Context_Control *, ior );
+ PRINT_IT( "ISR_OFFSET", Context_Control *, isr );
+ PRINT_IT( "PCOQFRONT_OFFSET", Context_Control *, pcoqfront );
+ PRINT_IT( "PCOQBACK_OFFSET", Context_Control *, pcoqback );
+ PRINT_IT( "PCSQFRONT_OFFSET", Context_Control *, pcsqfront );
+ PRINT_IT( "PCSQBACK_OFFSET", Context_Control *, pcsqback );
+ PRINT_IT( "ITIMER_OFFSET", Context_Control *, itimer );
+
+ /*
+ * Full interrupt frame (integer + float)
+ */
+ PRINT_COMMENT("Interrupt frame information");
+
+ PRINT_IT( "INTEGER_CONTEXT_OFFSET", CPU_Interrupt_frame *, Integer );
+ PRINT_IT( "FP_CONTEXT_OFFSET", CPU_Interrupt_frame *, Floating_Point );
+ size = sizeof( CPU_Interrupt_frame );
+
+ if ( size % CPU_STACK_ALIGNMENT )
+ size += CPU_STACK_ALIGNMENT - (size % CPU_STACK_ALIGNMENT);
+
+ printf( "#define\tCPU_INTERRUPT_FRAME_SIZE\t%d\t\t/* 0x%x */\n", size, size );
+
+#else
+
+ print_information();
+
+#endif
+
+#undef PRINT_IT
+#undef PRINT_SIZE
+#undef PRINT_COMMENT
+
+ /*
+ * Print the end of file stuff
+ */
+
+ printf(
+ "\n"
+ "#endif /* __OFFSETS_h */\n"
+ "\n"
+ "/* end of include file */\n"
+ );
+
+ return 0;
+}
+
+void print_information( void )
+{
+
+#define PRINT_IT( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_SIZE( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+/*
+ * Offsets of elements in the Context_control structure.
+ */
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_IT( "FLAGS_OFFSET", 0x00 );
+ PRINT_IT( "R1_OFFSET", 0x04 );
+ PRINT_IT( "R2_OFFSET", 0x08 );
+ PRINT_IT( "R3_OFFSET", 0x0c );
+ PRINT_IT( "R4_OFFSET", 0x00 );
+ PRINT_IT( "R5_OFFSET", 0x14 );
+ PRINT_IT( "R6_OFFSET", 0x18 );
+ PRINT_IT( "R7_OFFSET", 0x1c );
+ PRINT_IT( "R8_OFFSET", 0x20 );
+ PRINT_IT( "R9_OFFSET", 0x24 );
+ PRINT_IT( "R10_OFFSET", 0x28 );
+ PRINT_IT( "R11_OFFSET", 0x2c );
+ PRINT_IT( "R12_OFFSET", 0x30 );
+ PRINT_IT( "R13_OFFSET", 0x34 );
+ PRINT_IT( "R14_OFFSET", 0x38 );
+ PRINT_IT( "R15_OFFSET", 0x3c );
+ PRINT_IT( "R16_OFFSET", 0x40 );
+ PRINT_IT( "R17_OFFSET", 0x44 );
+ PRINT_IT( "R18_OFFSET", 0x48 );
+ PRINT_IT( "R19_OFFSET", 0x4c );
+ PRINT_IT( "R20_OFFSET", 0x50 );
+ PRINT_IT( "R21_OFFSET", 0x54 );
+ PRINT_IT( "R22_OFFSET", 0x58 );
+ PRINT_IT( "R23_OFFSET", 0x5c );
+ PRINT_IT( "R24_OFFSET", 0x60 );
+ PRINT_IT( "R25_OFFSET", 0x64 );
+ PRINT_IT( "R26_OFFSET", 0x68 );
+ PRINT_IT( "R27_OFFSET", 0x6c );
+ PRINT_IT( "R28_OFFSET", 0x70 );
+ PRINT_IT( "R29_OFFSET", 0x74 );
+ PRINT_IT( "R30_OFFSET", 0x78 );
+ PRINT_IT( "R31_OFFSET", 0x7c );
+
+ /*
+ * And common aliases for the above
+ */
+
+ PRINT_COMMENT("Common aliases for above");
+
+ PRINT_IT( "RP_OFFSET", 0x08 );
+ PRINT_IT( "ARG3_OFFSET", 0x5c );
+ PRINT_IT( "ARG2_OFFSET", 0x60 );
+ PRINT_IT( "ARG1_OFFSET", 0x64 );
+ PRINT_IT( "ARG0_OFFSET", 0x68 );
+ PRINT_IT( "SP_OFFSET", 0x78 );
+ PRINT_IT( "DP_OFFSET", 0x6c );
+ PRINT_IT( "RET0_OFFSET", 0x74 );
+ PRINT_IT( "RET1_OFFSET", 0x74 );
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE", 168 );
+
+ PRINT_COMMENT("Context_Control_fp information");
+
+ PRINT_SIZE("CPU_CONTEXT_FP_SIZE", 256);
+
+ /*
+ * And the control registers
+ */
+
+ PRINT_COMMENT("Control register portion of context");
+
+ PRINT_IT( "SAR_OFFSET", 0x80 );
+ PRINT_IT( "IPSW_OFFSET", 0x84 );
+ PRINT_IT( "IIR_OFFSET", 0x88 );
+ PRINT_IT( "IOR_OFFSET", 0x8c );
+ PRINT_IT( "ISR_OFFSET", 0x90 );
+ PRINT_IT( "PCOQFRONT_OFFSET", 0x94 );
+ PRINT_IT( "PCOQBACK_OFFSET", 0x98 );
+ PRINT_IT( "PCSQFRONT_OFFSET", 0x9c );
+ PRINT_IT( "PCSQBACK_OFFSET", 0xa0 );
+ PRINT_IT( "ITIMER_OFFSET", 0xa4 );
+
+ /*
+ * Full interrupt frame (integer + float)
+ */
+
+ PRINT_COMMENT("Interrupt frame information");
+
+ PRINT_IT( "INTEGER_CONTEXT_OFFSET", 0x00 );
+ PRINT_IT( "FP_CONTEXT_OFFSET", 0xa8 );
+ PRINT_SIZE( "CPU_INTERRUPT_FRAME_SIZE", 448 );
+
+}
diff --git a/c/src/exec/score/tools/unix/gensize.c b/c/src/exec/score/tools/unix/gensize.c
new file mode 100644
index 0000000000..0466d67b09
--- /dev/null
+++ b/c/src/exec/score/tools/unix/gensize.c
@@ -0,0 +1,116 @@
+/*
+ * gensize.c
+ *
+ * This file generates the file unixsize.h
+ *
+ * NOTE: It only prints the minimal information required.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+/*
+ * This feels like a very crude way to determine if we are on a Solaris
+ * host but it does work.
+ */
+
+#if defined(__sun__) && defined(__sparc__) && \
+ defined(__unix__) && defined(__svr4__)
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+#include <setjmp.h>
+#include <signal.h>
+
+typedef struct {
+ jmp_buf regs;
+ sigset_t isr_level;
+} Context_Control;
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ Context_Control *cc = 0;
+
+ /*
+ * Print the file header
+ */
+
+printf(
+ "/* unixsize.h\n"
+ " *\n"
+ " * This include file contans the size of the context control block\n"
+ " * C data structure. This structure must be defined in such a way\n"
+ " * that files NOT including the native header files can work.\n"
+ " *\n"
+ " * NOTE: THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
+ " * DO NOT EDIT THIS BY HAND!!!!\n"
+ " *\n"
+ " * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
+ " * On-Line Applications Research Corporation (OAR).\n"
+ " * All rights assigned to U.S. Government, 1994.\n"
+ " *\n"
+ " * This material may be reproduced by or for the U.S. Government pursuant\n"
+ " * to the copyright license under the clause at DFARS 252.227-7013. This\n"
+ " * notice must appear in all copies of this file and its derivatives.\n"
+ " */\n"
+ "\n"
+ "#ifndef __UNIXSIZE_h\n"
+ "#define __UNIXSIZE_h\n"
+ "\n"
+);
+
+#define PRINT_IT( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_SIZE( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE_IN_BYTES", sizeof( Context_Control ) );
+ PRINT_SIZE("CPU_CONTEXT_REGISTERS_OFFSET_IN_BYTES", (int) &cc->regs );
+ PRINT_SIZE("CPU_CONTEXT_SIGNALS_OFFSET_IN_BYTES", (int) &cc->isr_level );
+
+ /*
+ * Print the end of file stuff
+ */
+
+ printf(
+ "\n"
+ "#endif /* __UNIXSIZE_h */\n"
+ "\n"
+ "/* end of include file */\n"
+ );
+
+ return 0;
+}
+
diff --git a/c/src/lib/include/clockdrv.h b/c/src/lib/include/clockdrv.h
new file mode 100644
index 0000000000..258c590e0d
--- /dev/null
+++ b/c/src/lib/include/clockdrv.h
@@ -0,0 +1,51 @@
+/* clock.h
+ *
+ * This file describes the Clock Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CLOCK_DRIVER_h
+#define __CLOCK_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* variables */
+
+extern volatile rtems_unsigned32 Clock_driver_ticks;
+extern rtems_device_major_number rtems_clock_major;
+extern rtems_device_minor_number rtems_clock_minor;
+
+/* default clock driver entry */
+
+#define CLOCK_DRIVER_TABLE_ENTRY \
+ { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/console.h b/c/src/lib/include/console.h
new file mode 100644
index 0000000000..02196de7a9
--- /dev/null
+++ b/c/src/lib/include/console.h
@@ -0,0 +1,69 @@
+/* console.h
+ *
+ * This file describes the Console Device Driver for all boards.
+ * This driver provides support for the standard C Library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef _CONSOLE_DRIVER_h
+#define _CONSOLE_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CONSOLE_DRIVER_TABLE_ENTRY \
+ { console_initialize, console_open, console_close, \
+ console_read, console_write, console_control }
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/iosupp.h b/c/src/lib/include/iosupp.h
new file mode 100644
index 0000000000..5f4a83b8ca
--- /dev/null
+++ b/c/src/lib/include/iosupp.h
@@ -0,0 +1,44 @@
+/* iosupp.h
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __IOSUPP_h
+#define __IOSUPP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* character constants */
+
+#define BS 0x08 /* backspace */
+#define LF 0x0a /* line feed */
+#define CR 0x0d /* carriage return */
+#define XON 0x11 /* control-Q */
+#define XOFF 0x13 /* control-S */
+
+/* structures */
+
+#ifdef IOSUPP_INIT
+#define IOSUPP_EXTERN
+#else
+#undef IOSUPP_EXTERN
+#define IOSUPP_EXTERN extern
+#endif
+
+/* functions */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/lib/include/ringbuf.h b/c/src/lib/include/ringbuf.h
new file mode 100644
index 0000000000..8c80aaf9c8
--- /dev/null
+++ b/c/src/lib/include/ringbuf.h
@@ -0,0 +1,53 @@
+/*
+ * ringbuf.h
+ *
+ * This file provides simple ring buffer functionality.
+ *
+ * $Id$
+ */
+
+#ifndef __RINGBUF_H__
+#define __RINGBUF_H__
+
+#ifndef RINGBUF_QUEUE_LENGTH
+#define RINGBUF_QUEUE_LENGTH 128
+#endif
+
+typedef struct {
+ char buffer[RINGBUF_QUEUE_LENGTH];
+ volatile int head;
+ volatile int tail;
+} Ring_buffer_t;
+
+#define Ring_buffer_Initialize( _buffer ) \
+ do { \
+ (_buffer)->head = (_buffer)->tail = 0; \
+ } while ( 0 )
+
+#define Ring_buffer_Is_empty( _buffer ) \
+ ( (_buffer)->head == (_buffer)->tail )
+
+#define Ring_buffer_Is_full( _buffer ) \
+ ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
+
+#define Ring_buffer_Add_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
+ (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#define Ring_buffer_Remove_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
+ (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#endif
diff --git a/c/src/lib/include/rtems/assoc.h b/c/src/lib/include/rtems/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/c/src/lib/include/rtems/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/c/src/lib/include/rtems/error.h b/c/src/lib/include/rtems/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/c/src/lib/include/rtems/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/rtems/libcsupport.h b/c/src/lib/include/rtems/libcsupport.h
new file mode 100644
index 0000000000..f43cd189e1
--- /dev/null
+++ b/c/src/lib/include/rtems/libcsupport.h
@@ -0,0 +1,42 @@
+/* libcsupport.h
+ *
+ * This include file contains the information regarding the
+ * RTEMS specific support for the standard C library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __LIBC_SUPPORT_h
+#define __LIBC_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+);
+
+extern void malloc_dump(void);
+extern void libc_init(int reentrant);
+extern int host_errno(void);
+extern void fix_syscall_errno(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/rtems/libio.h b/c/src/lib/include/rtems/libio.h
new file mode 100644
index 0000000000..07d72620b1
--- /dev/null
+++ b/c/src/lib/include/rtems/libio.h
@@ -0,0 +1,98 @@
+/*
+ * General purpose communication channel for RTEMS to allow UNIX/POSIX
+ * system call behavior on top of RTEMS IO devices.
+ *
+ * TODO
+ * stat(2)
+ * unlink(2)
+ * rename(2)
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_LIBIO_H
+#define _RTEMS_LIBIO_H
+
+typedef unsigned32 rtems_libio_offset_t;
+
+/*
+ * An open file data structure, indexed by 'fd'
+ * TODO:
+ * should really have a separate per/file data structure that this
+ * points to (eg: size, offset, driver, pathname should be in that)
+ */
+
+typedef struct {
+ rtems_driver_name_t *driver;
+ rtems_libio_offset_t size; /* size of file */
+ rtems_libio_offset_t offset; /* current offset into the file */
+ unsigned32 flags;
+ char *pathname; /* opened pathname */
+ Objects_Id sem;
+ unsigned32 data0; /* private to "driver" */
+ unsigned32 data1; /* ... */
+} rtems_libio_t;
+
+
+/*
+ * param block for read/write
+ * Note: it must include 'offset' instead of using iop's offset since
+ * we can have multiple outstanding i/o's on a device.
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ rtems_libio_offset_t offset;
+ unsigned8 *buffer;
+ unsigned32 count;
+ unsigned32 flags;
+ unsigned32 bytes_moved;
+} rtems_libio_rw_args_t;
+
+/*
+ * param block for open/close
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 flags;
+ unsigned32 mode;
+} rtems_libio_open_close_args_t;
+
+/*
+ * param block for ioctl
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 command;
+ void *buffer;
+ unsigned32 ioctl_return;
+} rtems_libio_ioctl_args_t;
+
+
+/*
+ * Values for 'flag'
+ */
+
+#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
+#define LIBIO_FLAGS_READ 0x0002 /* reading */
+#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
+#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
+#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
+#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
+#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
+
+#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
+
+void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
+void rtems_libio_init(void);
+
+int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
+int __close(int fd);
+int __read(int fd, void *buffer, unsigned32 count);
+int __write(int fd, const void *buffer, unsigned32 count);
+int __ioctl(int fd, unsigned32 command, void *buffer);
+int __lseek(int fd, rtems_libio_offset_t offset, int whence);
+
+#endif /* _RTEMS_LIBIO_H */
diff --git a/c/src/lib/include/spurious.h b/c/src/lib/include/spurious.h
new file mode 100644
index 0000000000..428e826164
--- /dev/null
+++ b/c/src/lib/include/spurious.h
@@ -0,0 +1,38 @@
+/* spurious.h
+ *
+ * This file describes the Spurious Interrupt Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SPURIOUS_h
+#define __SPURIOUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SPURIOUS_DRIVER_TABLE_ENTRY \
+ { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL }
+
+rtems_device_driver Spurious_Initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/sys/utsname.h b/c/src/lib/include/sys/utsname.h
new file mode 100644
index 0000000000..ca15230d40
--- /dev/null
+++ b/c/src/lib/include/sys/utsname.h
@@ -0,0 +1,49 @@
+/* sys/utsname.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SYS_UTSNAME_h
+#define __POSIX_SYS_UTSNAME_h
+
+#include <sys/times.h>
+#include <sys/types.h>
+
+/*
+ * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
+ *
+ * NOTE: The lengths of the strings in this structure are
+ * just long enough to reliably contain the RTEMS information.
+ * For example, the fields are not long enough to support
+ * Internet hostnames.
+ */
+
+struct utsname {
+ char sysname[ 32 ]; /* Name of this implementation of the operating system */
+ char nodename[ 32 ]; /* Name of this node within an implementation */
+ /* specified communication network */
+ char release[ 32 ]; /* Current release level of this implementation */
+ char version[ 32 ]; /* Current version level of this release */
+ char machine[ 32 ]; /* Name of the hardware type on which the system */
+ /* is running */
+};
+
+/*
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+);
+
+/*
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+);
+
+#endif
+/* end of include file */
+
diff --git a/c/src/lib/include/timerdrv.h b/c/src/lib/include/timerdrv.h
new file mode 100644
index 0000000000..d091b62410
--- /dev/null
+++ b/c/src/lib/include/timerdrv.h
@@ -0,0 +1,40 @@
+/* timerdrv.h
+ *
+ * This file describes the Timer Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_DRIVER_h
+#define __TIMER_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* functions */
+
+void Timer_initialize( void );
+
+rtems_unsigned32 Read_timer( void );
+
+rtems_status_code Empty_function( void );
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/include/vmeintr.h b/c/src/lib/include/vmeintr.h
new file mode 100644
index 0000000000..6148114ce8
--- /dev/null
+++ b/c/src/lib/include/vmeintr.h
@@ -0,0 +1,58 @@
+/*
+ * vmeintr.h
+ *
+ * This file is the specification for the VMEbus interface library
+ * which should be provided by all BSPs for VMEbus Single Board
+ * Computers but currently only a few do so.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __VME_INTERRUPT_h
+#define __VME_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the mask which is used to determine which
+ * interrupt levels are affected by a call to this package.
+ * The LSB corresponds to VME interrupt 0 and the MSB
+ * to VME interrupt 7.
+ *
+ */
+
+typedef rtems_unsigned8 VME_interrupt_Mask;
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Disable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Enable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of include file */
diff --git a/c/src/lib/libbsp/README b/c/src/lib/libbsp/README
new file mode 100644
index 0000000000..c3b978b6cb
--- /dev/null
+++ b/c/src/lib/libbsp/README
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+
+Board Support Package library
+
+This directory contains the source for the libbsp.a library.
+For each supported board $(RTEMS_BSP) there is a standard
+set of functions which must be provided in the BSP:
+
+ + start up initialization
+ + exit support
+ + set vector
+ + console IO support
+ + drivers
+
+In addition, the BSP also determines the memory usage by providing
+any necessary linker scripts.
+
+There are also "generic" drivers in this directory. Currently
+they are shmdr and stubdr.
+
+Some of the supplied generic drivers (for example, shared memory) require
+target board specific support routines.
+
+NOTE: The library libbsp.a is actually built by $(RTEMS_BSP)/wrapup/Makefile.
+
+To execute all of the test in the RTEMS Tests Suites the following
+device drivers must be supplied:
+
+ + Clock Tick
+ + IO Driver Support
+ + Timer
+ + Shared Memory Driver Support
+
+The Timer Driver is used only by the Timing Test Suite (c/src/tests/tmtests/*).
+These tests are used to generate the execution times for RTEMS found in the
+flyers. It is recommended that these tests be run to verify a port to a new
+CPU or with a newly developed BSP. Looking at the times as compared to a
+known CPU and target can yield insights into potential performance problems
+in either the port, the BSP, or the target hardware.
+
+The Shared Memory Support is only required to execute the Multiprocessor
+Test Suite (c/src/tests/mptests/*). Multiprocessing is not a required part
+of a BSP.
+
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h
new file mode 100644
index 0000000000..2dfc2cc8df
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h
@@ -0,0 +1,121 @@
+/* bsp.h
+ *
+ * This include file contains all HP PA-RISC simulator definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PXFL_BSP_h
+#define __PXFL_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <rtems/ttydrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 3 /* 3 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+#define Install_tm27_vector( handler ) \
+ ( void ) set_vector( handler, HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER, 1 );
+
+#define Cause_tm27_intr() \
+ set_itimer( get_itimer() + 20 )
+
+#define Clear_tm27_intr() \
+ set_eirr( 0x80000000 )
+
+#define Lower_tm27_intr() \
+ { \
+ register unsigned32 ignored; \
+ HPPA_ASM_SSM( HPPA_PSW_I, ignored ); \
+ }
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+extern void Clock_delay(rtems_unsigned32 microseconds);
+#define delay( microseconds ) \
+ Clock_delay(microseconds);
+
+/*
+ * Todo: this should be put somewhere else
+ */
+
+#undef CLOCK_DRIVER_TABLE_ENTRY
+#define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+);
+
+/*
+ * We printf() to a buffer if multiprocessing, *or* if this is set.
+ * ref: src/lib/libbsp/hppa/pxfl/iosupp/consupp.c
+ */
+
+extern int use_print_buffer;
+
+/*
+ * When not doing printf to a buffer, we do printf thru RTEMS libio
+ * and our tty driver. Set it up so that console is right.
+ */
+
+#define CONSOLE_DRIVER_TABLE_ENTRY \
+ { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control }
+
+/*
+ * How many libio files we want
+ */
+#define BSP_LIBIO_MAX_FDS 20
+
+#define HPPA_INTERRUPT_EXTERNAL_MPCI HPPA_INTERRUPT_EXTERNAL_10
+
+rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
+
+void bsp_start( void );
+void bsp_cleanup( void );
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+extern rtems_unsigned32 bsp_isr_level;
+
+extern int cpu_number; /* from 0; cpu number in a multi cpu system */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/include/coverhd.h b/c/src/lib/libbsp/hppa1.1/simhppa/include/coverhd.h
new file mode 100644
index 0000000000..1f5e3a3d5a
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C for this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/include/ttydrv.h b/c/src/lib/libbsp/hppa1.1/simhppa/include/ttydrv.h
new file mode 100644
index 0000000000..b20878d99c
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/include/ttydrv.h
@@ -0,0 +1,54 @@
+/*
+ * $Id$
+ */
+
+/*
+ * definitions for the tty driver
+ */
+
+#ifndef _RTEMS_TTYDRV_H
+#define _RTEMS_TTYDRV_H
+
+rtems_device_driver
+tty_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+rtems_device_driver
+tty_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+rtems_device_driver
+tty_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+rtems_device_driver
+tty_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+rtems_device_driver
+tty_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+rtems_device_driver
+tty_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ );
+
+#endif /* _RTEMS_TTYDRV_H */
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/README b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/README
new file mode 100644
index 0000000000..cf60698ca4
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+This directory contains the SHM driver support files for the
+HP PA-RISC simulator for the 72000 processor.
+
+WARNING: The interrupt support in this directory currently will
+ only work in a homogeneous system.
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/addrconv.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/addrconv.c
new file mode 100644
index 0000000000..0d67bba2a6
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/addrconv.c
@@ -0,0 +1,30 @@
+/* Shm_Convert_address
+ *
+ * No address range conversion is required.
+ *
+ * Input parameters:
+ * address - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+void *Shm_Convert_address(
+ void *address
+)
+{
+ return ( address );
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c
new file mode 100644
index 0000000000..f29eecf093
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c
@@ -0,0 +1,89 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the HP PA-RISC
+ * simulator.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+ * NOTES: The MP interrupt used is the Runway bus' ability to directly
+ * address the control registers of up to four CPUs and cause
+ * interrupts on them.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED BIG 2+
+ * INTERRUPT BIG 2..4 (on Runway)
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include <shm.h>
+
+#define INTERRUPT 0 /* can be interrupt or polling */
+#define POLLING 1
+
+#define HPPA_RUNWAY_PROC_HPA_BASE ((void *) 0xFFFA0000)
+
+/* given a processor number, where is its HPA? */
+#define HPPA_RUNWAY_HPA(cpu) \
+ ((rtems_unsigned32) (HPPA_RUNWAY_PROC_HPA_BASE + ((cpu) * 0x2000)))
+
+#define HPPA_RUNWAY_REG_IO_EIR_OFFSET 0x000
+
+shm_config_table BSP_shm_cfgtbl;
+
+extern void Shm_Cause_interrupt_pxfl( rtems_unsigned32 node );
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ BSP_shm_cfgtbl.base = (vol_u32 *) 0x44000000;
+ BSP_shm_cfgtbl.length = 16 * KILOBYTE;
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt_pxfl;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+#if ( POLLING == 1 )
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+#else
+ BSP_shm_cfgtbl.poll_intr = INTR_MODE;
+ BSP_shm_cfgtbl.Intr.address =
+ (vol_u32 *) (HPPA_RUNWAY_HPA( localnode - 1) +
+ HPPA_RUNWAY_REG_IO_EIR_OFFSET);
+ BSP_shm_cfgtbl.Intr.value = HPPA_INTERRUPT_EXTERNAL_MPCI;
+ BSP_shm_cfgtbl.Intr.length = LONG;
+#endif
+
+ *shmcfg = &BSP_shm_cfgtbl;
+}
+
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c
new file mode 100644
index 0000000000..161ae3f522
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c
@@ -0,0 +1,51 @@
+/* void Shm_Cause_interrupt_pxfl( node )
+ *
+ * This routine is the shared memory driver routine which
+ * generates interrupts to other CPUs.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+
+#include <rtems.h>
+#include <rtems/error.h>
+
+#include <shm.h>
+
+void Shm_Cause_interrupt_pxfl(
+ rtems_unsigned32 node
+)
+{
+ Shm_Interrupt_information *intr;
+ rtems_unsigned32 *u32;
+ rtems_unsigned32 value;
+
+ intr = &Shm_Interrupt_table[node];
+ value = intr->value;
+
+ switch ( intr->length ) {
+ case NO_INTERRUPT:
+ break;
+
+ case LONG:
+ u32 = (rtems_unsigned32 *)intr->address;
+ HPPA_ASM_STWAS( value, 0, u32 );
+ break;
+ default:
+ fprintf( stderr, "Shm_Cause_interrupt_pxfl: Unsupported length!!!\n" );
+ }
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/lock.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/lock.c
new file mode 100644
index 0000000000..724758b8b8
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/lock.c
@@ -0,0 +1,75 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = LQ_UNLOCKED;
+}
+
+/* Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+ vol_u32 *lockptr = &lq_cb->lock;
+ rtems_unsigned32 lock_value;
+
+ rtems_interrupt_disable( isr_level );
+
+ Shm_isrstat = isr_level;
+
+ do {
+ HPPA_ASM_LDCWS( 0, 0, lockptr, lock_value );
+ } while (lock_value == SHM_LOCK_VALUE);
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ lq_cb->lock = SHM_UNLOCK_VALUE;
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/mpisr.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/mpisr.c
new file mode 100644
index 0000000000..29e897d781
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/mpisr.c
@@ -0,0 +1,27 @@
+/* Shm_setvec
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+void Shm_setvec( void )
+{
+ set_vector( Shm_isr, HPPA_INTERRUPT_EXTERNAL_MPCI, 1 );
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspclean.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspclean.c
new file mode 100644
index 0000000000..fe2aa75fc4
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspclean.c
@@ -0,0 +1,36 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and returns
+ * control to a monitor but on the HP PA-RISC simulator
+ * we do that directly from main.c.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+/*
+ * The app has "exited" (called rtems_shutdown_executive)
+ */
+
+void bsp_cleanup( void )
+{
+ /*
+ * Invoke any fatal error extension and "halt"
+ * By definition, rtems_fatal_error_occurred does not return.
+ */
+
+ rtems_fatal_error_occurred(0);
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
new file mode 100644
index 0000000000..d702f3f315
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
@@ -0,0 +1,439 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * Called by RTEMS::RTEMS constructor in startup-ctor.cc
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+rtems_cpu_table Cpu_table;
+rtems_unsigned32 bsp_isr_level;
+
+int cpu_number;
+
+#define WORKSPACE_SIZE (1024 * 1024)
+rtems_unsigned8 MY_WORK_SPACE[ WORKSPACE_SIZE ];
+
+/*
+ * Amount to increment itimer by each pass
+ * It is a variable instead of a #define to allow the 'looptest'
+ * script to bump it without recompiling rtems
+ */
+
+rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK;
+
+#if SIMHPPA_FAST_IDLE
+
+/*
+ * Many of the tests are very slow on the simulator because they have
+ * have 5 second delays hardwired in.
+ * Try to speed those tests up by speeding up the clock when in idle
+ */
+
+rtems_extension
+fast_idle_switch_hook(rtems_tcb *current_task,
+ rtems_tcb *heir_task)
+{
+ static rtems_unsigned32 normal_clock = ~0;
+ static rtems_unsigned32 fast_clock;
+
+ /* init our params on first call */
+ if (normal_clock == ~0)
+ {
+ normal_clock = CPU_HPPA_CLICKS_PER_TICK;
+ fast_clock = CPU_HPPA_CLICKS_PER_TICK / 0x100;
+ if (fast_clock == 0) /* who? me? pathological? never! */
+ fast_clock++;
+ }
+
+ /*
+ * Checking for 'name' field of 'IDLE' is not the best/safest,
+ * but its the best we could think of at the moment.
+ */
+
+ if (heir_task == _Thread_Idle)
+ CPU_HPPA_CLICKS_PER_TICK = fast_clock;
+ else if (current_task == _Thread_Idle)
+ CPU_HPPA_CLICKS_PER_TICK = normal_clock;
+}
+
+#endif
+
+/*
+ * Function: bsp_libc_init
+ * Created: 94/12/6
+ *
+ * Description:
+ * Initialize whatever libc we are using
+ * called from bsp_postdriver_hook
+ *
+ *
+ * Parameters:
+ * none
+ *
+ * Returns:
+ * none.
+ *
+ * Side Effects:
+ *
+ *
+ * Notes:
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+void
+bsp_libc_init(void)
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ * XXX; this should allow for case of some other non-clock interrupts
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+
+ /*
+ * on MP systems, always use the print buffer
+ * instead of the (broken) system calls
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ use_print_buffer = 1;
+
+#ifdef SIMHPPA_ROM
+ use_print_buffer = 1;
+#endif
+}
+
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * Parameters:
+ * none
+ *
+ * Returns:
+ * nada
+ *
+ * Side Effects:
+ * installs a few extensions
+ *
+ * Notes:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#if SIMHPPA_FAST_IDLE
+ /*
+ * Install the fast idle task switch extension
+ *
+ * on MP systems, might now want to do this; it confuses at least
+ * one test (mp06)
+ */
+
+#if 0
+ if (BSP_Configuration.User_multiprocessing_table == 0)
+#endif
+ {
+ rtems_extensions_table fast_idle_extension;
+ rtems_id extension_id;
+ rtems_status_code rc;
+
+ memset(&fast_idle_extension, 0, sizeof(fast_idle_extension));
+
+ fast_idle_extension.thread_switch = fast_idle_switch_hook;
+
+ rc = rtems_extension_create(rtems_build_name('F', 'D', 'L', 'E'),
+ &fast_idle_extension, &extension_id);
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+ }
+#endif
+
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+}
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+/*
+ * Function: bsp_start
+ * Created: 94/12/6
+ *
+ * Description:
+ * called by crt0 as our "main" equivalent
+ *
+ *
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+
+void
+bsp_start(void)
+{
+ /*
+ * Set cpu_number to accurately reflect our cpu number
+ */
+
+#ifdef hppa7200
+ /*
+ * Use HPPA_DR0 if supported
+ */
+ {
+ int dr0;
+ HPPA_ASM_MFCPU(HPPA_DR0, dr0);
+ cpu_number = (dr0 >> 4) & 0x7;
+ }
+#else
+ if (Configuration.User_multiprocessing_table)
+ cpu_number = Configuration.User_multiprocessing_table->node - 1;
+ else
+ cpu_number = 0;
+#endif
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)MY_WORK_SPACE;
+ if (BSP_Configuration.work_space_size)
+ BSP_Configuration.work_space_size = WORKSPACE_SIZE;
+
+ /*
+ * Set up our hooks
+ * Make sure libc_init is done before drivers init'd so that
+ * they can use atexit()
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook; /* register drivers */
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ /*
+ * Don't zero out the workspace. The simulator did it for us.
+ */
+
+ Cpu_table.do_zero_of_workspace = FALSE;
+
+ Cpu_table.interrupt_stack_size = (12 * 1024);
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Set this artificially low for the simulator
+ */
+
+ Cpu_table.itimer_clicks_per_microsecond = 1;
+
+#ifdef 0
+ /*
+ * Commented by DIVISION INC. External interrupt
+ * processing is now divorced from RTEMS for HPPA.
+ */
+
+ /*
+ * Determine the external interrupt processing order
+ * the external interrupt handler walks thru this table, in
+ * order checking for posted interrupts.
+ */
+
+ Cpu_table.external_interrupts = 0;
+
+ Cpu_table.external_interrupt[ Cpu_table.external_interrupts ] =
+ HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER - HPPA_INTERRUPT_EXTERNAL_BASE;
+ Cpu_table.external_interrupts++;
+
+ if ( Configuration.User_multiprocessing_table ) {
+ Cpu_table.external_interrupt[ Cpu_table.external_interrupts ] =
+ HPPA_INTERRUPT_EXTERNAL_10 - HPPA_INTERRUPT_EXTERNAL_BASE;
+ Cpu_table.external_interrupts++;
+ }
+#endif
+
+ /*
+ * Add 1 region for RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+#ifdef RTEMS_NEWLIB
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Add 1 extension for stack checker
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+#if SIMHPPA_FAST_IDLE
+ /*
+ * Add 1 extension for fast idle
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Add 1 extension for MPCI_fatal
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ BSP_Configuration.maximum_extensions++;
+
+ /*
+ * Set the "clicks per tick" for the simulator
+ * used by libcpu/hppa/clock/clock.c to schedule interrupts
+ *
+ * Set it only if 0 to allow for simulator setting it via script
+ * on test startup.
+ */
+
+ if (CPU_HPPA_CLICKS_PER_TICK == 0)
+ CPU_HPPA_CLICKS_PER_TICK = 0x4000;
+
+ /*
+ * Start most of RTEMS
+ * main() will start the rest
+ */
+
+ bsp_isr_level = rtems_initialize_executive_early(
+ &BSP_Configuration,
+ &Cpu_table
+ );
+}
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/setvec.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/setvec.c
new file mode 100644
index 0000000000..9d2aa5de73
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/setvec.c
@@ -0,0 +1,66 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the HP PA-RISC simulator.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * NOTE 'type' is ignored on hppa; all interrupts are owned by RTEMS
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+/*
+ * Install an interrupt handler in the right place
+ * given its vector number from cpu/hppa.h
+ * There are 2 places an interrupt can be installed
+ * _ISR_Vector_table
+ * bsp interrupt XXX: nyi
+ *
+ * We decide which based on the vector number
+ */
+
+rtems_isr_entry
+set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ rtems_isr_entry previous_isr;
+
+ /* is it an on chip interrupt? */
+ /* XXX this should say CPU_INTERRUPT_NUMBER_OF_VECTORS */
+ if (vector < HPPA_INTERRUPT_MAX)
+ {
+ rtems_interrupt_catch(handler, vector, &previous_isr);
+ }
+#if 0 /* XXX */
+ else if ((vector >= HPPA_INTERRUPT_BSP_BASE) &&
+ (vector < (HPPA_INTERRUPT_BSP_BASE + HPPA_BSP_INTERRUPTS)))
+ {
+ pxfl_interrupt_install(handler,
+ vector - HPPA_INTERRUPT_BSP_BASE,
+ (rtems_isr_entry *) &previous_isr);
+ }
+#endif
+
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/times b/c/src/lib/libbsp/hppa1.1/simhppa/times
new file mode 100644
index 0000000000..272488a8c0
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/times
@@ -0,0 +1,7 @@
+#
+# Timing Test Suite Results for the PA-RISC Simulator.
+#
+# $Id$
+#
+
+Times are not available for the PA-RISC Simulator.
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/tools/print_dump.c b/c/src/lib/libbsp/hppa1.1/simhppa/tools/print_dump.c
new file mode 100644
index 0000000000..8b4313166a
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/tools/print_dump.c
@@ -0,0 +1,332 @@
+/*
+ * print_dump
+ *
+ * $Id$
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ */
+
+#define GETOPTARGS "v"
+
+char *USAGE = "\
+usage: print_dump [ -v ] \n\
+ -v -- verbose\n\
+ Reads HP simulator 'memdump' output of 'print_buffer' structure
+ on stdin. Dumps it out in vanilla ASCII.
+";
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define Failed(x) (((int) (x)) == -1)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+
+typedef union uval {
+ u8 uv_chars[4];
+ u16 uv_words[2];
+ u32 uv_long;
+ void *uv_ptr[sizeof(long) / sizeof(void *)];
+} uval_t;
+
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+void error(int errn, ...);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+int process(void);
+void prchar(unsigned int ch);
+
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ return process();
+}
+
+
+/*
+ * process(arg)
+ *
+ * Input looks like this
+ *
+ * Starting address: 00000001.480035a0
+ * -----------------------------------
+
++0000 / 0d0a0d0a 2a2a2a20 53454d20 54455354 202d2d20 4e4f4445 2032202a 2a2a0d0a
++0020 / 73703a20 30783433 30303030 31300d0a 30783438 30613161 38383a20 676f7420
+ ....
++0b40 / xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
+
+ *
+ * The 'xxxxxxxxx' shows up if the page has not been allocated.
+ */
+
+int
+process(void)
+{
+ uval_t b[8];
+ u32 ignore;
+ char *p;
+ int i;
+ int failed_once;
+
+ char line[1024];
+
+#define PRINT_BUFFER_SIZE (16 * 1024)
+ struct {
+ int index;
+ int size;
+ u8 buffer[PRINT_BUFFER_SIZE];
+ } print_buffer;
+
+ /* we stuff the data into print_buffer using memcpy() */
+ p = (char *) &print_buffer;
+
+ failed_once = 0;
+
+ while (gets(line))
+ {
+ char *cp;
+
+ /* hack; deal with the 'xxxxxxxx' problem noted above */
+ for (cp=line; *cp; cp++)
+ if (*cp == 'x')
+ *cp = '0';
+
+ if (*line != '+')
+ continue;
+ if (sscanf(line, "+%x / %x %x %x %x %x %x %x %x\n",
+ &ignore,
+ &b[0].uv_long,
+ &b[1].uv_long,
+ &b[2].uv_long,
+ &b[3].uv_long,
+ &b[4].uv_long,
+ &b[5].uv_long,
+ &b[6].uv_long,
+ &b[7].uv_long) != 9)
+ {
+ if (failed_once)
+ error(ERR_FATAL, "2nd format problem; giving up");
+ error(0, "format problem in line: `%s`", line);
+ failed_once = 1;
+ }
+
+ memcpy((void *) p, (void *) b, sizeof(b));
+ p += sizeof(b);
+ }
+
+ if (verbose)
+ printf("buffer size: %d\n", print_buffer.size);
+
+ if (print_buffer.size < 0)
+ error(ERR_FATAL, "size is too small");
+
+ if (print_buffer.size != sizeof(print_buffer.buffer))
+ {
+ error(ERR_FATAL, "buffer size mismatch, expected %d",
+ sizeof(print_buffer.buffer));
+ /* XXX we really should just dynamically allocate the buffer */
+ }
+
+ i = print_buffer.index + 1;
+ while (i != print_buffer.index)
+ {
+ unsigned int c;
+ c = print_buffer.buffer[i++];
+ if (c && (c != '\r'))
+ prchar(c);
+ i %= print_buffer.size;
+ }
+ printf("\n");
+ return 0;
+}
+
+/* de-controlify */
+char *de_control[] = {
+ "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
+ "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
+ "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
+ " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
+ ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";",
+ "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I",
+ "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
+ "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
+ "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
+ "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "^?",
+ "M-^@", "M-^A", "M-^B", "M-^C", "M-^D", "M-^E", "M-^F", "M-^G",
+ "M-^H", "M-^I", "M-^J", "M-^K", "M-^L", "M-^M", "M-^N", "M-^O",
+ "M-^P", "M-^Q", "M-^R", "M-^S", "M-^T", "M-^U", "M-^V", "M-^W",
+ "M-^X", "M-^Y", "M-^Z", "M-^[", "M-^\\", "M-^]", "M-^~", "M-^_",
+ "M- ", "M-!", "M-\"", "M-#", "M-$", "M-%", "M-&", "M-'",
+ "M-(", "M-)", "M-*", "M-+", "M-,", "M--", "M-.", "M-/",
+ "M-0", "M-1", "M-2", "M-3", "M-4", "M-5", "M-6", "M-7",
+ "M-8", "M-9", "M-:", "M-;", "M-<", "M-=", "M->", "M-?",
+ "M-@", "M-A", "M-B", "M-C", "M-D", "M-E", "M-F", "M-G",
+ "M-H", "M-I", "M-J", "M-K", "M-L", "M-M", "M-N", "M-O",
+ "M-P", "M-Q", "M-R", "M-S", "M-T", "M-U", "M-V", "M-W",
+ "M-X", "M-Y", "M-Z", "M-[", "M-\\", "M-]", "M-^", "M-_",
+ "M-`", "M-a", "M-b", "M-c", "M-d", "M-e", "M-f", "M-g",
+ "M-h", "M-i", "M-j", "M-k", "M-l", "M-m", "M-n", "M-o",
+ "M-p", "M-q", "M-r", "M-s", "M-t", "M-u", "M-v", "M-w",
+ "M-x", "M-y", "M-z", "M-{", "M-|", "M-}", "M-~", "M-^?"
+};
+
+/*
+ * prchar(ch); print ch in a readable format, ie ^X or X or ~^X or DEL, etc.
+ */
+
+void
+prchar(unsigned int ch)
+{
+ if (isprint(ch) || isspace(ch))
+ putchar(ch);
+ else
+ printf("%s", de_control[ch]);
+}
+
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_EXIT bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, local_errno ? "fatal error, exiting" : "exiting");
+ exit(local_errno);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/tty/tty.c b/c/src/lib/libbsp/hppa1.1/simhppa/tty/tty.c
new file mode 100644
index 0000000000..4a8c2757ec
--- /dev/null
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/tty/tty.c
@@ -0,0 +1,254 @@
+/*
+ * Tty IO Driver
+ * This is a "libio" driver based on libc/support/generic/libio interface
+ * which is on top of the RTEMS IO manager.
+ *
+ * These provide UNIX-like read and write calls for the C library.
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <errno.h>
+
+#define PRINT_BUFFER_SIZE (16 * 1024)
+
+/*
+ * NOTE: this structure is dumplicated in print_dump.c utility
+ */
+
+struct {
+ int index;
+ int size;
+ char buffer[PRINT_BUFFER_SIZE];
+} print_buffer;
+
+/* always use printf buffer if non-zero */
+int use_print_buffer;
+
+static int host_read_syscall(int fd, char *buffer, int count);
+static int host_write_syscall(int fd, char *buffer, int count);
+
+rtems_device_driver
+tty_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ rtems_status_code status;
+
+ status = rtems_io_register_name("/dev/tty00",
+ major,
+ (rtems_device_minor_number) 0);
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver
+tty_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver
+tty_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver
+tty_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+
+rtems_device_driver
+tty_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ rtems_libio_rw_args_t *rw_args;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ /*
+ * If we are printing to a buffer, then just return newline on all
+ * read's. If we return 0 bytes read, then the pause() calls in
+ * the RTEMS tests get hosed (pause() does a gets())
+ */
+
+ if ( use_print_buffer )
+ {
+ *rw_args->buffer = '\n';
+ count = 1;
+ }
+ else
+ {
+ count = host_read_syscall(0, rw_args->buffer, rw_args->count);
+ }
+
+ if (count >= 0)
+ {
+ rw_args->bytes_moved = count;
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_UNSATISFIED;
+}
+
+rtems_device_driver
+tty_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+ )
+{
+ unsigned32 level;
+ rtems_libio_rw_args_t *rw_args;
+ int count = 0;
+ int fd = 1; /* XXX fixme; needs to be saved in iop */
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ /*
+ * HACK alert
+ *
+ * Some of the simulators have real problems when multi cpu and
+ * using the system calls. Until this is fixed, if we are multi
+ * cpu then we write to a printf buffer
+ */
+
+ if ( use_print_buffer )
+ {
+ /* save size in memory for dumper */
+ if (print_buffer.size == 0)
+ print_buffer.size = PRINT_BUFFER_SIZE;
+
+ while (rw_args->count-- > 0)
+ {
+ rtems_interrupt_disable(level);
+ print_buffer.buffer[print_buffer.index] = *rw_args->buffer++;
+ print_buffer.index++;
+ print_buffer.index &= (PRINT_BUFFER_SIZE - 1);
+ print_buffer.buffer[print_buffer.index] = 0;
+ rtems_interrupt_enable(level);
+ count++;
+ }
+ }
+ else
+ {
+#if 1
+ /*
+ * if on a multi cpu system and writing to stdout, redirect to stderr
+ * so we can keep them separate
+ */
+
+ if ((cpu_number == 1) && (fd == 1))
+ fd = 2;
+#endif
+ count = host_write_syscall(fd, rw_args->buffer, rw_args->count);
+ }
+
+ if (count >= 0)
+ {
+ rw_args->bytes_moved = count;
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_UNSATISFIED;
+}
+
+
+/*
+ * Host system call hack.
+ * This little trick gets all the args in the right registers
+ * for the system call and permits simpler inline asm.
+ * Since this whole thing (syscalls under simulator) is a hack,
+ * this little bit more is not going to hurt anything.
+ */
+
+
+static int
+host_read_syscall(
+ int fd,
+ char *buffer,
+ int count
+ )
+{
+ unsigned32 level;
+ int rc;
+
+ rtems_interrupt_disable(level);
+
+ /* This is an HPUX system call, with return value copied out */
+ asm volatile (" stw %%r19,-28(0,%%r30)\n\
+ ldil L%%0xc0000000,%%r1\n\
+ ble 4(7,%%r1)\n\
+ ldi 3,%%r22\n\
+ ldw -28(0,%%r30),%%r19\n\
+ copy %%r28, %0"
+ : "=r" (rc)
+ : );
+
+ rtems_interrupt_enable(level);
+ return rc;
+}
+
+static int
+host_write_syscall(
+ int fd,
+ char *buffer,
+ int count
+ )
+{
+ unsigned32 level;
+ int rc;
+
+ rtems_interrupt_disable(level);
+
+ /* This is an HPUX system call, with return value copied out */
+ asm volatile (" stw %%r19,-28(0,%%r30)\n\
+ ldil L%%0xc0000000,%%r1\n\
+ ble 4(7,%%r1)\n\
+ ldi 4,%%r22\n\
+ ldw -28(0,%%r30),%%r19\n\
+ copy %%r28, %0"
+ : "=r" (rc)
+ : );
+
+ rtems_interrupt_enable(level);
+ return rc;
+}
+
diff --git a/c/src/lib/libbsp/i386/force386/clock/ckinit.c b/c/src/lib/libbsp/i386/force386/clock/ckinit.c
new file mode 100644
index 0000000000..9bfad8991a
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/clock/ckinit.c
@@ -0,0 +1,135 @@
+/* Clock_initialize
+ *
+ * This routine initializes the Motorola MFP 68901 on the
+ * FORCE CPU386 board. The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include <rtems/libio.h>
+
+#include <stdlib.h>
+
+#define CLOCK_VECTOR 0x38
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_major_number rtems_clock_minor = 0;
+
+/*
+ * This is the ISR handler.
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ /* enable_tracing(); */
+ Clock_driver_ticks += 1;
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ outport_byte( TBCR, 0x14 ); /* reset it, delay mode, 50X */
+ outport_byte( TBDR, 0x50 ); /* 1 millisecond */
+ outport_byte( IERA, 0x41 ); /* enable interrupt for B */
+ }
+ atexit( Clock_exit );
+}
+
+void Clock_exit( void )
+{
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ outport_byte( TBCR, 0x00 ); /* initial value */
+ outport_byte( IERA, 0x40 ); /* disable interrupt */
+ /* ??? Is "do not restore old vector" causing problems? */
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/i386/force386/console/console.c b/c/src/lib/libbsp/i386/force386/console/console.c
new file mode 100644
index 0000000000..f3932150bf
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/console/console.c
@@ -0,0 +1,286 @@
+/*
+ * This file contains the Force CPU386 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define F386_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <stdlib.h>
+
+/* console_cleanup
+ *
+ * This routine is called at exit to clean up the console hardware.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+void console_cleanup( void )
+{
+ register rtems_unsigned8 ignored;
+ /*
+ * FORCE technical support mentioned that it may be necessary to
+ * read the DUSCC RX_BUFFER port four times to remove all junk.
+ * This code is a little more paranoid.
+ */
+
+ inport_byte( RX_BUFFER, ignored );
+ inport_byte( RX_BUFFER, ignored );
+ inport_byte( RX_BUFFER, ignored );
+ inport_byte( RX_BUFFER, ignored );
+ inport_byte( RX_BUFFER, ignored );
+}
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ /*
+ * flush the console now and at exit. Just in case.
+ */
+
+ console_cleanup();
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ atexit( console_cleanup );
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ register rtems_unsigned8 status;
+
+ inport_byte( RX_STATUS, status );
+
+ if ( Is_rx_ready( status ) ) {
+ inport_byte( RX_BUFFER, status );
+ *ch = status;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the UART.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from UART
+ */
+
+char inbyte( void )
+{
+ register rtems_unsigned8 status;
+ char ch;
+
+ do {
+ inport_byte( RX_STATUS, status );
+ } while ( !Is_rx_ready( status ) );
+
+#if ( PORTB == 1 )
+ /*
+ * Force example code resets the Channel B Receiver here.
+ * It appears to cause XON's to be lost.
+ */
+
+ /* outport_byte( RX_STATUS, 0x10 ); */
+#endif
+
+ inport_byte( RX_BUFFER, ch );
+
+ return ch;
+}
+
+/* outbyte
+ *
+ * This routine transmits a character out the port. It supports
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ rtems_unsigned8 status;
+
+ do {
+ inport_byte( TX_STATUS, status );
+ } while ( !Is_tx_ready( status ) );
+
+#if 0
+ while ( is_character_ready( &status ) == TRUE ) { /* must be an XOFF */
+ if ( status == XOFF )
+ do {
+ while ( is_character_ready( &status ) == FALSE ) ;
+ } while ( status != XON );
+ }
+#endif
+
+ outport_byte( TX_BUFFER, ch );
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/i386/force386/include/bsp.h b/c/src/lib/libbsp/i386/force386/include/bsp.h
new file mode 100644
index 0000000000..c6c553e454
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/include/bsp.h
@@ -0,0 +1,176 @@
+/* bsp.h
+ *
+ * This include file definitions related to the Force CPU-386 board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __FORCE386_h
+#define __FORCE386_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: Use a software interrupt for the i386.
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 )
+
+#define Cause_tm27_intr() asm volatile( "int $0x90" : : );
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( _microseconds ) \
+ { \
+ rtems_unsigned32 _counter; \
+ \
+ _counter = (_microseconds); \
+ \
+ asm volatile ( "0: nop;" \
+ " mov %0,%0 ;" \
+ " loop 0b" : "=c" (_counter) \
+ : "0" (_counter) \
+ ); \
+ \
+ }
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+/* I/O addressing */
+
+/*
+ * The following determines whether Port B or the Console should
+ * be used for test I/O. Setting ONE (and only ONE) of these to 1
+ * enables I/O on that port.
+ *
+ * PORT A - DUSCC MC68562 Channel A
+ * PORT B - DUSCC MC68562 Channel B
+ * PORT C - MFP MC68901 Channel (*** FORCEbug console ***)
+ */
+
+#define PORTB 1 /* use port b as test port */
+#define PORTC 0 /* use console port as test port */
+
+#if ( PORTB == 1 )
+#define TX_STATUS 0x1b6 /* DUSCC General Status Register */
+#define RX_STATUS 0x1b6 /* DUSCC General Status Register */
+#define TX_BUFFER 0x1e0 /* DUSCC Transmitter Channel B */
+#define RX_BUFFER 0x1e8 /* DUSCC Receiver Channel B */
+#define Is_tx_ready( _status ) ( (_status) & 0x20 )
+#define Is_rx_ready( _status ) ( (_status) & 0x10 )
+#endif
+
+#if ( PORTC == 1 )
+#define TX_STATUS 0x12c /* MFP Transmit Status Register */
+#define RX_STATUS 0x12a /* MFP Receive Status Register */
+#define TX_BUFFER 0x12e /* MFP Transmitter Channel */
+#define RX_BUFFER 0x12e /* MFP Receiver Channel */
+#define Is_tx_ready( _status ) ( (_status) & 0x80 )
+#define Is_rx_ready( _status ) ( (_status) & 0x80 )
+#endif
+
+/* Timer constants */
+
+#define IERA 0x106 /* Interrupt Enable Register A */
+#define IMRA 0x112 /* Interrupt Mask Register A */
+#define TACR 0x118 /* Timer A Control Register */
+#define TADR 0x11e /* Timer A Data Register */
+
+#define IERB 0x108 /* Interrupt Enable Register B */
+#define TBCR 0x11a /* Timer B Control Register */
+#define TBDR 0x120 /* Timer B Data Register */
+
+/* Structures */
+
+#ifdef F386_INIT
+#undef BSP_EXTERN
+#define BSP_EXTERN
+#else
+#undef BSP_EXTERN
+#define BSP_EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern i386_IDT_slot Interrupt_descriptor_table[ 256 ];
+extern i386_GDT_slot Global_descriptor_table[ 8192 ];
+
+BSP_EXTERN unsigned short Idt[3]; /* Interrupt Descriptor Table Address */
+BSP_EXTERN unsigned short Gdt[3]; /* Global Descriptor Table Address */
+BSP_EXTERN unsigned int Idt_base;
+BSP_EXTERN unsigned int Gdt_base;
+
+/* routines */
+
+i386_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i386/force386/include/coverhd.h b/c/src/lib/libbsp/i386/force386/include/coverhd.h
new file mode 100644
index 0000000000..7ec7cb2ebc
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 3
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 3
+#define CALLING_OVERHEAD_TASK_CREATE 4
+#define CALLING_OVERHEAD_TASK_IDENT 4
+#define CALLING_OVERHEAD_TASK_START 4
+#define CALLING_OVERHEAD_TASK_RESTART 3
+#define CALLING_OVERHEAD_TASK_DELETE 3
+#define CALLING_OVERHEAD_TASK_SUSPEND 3
+#define CALLING_OVERHEAD_TASK_RESUME 3
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 4
+#define CALLING_OVERHEAD_TASK_MODE 4
+#define CALLING_OVERHEAD_TASK_GET_NOTE 4
+#define CALLING_OVERHEAD_TASK_SET_NOTE 4
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 7
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 3
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 4
+#define CALLING_OVERHEAD_CLOCK_GET 7
+#define CALLING_OVERHEAD_CLOCK_SET 7
+#define CALLING_OVERHEAD_CLOCK_TICK 2
+
+#define CALLING_OVERHEAD_TIMER_CREATE 3
+#define CALLING_OVERHEAD_TIMER_IDENT 3
+#define CALLING_OVERHEAD_TIMER_DELETE 3
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 4
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 8
+#define CALLING_OVERHEAD_TIMER_RESET 3
+#define CALLING_OVERHEAD_TIMER_CANCEL 3
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 4
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 3
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 4
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 4
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 4
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 4
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 4
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 4
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 3
+
+#define CALLING_OVERHEAD_EVENT_SEND 4
+#define CALLING_OVERHEAD_EVENT_RECEIVE 4
+#define CALLING_OVERHEAD_SIGNAL_CATCH 3
+#define CALLING_OVERHEAD_SIGNAL_SEND 3
+#define CALLING_OVERHEAD_PARTITION_CREATE 4
+#define CALLING_OVERHEAD_PARTITION_IDENT 4
+#define CALLING_OVERHEAD_PARTITION_DELETE 3
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 4
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 4
+#define CALLING_OVERHEAD_REGION_CREATE 4
+#define CALLING_OVERHEAD_REGION_IDENT 3
+#define CALLING_OVERHEAD_REGION_DELETE 3
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 4
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 4
+#define CALLING_OVERHEAD_PORT_CREATE 4
+#define CALLING_OVERHEAD_PORT_IDENT 3
+#define CALLING_OVERHEAD_PORT_DELETE 3
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 4
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 4
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 4
+#define CALLING_OVERHEAD_IO_OPEN 4
+#define CALLING_OVERHEAD_IO_CLOSE 4
+#define CALLING_OVERHEAD_IO_READ 4
+#define CALLING_OVERHEAD_IO_WRITE 4
+#define CALLING_OVERHEAD_IO_CONTROL 4
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 3
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 3
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 3
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 3
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 3
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 3
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i386/force386/shmsupp/addrconv.c b/c/src/lib/libbsp/i386/force386/shmsupp/addrconv.c
new file mode 100644
index 0000000000..49d27200a0
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/shmsupp/addrconv.c
@@ -0,0 +1,32 @@
+/* Shm_Convert_address
+ *
+ * The CPU386 has a "normal" view of the VME address space.
+ * No address range conversion is required.
+ *
+ * Input parameters:
+ * address - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+void *Shm_Convert_address(
+ void *address
+)
+{
+ return ( address );
+}
diff --git a/c/src/lib/libbsp/i386/force386/shmsupp/getcfg.c b/c/src/lib/libbsp/i386/force386/shmsupp/getcfg.c
new file mode 100644
index 0000000000..8a05cdf641
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/shmsupp/getcfg.c
@@ -0,0 +1,73 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the FORCE CPU-386
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+ * NOTES: The FORCE CPU-386 does not have an interprocessor interrupt.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED BIG 2+
+ * INTERRUPT **** NOT SUPPORTED ****
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <shm.h>
+#include <bsp.h>
+
+#define INTERRUPT 0
+#define POLLING 1 /* FORCE CPU-386 target is polling ONLY!!! */
+
+
+shm_config_table BSP_shm_cfgtbl;
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ set_segment( get_ds(), 0x00002000, 0xffffd000 );
+
+ BSP_shm_cfgtbl.base = i386_Physical_to_logical(
+ get_ds(),
+ (void *) 0x20000000
+ );
+
+ BSP_shm_cfgtbl.length = 1 * MEGABYTE;
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+
+ *shmcfg = &BSP_shm_cfgtbl;
+}
diff --git a/c/src/lib/libbsp/i386/force386/shmsupp/lock.c b/c/src/lib/libbsp/i386/force386/shmsupp/lock.c
new file mode 100644
index 0000000000..7e1b7874d1
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/shmsupp/lock.c
@@ -0,0 +1,83 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = LQ_UNLOCKED;
+}
+
+/* void _Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+ volatile rtems_unsigned32 *lockptr = &lq_cb->lock;
+ rtems_unsigned32 lock_value;
+
+ lock_value = SHM_LOCK_VALUE;
+ rtems_interrupt_disable( isr_level );
+
+ Shm_isrstat = isr_level;
+ while ( 1 ) {
+ asm volatile( "lock ; xchg (%0),%1"
+ : "=r" (lockptr), "=r" (lock_value)
+ : "0" (lockptr), "1" (lock_value)
+ );
+ if ( lock_value == SHM_UNLOCK_VALUE )
+ break;
+ delay( 10 ); /* approximately 10 microseconds */
+ }
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ lq_cb->lock = SHM_UNLOCK_VALUE;
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
+
diff --git a/c/src/lib/libbsp/i386/force386/shmsupp/mpisr.c b/c/src/lib/libbsp/i386/force386/shmsupp/mpisr.c
new file mode 100644
index 0000000000..dc6f8433e6
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/shmsupp/mpisr.c
@@ -0,0 +1,31 @@
+/* Shm_setvec
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * NOTE: This routine is not used by the FORCE CPU-386 because it
+ * only supports polling mode.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+void Shm_setvec()
+{
+ /* NOT USED ON FORCE CPU-386!!! */
+}
diff --git a/c/src/lib/libbsp/i386/force386/startup/bspstart.c b/c/src/lib/libbsp/i386/force386/startup/bspstart.c
new file mode 100644
index 0000000000..d2349f9fc7
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/startup/bspstart.c
@@ -0,0 +1,225 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * FORCE documentation incorrectly states that the bus request
+ * level is initialized to 3. It is actually initialized by
+ * FORCEbug to 0.
+ */
+
+ outport_byte( 0x00, 0x3f ); /* resets VMEbus request level */
+
+ /*
+ * we do not use the pretasking_hook.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_table_segment = get_ds();
+
+ Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ RAM_END - BSP_Configuration.work_space_size;
+
+ /*
+ * Add 1 region for Malloc in libc_low
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+ /* no cleanup necessary for Force CPU-386 */
+ return 0;
+}
diff --git a/c/src/lib/libbsp/i386/force386/startup/exit.c b/c/src/lib/libbsp/i386/force386/startup/exit.c
new file mode 100644
index 0000000000..717972cec0
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/startup/exit.c
@@ -0,0 +1,29 @@
+/*
+ * exit
+ *
+ * This routine returns control to FORCEbug.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <clockdrv.h>
+#include <iodrv.h>
+
+void _exit( )
+{
+ /* Clock or Timer cleanup is run by at_exit() */
+
+ Io_cleanup();
+
+ bsp_cleanup();
+}
diff --git a/c/src/lib/libbsp/i386/force386/startup/ldsegs.s b/c/src/lib/libbsp/i386/force386/startup/ldsegs.s
new file mode 100644
index 0000000000..0085e1d38a
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/startup/ldsegs.s
@@ -0,0 +1,86 @@
+/* _load_segments
+ *
+ * This file assists the board independent startup code by
+ * loading the proper segment register values. The values
+ * loaded are board dependent.
+ *
+ * NOTE: No stack has been established when this routine
+ * is invoked. It returns by jumping back to bspentry.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+
+/*
+ * FORCEBUG loads us into a virtual address space which
+ * really starts at PHYSICAL_ADDRESS_BASE.
+ */
+
+.set PHYSICAL_ADDRESS_BASE, 0x00002000
+
+/*
+ * At reset time, FORCEBUG normally has the segment selectors preloaded.
+ * If a human resets the instruction pointer, this will not have occurred.
+ * However, no guarantee can be made of the other registers if cs:ip was
+ * modified to restart the program. Because of this, the BSP reloads all
+ * segment registers (except cs) with the values they have following
+ * a reset.
+ */
+
+
+.set RESET_SS, 0x40 # initial value of stack segment register
+.set RESET_DS, 0x40 # initial value of data segment register
+.set RESET_ES, 0x40 # initial value of extra segment register
+.set RESET_FS, 0x40 # initial value of "f" segment register
+.set RESET_GS, 0x30 # initial value of "g" segment register
+
+
+#define LOAD_SEGMENTS(_value,_segment) \
+ movw $ ## _value, ax ; \
+ movw ax, _segment
+
+ EXTERN (establish_stack)
+
+ PUBLIC (_load_segments)
+SYM (_load_segments):
+ LOAD_SEGMENTS( RESET_SS, ss )
+ LOAD_SEGMENTS( RESET_DS, ds )
+ LOAD_SEGMENTS( RESET_ES, es )
+ LOAD_SEGMENTS( RESET_FS, fs )
+ LOAD_SEGMENTS( RESET_GS, gs )
+
+ jmp SYM (_establish_stack) # return to the bsp entry code
+
+ PUBLIC (_return_to_monitor)
+SYM (_return_to_monitor):
+
+ call SYM (Clock_exit)
+ movb $0,al
+ int $0x20 # restart FORCEbug
+ jmp SYM (start) # FORCEbug does not reset PC
+
+END_CODE
+
+BEGIN_DATA
+
+ PUBLIC (_Do_Load_IDT)
+SYM (_Do_Load_IDT):
+ .byte 1
+
+ PUBLIC (_Do_Load_GDT)
+SYM (_Do_Load_GDT):
+ .byte 0
+
+END_DATA
+END
diff --git a/c/src/lib/libbsp/i386/force386/startup/linkcmds b/c/src/lib/libbsp/i386/force386/startup/linkcmds
new file mode 100644
index 0000000000..a8e0877e56
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/startup/linkcmds
@@ -0,0 +1,44 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the FORCE CPU386 board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x0, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x0 :
+ {
+ _text_start = . ;
+ *(.text)
+ _etext = ALIGN( 0x10 ) ;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ _data_start = . ;
+ *(.data)
+ _edata = ALIGN( 0x10 ) ;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ __end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/i386/force386/startup/setvec.c b/c/src/lib/libbsp/i386/force386/startup/setvec.c
new file mode 100644
index 0000000000..e8195c0733
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/startup/setvec.c
@@ -0,0 +1,59 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the Force CPU-386.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+i386_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ i386_isr_entry previous_isr;
+ i386_IDT_slot idt;
+
+ if ( type )
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+ else {
+ /* get the address of the old handler */
+
+ idt = Interrupt_descriptor_table[ vector ];
+
+ previous_isr = (i386_isr_entry)
+ ((idt.offset_16_31 << 16) | idt.offset_0_15);
+
+ /* build the IDT entry */
+ idt.offset_0_15 = ((rtems_unsigned32) handler) & 0xffff;
+ idt.segment_selector = get_cs();
+ idt.reserved = 0x00;
+ idt.p_dpl = 0x8e; /* present, ISR */
+ idt.offset_16_31 = ((rtems_unsigned32) handler) >> 16;
+
+ /* install the IDT entry */
+ Interrupt_descriptor_table[ vector ] = idt;
+ }
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/i386/force386/timer/timer.c b/c/src/lib/libbsp/i386/force386/timer/timer.c
new file mode 100644
index 0000000000..1896e15a23
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/timer/timer.c
@@ -0,0 +1,96 @@
+/* Timer_init()
+ *
+ * This routine initializes the timer on the FORCE CPU-386 board.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: This routine will not work if the optimizer is enabled
+ * for some compilers. The multiple writes to the Z8036
+ * may be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+#include <bsp.h>
+
+int Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+
+ (void) set_vector( timerisr, 0x38, 0 ); /* install ISR */
+
+ Ttimer_val = 0; /* clear timer ISR count */
+
+ outport_byte( IERA, 0x40 ); /* disable interrupt */
+ outport_byte( TBCR, 0x40 ); /* stop the timer */
+ outport_byte( TBDR, 250 ); /* 250 units */
+
+ outport_byte( TBCR, 0x11 ); /* reset it, delay mode, 4X */
+#if 0
+ outport_byte( TBCR, 0x13 ); /* reset it, delay mode, 16X */
+#endif
+
+ outport_byte( IERA, 0x41 ); /* enable interrupt */
+
+}
+
+#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
+ /* (3 ticks) to start/stop the timer. */
+#define LEAST_VALID 4 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ register rtems_unsigned32 clicks;
+ register rtems_unsigned32 total;
+
+ outport_byte( TBCR, 0x00 ); /* stop the timer */
+
+ inport_byte( TBDR, clicks );
+
+ total = Ttimer_val + 250 - clicks;
+
+ outport_byte( TBCR, 0x00 ); /* initial value */
+ outport_byte( IERA, 0x40 ); /* disable interrupt */
+
+ /* ??? Is "do not restore old vector" causing problems? */
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in one microsecond units */
+
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ return (total - AVG_OVERHEAD);
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/i386/force386/timer/timerisr.s b/c/src/lib/libbsp/i386/force386/timer/timerisr.s
new file mode 100644
index 0000000000..bda3056ade
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/timer/timerisr.s
@@ -0,0 +1,34 @@
+/* timer_isr()
+ *
+ * This routine provides the ISR for the Z8036 timer on the MVME136
+ * board. The timer is set up to generate an interrupt at maximum
+ * intervals.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+ BEGIN_CODE
+
+ EXTERN (Ttimer_val)
+
+ PUBLIC (timerisr)
+SYM (timerisr):
+ addl $250, SYM (Ttimer_val) # another 250 microseconds
+ iret
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/i386/force386/times b/c/src/lib/libbsp/i386/force386/times
new file mode 100644
index 0000000000..123a668d83
--- /dev/null
+++ b/c/src/lib/libbsp/i386/force386/times
@@ -0,0 +1,191 @@
+#
+# Timing Test Suite Results for the Force CPU386 BSP
+#
+# $Id$
+#
+
+Board: Force CPU-386
+CPU: i386/DX + i387
+Clock Speed: 16 Mhz
+Memory Configuration: DRAM, no cache
+Wait States: 0 wait states
+
+Times Reported in: microseconds
+Timer Source: count-down timer provided by a Motorola MC68901
+
+Column A: 3.5.1 pre-release
+Column B: 3.5.1
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 73 72
+ rtems_semaphore_delete 69 70
+ rtems_semaphore_obtain: available 50
+ rtems_semaphore_obtain: not available -- NO_WAIT 50
+ rtems_semaphore_release: no waiting tasks 55
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 126 127
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 104 103
+
+ 4 rtems_task_restart: blocked task -- preempts caller 164 165
+ rtems_task_restart: ready task -- preempts caller 158
+ rtems_semaphore_release: task readied -- returns to caller 79
+ rtems_task_create 164 167
+ rtems_task_start 93
+ rtems_task_restart: suspended task -- returns to caller 109
+ rtems_task_delete: suspended task 154 156
+ rtems_task_restart: ready task -- returns to caller 111
+ rtems_task_restart: blocked task -- returns to caller 144 145
+ rtems_task_delete: blocked task 162 163
+
+ 5 rtems_task_suspend: calling task 87
+ rtems_task_resume: task readied -- preempts caller 79
+
+ 6 rtems_task_restart: calling task 121
+ rtems_task_suspend: returns to caller 54
+ rtems_task_resume: task readied -- returns to caller 54
+ rtems_task_delete: ready task 164
+
+ 7 rtems_task_restart: suspended task -- preempts caller 151 152
+
+ 8 rtems_task_set_priority: obtain current priority 40
+ rtems_task_set_priority: returns to caller 75
+ rtems_task_mode: obtain current mode 20
+ rtems_task_mode: no reschedule 22
+ rtems_task_mode: reschedule -- returns to caller 27
+ rtems_task_mode: reschedule -- preempts caller 74
+ rtems_task_set_note 41
+ rtems_task_get_note 42
+ rtems_clock_set 95
+ rtems_clock_get 88
+
+ 9 rtems_message_queue_create 304 303
+ rtems_message_queue_send: no waiting tasks 124
+ rtems_message_queue_urgent: no waiting tasks 123 124
+ rtems_message_queue_receive: available 101 102
+ rtems_message_queue_flush: no messages flushed 38
+ rtems_message_queue_flush: messages flushed 50 49
+ rtems_message_queue_delete 88 89
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 54
+ rtems_message_queue_receive: not available -- caller blocks 131
+
+11 rtems_message_queue_send: task readied -- preempts caller 152
+
+12 rtems_message_queue_send: task readied -- returns to caller 126 127
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 152 151
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 126
+
+15 rtems_event_receive: obtain current events 0
+ rtems_event_receive: not available -- NO_WAIT 37
+ rtems_event_receive: not available -- caller blocks 102 101
+ rtems_event_send: no task readied 37
+ rtems_event_receive: available 39 40
+ rtems_event_send: task readied -- returns to caller 68 69
+
+16 rtems_event_send: task readied -- preempts caller 96 97
+
+17 rtems_task_set_priority: preempts caller 119 118
+
+18 rtems_task_delete: calling task 192
+
+19 rtems_signal_catch 23
+ rtems_signal_send: returns to caller 43
+ rtems_signal_send: signal to self 57
+ exit ASR overhead: returns to calling task 39
+ exit ASR overhead: returns to preempting task 70
+
+20 rtems_partition_create 96 92
+ rtems_region_create 78 77
+ rtems_partition_get_buffer: available 42
+ rtems_partition_get_buffer: not available 42
+ rtems_partition_return_buffer 49
+ rtems_partition_delete 50
+ rtems_region_get_segment: available 57 58
+ rtems_region_get_segment: not available -- NO_WAIT 54
+ rtems_region_return_segment: no waiting tasks 62 61
+ rtems_region_get_segment: not available -- caller blocks 131 132
+ rtems_region_return_segment: task readied -- preempts caller 147 146
+ rtems_region_return_segment: task readied -- returns to caller 123 122
+ rtems_region_delete 48
+ rtems_io_initialize 4
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 671
+ rtems_message_queue_ident 656
+ rtems_semaphore_ident 699
+ rtems_partition_ident 655
+ rtems_region_ident 670
+ rtems_port_ident 657
+ rtems_timer_ident 658
+ rtems_rate_monotonic_ident 659
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 129
+ rtems_message_queue_broadcast: no waiting tasks 61 62
+ rtems_message_queue_broadcast: task readied -- preempts caller 155 154
+
+23 rtems_timer_create 45
+ rtems_timer_fire_after: inactive 70
+ rtems_timer_fire_after: active 75
+ rtems_timer_cancel: active 45
+ rtems_timer_cancel: inactive 41
+ rtems_timer_reset: inactive 65
+ rtems_timer_reset: active 69
+ rtems_timer_fire_when: inactive 100
+ rtems_timer_fire_when: active 100
+ rtems_timer_delete: active 60
+ rtems_timer_delete: inactive 56
+ rtems_task_wake_when 132
+
+24 rtems_task_wake_after: yield -- returns to caller 29
+ rtems_task_wake_after: yields -- preempts caller 71
+
+25 rtems_clock_tick 14
+
+26 _ISR_Disable 2
+ _ISR_Flash 2
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 1
+ _Thread_Enable_dispatch 22
+ _Thread_Set_state 25
+ _Thread_Disptach (NO FP) 55
+ context switch: no floating point contexts 42
+ context switch: self 8
+ context switch: to another task 10
+ context switch: restore 1st FP task 65
+ fp context switch: save idle, restore idle 93
+ fp context switch: save idle, restore initialized 60
+ fp context switch: save initialized, restore initialized 60
+ _Thread_Resume 19
+ _Thread_Unblock 19
+ _Thread_Ready 22
+ _Thread_Get 14
+ _Semaphore_Get 11
+ _Thread_Get: invalid id 3
+
+27 interrupt entry overhead: returns to interrupted task 13 12
+ interrupt exit overhead: returns to interrupted task 11
+ interrupt entry overhead: returns to nested interrupt 12
+ interrupt exit overhead: returns to nested interrupt 10
+ interrupt entry overhead: returns to preempting task 12
+ interrupt exit overhead: returns to preempting task 65
+
+28 rtems_port_create 48
+ rtems_port_external_to_internal 36
+ rtems_port_internal_to_external 36
+ rtems_port_delete 48
+
+29 rtems_rate_monotonic_create 47
+ rtems_rate_monotonic_period: initiate period -- returns to caller 60
+ rtems_rate_monotonic_period: obtain status 38
+ rtems_rate_monotonic_cancel 48
+ rtems_rate_monotonic_delete: inactive 57
+ rtems_rate_monotonic_delete: active 61
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 88
diff --git a/c/src/lib/libbsp/i386/go32/clock/ckinit.c b/c/src/lib/libbsp/i386/go32/clock/ckinit.c
new file mode 100644
index 0000000000..70c564fabc
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/clock/ckinit.c
@@ -0,0 +1,199 @@
+/* Clock_initialize
+ *
+ * This routine initializes the 8254 timer under GO32.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <stdlib.h>
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+rtems_unsigned32 Clock_isrs_per_tick; /* ISRs per tick */
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+rtems_isr_entry Old_ticker;
+
+#define CLOCK_VECTOR 0x8
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ /* touch interrupt controller for irq0 (0x20+0) */
+ outport_byte( 0x20, 0x20 );
+
+ Clock_driver_ticks += 1;
+
+#if 0 && defined(pentium)
+ {
+ extern long long Last_RDTSC;
+ __asm __volatile( ".byte 0x0F, 0x31" : "=A" (Last_RDTSC) );
+ }
+#endif
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = Clock_isrs_per_tick;
+ } else {
+ Clock_isrs -= 1;
+ }
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ unsigned int microseconds_per_isr;
+
+#if 0
+ /* Initialize clock from on-board real time clock. This breaks the */
+ /* test code which assumes which assumes the application will do it. */
+ {
+ rtems_time_of_day Now;
+ extern void init_rtc( void );
+ extern long rtc_read( rtems_time_of_day * tod );
+ init_rtc();
+ if ( rtc_read( &Now ) >= 0 )
+ clock_set( &Now );
+ }
+#endif
+
+ /* Start by assuming hardware counter is large enough, then */
+ /* scale it until it actually fits. */
+ Clock_driver_ticks = 0;
+ Clock_isrs_per_tick = 1;
+
+ if ( BSP_Configuration.microseconds_per_tick == 0 )
+ microseconds_per_isr = 10000; /* default 10 ms */
+ else
+ microseconds_per_isr = BSP_Configuration.microseconds_per_tick;
+ while ( US_TO_TICK(microseconds_per_isr) > 65535 ) {
+ Clock_isrs_per_tick *= 10;
+ microseconds_per_isr /= 10;
+ }
+
+ /* Initialize count in ckisr.c */
+ Clock_isrs = Clock_isrs_per_tick;
+
+#if 0
+ /* This was dropped in the last revision. Its a nice thing to know. */
+ TICKS_PER_SECOND = 1000000 / (Clock_isrs_per_tick * microseconds_per_isr);
+#endif
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ /* 105/88 approximates TIMER_TICK*1e-6 */
+ unsigned int count = US_TO_TICK( microseconds_per_isr );
+
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+ outport_byte( TIMER_CNTR0, count >> 0 & 0xff );
+ outport_byte( TIMER_CNTR0, count >> 8 & 0xff );
+ }
+ atexit( Clock_exit );
+}
+
+void Clock_exit( void )
+{
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ extern void rtc_set_dos_date( void );
+
+ /* reset to DOS value: */
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+ outport_byte( TIMER_CNTR0, 0 );
+ outport_byte( TIMER_CNTR0, 0 );
+
+ /* reset time-of-day */
+ rtc_set_dos_date();
+
+ /* re-enable old handler: assume it was one of ours */
+ set_vector( (rtems_isr_entry)Old_ticker, CLOCK_VECTOR, 1 );
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
+#if 0 && defined(pentium)
+/* This can be used to get extremely accurate timing on a pentium. */
+/* It isn't supported. [bryce] */
+#define HZ 90.0
+volatile long long Last_RDTSC;
+#define RDTSC()\
+ ({ long long _now; __asm __volatile (".byte 0x0F,0x31":"=A"(_now)); _now; })
+
+long long Kernel_Time_ns( void )
+{
+ extern rtems_unsigned32 _TOD_Ticks_per_second;
+ unsigned isrs_per_second = Clock_isrs_per_tick * _TOD_Ticks_per_second;
+ long long now;
+ int flags;
+ disable_intr( flags );
+ now = 1e9 * Clock_driver_ticks / isrs_per_second
+ + (RDTSC() - Last_RDTSC) * (1000.0/HZ);
+ enable_intr( flags );
+ return now;
+}
+#endif
diff --git a/c/src/lib/libbsp/i386/go32/clock/rtc.c b/c/src/lib/libbsp/i386/go32/clock/rtc.c
new file mode 100644
index 0000000000..38e9497000
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/clock/rtc.c
@@ -0,0 +1,212 @@
+/*
+ * $Id$
+ */
+
+#define IO_RTC 0x70 /* RTC */
+
+#define RTC_SEC 0x00 /* seconds */
+#define RTC_SECALRM 0x01 /* seconds alarm */
+#define RTC_MIN 0x02 /* minutes */
+#define RTC_MINALRM 0x03 /* minutes alarm */
+#define RTC_HRS 0x04 /* hours */
+#define RTC_HRSALRM 0x05 /* hours alarm */
+#define RTC_WDAY 0x06 /* week day */
+#define RTC_DAY 0x07 /* day of month */
+#define RTC_MONTH 0x08 /* month of year */
+#define RTC_YEAR 0x09 /* month of year */
+#define RTC_STATUSA 0x0a /* status register A */
+#define RTCSA_TUP 0x80 /* time update, don't look now */
+
+#define RTC_STATUSB 0x0b /* status register B */
+
+#define RTC_INTR 0x0c /* status register C (R) interrupt source */
+#define RTCIR_UPDATE 0x10 /* update intr */
+#define RTCIR_ALARM 0x20 /* alarm intr */
+#define RTCIR_PERIOD 0x40 /* periodic intr */
+#define RTCIR_INT 0x80 /* interrupt output signal */
+
+#define RTC_STATUSD 0x0d /* status register D (R) Lost Power */
+#define RTCSD_PWR 0x80 /* clock lost power */
+
+#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
+#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
+
+#define RTC_CENTURY 0x32 /* current century - increment in Dec99 */
+
+
+
+#include <rtems.h>
+#include <string.h>
+
+void init_rtc( void )
+{
+ int s;
+
+ /* initialize brain-dead battery powered clock */
+ outport_byte( IO_RTC, RTC_STATUSA );
+ outport_byte( IO_RTC+1, 0x26 );
+ outport_byte( IO_RTC, RTC_STATUSB );
+ outport_byte( IO_RTC+1, 2 );
+
+ outport_byte( IO_RTC, RTC_DIAG );
+ inport_byte( IO_RTC+1, s );
+#if 0
+ if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
+#endif
+}
+
+
+/* convert 2 digit BCD number */
+static int bcd( unsigned int i )
+{
+ return ((i/16)*10 + (i%16));
+}
+
+/* convert years to seconds (from 1970) */
+static unsigned long ytos( int y )
+{
+ int i;
+ unsigned long ret;
+
+ ret = 0;
+ for(i = 1970; i < y; i++) {
+ if (i % 4) ret += 365*24*60*60;
+ else ret += 366*24*60*60;
+ }
+ return ret;
+}
+
+/* convert months to seconds */
+static unsigned long mtos( int m, int leap )
+{
+ int i;
+ unsigned long ret;
+
+ ret = 0;
+ for(i=1;i<m;i++) {
+ switch(i){
+ case 1: case 3: case 5: case 7: case 8: case 10: case 12:
+ ret += 31*24*60*60;
+ break;
+ case 4: case 6: case 9: case 11:
+ ret += 30*24*60*60;
+ break;
+ case 2:
+ if (leap)
+ ret += 29*24*60*60;
+ else
+ ret += 28*24*60*60;
+ }
+ }
+ return ret;
+}
+
+
+static inline unsigned int rtcin( unsigned int what )
+{
+ unsigned int r;
+ outport_byte( IO_RTC, what );
+ inport_byte( IO_RTC+1, r );
+ return r;
+}
+
+
+/*
+ * Initialize the time of day register, based on the time base which is, e.g.
+ * from a filesystem.
+ */
+long rtc_read( rtems_time_of_day * tod )
+{
+ int sa;
+ unsigned long sec = 0;
+
+ memset( tod, 0, sizeof *tod );
+
+ /* do we have a realtime clock present? (otherwise we loop below) */
+ sa = rtcin(RTC_STATUSA);
+ if (sa == 0xff || sa == 0)
+ return -1;
+
+ /* ready for a read? */
+ while ((sa&RTCSA_TUP) == RTCSA_TUP)
+ sa = rtcin(RTC_STATUSA);
+
+ tod->year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
+ if (tod->year < 1970) tod->year += 100;
+ tod->month = bcd(rtcin(RTC_MONTH)); /* month */
+ tod->day = bcd(rtcin(RTC_DAY)); /* day */
+ (void) bcd(rtcin(RTC_WDAY)); /* weekday */
+ tod->hour = bcd(rtcin(RTC_HRS)); /* hour */
+ tod->minute = bcd(rtcin(RTC_MIN)); /* minutes */
+ tod->second = bcd(rtcin(RTC_SEC)); /* seconds */
+ tod->ticks = 0;
+#if 0
+ sec = ytos( tod->year );
+ sec += mtos( tod->month, tod->year % 4 == 0 );
+ sec += tod->day * 24*60*60;
+ sec += tod->hour * 60*60; /* hour */
+ sec += tod->minute * 60; /* minutes */
+ sec += tod->second; /* seconds */
+#else
+ sec = 0;
+#endif
+ return sec;
+}
+
+
+
+/* from djgpp: include before rtems.h to avoid conflicts */
+#undef delay
+#include <dos.h>
+
+void rtc_set_dos_date( void )
+{
+ int s;
+ struct date date;
+ struct time time;
+
+ /* initialize brain-dead battery powered clock */
+ outport_byte( IO_RTC, RTC_STATUSA );
+ outport_byte( IO_RTC+1, 0x26 );
+ outport_byte( IO_RTC, RTC_STATUSB );
+ outport_byte( IO_RTC+1, 2 );
+
+ outport_byte( IO_RTC, RTC_DIAG );
+ inport_byte( IO_RTC+1, s );
+ if (s) {
+#if 0
+ printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
+#else
+ return;
+#endif
+ }
+
+ /* check for presence of clock */
+ s = rtcin(RTC_STATUSA);
+ if ( s == 0xff || s == 0 ) {
+#if 0
+ printf( "Real-time clock not found\n" );
+#endif
+ return;
+ }
+
+ /* ready for a read? */
+ while ((s & RTCSA_TUP) == RTCSA_TUP)
+ s = rtcin(RTC_STATUSA);
+
+ date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
+ if ( date.da_year < 1970) date.da_year += 100;
+ date.da_year -= 1980;
+ date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
+ date.da_day = bcd(rtcin(RTC_DAY)); /* day */
+
+ (void)bcd(rtcin(RTC_WDAY)); /* weekday */
+
+ time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
+ time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
+ time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
+ time.ti_hund = 0;
+
+ setdate( & date );
+ settime( & time );
+}
diff --git a/c/src/lib/libbsp/i386/go32/console/console.c b/c/src/lib/libbsp/i386/go32/console/console.c
new file mode 100644
index 0000000000..0649326846
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/console/console.c
@@ -0,0 +1,257 @@
+/*
+ * This file contains the go32 console IO package.
+ *
+ * $Id$
+ */
+
+#define IBMPC_INIT
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <dpmi.h>
+#include <go32.h>
+
+/* console_cleanup
+ *
+ * This routine is called at exit to clean up the console hardware.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+void console_cleanup( void )
+{
+ /* nothing */
+}
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+/* Set this if console I/O should use go32 (DOS) read/write calls. */
+/* Otherwise, direct hardware accesses will be used. */
+
+int _IBMPC_Use_Go32_IO = 0;
+
+static rtems_isr_entry old_keyboard_isr = NULL;
+
+extern void _IBMPC_keyboard_isr( rtems_unsigned32 interrupt );
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ if ( _IBMPC_Use_Go32_IO ) {
+ /* Nothing. We let DOS and go32 do all the work. */
+ } else {
+ /* Grap the keyboard interrupt so DOS doesn't steal our */
+ /* keystrokes. */
+ rtems_status_code status;
+
+ status =
+ rtems_interrupt_catch( _IBMPC_keyboard_isr, 9, &old_keyboard_isr );
+
+ if ( status ) {
+ int write( int, void *, int );
+ void exit( int );
+
+ char msg[] = "error initializing keyboard\n";
+ write( 2, msg, sizeof msg - 1 );
+ exit( 1 );
+ }
+ }
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ atexit( console_cleanup );
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ return _IBMPC_chrdy( ch ) ? TRUE : FALSE;
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the UART.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from UART
+ */
+
+char inbyte( void )
+{
+ char ch = _IBMPC_inch();
+#if 1
+ /* Echo character to screen */
+ void outbyte( char ch );
+ outbyte( ch );
+ if ( ch == '\r' )
+ outbyte( '\n' );
+#endif
+ return ch;
+}
+
+/* outbyte
+ *
+ * This routine transmits a character out the port.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte( char ch )
+{
+ _IBMPC_outch( ch );
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ /* What if this goes past the end of the buffer? We're hosed. [bhc] */
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/i386/go32/console/inch.c b/c/src/lib/libbsp/i386/go32/console/inch.c
new file mode 100644
index 0000000000..e3bbbd7105
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/console/inch.c
@@ -0,0 +1,162 @@
+/*
+ * $Id$
+ */
+
+#include <pc.h>
+#include <go32.h>
+#include <bsp.h>
+
+/*
+ * Ports for PC keyboard
+ */
+#define KBD_CTL 0x61
+#define KBD_DATA 0x60
+#define KBD_STATUS 0x64
+
+static char key_map[] = {
+0,033,'1','2','3','4','5','6','7','8','9','0','-','=','\b','\t',
+'q','w','e','r','t','y','u','i','o','p','[',']',015,0x80,
+'a','s','d','f','g','h','j','k','l',';',047,0140,0x80,
+0134,'z','x','c','v','b','n','m',',','.','/',0x80,
+'*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,'0',0177
+};
+
+static char shift_map[] = {
+0,033,'!','@','#','$','%','^','&','*','(',')','_','+','\b','\t',
+'Q','W','E','R','T','Y','U','I','O','P','{','}',015,0x80,
+'A','S','D','F','G','H','J','K','L',':',042,'~',0x80,
+'|','Z','X','C','V','B','N','M','<','>','?',0x80,
+'*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,'7','8','9',0x80,'4','5','6',0x80,
+'1','2','3','0',177
+};
+
+extern int _IBMPC_Use_Go32_IO;
+
+#define KBD_BUF_SIZE 256
+static char kbd_buffer[ KBD_BUF_SIZE ];
+static unsigned int kbd_first = 0;
+static unsigned int kbd_last = 0;
+
+/* This function can be called during a poll for input, or by an ISR. */
+/* Basically any time you want to process a keypress. */
+int _IBMPC_scankey( char * ch )
+{
+ unsigned char c;
+ unsigned char outch;
+ static int shift_pressed = 0;
+ static int ctrl_pressed = 0;
+ static int caps_pressed = 0;
+
+ /* Read keyboard controller, toggle enable */
+ inport_byte( KBD_CTL, c );
+ outport_byte( KBD_CTL, c & ~0x80 );
+ outport_byte( KBD_CTL, c | 0x80 );
+ outport_byte( KBD_CTL, c & ~0x80 );
+
+ /* See if it has data */
+ inport_byte( KBD_STATUS, c );
+ if ( ( c & 0x01 ) == 0 )
+ return 0;
+
+ /* Read the data. Handle nonsense with shift, control, etc. */
+ inport_byte( KBD_DATA, c );
+ switch ( c ) {
+ case 0x36:
+ case 0x2a:
+ shift_pressed = 1;
+ return 0;
+ case 0x3a:
+ caps_pressed = 1;
+ return 0;
+ case 0x1d:
+ ctrl_pressed = 1;
+ return 0;
+ case 0xb6:
+ case 0xaa:
+ shift_pressed = 0;
+ return 0;
+ case 0xba:
+ caps_pressed = 0;
+ return 0;
+ case 0x9d:
+ ctrl_pressed = 0;
+ return 0;
+ /*
+ * Ignore unrecognized keys--usually arrow and such
+ */
+ default:
+ if ( c & 0x80 )
+ /* High-bit on means key is being released, not pressed */
+ return 0;
+ if ( c == 88 )
+ /* F12 - abort */
+ exit( 1 );
+ if ( c > 0x39 ) {
+ return 0;
+ }
+ }
+
+ /* Strip high bit, look up in our map */
+ c &= 127;
+ if ( ctrl_pressed ) {
+ outch = key_map[c];
+ outch &= 037;
+ } else {
+ outch = shift_pressed ? shift_map[c] : key_map[c];
+ if ( caps_pressed ) {
+ if ( outch >= 'A' && outch <= 'Z' ) outch += 'a' - 'A';
+ else if ( outch >= 'a' && outch <= 'z' ) outch -= 'a' - 'A';
+ }
+ }
+
+ *ch = outch;
+ return 1;
+}
+
+
+void _IBMPC_keyboard_isr( rtems_unsigned32 interrupt )
+{
+ if ( _IBMPC_scankey( & kbd_buffer[ kbd_last ] ) ) {
+ /* Got one; save it if there is enough room in buffer. */
+ unsigned int next = (kbd_last + 1) % KBD_BUF_SIZE;
+ if ( next != kbd_first )
+ kbd_last = next;
+ }
+
+ /* Mark interrupt as handled */
+ outport_byte( 0x20, 0x20 );
+}
+
+
+int _IBMPC_chrdy( char * ch )
+{
+ if ( _IBMPC_Use_Go32_IO ) {
+ /* Read keyboard via BIOS: raw mode. */
+ if ( kbhit() ) {
+ *ch = getkey();
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ /* Check buffer our ISR builds */
+ if ( kbd_first != kbd_last ) {
+ *ch = kbd_buffer[ kbd_first ];
+ kbd_first = (kbd_first + 1) % KBD_BUF_SIZE;
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
+
+int _IBMPC_inch( void )
+{
+ char Ch;
+ while ( ! _IBMPC_chrdy( & Ch ) )
+ continue;
+ return Ch;
+}
diff --git a/c/src/lib/libbsp/i386/go32/console/outch.c b/c/src/lib/libbsp/i386/go32/console/outch.c
new file mode 100644
index 0000000000..fa4422e1b3
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/console/outch.c
@@ -0,0 +1,150 @@
+/*
+ * $Id$
+ */
+
+#include <go32.h>
+#include <bsp.h>
+
+#include <string.h>
+
+#define MAX_COL 80
+#define MAX_ROW 50
+
+static unsigned nrow = 25;
+static unsigned ncol = 80;
+static unsigned short * tvram = TVRAM;
+static unsigned char current_col = 0;
+static unsigned char current_row = 0;
+static unsigned short screen_copy[ MAX_ROW*MAX_COL ];
+
+static void init_cons( void );
+
+/*
+ * set_cursor_pos()
+ * Set cursor position based on current absolute screen offset
+ */
+static void
+set_cursor_pos(void)
+{
+ register unsigned short gdc_pos = current_row * ncol + current_col;
+ outport_byte( GDC_REG_PORT, 0xe );
+ outport_byte( GDC_VAL_PORT, (gdc_pos >> 8) & 0xff );
+ outport_byte( GDC_REG_PORT, 0xf );
+ outport_byte( GDC_VAL_PORT, gdc_pos & 0xff );
+}
+
+/*
+ * scroll_up()
+ * Scroll screen up one line
+ */
+static void
+scroll_up( unsigned short * tv, unsigned short * copy, unsigned int lines )
+{
+ if ( lines > nrow )
+ lines = nrow;
+
+ /* move everything up */
+ memmove( copy, copy+ncol*lines, (nrow-lines)*ncol*sizeof copy[0] );
+
+ /* fill bottom with blanks */
+ {
+ int loop = ncol*lines;
+ unsigned short * ptr = copy + ncol*(nrow-lines);
+ while ( --loop >= 0 )
+ *ptr++ = (WHITE<<8) | ' ';
+ }
+
+ /* copy new screen to video buffer */
+ dosmemput( copy, nrow*ncol*sizeof copy[0], (int)tv );
+}
+
+
+/*
+ * PUT()
+ * Write character at current screen location
+ */
+inline static void PUT( char c )
+{
+ unsigned short loc = current_row*ncol+current_col;
+ unsigned short val = (WHITE<<8) | c;
+ screen_copy[loc] = val;
+ dosmemput( &screen_copy[loc], sizeof screen_copy[0], (int)(tvram+loc) );
+}
+
+/*
+ * cons_putc()
+ * Place a character on next screen position
+ */
+static void
+cons_putc( unsigned char c )
+{
+ static int first = 1;
+ if ( first ) {
+ init_cons();
+ first = 0;
+ }
+
+ switch (c) {
+ case '\t':
+ while ( current_row % 8 )
+ cons_putc(' ');
+ break;
+ case '\r':
+ current_col = 0;
+ break;
+ case '\n':
+ if ( ++current_row >= nrow ) {
+ scroll_up( tvram, screen_copy, 1 );
+ current_row -= 1;
+ }
+ break;
+ case '\b':
+ if ( current_col > 0 ) {
+ --current_col;
+ PUT(' ');
+ }
+ break;
+ default:
+ PUT(c);
+ current_col += 1;
+ if ( current_col >= ncol ) {
+ current_col = 0;
+ current_row += 1;
+ if ( current_row >= nrow ) {
+ scroll_up( tvram, screen_copy, 1 );
+ current_row -= 1;
+ }
+ }
+ };
+ set_cursor_pos();
+}
+
+
+/*
+ * init_cons()
+ * Hook for any early setup
+ */
+static void
+init_cons( void )
+{
+#if 0
+ /* Get a copy of original screen */
+ dosmemget( (int)tvram, nrow*ncol*sizeof *tvram, screen_copy );
+#else
+ /* Clear entire screen */
+ scroll_up( tvram, screen_copy, nrow );
+#endif
+}
+
+
+
+void _IBMPC_outch( unsigned char ch )
+{
+ extern int _IBMPC_Use_Go32_IO;
+
+ if ( _IBMPC_Use_Go32_IO ) {
+ write( 1, &ch, 1 );
+ } else {
+ cons_putc( ch );
+ }
+}
diff --git a/c/src/lib/libbsp/i386/go32/include/bsp.h b/c/src/lib/libbsp/i386/go32/include/bsp.h
new file mode 100644
index 0000000000..5bafd27bd4
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/include/bsp.h
@@ -0,0 +1,172 @@
+/* bsp.h
+ *
+ * This include file definitions related to the ibm386 (go32) board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __IBMPC_h
+#define __IBMPC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: Use a software interrupt for the i386 family.
+ */
+#define MUST_WAIT_FOR_INTERRUPT 0
+#define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 )
+#define Cause_tm27_intr() asm volatile( "int $0x90" : : );
+#define Clear_tm27_intr()
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( _microseconds ) { \
+ rtems_unsigned32 _cnt = (_microseconds); \
+ asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt) ); \
+}
+
+
+/* Constants */
+
+/* Assume color console */
+#define COLOR 1
+#if COLOR
+# define GDC_REG_PORT 0x3d4
+# define GDC_VAL_PORT 0x3d5
+# define TVRAM ((unsigned short *)0xb8000L)
+#else
+# define GDC_REG_PORT 0x3b4
+# define GDC_VAL_PORT 0x3b5
+# define TVRAM ((unsigned short *)0xb0000L)
+#endif
+
+/* White character attribute--works for MGA and CGA */
+#define WHITE 0x07
+
+/* Ports for PC keyboard */
+#define KBD_CTL 0x61
+#define KBD_DATA 0x60
+#define KBD_STATUS 0x64
+
+/* Constants relating to the 8254 (or 8253) programmable interval timers */
+ /* Port address of the control port and timer channels */
+/*
+ * Macros for specifying values to be written into a mode register.
+ */
+#define IO_TIMER1 0x40
+#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
+#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
+#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
+#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
+#define TIMER_SEL0 0x00 /* select counter 0 */
+#define TIMER_SEL1 0x40 /* select counter 1 */
+#define TIMER_SEL2 0x80 /* select counter 2 */
+#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
+#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
+#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
+#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
+#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
+#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
+#define TIMER_LATCH 0x00 /* latch counter for reading */
+#define TIMER_LSB 0x10 /* r/w counter LSB */
+#define TIMER_MSB 0x20 /* r/w counter MSB */
+#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
+#define TIMER_BCD 0x01 /* count in BCD */
+
+#define CLOCK_DISABLE() \
+ ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask | 1 ); })
+#define CLOCK_ENABLE() \
+ ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask & ~1); })
+
+/* The internal tick rate in ticks per second */
+#define TIMER_TICK 1193182
+#define US_TO_TICK(us) (((us)*105+44)/88)
+#define TICK_TO_US(tk) (((tk)*88+52)/105)
+
+/* Structures */
+
+#ifdef IBMPC_INIT
+#undef BSP_EXTERN
+#define BSP_EXTERN
+#else
+#undef BSP_EXTERN
+#define BSP_EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+int _IBMPC_chrdy( char * ch );
+int _IBMPC_inch( void );
+void _IBMPC_outch( unsigned char );
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+/* routines */
+
+i386_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
+
diff --git a/c/src/lib/libbsp/i386/go32/include/coverhd.h b/c/src/lib/libbsp/i386/go32/include/coverhd.h
new file mode 100644
index 0000000000..ab65a05107
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i386/go32/startup/bspstart.c b/c/src/lib/libbsp/i386/go32/startup/bspstart.c
new file mode 100644
index 0000000000..c4575f81d4
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/startup/bspstart.c
@@ -0,0 +1,234 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+#include <z8036.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ rtems_unsigned32 heap_start;
+
+#if 0
+ extern int end;
+ heap_start = (rtems_unsigned32) &end;
+#else
+ void * sbrk( int );
+ heap_start = (rtems_unsigned32) sbrk( 64 * 1024 + CPU_ALIGNMENT );
+#endif
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+/* This is the original command line passed from DOS */
+char ** Go32_Argv;
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ extern void * sbrk( int );
+ extern volatile void _exit( int );
+
+ /* Set up arguments that we can access later */
+ Go32_Argv = argv;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+ Cpu_table.predriver_hook = NULL;
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+ Cpu_table.do_zero_of_workspace = TRUE;
+ Cpu_table.interrupt_table_segment = 0;/* get_ds(); */
+ Cpu_table.interrupt_table_offset = (void *)0;
+ Cpu_table.interrupt_stack_size = 4096;
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size );
+ if ( BSP_Configuration.work_space_start == 0 ) {
+ /* Big trouble */
+ int write( int, void *, int );
+ char msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n";
+ write( 2, msg, sizeof msg - 1 );
+ _exit( 1 );
+ }
+
+ /*
+ * Add 1 region for Malloc in libc_low
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ /* We only return here if the executive has finished. This happens */
+ /* when the task has called exit(). */
+ /* At this point we call _exit() which resides in djgcc. */
+
+ for (;;)
+ _exit( 0 );
+
+ /* no cleanup necessary for GO32 */
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/i386/go32/startup/exit.c b/c/src/lib/libbsp/i386/go32/startup/exit.c
new file mode 100644
index 0000000000..a7c81df0c7
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/startup/exit.c
@@ -0,0 +1,30 @@
+/*
+ * exit
+ *
+ * This routine returns control to DOS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <clockdrv.h>
+#include <iodrv.h>
+
+#if 0
+/* Prefer to pick up _exit() in djgcc */
+void _exit( )
+{
+ Io_cleanup();
+ bsp_cleanup();
+}
+#endif
+
diff --git a/c/src/lib/libbsp/i386/go32/startup/setvec.c b/c/src/lib/libbsp/i386/go32/startup/setvec.c
new file mode 100644
index 0000000000..d9be6b4cf7
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/startup/setvec.c
@@ -0,0 +1,46 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector under go32.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+#include <dpmi.h>
+#include <go32.h>
+
+i386_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ i386_isr_entry previous_isr;
+
+ if ( type ) {
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr);
+ } else {
+ _CPU_ISR_install_raw_handler( vector, handler, (proc_ptr *)&previous_isr);
+ }
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/i386/go32/timer/timer.c b/c/src/lib/libbsp/i386/go32/timer/timer.c
new file mode 100644
index 0000000000..402fa9c334
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/timer/timer.c
@@ -0,0 +1,144 @@
+/* Timer_init()
+ *
+ * This routine initializes the timer on the IBM 386.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+volatile rtems_unsigned32 Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+#if defined(pentium)
+static inline unsigned long long rdtsc( void )
+{
+ /* Return the value of the on-chip cycle counter. */
+ unsigned long long result;
+ __asm __volatile( ".byte 0x0F, 0x31" : "=A" (result) );
+ return result;
+}
+#else
+#define US_PER_ISR 250
+extern rtems_isr timerisr();
+static rtems_isr_entry Old_Ticker;
+#endif
+
+static void Timer_exit( void )
+{
+#if defined(pentium)
+ CLOCK_ENABLE();
+#else /* pentium */
+ extern void rtc_set_dos_date( void );
+
+ /* reset to DOS value: */
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+ outport_byte( TIMER_CNTR0, 0 );
+ outport_byte( TIMER_CNTR0, 0 );
+
+ /* reset time-of-day */
+ rtc_set_dos_date();
+
+ /* re-enable old handler: assume it was one of ours */
+ set_vector( (rtems_isr_entry)Old_Ticker, 0x8, 0 );
+#endif /* pentium */
+}
+
+void Timer_initialize()
+{
+ extern int atexit( void (*)(void) );
+
+ static int First = 1;
+
+ if ( First ) {
+ First = 0;
+
+ /* Try not to hose the system on return to DOS. */
+ atexit( Timer_exit );
+
+#if defined(pentium)
+ /* Disable the programmable timer so ticks don't interfere. */
+ CLOCK_DISABLE();
+#else /* pentium */
+ /* install a timer ISR */
+ Old_Ticker = (rtems_isr_entry) set_vector( timerisr, 0x8, 0 );
+
+ /* Wait for ISR to be called at least once */
+ Ttimer_val = 0;
+ while ( Ttimer_val == 0 )
+ continue;
+
+ /* load timer for US_PER_ISR microsecond period */
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+ outport_byte( TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 0 & 0xff );
+ outport_byte( TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 8 & 0xff );
+#endif /* PENTIUM */
+ }
+#if defined(pentium)
+ Ttimer_val = rdtsc(); /* read starting time */
+#else
+ /* Wait for ISR to be called at least once */
+ asm( "sti" );
+ Ttimer_val = 0;
+ while ( Ttimer_val == 0 )
+ continue;
+ Ttimer_val = 0;
+#endif
+}
+
+#define AVG_OVERHEAD 0 /* 0.1 microseconds to start/stop timer. */
+#define LEAST_VALID 1 /* Don't trust a value lower than this */
+
+
+int Read_timer()
+{
+ register rtems_unsigned32 total;
+#if defined(pentium)
+ total = rdtsc() - Ttimer_val;
+#else /* pentium */
+ register rtems_unsigned8 lsb, msb;
+ register rtems_unsigned32 clicks;
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_LATCH );
+ inport_byte( TIMER_CNTR0, lsb );
+ inport_byte( TIMER_CNTR0, msb );
+ clicks = msb << 8 | lsb;
+ total = (Ttimer_val * US_PER_ISR) + (US_PER_ISR - TICK_TO_US( clicks ));
+#endif /* pentium */
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total;
+ else if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ else
+ return total - AVG_OVERHEAD;
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
+
diff --git a/c/src/lib/libbsp/i386/go32/timer/timerisr.s b/c/src/lib/libbsp/i386/go32/timer/timerisr.s
new file mode 100644
index 0000000000..cbd6b5cb6d
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/timer/timerisr.s
@@ -0,0 +1,41 @@
+# timer_isr()
+#
+# This routine provides the ISR for the timer. The timer is set up
+# to generate an interrupt at maximum intervals.
+#
+# Input parameters: NONE
+#
+# Output parameters: NONE
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+# $Id$
+#
+
+#include "asm.h"
+
+ BEGIN_CODE
+
+ EXTERN(_Ttimer_val)
+
+ PUBLIC(timerisr)
+
+SYM (timerisr):
+ addl $1,_Ttimer_val # another tick
+ push edx
+ push eax
+ movw $0x20,dx
+ mov edx,eax
+ outb al,(dx) # touch interrupt controller
+ pop eax
+ pop edx
+ iret
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/i386/go32/times_i486dx b/c/src/lib/libbsp/i386/go32/times_i486dx
new file mode 100644
index 0000000000..77a6d56193
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/times_i486dx
@@ -0,0 +1,191 @@
+#
+# Timing Test Suite Results for the go32 BSP using an i486DX
+#
+# $Id$
+#
+
+Board: PC/AT clone
+CPU: Intel i486DX
+Clock Speed: 33 Mhz
+Memory Configuration: DRAM w/256K cache
+Wait States: unknown
+
+Times Reported in: microseconds
+Timer Source: i8254
+
+Column A: 3.5.1 pre-release
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 57
+ rtems_semaphore_delete 59
+ rtems_semaphore_obtain: available 9
+ rtems_semaphore_obtain: not available -- NO_WAIT 8
+ rtems_semaphore_release: no waiting tasks 9
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 39
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 25
+
+ 4 rtems_task_restart: blocked task -- preempts caller 124
+ rtems_task_restart: ready task -- preempts caller 55
+ rtems_semaphore_release: task readied -- returns to caller 16
+ rtems_task_create 31
+ rtems_task_start 19
+ rtems_task_restart: suspended task -- returns to caller 20
+ rtems_task_delete: suspended task 28
+ rtems_task_restart: ready task -- returns to caller 20
+ rtems_task_restart: blocked task -- returns to caller 28
+ rtems_task_delete: blocked task 34
+
+ 5 rtems_task_suspend: calling task 26
+ rtems_task_resume: task readied -- preempts caller 17
+
+ 6 rtems_task_restart: calling task 22
+ rtems_task_suspend: returns to caller 10
+ rtems_task_resume: task readied -- returns to caller 10
+ rtems_task_delete: ready task 34
+
+ 7 rtems_task_restart: suspended task -- preempts caller 37
+
+ 8 rtems_task_set_priority: obtain current priority 7
+ rtems_task_set_priority: returns to caller 13
+ rtems_task_mode: obtain current mode 3
+ rtems_task_mode: no reschedule 4
+ rtems_task_mode: reschedule -- returns to caller 20
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 7
+ rtems_task_get_note 7
+ rtems_clock_set 17
+ rtems_clock_get 2
+
+ 9 rtems_message_queue_create 117
+ rtems_message_queue_send: no waiting tasks 22
+ rtems_message_queue_urgent: no waiting tasks 22
+ rtems_message_queue_receive: available 18
+ rtems_message_queue_flush: no messages flushed 15
+ rtems_message_queue_flush: messages flushed 17
+ rtems_message_queue_delete 63
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 10
+ rtems_message_queue_receive: not available -- caller blocks 42
+
+11 rtems_message_queue_send: task readied -- preempts caller 38
+
+12 rtems_message_queue_send: task readied -- returns to caller 27
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 38
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 26
+
+15 rtems_event_receive: obtain current events 0
+ rtems_event_receive: not available -- NO_WAIT 6
+ rtems_event_receive: not available -- caller blocks 34
+ rtems_event_send: no task readied 6
+ rtems_event_receive: available 21
+ rtems_event_send: task readied -- returns to caller 19
+
+16 rtems_event_send: task readied -- preempts caller 26
+
+17 rtems_task_set_priority: preempts caller 36
+
+18 rtems_task_delete: calling task 51
+
+19 rtems_signal_catch 17
+ rtems_signal_send: returns to caller 38
+ rtems_signal_send: signal to self 46
+ exit ASR overhead: returns to calling task 20
+ exit ASR overhead: returns to preempting task 29
+
+20 rtems_partition_create 65
+ rtems_region_create 59
+ rtems_partition_get_buffer: available 39
+ rtems_partition_get_buffer: not available 18
+ rtems_partition_return_buffer 36
+ rtems_partition_delete 32
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 29
+ rtems_region_return_segment: no waiting tasks 24
+ rtems_region_get_segment: not available -- caller blocks 83
+ rtems_region_return_segment: task readied -- preempts caller 85
+ rtems_region_return_segment: task readied -- returns to caller 39
+ rtems_region_delete 30
+ rtems_io_initialize 1
+ rtems_io_open 0
+ rtems_io_close 0
+ rtems_io_read 0
+ rtems_io_write 0
+ rtems_io_control 0
+
+21 rtems_task_ident 116
+ rtems_message_queue_ident 113
+ rtems_semaphore_ident 122
+ rtems_partition_ident 113
+ rtems_region_ident 115
+ rtems_port_ident 113
+ rtems_timer_ident 113
+ rtems_rate_monotonic_ident 113
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 82
+ rtems_message_queue_broadcast: no waiting tasks 11
+ rtems_message_queue_broadcast: task readied -- preempts caller 51
+
+23 rtems_timer_create 8
+ rtems_timer_fire_after: inactive 14
+ rtems_timer_fire_after: active 13
+ rtems_timer_cancel: active 8
+ rtems_timer_cancel: inactive 7
+ rtems_timer_reset: inactive 11
+ rtems_timer_reset: active 11
+ rtems_timer_fire_when: inactive 17
+ rtems_timer_fire_when: active 17
+ rtems_timer_delete: active 10
+ rtems_timer_delete: inactive 9
+ rtems_task_wake_when 36
+
+24 rtems_task_wake_after: yield -- returns to caller 5
+ rtems_task_wake_after: yields -- preempts caller 22
+
+25 rtems_clock_tick 31
+
+26 _ISR_Disable 11
+ _ISR_Flash 9
+ _ISR_Enable 31
+ _Thread_Disable_dispatch 11
+ _Thread_Enable_dispatch 18
+ _Thread_Set_state 20
+ _Thread_Disptach (NO FP) 37
+ context switch: no floating point contexts 29
+ context switch: self 14
+ context switch: to another task 12
+ context switch: restore 1st FP task 54
+ fp context switch: save idle, restore idle 47
+ fp context switch: save idle, restore initialized 25
+ fp context switch: save initialized, restore initialized 24
+ _Thread_Resume 23
+ _Thread_Unblock 14
+ _Thread_Ready 16
+ _Thread_Get 2
+ _Semaphore_Get 1
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 25
+ interrupt exit overhead: returns to interrupted task 14
+ interrupt entry overhead: returns to nested interrupt 12
+ interrupt exit overhead: returns to nested interrupt 14
+ interrupt entry overhead: returns to preempting task 14
+ interrupt exit overhead: returns to preempting task 42
+
+28 rtems_port_create 43
+ rtems_port_external_to_internal 6
+ rtems_port_internal_to_external 6
+ rtems_port_delete 39
+
+29 rtems_rate_monotonic_create 48
+ rtems_rate_monotonic_period: initiate period -- returns to caller 61
+ rtems_rate_monotonic_period: obtain status 23
+ rtems_rate_monotonic_cancel 38
+ rtems_rate_monotonic_delete: inactive 32
+ rtems_rate_monotonic_delete: active 22
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 24
diff --git a/c/src/lib/libbsp/i386/go32/times_p5 b/c/src/lib/libbsp/i386/go32/times_p5
new file mode 100644
index 0000000000..977c4ec482
--- /dev/null
+++ b/c/src/lib/libbsp/i386/go32/times_p5
@@ -0,0 +1,196 @@
+#
+# Timing Test Suite Results for the go32 BSP using a Pentium
+#
+# $Id$
+#
+
+NOTE: To obtain the execution time in microseconds, divide the number of
+ cycles by the clock speed. For example, if rtems_semaphore create
+ is reported to be 1164 cycles, then at 66 Mhz it takes 17.64
+ microseconds or 8.75 microseconds at 133 Mhz.
+
+Board: PC/AT clone
+CPU: Intel Pentium
+Clock Speed: 66 Mhz
+Memory Configuration: DRAM w/512 Kb cache
+Wait States: unknown
+
+Times Reported in: cycles
+Timer Source: on-CPU cycle counter
+
+Column A: 3.5.1 pre-release
+Column Y: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 1164
+ rtems_semaphore_delete 976
+ rtems_semaphore_obtain: available 300
+ rtems_semaphore_obtain: not available -- NO_WAIT 300
+ rtems_semaphore_release: no waiting tasks 291
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 1182
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 716
+
+ 4 rtems_task_restart: blocked task -- preempts caller 2130
+ rtems_task_restart: ready task -- preempts caller 1861
+ rtems_semaphore_release: task readied -- returns to caller 491
+ rtems_task_create 1017
+ rtems_task_start 965
+ rtems_task_restart: suspended task -- returns to caller 816
+ rtems_task_delete: suspended task 926
+ rtems_task_restart: ready task -- returns to caller 850
+ rtems_task_restart: blocked task -- returns to caller 1076
+ rtems_task_delete: blocked task 927
+
+ 5 rtems_task_suspend: calling task 714
+ rtems_task_resume: task readied -- preempts caller 575
+
+ 6 rtems_task_restart: calling task 646
+ rtems_task_suspend: returns to caller 309
+ rtems_task_resume: task readied -- returns to caller 320
+ rtems_task_delete: ready task 994
+
+ 7 rtems_task_restart: suspended task -- preempts caller 1025
+
+ 8 rtems_task_set_priority: obtain current priority 223
+ rtems_task_set_priority: returns to caller 468
+ rtems_task_mode: obtain current mode 99
+ rtems_task_mode: no reschedule 114
+ rtems_task_mode: reschedule -- returns to caller 264
+ rtems_task_mode: reschedule -- preempts caller 836
+ rtems_task_set_note 236
+ rtems_task_get_note 232
+ rtems_clock_set 569
+ rtems_clock_get 107
+
+ 9 rtems_message_queue_create 3287
+ rtems_message_queue_send: no waiting tasks 613
+ rtems_message_queue_urgent: no waiting tasks 615
+ rtems_message_queue_receive: available 534
+ rtems_message_queue_flush: no messages flushed 252
+ rtems_message_queue_flush: messages flushed 335
+ rtems_message_queue_delete 1195
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 333
+ rtems_message_queue_receive: not available -- caller blocks 1194
+
+11 rtems_message_queue_send: task readied -- preempts caller 957
+
+12 rtems_message_queue_send: task readied -- returns to caller 700
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 1261
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 697
+
+15 rtems_event_receive: obtain current events 27
+ rtems_event_receive: not available -- NO_WAIT 226
+ rtems_event_receive: not available -- caller blocks 888
+ rtems_event_send: no task readied 221
+ rtems_event_receive: available 393
+ rtems_event_send: task readied -- returns to caller 496
+
+16 rtems_event_send: task readied -- preempts caller 719
+
+17 rtems_task_set_priority: preempts caller 959
+
+18 rtems_task_delete: calling task 1295
+
+19 rtems_signal_catch 223
+ rtems_signal_send: returns to caller 628
+ rtems_signal_send: signal to self 821
+ exit ASR overhead: returns to calling task 401
+ exit ASR overhead: returns to preempting task 482
+
+20 rtems_partition_create 1337
+ rtems_region_create 1031
+ rtems_partition_get_buffer: available 680
+ rtems_partition_get_buffer: not available 303
+ rtems_partition_return_buffer 617
+ rtems_partition_delete 523
+ rtems_region_get_segment: available 458
+ rtems_region_get_segment: not available -- NO_WAIT 565
+ rtems_region_return_segment: no waiting tasks 388
+ rtems_region_get_segment: not available -- caller blocks 1683
+ rtems_region_return_segment: task readied -- preempts caller 1476
+ rtems_region_return_segment: task readied -- returns to caller 818
+ rtems_region_delete 477
+ rtems_io_initialize 48
+ rtems_io_open 22
+ rtems_io_close 22
+ rtems_io_read 22
+ rtems_io_write 22
+ rtems_io_control 23
+
+21 rtems_task_ident 3381
+ rtems_message_queue_ident 3328
+ rtems_semaphore_ident 3593
+ rtems_partition_ident 3286
+ rtems_region_ident 3343
+ rtems_port_ident 3278
+ rtems_timer_ident 3282
+ rtems_rate_monotonic_ident 3287
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 1322
+ rtems_message_queue_broadcast: no waiting tasks 347
+ rtems_message_queue_broadcast: task readied -- preempts caller 1385
+
+23 rtems_timer_create 306
+ rtems_timer_fire_after: inactive 475
+ rtems_timer_fire_after: active 475
+ rtems_timer_cancel: active 277
+ rtems_timer_cancel: inactive 251
+ rtems_timer_reset: inactive 391
+ rtems_timer_reset: active 465
+ rtems_timer_fire_when: inactive 577
+ rtems_timer_fire_when: active 578
+ rtems_timer_delete: active 377
+ rtems_timer_delete: inactive 350
+ rtems_task_wake_when 1080
+
+24 rtems_task_wake_after: yield -- returns to caller 159
+ rtems_task_wake_after: yields -- preempts caller 574
+
+25 rtems_clock_tick 505
+
+26 _ISR_Disable 33
+ _ISR_Flash 33
+ _ISR_Enable 26
+ _Thread_Disable_dispatch 36
+ _Thread_Enable_dispatch 240
+ _Thread_Set_state 315
+ _Thread_Disptach (NO FP) 623
+ context switch: no floating point contexts 594
+ context switch: self 89
+ context switch: to another task 122
+ context switch: restore 1st FP task 1043
+ fp context switch: save idle, restore idle 978
+ fp context switch: save idle, restore initialized 390
+ fp context switch: save initialized, restore initialized 392
+ _Thread_Resume 238
+ _Thread_Unblock 171
+ _Thread_Ready 176
+ _Thread_Get 71
+ _Semaphore_Get 61
+ _Thread_Get: invalid id 10
+
+27 interrupt entry overhead: returns to interrupted task 391
+ interrupt exit overhead: returns to interrupted task 110
+ interrupt entry overhead: returns to nested interrupt 167
+ interrupt exit overhead: returns to nested interrupt 120
+ interrupt entry overhead: returns to preempting task 193
+ interrupt exit overhead: returns to preempting task 961
+
+28 rtems_port_create 668
+ rtems_port_external_to_internal 215
+ rtems_port_internal_to_external 211
+ rtems_port_delete 491
+
+29 rtems_rate_monotonic_create 823
+ rtems_rate_monotonic_period: initiate period -- returns to caller 1094
+ rtems_rate_monotonic_period: obtain status 345
+ rtems_rate_monotonic_cancel 602
+ rtems_rate_monotonic_delete: inactive 553
+ rtems_rate_monotonic_delete: active 528
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 672
diff --git a/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c b/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c
new file mode 100644
index 0000000000..3f2ba718bc
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c
@@ -0,0 +1,141 @@
+/* Clock_init()
+ *
+ * This routine initializes the timer on the VIC chip on the CVME961.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#define CLOCK_VECTOR 5
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+i960_isr_entry Old_ticker;
+volatile rtems_unsigned32 Clock_driver_ticks;
+ /* ticks since initialization */
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+
+/* this is later in the file to avoid it being inlined */
+rtems_isr Clock_isr( rtems_vector_number vector );
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ volatile unsigned char *victimer;
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ victimer = (volatile unsigned char *) 0xa00000c3;
+ *victimer = 0x12;
+ *victimer = 0x92; /* 1000 HZ */
+ }
+}
+
+void Clock_exit()
+{
+ unsigned char *victimer;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ victimer = (unsigned char *) 0xa00000c3;
+ *victimer = 0x12;
+ i960_mask_intr( 5 );
+ /* do not restore old vector */
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ atexit( Clock_exit );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ /* enable_tracing(); */
+ Clock_driver_ticks += 1;
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+ i960_clear_intr( 5 );
+}
+
diff --git a/c/src/lib/libbsp/i960/cvme961/console/console.c b/c/src/lib/libbsp/i960/cvme961/console/console.c
new file mode 100644
index 0000000000..f108fcbea5
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/console/console.c
@@ -0,0 +1,212 @@
+/*
+ * This file contains the CVME961 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define C961_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * NINDY_IO( ... )
+ *
+ * Interface to NINDY.
+ */
+
+#define NINDY_INPUT 0
+#define NINDY_OUTPUT 1
+
+void NINDY_IO();
+
+void ___NINDY_IO_WRAPPER( void ) /* never called */
+{
+ asm volatile ( " .text" );
+ asm volatile ( " .align 4" );
+ asm volatile ( " .globl _NINDY_IO" );
+ asm volatile ( "_NINDY_IO:" );
+ asm volatile ( " calls 0 /* call console routines */" );
+ asm volatile ( " ret" );
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the console using NINDY.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from UART
+ */
+
+char inbyte( void )
+{
+ char ch;
+
+ NINDY_IO( NINDY_INPUT, &ch );
+ return ch;
+}
+
+
+/* outbyte
+ *
+ * This routine transmits a character out the console using NINDY.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ NINDY_IO( NINDY_OUTPUT, ch );
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/i960/cvme961/include/bsp.h b/c/src/lib/libbsp/i960/cvme961/include/bsp.h
new file mode 100644
index 0000000000..9b6caab59d
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/include/bsp.h
@@ -0,0 +1,149 @@
+/* bsp.h
+ *
+ * This include file contains some definitions specific to the
+ * Cyclone CVME960 and CVME961 boards. These boards are the
+ * same except the 960 uses SRAM and the 961 DRAM.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CVME961_h
+#define __CVME961_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: Following are for i960CA and are board independent
+ *
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 6, 1 )
+
+#define Cause_tm27_intr() i960_cause_intr( 0x62 )
+
+#define Clear_tm27_intr() i960_clear_intr( 6 )
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp; \
+ asm volatile( "0: \
+ remo 3,31,%0 ; \
+ cmpo 0,%0 ; \
+ subo 1,%1,%1 ; \
+ cmpobne.t 0,%1,0b " \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+/* NINDY console I/O requests:
+ * CO sends a single character to stdout,
+ * CI reads one.
+ */
+
+#define NINDY_INPUT 0
+#define NINDY_OUTPUT 1
+
+/*
+ * get_prcb
+ *
+ * Returns the PRCB pointer.
+ */
+
+static inline i960ca_PRCB *get_prcb( void )
+{
+ register i960ca_PRCB *_prcb = 0;
+
+ asm volatile( "calls 5; \
+ mov g0,%0" \
+ : "=d" (_prcb) \
+ : "0" (_prcb) );
+ return ( _prcb );
+}
+
+#ifdef C961_INIT
+#undef BSP_EXTERN
+#define BSP_EXTERN
+#else
+#undef BSP_EXTERN
+#define BSP_EXTERN extern
+#endif
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+BSP_EXTERN i960ca_PRCB *Prcb;
+BSP_EXTERN i960ca_control_table *Ctl_tbl;
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+i960_isr_entry set_vector( rtems_isr_entry, unsigned int, unsigned int );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i960/cvme961/include/coverhd.h b/c/src/lib/libbsp/i960/cvme961/include/coverhd.h
new file mode 100644
index 0000000000..9d6b26111a
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 3
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 3
+#define CALLING_OVERHEAD_CLOCK_SET 3
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 6
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i960/cvme961/shmsupp/addrconv.c b/c/src/lib/libbsp/i960/cvme961/shmsupp/addrconv.c
new file mode 100644
index 0000000000..7702d22e67
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/shmsupp/addrconv.c
@@ -0,0 +1,37 @@
+/* Shm_Convert_address
+ *
+ * This routine takes into account the peculiar short VME address
+ * of the CVME961 board. The CVME961 maps short address space
+ * 0xffffxxxx to 0xb400xxxx.
+ *
+ * Input parameters:
+ * address - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include "shm.h"
+
+void *Shm_Convert_address(
+ void *address
+)
+{
+ rtems_unsigned32 workaddr = (rtems_unsigned32) address;
+
+ if ( workaddr >= 0xffff0000 )
+ workaddr = (workaddr & 0xffff) | 0xb4000000;
+ return ( (rtems_unsigned32 *)workaddr );
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/shmsupp/getcfg.c b/c/src/lib/libbsp/i960/cvme961/shmsupp/getcfg.c
new file mode 100644
index 0000000000..f72e715b6f
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/shmsupp/getcfg.c
@@ -0,0 +1,98 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the Cyclone CVME961.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+ * NOTES: CVME961 target system has onboard dual-ported memory. This
+ * file uses the USE_ONBOARD_RAM macro to determine if this
+ * RAM is to be used as the SHM. If so (i.e. USE_ONBOARD_RAM
+ * is set to 1), it is assumed that the master node's dual
+ * ported memory will be used and that it is configured
+ * correctly. The node owning the memory CANNOT access it
+ * using a local address. The "if" insures that the MASTER
+ * node uses a local address to access the dual-ported memory.
+ *
+ * The interprocessor interrupt used on the CVME961 is generated
+ * by the VIC068. The ICMS capablities of the VIC068 are used
+ * to generate interprocessor interrupts for up to eight nodes.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED LITTLE 2+
+ * INTERRUPT LITTLE 2-8
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+#define USE_ONBOARD_RAM 0 /* use onboard (1) or VME RAM */
+ /* for SHM communications */
+
+#define INTERRUPT 1 /* CVME961 target supports both */
+#define POLLING 0 /* polling and interrupt modes */
+
+
+shm_config_table BSP_shm_cfgtbl;
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+#if ( USE_ONBOARD_RAM == 1 )
+ if ( Shm_RTEMS_MP_Configuration->node == MASTER )
+ BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x00300000;
+ else
+ BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x10300000;
+#else
+ BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x20000000;
+#endif
+
+ BSP_shm_cfgtbl.length = 1 * MEGABYTE;
+ BSP_shm_cfgtbl.format = SHM_LITTLE;
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = (void *)CPU_swap_u32;
+#else
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#endif
+
+#if (POLLING==1)
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+#else
+ BSP_shm_cfgtbl.poll_intr = INTR_MODE;
+ BSP_shm_cfgtbl.Intr.address =
+ (rtems_unsigned32 *) (0xffff0021|((localnode-1) << 12));
+ /* use ICMS0 */
+ BSP_shm_cfgtbl.Intr.value = 1;
+ BSP_shm_cfgtbl.Intr.length = BYTE;
+#endif
+
+ *shmcfg = &BSP_shm_cfgtbl;
+
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/shmsupp/lock.c b/c/src/lib/libbsp/i960/cvme961/shmsupp/lock.c
new file mode 100644
index 0000000000..69b458f099
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/shmsupp/lock.c
@@ -0,0 +1,76 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = LQ_UNLOCKED;
+}
+
+/* void _Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level, oldlock;
+
+ rtems_interrupt_disable( isr_level );
+ Shm_isrstat = isr_level;
+ while ( 1 ) {
+ atomic_modify( SHM_LOCK_VALUE, &lq_cb->lock, oldlock );
+ if ( !(oldlock & SHM_LOCK_VALUE) )
+ return;
+ delay( 28 ); /* delay 28 microseconds */
+ }
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ lq_cb->lock = SHM_UNLOCK_VALUE;
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
+
diff --git a/c/src/lib/libbsp/i960/cvme961/shmsupp/mpisr.c b/c/src/lib/libbsp/i960/cvme961/shmsupp/mpisr.c
new file mode 100644
index 0000000000..827c5e4adb
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/shmsupp/mpisr.c
@@ -0,0 +1,70 @@
+/* Shm_isr_cvme961()
+ *
+ * NOTE: This routine is not used when in polling mode. Either
+ * this routine OR Shm_clockisr is used in a particular system.
+ *
+ * There must be sufficient time after the IACK (read at
+ * 0xb600000x) for the VIC068 to clear the interrupt request
+ * before the interrupt request is cleared from IPND (sf0).
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include "shm.h"
+
+rtems_isr Shm_isr_cvme961(
+ rtems_vector_number vector
+)
+{
+ rtems_unsigned32 vic_vector;
+
+ /* enable_tracing(); */
+ vic_vector = (*(volatile rtems_unsigned8 *)0xb6000007);
+ /* reset intr by reading */
+ /* vector at IPL=3 */
+ Shm_Interrupt_count += 1;
+ rtems_multiprocessing_announce();
+ (*(volatile rtems_unsigned8 *)0xa000005f) = 0; /* clear ICMS0 */
+ i960_clear_intr( 6 );
+
+}
+
+/* void _Shm_setvec( )
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * NOTE: See pp. 21-22, 36-39 of the CVME961 Manual for more info.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void Shm_setvec()
+{
+ rtems_unsigned32 isrlevel;
+
+ rtems_interrupt_disable( isrlevel );
+ /* set SQSIO4 CTL REG for */
+ /* VME slave address */
+ (*(rtems_unsigned8 *)0xc00000b0) =
+ (Shm_RTEMS_MP_Configuration->node - 1) | 0x10;
+ set_vector( Shm_isr_cvme961, 6, 1 );
+ /* set ICMS Bector Base Register */
+ (*(rtems_unsigned8 *)0xa0000053) = 0x60; /* XINT6 vector is 0x62 */
+ /* set ICMS Intr Control Reg */
+ (*(rtems_unsigned8 *)0xa0000047) = 0xeb; /* ICMS0 enabled, IPL=0 */
+ (*(rtems_unsigned8 *)0xa000005f) = 0; /* clear ICMS0 */
+ rtems_interrupt_enable( isrlevel );
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/bspclean.c b/c/src/lib/libbsp/i960/cvme961/startup/bspclean.c
new file mode 100644
index 0000000000..fb35e206be
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/startup/bspclean.c
@@ -0,0 +1,32 @@
+/*
+ * This routine is used to return control to the NINDY monitor
+ * and is automatically invoked at shutdown.
+ *
+ * NOTES: DOES NOT RETURN!!!
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "bsp.h"
+
+void bsp_cleanup( void )
+{
+ asm volatile( "mov 0,g0; \
+ fmark ; \
+ syncf ; \
+ .word 0xfeedface ; \
+ bx start" : : );
+ /* The constant 0xfeedface is a magic word for break which
+ * is defined by NINDY. The branch extended restarts the
+ * application if the user types "go".
+ */
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
new file mode 100644
index 0000000000..7316f46f54
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
@@ -0,0 +1,245 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /* set node number in SQSIO4 CTL REG */
+
+ *((rtems_unsigned32 *)0xc00000b0) =
+ (Configuration.User_multiprocessing_table) ?
+ Configuration.User_multiprocessing_table->node : 0;
+
+ Prcb = get_prcb();
+ Ctl_tbl = Prcb->control_tbl;
+
+ /* following configures the data breakpoint (which must be set
+ * before this is executed) to break on writes only.
+ */
+
+ Ctl_tbl->bpcon &= ~0x00cc0000;
+ i960_reload_ctl_group( 6 );
+
+ /* bit 31 of the Register Cache Control can be set to
+ * enable an alternative caching algorithm. It does
+ * not appear to help RTEMS.
+ */
+
+ /* Configure Number of Register Caches */
+
+ Prcb->reg_cache_cfg = 8;
+ i960_soft_reset( Prcb );
+
+ /*
+ * we do not use the pretasking_hook.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ Cpu_table.Prcb = Prcb;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ bsp_cleanup();
+
+ return 0;
+
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/exit.c b/c/src/lib/libbsp/i960/cvme961/startup/exit.c
new file mode 100644
index 0000000000..c412cad281
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/startup/exit.c
@@ -0,0 +1,38 @@
+/* exit
+ *
+ * This routine is used to return control to the NINDY monitor
+ * and is automatically invoked by the STDIO exit() routine.
+ *
+ * INPUT:
+ * status - exit status
+ *
+ * OUTPUT: NONE
+ *
+ * NOTES: DOES NOT RETURN!!!
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "bsp.h"
+
+void _exit( )
+{
+ asm volatile( "mov 0,g0; \
+ fmark ; \
+ syncf ; \
+ .word 0xfeedface ; \
+ bx start" : : );
+ /* The constant 0xfeedface is a magic word for break which
+ * is defined by NINDY. The branch extended restarts the
+ * application if the user types "go".
+ */
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/linkcmds b/c/src/lib/libbsp/i960/cvme961/startup/linkcmds
new file mode 100644
index 0000000000..d23ada6242
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/startup/linkcmds
@@ -0,0 +1,48 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the Cyclone CVME960/CVME961 boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x0, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x10000 :
+ {
+ text_start = . ;
+ _text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+/* _etext = .; -- conflicts */
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ _data_start = .;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+/* _edata = .; -- conflicts */
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/setvec.c b/c/src/lib/libbsp/i960/cvme961/startup/setvec.c
new file mode 100644
index 0000000000..bfba01c271
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/startup/setvec.c
@@ -0,0 +1,145 @@
+/* set_vector
+ *
+ * This routine attempts to perform all "generic" interrupt initialization
+ * for the specified XINT line. It is specific to the Cyclone CVME961 in
+ * that it knows which interrupts are initialized by the monitor, the
+ * characteristics of XINT5 (VIC068 clock tick), and that it assumes the
+ * i960 is processing interrupts in dedicated mode. It attempts to map
+ * XINTs to interrupt vectors in a fairly straght forward way.
+ *
+ * XINT USE VECTOR INTR TBL INDEX TRIGGERED
+ * ==== ============= ====== ============== =========
+ * 0 VMEbus ERROR 0x02 0x03 EDGE
+ * 1 DRAM PARITY 0x12 0x13 EDGE
+ * 2 Z8530 0x22 0x23 LEVEL
+ * 3 SQUALL 0 0x52 0x53 ----
+ * 4 Z8536 (SQSIO4) 0x72 0x73 LEVEL
+ * 5 TICK 0x32 0x33 EDGE
+ * 6 VIC068 0x62 0x63 LEVEL
+ * 7 UNUSED 0x42 0x43 LEVEL
+ *
+ * The interrupt handler is installed in both the cached and memory
+ * resident interrupt tables. The appropriate IMAP register is updated to
+ * reflect the vector selected by this routine. Global interrupts are
+ * enabled. If XINT5 is being installed, places it in trigger mode.
+ * Finally, set_vector_support() is invoked to install the new IMAP and
+ * ICON, unmask the XINT in IMASK, and lower the i960's interrupt
+ * level to 0.
+ *
+ * INPUT:
+ * func - interrupt handler entry point
+ * xint - external interrupt line
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+#include <stdio.h>
+
+void print_prcb();
+void print_intr_info();
+void print_ipnd_imsk();
+
+unsigned int Xint_2_Group_Map[8] = { 0, 1, 2, 5, 7, 3, 6, 4 };
+
+i960_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry func, /* isr routine */
+ unsigned int xint, /* XINT number */
+ unsigned int type /* RTEMS or RAW */
+)
+{
+ i960_isr_entry *intr_tbl, *cached_intr_tbl;
+ i960_isr_entry saved_intr;
+ unsigned int vector, group, nibble;
+ unsigned int *imap;
+
+ if ( xint > 7 )
+ exit( 0x80 );
+
+ cached_intr_tbl = (i960_isr_entry *) 0;
+ intr_tbl = (i960_isr_entry *) Prcb->intr_tbl;
+ group = Xint_2_Group_Map[xint]; /* remap XINT to group */
+ vector = (group << 4) + 2; /* direct vector num */
+
+ if ( type )
+ rtems_interrupt_catch( func, vector, (rtems_isr_entry *) &saved_intr );
+ else {
+ saved_intr = (i960_isr_entry) intr_tbl[ vector ];
+ /* return old vector */
+ intr_tbl[ vector + 1 ] = /* normal vector table */
+ cached_intr_tbl[ group ] = (i960_isr_entry) func; /* cached vector */
+ }
+
+ if ( xint <= 3 ) imap = &Ctl_tbl->imap0; /* updating IMAP0 */
+ else imap = &Ctl_tbl->imap1; /* updating IMAP1 */
+ nibble = (xint % 4) * 4;
+ *imap &= ~(0xf << nibble);
+ *imap |= group << nibble;
+
+ Ctl_tbl->icon &= ~0x00000400; /* enable global interrupts */
+ Ctl_tbl->icon |= 0x00004000; /* fast sampling mode */
+ switch ( xint ) {
+ case 0: Ctl_tbl->icon |= 0x00000004; break;
+ case 1: Ctl_tbl->icon |= 0x00000008; break;
+ case 2: Ctl_tbl->icon &= ~0x00000010; break;
+ case 4: Ctl_tbl->icon &= ~0x00000040; break;
+ case 5: Ctl_tbl->icon |= 0x00000080; break;
+ case 6: Ctl_tbl->icon &= ~0x00000100; break;
+ default: exit( 0x81 ); break; /* unsupported */
+ }
+
+ if ( xint == 4 ) { /* reprogram MCON for SQSIO4 */
+ Ctl_tbl->mcon12 = 0x00002012; /* MCON12 - 0xCxxxxxxx */
+ Ctl_tbl->mcon13 = 0x00000000; /* MCON13 - 0xDxxxxxxx */
+ i960_reload_ctl_group( 5 ); /* update MCON12-MCON15 */
+ }
+
+ i960_unmask_intr( xint ); /* update IMSK */
+ i960_reload_ctl_group( 1 ); /* update IMAP?/ICON */
+ return( saved_intr ); /* return old vector */
+}
+
+void print_prcb()
+{
+ printf( "fault_table =0x%p\n", Prcb->fault_tbl );
+ printf( "control_tbl =0x%p\n", Prcb->control_tbl );
+ printf( "AC mask ov =0x%x\n", Prcb->initial_ac );
+ printf( "fltconfig =0x%x\n", Prcb->fault_config );
+ printf( "intr tbl =0x%p\n", Prcb->intr_tbl );
+ printf( "systable =0x%p\n", Prcb->sys_proc_tbl );
+ printf( "reserved =0x%x\n", Prcb->reserved );
+ printf( "isr stk =0x%p\n", Prcb->intr_stack );
+ printf( "ins cache =0x%x\n", Prcb->ins_cache_cfg );
+ printf( "reg cache =0x%x\n", Prcb->reg_cache_cfg );
+}
+
+void print_intr_info()
+{
+ printf( "prcb =0x%p\n", Prcb );
+ printf( "ctl_tbl =0x%p\n", Ctl_tbl );
+ printf( "intr_tbl=0x%p\n", Prcb->intr_tbl );
+ printf( "IMAP0 = 0x%x\n", Ctl_tbl->imap0 );
+ printf( "IMAP1 = 0x%x\n", Ctl_tbl->imap1 );
+ print_ipnd_imsk();
+}
+
+void print_ipnd_imsk()
+{
+ printf(" IPEND = 0x%x\n", i960_pend_intrs() );
+ printf(" IMASK = 0x%x\n", i960_mask_intrs() );
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/timer/timer.c b/c/src/lib/libbsp/i960/cvme961/timer/timer.c
new file mode 100644
index 0000000000..0a91d12a93
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/timer/timer.c
@@ -0,0 +1,107 @@
+/* Timer_init()
+ *
+ * This routine initializes the Z8536 timer on the SQSIO4 SQUALL
+ * board for the CVME961 board. The timer is setup to provide a
+ * tick every 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: This routine will not work if the optimizer is enabled
+ * for most compilers. The multiple writes to the Z8536
+ * will be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+#include <bsp.h>
+#include "z8536.h"
+
+#define TIMER 0xc00000a0
+
+int Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+void flush_reg();
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+ set_vector( timerisr, 4, 0 ); /* install ISR */
+
+ i960_mask_intr( 5 ); /* disable VIC068 tick */
+ flush_reg(); /* timed code starts clean */
+ Ttimer_val = 0; /* clear timer ISR count */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0x01 ); /* reset */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0x00 ); /* clear reset */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0x00 ); /* disable everything */
+ Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, 0x72 ); /* clear intr vector */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0x20 ); /* clear intr info */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xe0 ); /* disable interrupts */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0x20 ); /* clear intr info */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xe0 ); /* disable interrupts */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0xe2 ); /* disable lower chain, */
+ /* no vector, set right */
+ /* justified addr and */
+ /* master int enable */
+ Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x80 ); /* T1 continuous, and */
+ /* cycle/pulse output */
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_MSB, 0x00 );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0x00 );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xc0 ); /* set INTR enable (IE) */
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0x40 ); /* enable timer1 */
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x06 ); /* set trigger command */
+ /* (TCB) and gate */
+ /* command (GCB) bits */
+}
+
+#define AVG_OVERHEAD 11 /* It typically takes 5.5 microseconds */
+ /* (11 countdowns) to start/stop the timer. */
+#define LEAST_VALID 15 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ rtems_unsigned8 msb, lsb;
+ rtems_unsigned32 remaining, total;
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xce ); /* read the counter value */
+ Z8x36_READ( TIMER, CT1_CUR_CNT_MSB, msb );
+ Z8x36_READ( TIMER, CT1_CUR_CNT_LSB, lsb );
+
+ remaining = 0xffff - ((msb << 8) + lsb);
+ total = (Ttimer_val * 0x10000) + remaining;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in one-half microsecond units */
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ return (total-AVG_OVERHEAD) >> 1;
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/i960/cvme961/timer/timerisr.s b/c/src/lib/libbsp/i960/cvme961/timer/timerisr.s
new file mode 100644
index 0000000000..02dc23cd5c
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/timer/timerisr.s
@@ -0,0 +1,59 @@
+/* timer_isr()
+ *
+ * This routine initializes the Z8536 timer on the SQSIO4 SQUALL
+ * board for the CVME961 board. The timer is setup to provide a
+ * tick every 0x10000 / 2 milliseconds. This is used to time
+ * executing code.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+.set PORT_A, 0xc00000a8 # port A
+.set PORT_B, 0xc00000a4 # port B
+.set PORT_C, 0xc00000a0 # port C
+.set CTL_PORT, 0xc00000ac # control port
+
+.set T1CSR, 0x0a # T1 command/status reg
+.set RELOAD, 0x24 # clr IP & IUS,allow countdown
+
+ PUBLIC(_timerisr)
+SYM (_timerisr):
+ #ldconst 1,r4
+ #modpc 0,r4,r4 # enable tracing
+
+ ld _Ttimer_val,r6 # r6 = test timer
+
+ ldconst T1CSR,r4 # r4 = T1 control status reg
+ stob r4,CTL_PORT # select T1CSR
+ ldconst RELOAD,r5 # r5 = reset value
+ stob r5,CTL_PORT # reset countdown
+ addo 1,r6,r6
+ st r6,_Ttimer_val # increment test timer
+loop_til_cleared:
+ clrbit 4,sf0,sf0
+ bbs 4,sf0,loop_til_cleared
+leaf: ret
+
+ .leafproc _flush_reg, flush_reg.lf
+ .globl _flush_reg, flush_reg.lf
+_flush_reg:
+ lda leaf,g14 # g14 = exit address
+flush_reg.lf:
+ flushreg
+ mov g14,g0 # g0 = exit address
+ ldconst 0,g14 # set g14 for non-leaf
+ bx (g0)
diff --git a/c/src/lib/libbsp/i960/cvme961/times b/c/src/lib/libbsp/i960/cvme961/times
new file mode 100644
index 0000000000..2e742dd876
--- /dev/null
+++ b/c/src/lib/libbsp/i960/cvme961/times
@@ -0,0 +1,191 @@
+#
+# Timing Test Suite Results for the Cyclone CVME961 BSP
+#
+# $Id$
+#
+
+Board: Cyclone CVME961
+CPU: Intel i960CA
+Clock Speed: 33 Mhz
+Memory Configuration: DRAM w/no cache
+Wait States: 2 wait states
+
+Times Reported in: microseconds
+Timer Source: Z8536 on SQUALL mezzanine module
+
+Column A: 3.5.1 pre-release
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c b/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c
new file mode 100644
index 0000000000..128bed84d7
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c
@@ -0,0 +1,162 @@
+/* Clock_init()
+ *
+ * This routine initializes the Z80386 1 on the MVME136 board.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+volatile rtems_unsigned32 Clock_driver_ticks;
+ /* ticks since initialization */
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+#define CLOCK_VECTOR TIMER_VECTOR
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * ISR Handler
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ Clock_driver_ticks += 1;
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xE2 );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x22 );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xC6 );
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ rtems_unsigned8 data;
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xd4 );
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0x7E) );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_MSB, 0x04 );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0xCE );
+ Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x83 );
+ Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, CLOCK_VECTOR );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x20 );
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0xDA) | 0x80 );
+
+ /*
+ * ACC_IC54 - interrupt 5 will be vectored and mapped to level 6
+ */
+
+ data = (*(rtems_unsigned8 *)0x0D00000B);
+ (*(rtems_unsigned8 *)0x0D00000B) = (data & 0x7F) | 0x60;
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xC6 );
+
+ atexit( Clock_exit );
+ }
+}
+
+void Clock_exit( void )
+{
+ rtems_unsigned8 data;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0x01) );
+ /* do not restore old vector */
+
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/dmv152/console/console.c b/c/src/lib/libbsp/m68k/dmv152/console/console.c
new file mode 100644
index 0000000000..daa50f37f1
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/console/console.c
@@ -0,0 +1,249 @@
+/*
+ * This file contains the DMV152 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define D152_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ rtems_unsigned8 rr_0;
+
+ for ( ; ; ) {
+ Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
+ if ( !(rr_0 & RR_0_RX_DATA_AVAILABLE) )
+ return( FALSE );
+
+ Z8x30_READ_DATA( CONSOLE_DATA, *ch );
+ return( TRUE );
+ }
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the SCC.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from SCC
+ */
+
+char inbyte( void )
+{
+ rtems_unsigned8 rr_0;
+ char ch;
+
+ for ( ; ; ) {
+ Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
+ if ( (rr_0 & RR_0_RX_DATA_AVAILABLE) != 0 )
+ break;
+ }
+
+ Z8x30_READ_DATA( CONSOLE_DATA, ch );
+ return ( ch );
+}
+
+/* outbyte
+ *
+ * This routine transmits a character out the SCC. It supports
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ rtems_unsigned8 rr_0;
+ char flow_control;
+
+ for ( ; ; ) {
+ Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
+ if ( (rr_0 & RR_0_TX_BUFFER_EMPTY) != 0 )
+ break;
+ }
+
+ for ( ; ; ) {
+ Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
+ if ( (rr_0 & RR_0_RX_DATA_AVAILABLE) == 0 )
+ break;
+
+ Z8x30_READ_DATA( CONSOLE_DATA, flow_control );
+
+ if ( flow_control == XOFF )
+ do {
+ do {
+ Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
+ } while ( (rr_0 & RR_0_RX_DATA_AVAILABLE) == 0 );
+ Z8x30_READ_DATA( CONSOLE_DATA, flow_control );
+ } while ( flow_control != XON );
+ }
+
+ Z8x30_WRITE_DATA( CONSOLE_DATA, ch );
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/include/bsp.h b/c/src/lib/libbsp/m68k/dmv152/include/bsp.h
new file mode 100644
index 0000000000..5a31136005
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/include/bsp.h
@@ -0,0 +1,190 @@
+/* bsp.h
+ *
+ * This include file contains all DMV152 board IO definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __DMV152_h
+#define __DMV152_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <console.h>
+#include <clockdrv.h>
+#include <iosupp.h>
+#include <vmeintr.h>
+#include <z8530.h>
+#include <z8536.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ */
+
+/* use a VMEbus interrupt */
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+#define Install_tm27_vector( handler ) \
+ { \
+ set_vector( (handler), 0x50, 1 ); \
+ (*(volatile rtems_unsigned32 *)0x0d800024) = 0x50; /* set IVECT reg */ \
+ (*(volatile rtems_unsigned8 *)0x0d00000c) = 0x40; /* set VIE reg */ \
+ }
+
+#define Cause_tm27_intr() \
+ (*(volatile rtems_unsigned8 *)0x0d000003) = 0x0f /* set VINT */
+
+#define Clear_tm27_intr() /* no operation necessary */
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* macros */
+
+#undef Z8x36_STATE0
+#undef Z8x36_WRITE
+#undef Z8x36_READ
+
+#define Z8x36_STATE0 ( z8536 ) \
+ { char *garbage; \
+ (garbage) = *(VOL8(z8536+0x7)) \
+ }
+
+#define Z8x36_WRITE( z8536, reg, data ) \
+ *(VOL8(z8536+0x7)) = (reg); \
+ *(VOL8(z8536+0x7)) = (data)
+
+#define Z8x36_READ( z8536, reg, data ) \
+ *(VOL8(z8536+0x7)) = (reg); \
+ (data) = *(VOL8(z8536+0x7))
+
+/*
+ * ACC Register Addresses
+ */
+
+#define ACC_BASE 0x0D000000
+
+#define ACC_STAT0 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x00))
+#define ACC_STAT1 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x01))
+#define ACC_GENCTL ((volatile rtems_unsigned8 *) (ACC_BASE + 0x02))
+#define ACC_VINT ((volatile rtems_unsigned8 *) (ACC_BASE + 0x03))
+#define ACC_VREQ ((volatile rtems_unsigned8 *) (ACC_BASE + 0x04))
+#define ACC_VARB ((volatile rtems_unsigned8 *) (ACC_BASE + 0x05))
+#define ACC_ID ((volatile rtems_unsigned8 *) (ACC_BASE + 0x06))
+#define ACC_CTL2 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x07))
+#define ACC_7IS ((volatile rtems_unsigned8 *) (ACC_BASE + 0x08))
+#define ACC_LIS ((volatile rtems_unsigned8 *) (ACC_BASE + 0x09))
+#define ACC_7IE ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0A))
+#define ACC_LIE ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0B))
+#define ACC_VIE ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0C))
+#define ACC_IC10 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0D))
+#define ACC_IC32 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0E))
+#define ACC_IC54 ((volatile rtems_unsigned8 *) (ACC_BASE + 0x0F))
+
+/* constants */
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+#define USE_CHANNEL_A 0 /* 1 = use channel A for console */
+#define USE_CHANNEL_B 1 /* 1 = use channel B for console */
+
+#define TIMER 0x0c000000
+#define TIMER_VECTOR 0x4D
+
+#if (USE_CHANNEL_A == 1)
+#define CONSOLE_CONTROL 0x0C800007
+#define CONSOLE_DATA 0x0C800005
+#elif (USE_CHANNEL_B == 1)
+#define CONSOLE_CONTROL 0x0C800001
+#define CONSOLE_DATA 0x0C800003
+#endif
+
+/* Structures */
+
+#ifdef D152_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/dmv152/include/coverhd.h b/c/src/lib/libbsp/m68k/dmv152/include/coverhd.h
new file mode 100644
index 0000000000..0033a50502
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 2
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 2
+#define CALLING_OVERHEAD_TASK_START 2
+#define CALLING_OVERHEAD_TASK_RESTART 2
+#define CALLING_OVERHEAD_TASK_DELETE 1
+#define CALLING_OVERHEAD_TASK_SUSPEND 1
+#define CALLING_OVERHEAD_TASK_RESUME 2
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 2
+#define CALLING_OVERHEAD_TASK_MODE 2
+#define CALLING_OVERHEAD_TASK_GET_NOTE 2
+#define CALLING_OVERHEAD_TASK_SET_NOTE 2
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 2
+#define CALLING_OVERHEAD_CLOCK_GET 4
+#define CALLING_OVERHEAD_CLOCK_SET 4
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+
+#define CALLING_OVERHEAD_TIMER_CREATE 2
+#define CALLING_OVERHEAD_TIMER_IDENT 1
+#define CALLING_OVERHEAD_TIMER_DELETE 2
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
+#define CALLING_OVERHEAD_TIMER_RESET 1
+#define CALLING_OVERHEAD_TIMER_CANCEL 1
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 2
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 1
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 2
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 2
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 2
+
+#define CALLING_OVERHEAD_EVENT_SEND 2
+#define CALLING_OVERHEAD_EVENT_RECEIVE 2
+#define CALLING_OVERHEAD_SIGNAL_CATCH 2
+#define CALLING_OVERHEAD_SIGNAL_SEND 2
+#define CALLING_OVERHEAD_PARTITION_CREATE 3
+#define CALLING_OVERHEAD_PARTITION_IDENT 2
+#define CALLING_OVERHEAD_PARTITION_DELETE 2
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 2
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 2
+#define CALLING_OVERHEAD_REGION_CREATE 3
+#define CALLING_OVERHEAD_REGION_IDENT 2
+#define CALLING_OVERHEAD_REGION_DELETE 1
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 3
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 2
+#define CALLING_OVERHEAD_PORT_CREATE 3
+#define CALLING_OVERHEAD_PORT_IDENT 2
+#define CALLING_OVERHEAD_PORT_DELETE 2
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 2
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 3
+#define CALLING_OVERHEAD_IO_OPEN 2
+#define CALLING_OVERHEAD_IO_CLOSE 2
+#define CALLING_OVERHEAD_IO_READ 2
+#define CALLING_OVERHEAD_IO_WRITE 2
+#define CALLING_OVERHEAD_IO_CONTROL 2
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 2
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/dmv152/spurious/spinit.c b/c/src/lib/libbsp/m68k/dmv152/spurious/spinit.c
new file mode 100644
index 0000000000..47f6e7c0be
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/spurious/spinit.c
@@ -0,0 +1,46 @@
+/* Spurious_driver
+ *
+ * This routine installs spurious interrupt handlers for the DMV152.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <stdio.h>
+
+rtems_isr Spurious_Isr(
+ rtems_vector_number vector
+)
+{
+ void *sp = 0;
+
+ asm volatile ( "movea.l %%sp,%0 " : "=a" (sp) : "0" (sp) );
+
+ fprintf( stderr, "Vector 0x%x sp=0x%p\n", vector, sp );
+}
+
+rtems_device_driver Spurious_Initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ rtems_vector_number vector;
+
+ for ( vector = 0x40 ; vector <= 0xFF ; vector++ )
+ (void) set_vector( Spurious_Isr, vector, 1 );
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
new file mode 100644
index 0000000000..0cc4ae8e60
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
@@ -0,0 +1,252 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ m68k_isr_entry *monitors_vector_table;
+ int index;
+ void *vbr;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ monitors_vector_table = (m68k_isr_entry *)0; /* Monitor Vectors are at 0 */
+ m68k_set_vbr( monitors_vector_table );
+
+ for ( index=2 ; index<=255 ; index++ )
+ M68Kvec[ index ] = monitors_vector_table[ 32 ];
+
+ M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
+ M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
+ M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
+
+ /*
+ * Uncommenting this seems to confuse/break the monitor on this board.
+ * It probably assumes the vector table is at 0.
+ */
+
+ /* m68k_set_vbr( &M68Kvec ); */
+
+ /*
+ * Adjust the VMEbus mode to round-robin.
+ */
+
+ /*
+ * This is only apparent with the shared memory driver which has not
+ * yet been supported on this target.
+ */
+
+ m68k_enable_caching();
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ m68k_get_vbr( vbr );
+ Cpu_table.interrupt_vector_table = vbr;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ /*
+ * Add 1 region for Malloc in libc_low
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ /* Clock_exit is done as an atexit() function */
+
+ VME_interrupt_Disable( 0xff );
+
+ /* return like a "normal" subroutine to the monitor */
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/linkcmds b/c/src/lib/libbsp/m68k/dmv152/startup/linkcmds
new file mode 100644
index 0000000000..76f43eec97
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/startup/linkcmds
@@ -0,0 +1,48 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the DY-4 DMV152/SVME153 boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x12800, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x12800 :
+ {
+ text_start = . ;
+ _text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+ _etext = .;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ _data_start = . ;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+ _edata = .;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/vmeintr.c b/c/src/lib/libbsp/m68k/dmv152/startup/vmeintr.c
new file mode 100644
index 0000000000..700b06776d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/startup/vmeintr.c
@@ -0,0 +1,60 @@
+/* vmeintr.c
+ *
+ * VMEbus support routines for the DMV152.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <vmeintr.h>
+
+/*PAGE
+ *
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Disable (
+ VME_interrupt_Mask mask /* IN */
+)
+{
+ volatile rtems_unsigned8 *VME_interrupt_enable;
+ rtems_unsigned8 value;
+
+ VME_interrupt_enable = ACC_VIE;
+ value = *VME_interrupt_enable;
+
+ value &= ~mask; /* turn off interrupts for all levels in mask */
+
+ *VME_interrupt_enable = value;
+}
+
+/*PAGE
+ *
+ * VME_interrupt_Enable
+ *
+ */
+
+void VME_interrupt_Enable (
+ VME_interrupt_Mask mask /* IN */
+)
+{
+ volatile rtems_unsigned8 *VME_interrupt_enable;
+ rtems_unsigned8 value;
+
+ VME_interrupt_enable = ACC_VIE;
+ value = *VME_interrupt_enable;
+
+ value |= mask; /* turn on interrupts for all levels in mask */
+
+ *VME_interrupt_enable = value;
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/timer/timer.c b/c/src/lib/libbsp/m68k/dmv152/timer/timer.c
new file mode 100644
index 0000000000..2e91a671df
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/timer/timer.c
@@ -0,0 +1,105 @@
+/* timer.c
+ *
+ * NOTE: These routines will not work if the optimizer is enabled
+ * for some compilers. The multiple writes to the Z8036
+ * may be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+#include <bsp.h>
+
+int Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+ rtems_unsigned8 data;
+
+ (void) set_vector( timerisr, TIMER_VECTOR, 0 ); /* install ISR */
+
+ Ttimer_val = 0; /* clear timer ISR count */
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0x01) );
+
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xd4 );
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0x7E) );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_MSB, 0x00 );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0x00 );
+ Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x87 );
+ Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, TIMER_VECTOR );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x20 );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x26 );
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0xDA) | 0x80 );
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xC6 );
+
+ /*
+ * ACC_IC54 - interrupt 5 will be vectored and mapped to level 6
+ */
+
+ data = (*(rtems_unsigned8 *)0x0D00000B);
+ (*(rtems_unsigned8 *)0x0D00000B) = (data & 0x0F) | 0x60;
+
+}
+
+#define AVG_OVERHEAD 9 /* It typically takes 3.65 microseconds */
+ /* (9 countdowns) to start/stop the timer. */
+#define LEAST_VALID 10 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ rtems_unsigned8 data;
+ rtems_unsigned8 msb, lsb;
+ rtems_unsigned32 remaining, total;
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xce ); /* read the counter value */
+ Z8x36_READ( TIMER, CT1_CUR_CNT_MSB, msb );
+ Z8x36_READ( TIMER, CT1_CUR_CNT_LSB, lsb );
+
+ remaining = 0x10000 - ((msb << 8) + lsb);
+ total = (Ttimer_val * 0x10000) + remaining;
+
+ Z8x36_READ ( TIMER, MASTER_INTR, data );
+ Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0x01) );
+
+ /* do not restore old vector */
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in countdown units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ /* Clocked at 2.4615 Mhz */
+
+ return (int)(((float)(total-AVG_OVERHEAD)) / 2.4615 * 2.0);
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/dmv152/timer/timerisr.s b/c/src/lib/libbsp/m68k/dmv152/timer/timerisr.s
new file mode 100644
index 0000000000..d7ec593c62
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/timer/timerisr.s
@@ -0,0 +1,38 @@
+/* timer_isr()
+ *
+ * This routine provides the ISR for the Z8536 timer on the DMV152
+ * board. The timer is set up to generate an interrupt at maximum
+ * intervals.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+
+.set TIMER, 0x0c000007 | port A
+.set CT1_CMD_STATUS, 0x0a | command status register
+.set RELOAD, 0x26 | clr IP & IUS,allow countdown
+
+ PUBLIC(timerisr)
+SYM (timerisr):
+ movb #CT1_CMD_STATUS,TIMER | set pointer to cmd status reg
+ movb #RELOAD,TIMER | reload countdown
+ addql #1, SYM (Ttimer_val) | increment timer value
+ rte
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/m68k/dmv152/times b/c/src/lib/libbsp/m68k/dmv152/times
new file mode 100644
index 0000000000..6d59b87862
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/dmv152/times
@@ -0,0 +1,195 @@
+#
+# Timing Test Suite Results for the DY-4 DMV152 BSP
+#
+# NOTE: These times also also applicable to similar configurations of
+# the DY-4 SVME153 which is the commercial grade version of the
+# same board.
+#
+# $Id$
+#
+
+Board: DY-4 DMV152 / DY-4 SVME153
+CPU: Motorola MC68020
+Clock Speed: 20 Mhz
+Memory Configuration: SRAM
+Wait States: 0
+
+Times Reported in: microseconds
+Timer Source: Zilog Z8036 Count Down Timer
+
+Column A: 3.5.1 pre-release
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 67
+ rtems_semaphore_delete 63
+ rtems_semaphore_obtain: available 45
+ rtems_semaphore_obtain: not available -- NO_WAIT 44
+ rtems_semaphore_release: no waiting tasks 49
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 114
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 92
+
+ 4 rtems_task_restart: blocked task -- preempts caller 153
+ rtems_task_restart: ready task -- preempts caller 145
+ rtems_semaphore_release: task readied -- returns to caller 71
+ rtems_task_create 154
+ rtems_task_start 83
+ rtems_task_restart: suspended task -- returns to caller 95
+ rtems_task_delete: suspended task 144
+ rtems_task_restart: ready task -- returns to caller 98
+ rtems_task_restart: blocked task -- returns to caller 128
+ rtems_task_delete: blocked task 149
+
+ 5 rtems_task_suspend: calling task 76
+ rtems_task_resume: task readied -- preempts caller 72
+
+ 6 rtems_task_restart: calling task 100
+ rtems_task_suspend: returns to caller 49
+ rtems_task_resume: task readied -- returns to caller 50
+ rtems_task_delete: ready task 150
+
+ 7 rtems_task_restart: suspended task -- preempts caller 100
+
+ 8 rtems_task_set_priority: obtain current priority 37
+ rtems_task_set_priority: returns to caller 69
+ rtems_task_mode: obtain current mode 16
+ rtems_task_mode: no reschedule 18
+ rtems_task_mode: reschedule -- returns to caller 24
+ rtems_task_mode: reschedule -- preempts caller 66
+ rtems_task_set_note 39
+ rtems_task_get_note 39
+ rtems_clock_set 90
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 206
+ rtems_message_queue_send: no waiting tasks 103
+ rtems_message_queue_urgent: no waiting tasks 102
+ rtems_message_queue_receive: available 87
+ rtems_message_queue_flush: no messages flushed 37
+ rtems_message_queue_flush: messages flushed 46
+ rtems_message_queue_delete 85
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 52
+ rtems_message_queue_receive: not available -- caller blocks 119
+
+11 rtems_message_queue_send: task readied -- preempts caller 128
+
+12 rtems_message_queue_send: task readied -- returns to caller 106
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 128
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 106
+
+15 rtems_event_receive: obtain current events 0
+ rtems_event_receive: not available -- NO_WAIT 32
+ rtems_event_receive: not available -- caller blocks 91
+ rtems_event_send: no task readied 34
+ rtems_event_receive: available 37
+ rtems_event_send: task readied -- returns to caller 66
+
+16 rtems_event_send: task readied -- preempts caller 89
+
+17 rtems_task_set_priority: preempts caller 109
+
+18 rtems_task_delete: calling task 175
+
+19 rtems_signal_catch 24
+ rtems_signal_send: returns to caller 43
+ rtems_signal_send: signal to self 50
+ exit ASR overhead: returns to calling task 37
+ exit ASR overhead: returns to preempting task 64
+
+20 rtems_partition_create 79
+ rtems_region_create 72
+ rtems_partition_get_buffer: available 43
+ rtems_partition_get_buffer: not available 41
+ rtems_partition_return_buffer 51
+ rtems_partition_delete 47
+ rtems_region_get_segment: available 59
+ rtems_region_get_segment: not available -- NO_WAIT 55
+ rtems_region_return_segment: no waiting tasks 63
+ rtems_region_get_segment: not available -- caller blocks 127
+ rtems_region_return_segment: task readied -- preempts caller 143
+ rtems_region_return_segment: task readied -- returns to caller 121
+ rtems_region_delete 47
+ rtems_io_initialize 6
+ rtems_io_open 3
+ rtems_io_close 2
+ rtems_io_read 2
+ rtems_io_write 2
+ rtems_io_control 2
+
+21 rtems_task_ident 352
+ rtems_message_queue_ident 343
+ rtems_semaphore_ident 369
+ rtems_partition_ident 342
+ rtems_region_ident 349
+ rtems_port_ident 342
+ rtems_timer_ident 344
+ rtems_rate_monotonic_ident 343
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 114
+ rtems_message_queue_broadcast: no waiting tasks 58
+ rtems_message_queue_broadcast: task readied -- preempts caller 136
+
+23 rtems_timer_create 36
+ rtems_timer_fire_after: inactive 64
+ rtems_timer_fire_after: active 68
+ rtems_timer_cancel: active 41
+ rtems_timer_cancel: inactive 38
+ rtems_timer_reset: inactive 59
+ rtems_timer_reset: active 63
+ rtems_timer_fire_when: inactive 93
+ rtems_timer_fire_when: active 93
+ rtems_timer_delete: active 54
+ rtems_timer_delete: inactive 50
+ rtems_task_wake_when 120
+
+24 rtems_task_wake_after: yield -- returns to caller 25
+ rtems_task_wake_after: yields -- preempts caller 63
+
+25 rtems_clock_tick 13
+
+26 _ISR_Disable 1
+ _ISR_Flash 1
+ _ISR_Enable 0
+ _Thread_Disable_dispatch 1
+ _Thread_Enable_dispatch 20
+ _Thread_Set_state 24
+ _Thread_Disptach (NO FP) 52
+ context switch: no floating point contexts 43
+ context switch: self 9
+ context switch: to another task 9
+ context switch: restore 1st FP task 47
+ fp context switch: save idle, restore idle 73
+ fp context switch: save idle, restore initialized 60
+ fp context switch: save initialized, restore initialized 58
+ _Thread_Resume 17
+ _Thread_Unblock 17
+ _Thread_Ready 22
+ _Thread_Get 11
+ _Semaphore_Get 10
+ _Thread_Get: invalid id 2
+
+27 interrupt entry overhead: returns to interrupted task 10
+ interrupt exit overhead: returns to interrupted task 9
+ interrupt entry overhead: returns to nested interrupt 9
+ interrupt exit overhead: returns to nested interrupt 6
+ interrupt entry overhead: returns to preempting task 10
+ interrupt exit overhead: returns to preempting task 62
+
+28 rtems_port_create 44
+ rtems_port_external_to_internal 34
+ rtems_port_internal_to_external 34
+ rtems_port_delete 45
+
+29 rtems_rate_monotonic_create 41
+ rtems_rate_monotonic_period: initiate period -- returns to caller 61
+ rtems_rate_monotonic_period: obtain status 39
+ rtems_rate_monotonic_cancel 46
+ rtems_rate_monotonic_delete: inactive 55
+ rtems_rate_monotonic_delete: active 58
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 82
diff --git a/c/src/lib/libbsp/m68k/efi332/README b/c/src/lib/libbsp/m68k/efi332/README
new file mode 100644
index 0000000000..12d8cc13cf
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/README
@@ -0,0 +1,42 @@
+#
+# $Id$
+#
+
+Description: efi68k
+============
+CPU: MC68332 @16MHz
+RAM: 256k max. (supports several configurations)
+ROM: 512k (supports several configurations)
+
+ This general purpose controller has been designed by a group of
+Internet subscribes to the mailing list "efi332" (an offshoot of the
+"diy_efi" mailing list). Although efi332 was initially designed for
+automotive research, it is a fairly generalized embedded controller
+when used without the companion EFI board. It is patterned much after
+the the Motorola BCC but cost on the order of $250US. A 4x3 inch
+(approx.) printed circuit board is available. For complete
+information see
+
+ http://www.cim.swin.edu.au/wwwhome/aden/efi332/332_index.html
+
+TODO:
+=====
+- add separate interrupt stack (low priority).
+
+- add a timer driver for the tmtest set.
+
+- generate include/coverhd.c to preform the tmtest.
+
+- the interrupt drive I/O should be integrated into the RTEMS.
+
+- finish the ROM memory model.
+
+
+ John S Gwynne
+ Gwynne.1@osu.edu
+_______________________________________________________________________________
+ T h e O h i o - S t a t e U n i v e r s i t y
+ ElectroScience Laboratory, 1320 Kinnear Road, Columbus, Ohio 43212, USA
+ Telephone: (614) 292-7981 * Fax: (614) 292-7297
+-------------------------------------------------------------------------------
+
diff --git a/c/src/lib/libbsp/m68k/efi332/clock/ckinit.c b/c/src/lib/libbsp/m68k/efi332/clock/ckinit.c
new file mode 100644
index 0000000000..8b46fc283d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/clock/ckinit.c
@@ -0,0 +1,137 @@
+/* Clock_init()
+ *
+ * This routine initailizes the periodic interrupt timer on
+ * the Motorola 68332.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <efi332.h>
+
+#define CLOCK_VECTOR EFI_PIV
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+volatile rtems_unsigned32 Clock_driver_ticks;
+ /* ticks since initialization */
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+rtems_isr Clock_isr(rtems_vector_number vector)
+{
+ Clock_driver_ticks += 1;
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+
+ /* enable 1mS interrupts */
+ *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
+ *PICR = (unsigned short int) /* enable interrupt */
+ ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
+
+ atexit( Clock_exit );
+ }
+}
+
+void Clock_exit( void )
+{
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+
+ /* shutdown the periodic interrupt */
+ *PICR = (unsigned short int)
+ ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
+ /* ^^ zero disables interrupt */
+
+ /* do not restore old vector */
+
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi332/console/console.c b/c/src/lib/libbsp/m68k/efi332/console/console.c
new file mode 100644
index 0000000000..b16ec72334
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/console/console.c
@@ -0,0 +1,390 @@
+/*
+ * This file contains the efi332 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/* BUFFER_LENGTH must be 2^n for n=1, 2, 3, .... */
+#define BUFFER_LENGTH 256
+#define RTS_STOP_SIZE BUFFER_LENGTH-64
+#define RTS_START_SIZE 16
+
+char xmt_buf[BUFFER_LENGTH];
+char rcv_buf[BUFFER_LENGTH];
+/* in: last entry into the buffer; always on a valid character */
+/* out: points to the next character to be pull from the buffer */
+/* in+1=out => buffer empty */
+/* in+2=out => buffer full */
+struct UART_buf {
+ char *offset;
+ char *in;
+ char *out;
+};
+static volatile struct UART_buf xmt = { xmt_buf, (char *)0, (char *)1};
+static volatile struct UART_buf rcv = { rcv_buf, (char *)0, (char *)1};
+static volatile char _debug_flag = 0;
+
+#define SET_RTS(a) {*PORTF0 = (*PORTF0 & 0x4) | ( (a)? 0 : 0x4); }
+#define GET_CTS (!(*PORTF0 & 0x2))
+
+/* _catchSCIint, _catchCTSint, and _catchSPURIOUSint are the
+ interrupt front-ends */
+extern void _catchSCIint();
+asm(" .text
+ .align 2
+ .globl _catchSCIint
+_catchSCIint:
+ moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */
+ jbsr uart_interrupt
+ moveml %sp@+,%d0-%d7/%a0-%a6
+ rte
+ ");
+
+extern void _catchCTSint();
+asm(" .text
+ .align 2
+ .globl _catchCTSint
+_catchCTSint:
+ moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */
+ jbsr cts_interrupt
+ moveml %sp@+,%d0-%d7/%a0-%a6
+ rte
+ ");
+
+extern void _catchSPURIOUSint();
+asm(" .text
+ .align 2
+ .globl _catchSPURIOUSint
+_catchSPURIOUSint:
+ moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */
+ jbsr spurious_interrupt
+ moveml %sp@+,%d0-%d7/%a0-%a6
+ rte
+ ");
+
+int _spurious_int_counter=0;
+
+/* note: cts uses int1. If it "bounces", a spurious interrupt is generated */
+void spurious_interrupt(void) {
+ _spurious_int_counter++; /* there should never be alot of these */
+}
+
+/* _fake_trap_1 will continue the UART interrupt (%sr *still*
+ UART_ISR_LEVEL) as a trap #1 to enter the debugger */
+
+/* *****fix me; this is for 68000 w/jsr ram exception table ******* */
+asm(" .text
+ .align 2
+_fake_trap_1:
+ unlk %a6 /* clear interrupt frame */
+ lea %sp@(4),%sp /* remove jbsr instruction */
+ moveml %sp@+,%d0-%d7/%a0-%a6 /* pop registers */
+ jmp (33*6-12) /* jump exception 1 */
+ ");
+
+/* dispatch UART interrupt */
+void xmit_interrupt(void);
+void rcvr_interrupt(void);
+void _fake_trap_1(void);
+
+void uart_interrupt(void) {
+ /* receiver status bits are cleared by a SCSR read followed
+ by a SCDR read. transmitter status bits are cleared by
+ a SCSR read followed by a SCDR write. */
+ if ((*SCSR) & (TDRE | TC))
+ xmit_interrupt();
+
+ if ((*SCSR) & (RDRF))
+ rcvr_interrupt();
+
+ if (_debug_flag) {
+ _debug_flag = 0; /* reset the flag */
+ _fake_trap_1(); /* fake a trap #1 */
+ }
+}
+
+/* transfer received character to the buffer */
+void rcvr_interrupt(void) {
+ register char *a, c;
+ register int length;
+
+ while((*SCSR) & (RDRF)) {
+ if ((c=*SCDR) == 0x1a) /* use ctl-z to reboot */
+ reboot();
+/* else if (c == 0x03) { */ /* use ctl-c to enter debugger */
+/* _debug_flag = 1; */
+/* continue; */
+/* } */
+
+ *(char *)((int)rcv.offset +(int)
+ (a=(char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1)))) = c;
+ if ((char *)(((int)rcv.in+2) & ((int)BUFFER_LENGTH-1)) != rcv.out)
+ rcv.in=a;
+ };
+
+ length = (BUFFER_LENGTH -1) & (
+ ( ((int)rcv.out <= (int)rcv.in) ? 0 : BUFFER_LENGTH) - (int)rcv.out
+ + (int)rcv.in + 1);
+ if (length >= RTS_STOP_SIZE)
+ SET_RTS(0);
+}
+
+/* tranfer buffered characters to the UART */
+void xmit_interrupt(void) {
+ register short int oldsr;
+
+ _CPU_ISR_Disable( oldsr ); /* for when outbyte or flush calls */
+ while ((*SCSR) & (TDRE)) {
+ if ((char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1)) != xmt.out)
+ /* xmit buffer not empty */
+ if (GET_CTS) {
+ /* send next char */
+ *SCDR=*(char *)((int)xmt.offset+(int)xmt.out);
+ xmt.out= (char *)(((int)xmt.out+1) & ((int)BUFFER_LENGTH-1));
+ *SCCR1 = (*SCCR1 & ~(TIE | TCIE)) | (TIE);
+ }
+ else {
+ /* configue CTS interrupt and shutdown xmit interrupts */
+ *SCCR1 &= ~(TIE | TCIE);
+ *PFPAR |= 0x2;
+ break;
+ }
+ else {
+ /* xmit buffer empty; shutdown interrupts */
+ *SCCR1 &= ~(TIE | TCIE);
+ break;
+ }
+ }
+ _CPU_ISR_Enable( oldsr );
+}
+
+void cts_interrupt(void) {
+ register short int oldsr;
+
+ _CPU_ISR_Disable( oldsr ); /* for when outbyte calls */
+
+ *PFPAR &= ~0x2;
+ *SCCR1 = (*SCCR1 & ~(TIE | TCIE)) | (TIE);
+
+ _CPU_ISR_Enable( oldsr );
+}
+
+
+
+/* transfer character from the buffer */
+char inbyte(void) {
+ register char a;
+ register int length;
+
+ while ((char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1))== rcv.out);
+ a=*(char *)((int)rcv.offset+(int)rcv.out);
+ rcv.out= (char *)(((int)rcv.out+1) & ((int)BUFFER_LENGTH-1));
+ length = (BUFFER_LENGTH -1) & (
+ ( ((int)rcv.out <= (int)rcv.in) ? 0 : BUFFER_LENGTH) - (int)rcv.out
+ + (int)rcv.in + 1);
+ if (length < RTS_START_SIZE)
+ SET_RTS(1);
+ return (a);
+}
+
+/* once room is avaliable in the buffer, transfer
+ the character into the buffer and enable
+ the xmtr interrupt */
+void outbyte(char c) {
+ register char *a;
+
+ while ((char *)(((int)xmt.in+2) & ((int)BUFFER_LENGTH-1)) == xmt.out);
+ *(char *)((int)xmt.offset+(int)
+ (a=(char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1))))=c;
+ xmt.in=a;
+
+ if (!(*SCCR1 & (TIE | TCIE)) && (!(*PFPAR & 0x2)) )
+ /* if neither interrupts are running, */
+ xmit_interrupt(); /* we need to restart the xmiter */
+}
+
+void _UART_flush(void) {
+ /* loop till xmt buffer empty. Works with interrupts disabled */
+ while ((char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1)) != xmt.out)
+ xmit_interrupt();
+ /* loop till UART buffer empty */
+ while ( (*SCSR & TC) == 0 );
+}
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ *QSMCR = ( SAM(QSM_IARB,0,IARB) );
+ *QILR = ( SAM(ISRL_QSPI,4,ILQSPI) | SAM(ISRL_SCI,0,ILSCI) );
+ *QIVR = ( SAM(EFI_QIVR,0,INTV) );
+
+ *SCCR0 = ( (int)( SYS_CLOCK/SCI_BAUD/32.0+0.5 ) & 0x1fff );
+ *SCCR1 = ( RIE | TE | RE );
+
+ set_vector(_catchSPURIOUSint, EFI_SPINT, 0);
+ set_vector(_catchSCIint, EFI_QIVR, 0);
+ set_vector(_catchCTSint, EFI_INT1, 0);
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ if ((char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1))== rcv.out)
+ return(FALSE);
+ else
+ return(TRUE);
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi332/include/bsp.h b/c/src/lib/libbsp/m68k/efi332/include/bsp.h
new file mode 100644
index 0000000000..dd876eeeec
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/include/bsp.h
@@ -0,0 +1,147 @@
+/* bsp.h
+ *
+ * This include file contains all efi332 board IO definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EFI332_BSP_h
+#define __EFI332_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+#include <efi332.h>
+#include <sim.h>
+#include <qsm.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ */
+
+/* XXX - JRS - I want to compile the tmtests */
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+#define Install_tm27_vector( handler )
+
+#define Cause_tm27_intr()
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* macros */
+
+#define RAM_START 0x80000
+#define RAM_END 0xc0000
+
+#define RAW_PUTS(str) \
+ { register char *ptr = str; \
+ while (*ptr) outbyte(*ptr++); \
+ }
+
+#define RAW_PUTI(n) { \
+ register int i, j; \
+ \
+ RAW_PUTS("0x"); \
+ for (i=28;i>=0;i -= 4) { \
+ j = (n>>i) & 0xf; \
+ outbyte( (j>9 ? j-10+'a' : j+'0') ); \
+ } \
+ }
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+extern int stack_size;
+
+extern int stack_start;
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+void console_init(void);
+
+void Spurious_Initialize(void);
+
+void _UART_flush(void);
+
+void Clock_exit(void);
+
+void outbyte(char);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/efi332/include/coverhd.h b/c/src/lib/libbsp/m68k/efi332/include/coverhd.h
new file mode 100644
index 0000000000..671f20d197
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/include/coverhd.h
@@ -0,0 +1,106 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#endif
diff --git a/c/src/lib/libbsp/m68k/efi332/include/efi332.h b/c/src/lib/libbsp/m68k/efi332/include/efi332.h
new file mode 100644
index 0000000000..80d23f291a
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/include/efi332.h
@@ -0,0 +1,46 @@
+/* efi332.h
+ *
+ * $Id$
+ */
+
+#ifndef _EFI332_H_
+#define _EFI332_H_
+
+
+/* SIM_MM (SIM Module Mapping) determines the location of the control
+ register block. When MM=0, register addresses range fom 0x7ff000 to
+ 0x7FFFFF. When MM=1, register addresses range from 0xfff000 to
+ 0xffffff. */
+#define SIM_MM 1
+
+
+/* Interrupt related definitions */
+#define SIM_IARB 15
+#define QSM_IARB 10
+
+#define EFI_PIV 64
+#define ISRL_PIT 4 /* zero disables PIT */
+
+#define EFI_QIVR 66 /* 66=>SCI and 67=>QSPI interrupt */
+#define ISRL_QSPI 0
+
+#define EFI_SPINT 24 /* spurious interrupt */
+#define EFI_INT1 25 /* CTS interrupt */
+#define ISRL_SCI 6
+
+
+
+/* System Clock definitions */
+#define XTAL 32768.0 /* crystal frequency in Hz */
+#define EFI_W 0 /* system clock parameters */
+#define EFI_X 1
+#define EFI_Y 0x38
+#define SYS_CLOCK (XTAL*4.0*(EFI_Y+1)*(1 << (2*EFI_W+EFI_X)))
+#define SCI_BAUD 19200 /* RS232 Baud Rate */
+
+
+/* macros/functions */
+static void reboot(void) __attribute__ ((noreturn));
+__inline__ static void reboot() {asm("trap #15");}
+
+#endif /* _EFI332_H_ */
diff --git a/c/src/lib/libbsp/m68k/efi332/spurious/spinit.c b/c/src/lib/libbsp/m68k/efi332/spurious/spinit.c
new file mode 100644
index 0000000000..3370cb0e30
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/spurious/spinit.c
@@ -0,0 +1,85 @@
+/* Spurious_driver
+ *
+ * This routine installs spurious interrupt handlers for the efi332.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <stdio.h>
+
+const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
+ "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
+ "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
+ "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
+ "Coprocessor Protocal Violation",
+ "Format Error ans Uninitialized Interrupt","Unassigned",
+ "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
+ "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
+ "Reserved Unassigned","User Defined"};
+
+rtems_isr Spurious_Isr(
+ rtems_vector_number vector
+)
+{
+ int sp = 0;
+ const char * const VectDescrip[] = {
+ _Spurious_Error_[0], _Spurious_Error_[0], _Spurious_Error_[1],
+ _Spurious_Error_[2], _Spurious_Error_[3], _Spurious_Error_[4],
+ _Spurious_Error_[5], _Spurious_Error_[6], _Spurious_Error_[7],
+ _Spurious_Error_[8], _Spurious_Error_[9], _Spurious_Error_[10],
+ _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
+ _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
+ _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
+ _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
+ _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
+ _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
+ _Spurious_Error_[27], _Spurious_Error_[28]};
+
+ asm volatile ( "movea.l %%sp,%0 " : "=a" (sp) : "0" (sp) );
+
+ _CPU_ISR_Set_level( 7 );
+ _UART_flush();
+
+ RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
+ RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
+ RAW_PUTS("\n\rRTEMS: Vector: ");
+ RAW_PUTI(vector);
+ RAW_PUTS(" sp: ");
+ RAW_PUTI(sp);
+ RAW_PUTS("\n\r");
+
+ bsp_cleanup();
+
+ for(;;);
+}
+
+void Spurious_Initialize(void)
+{
+ rtems_vector_number vector;
+
+ for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
+ (void) set_vector( Spurious_Isr, vector, 1 );
+}
diff --git a/c/src/lib/libbsp/m68k/efi332/startup/bspclean.c b/c/src/lib/libbsp/m68k/efi332/startup/bspclean.c
new file mode 100644
index 0000000000..34a57b6b68
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/startup/bspclean.c
@@ -0,0 +1,28 @@
+/* bsp_cleanup()
+ *
+ * This routine cleans up in the sense that it places the board
+ * in a safe state and flushes the I/O buffers before exiting.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+void bsp_cleanup(void)
+{
+ /* interrupt driven stdio must be flushed */
+ _CPU_ISR_Set_level( 7 );
+ _UART_flush();
+}
diff --git a/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
new file mode 100644
index 0000000000..82dbb94638
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
@@ -0,0 +1,222 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ void *vbr;
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook;
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ m68k_get_vbr( vbr );
+ Cpu_table.interrupt_vector_table = vbr;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ if ((unsigned int)BSP_Configuration.work_space_start <
+ (unsigned int)((stack_start + stack_size) & 0xffffffc0) ) {
+ /* rtems_fatal_error_occurred can not be used before initalization */
+ RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
+ RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
+ goto exit;
+ }
+
+ /*
+ * Add 1 region for Malloc in libc_low
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ /* Clock_exit is done as an atexit() function */
+
+exit:
+ /* configure peripherals for safe exit */
+ bsp_cleanup();
+
+ /* return like a "normal" subroutine to the monitor */
+ return 0;
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi332/startup/linkcmds b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds
new file mode 100644
index 0000000000..37d1eb5667
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds
@@ -0,0 +1,100 @@
+/* linkcmds
+ *
+ * $Id$
+ */
+
+OUTPUT_ARCH(m68k)
+__DYNAMIC = 0;
+
+/*
+ * The memory map looks like this:
+ * +--------------------+ <- low memory
+ * | .text |
+ * | etext |
+ * | ctor list | the ctor and dtor lists are for
+ * | dtor list | C++ support
+ * | _endtext |
+ * +--------------------+
+ * | .data | initialized data goes here
+ * | _sdata |
+ * | _edata |
+ * +--------------------+
+ * | .bss |
+ * | __bss_start | start of bss, cleared by crt0
+ * | _end | start of heap, used by sbrk()
+ * +--------------------+
+ * | heap space |
+ * | _ENDHEAP |
+ * | stack space |
+ * | __stack | top of stack
+ * +--------------------+ <- high memory
+ */
+
+MEMORY
+{
+ ram : ORIGIN = 0x80000, LENGTH = 256K
+}
+
+_copy_data_from_rom = 0;
+
+/*
+ * stick everything in ram (of course)
+ */
+SECTIONS
+{
+ .text :
+ {
+ CREATE_OBJECT_SYMBOLS
+ text_start = .;
+ _text_start = .;
+ *(.text)
+ etext = ALIGN(0x10);
+ _etext = .;
+ __CTOR_LIST__ = .;
+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
+ *(.ctors)
+ LONG(0)
+ __CTOR_END__ = .;
+ __DTOR_LIST__ = .;
+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
+ *(.dtors)
+ LONG(0)
+ __DTOR_END__ = .;
+ *(.lit)
+ *(.shdata)
+ _endtext = .;
+ } > ram
+ .data :
+ {
+ data_start = .;
+ _data_start = .;
+ _sdata = . ;
+ *(.data)
+ CONSTRUCTORS
+ edata = ALIGN(0x10);
+ _edata = .;
+ } > ram
+ .shbss :
+ {
+ *(.shbss)
+ } > ram
+ .bss :
+ {
+ __bss_start = ALIGN(0x8);
+ bss_start = .;
+ _bss_start = .;
+ *(.bss)
+ *(COMMON)
+ end = .;
+ _end = ALIGN(0x8);
+ __end = ALIGN(0x8);
+ } > ram
+ .stab . (NOLOAD) :
+ {
+ [ .stab ]
+ }
+ .stabstr . (NOLOAD) :
+ {
+ [ .stabstr ]
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/efi332/timer/timer.c b/c/src/lib/libbsp/m68k/efi332/timer/timer.c
new file mode 100644
index 0000000000..7a9b1b6267
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/timer/timer.c
@@ -0,0 +1,84 @@
+/* Timer_init()
+ *
+ * This routine initializes a timer in efi68k's DP8570A TCP
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <bsp.h>
+
+rtems_boolean Timer_driver_Find_average_overhead;
+
+extern rtems_isr Clock_isr();
+
+void Timer_initialize( void )
+{
+}
+
+/*
+ * The following controls the behavior of Read_timer().
+ *
+ * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count.
+ *
+ * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
+ * is usually deducted from the number returned.
+ *
+ * LEAST_VALID is the lowest number this routine should trust. Numbers
+ * below this are "noise" and zero is returned.
+ */
+
+#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
+ /* (Y countdowns) to start/stop the timer. */
+ /* This value is in microseconds. */
+#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
+
+/*
+ * Return timer value in 1/2-microsecond units
+ */
+int Read_timer( void )
+{
+ rtems_unsigned32 total;
+ total = 0;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ return (total - AVG_OVERHEAD);
+}
+
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+
+rtems_status_code Empty_function(void)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/efi332/times b/c/src/lib/libbsp/m68k/efi332/times
new file mode 100644
index 0000000000..17ac20f2cf
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi332/times
@@ -0,0 +1,193 @@
+#
+# Timing Test Suite Results for the EFI332 BSP
+#
+# $Id$
+#
+
+NOTE: This BSP is used submitted and no information is currently available.
+
+Board: EFI332
+CPU: 68332
+Clock Speed: 20 Mhz
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/efi68k/README b/c/src/lib/libbsp/m68k/efi68k/README
new file mode 100644
index 0000000000..7a431fd48b
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/README
@@ -0,0 +1,48 @@
+#
+# $Id$
+#
+
+Description: efi68k
+============
+CPU: MC68HC000 @16MHz
+RAM: 256k
+ROM: 256k
+
+ Based upon a 16MHz 68HC000, efi332 is a minimally configured 4x6
+inch single board computer. It includes the following major
+components: (a) 256k SRAM (km681000l), (b) 256 EPROM (27C010),
+(c) DP8570A (clock/timer/calendar), (d) MAX791 (cpu supervisory chip
+with battery backup switch-over and watch dog timer), and
+(e) NS16550DN (UART). The following interrupt functions have also been
+incorporated: UART, TIMER, Watch Dog, and Low Line voltage (trips at
+4.85V; enough time to save the cpu reg before reset is asserted on
+power down).
+ The schematic for efi68k is freely available via e-mail. Send
+"index diy_efi" to majordomo@coulomb.eng.ohio-state.edu. Retrieve the
+files related to 68hc000-1.00 with the "get diy_efi <filename>"
+command. efi68k does not have an available printed circuit board, but
+can be wire-wrapped in about four days. Cost is about $100US.
+
+For more information, I can be contacted at the address below.
+
+
+TODO:
+=====
+- add separate interrupt stack (low priority).
+
+- add the "tm27 vector" ... can we use a trap instruction?
+
+- generate include/coverhd.c to preform the tmtest.
+
+- the interrupt drive I/O should be integrated into the RTEMS.
+
+- finish the ROM memory model.
+
+ John S Gwynne
+ Gwynne.1@osu.edu
+_______________________________________________________________________________
+ T h e O h i o - S t a t e U n i v e r s i t y
+ ElectroScience Laboratory, 1320 Kinnear Road, Columbus, Ohio 43212, USA
+ Telephone: (614) 292-7981 * Fax: (614) 292-7297
+-------------------------------------------------------------------------------
+
diff --git a/c/src/lib/libbsp/m68k/efi68k/clock/ckinit.c b/c/src/lib/libbsp/m68k/efi68k/clock/ckinit.c
new file mode 100644
index 0000000000..9c698cd0ba
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/clock/ckinit.c
@@ -0,0 +1,157 @@
+/* Clock_init()
+ *
+ * This routine initializes the DP8570A periodic interrupt on the
+ * efi68k board. The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#define CLOCK_VECTOR (TCP_ISR_LEVEL+24)
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+volatile rtems_unsigned32 Clock_driver_ticks;
+ /* ticks since initialization */
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+
+void per_interrupt(void)
+{
+ Clock_driver_ticks += 1;
+
+ *MSR = PER;
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ unsigned char entry_msr, msr;
+
+ entry_msr = *MSR;
+ *MSR = 0;
+ while ( (msr=*MSR) & INT )
+ /* test enabled interrupt bits */
+ if (msr & PER)
+ per_interrupt();
+ else if (msr & T0) {
+ *MSR = T0; /* reset interrupt */
+ Timer_interrupts++; /* inc wrap around counter */
+ }
+ else
+ /* there has been an error if we reach this point */
+ /* default action: reset all the interrupts */
+ *MSR = ( PER | AL | T0 | T1 );
+ *MSR = entry_msr & (RS | PS);
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+
+ *MSR = RS; /* enable 1mS interrupts */
+ *ICR0 |= OME;
+
+ atexit( Clock_exit );
+ }
+}
+
+void Clock_exit( void )
+{
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+
+ /* shutdown periodic interrupt */
+ *MSR = RS;
+ *ICR0 &= 0xc0;
+ /* do not restore old vector */
+
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/console/console.c b/c/src/lib/libbsp/m68k/efi68k/console/console.c
new file mode 100644
index 0000000000..73e3cff1fe
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/console/console.c
@@ -0,0 +1,363 @@
+/*
+ * This file contains the efi68k console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+
+
+#define BAUD 38400
+#define CLK_FREQ 8000000.0
+
+/* BUFFER_LENGTH must be 2^n for n=1, 2, 3, .... */
+#define BUFFER_LENGTH 256
+#define RTS_STOP_SIZE BUFFER_LENGTH-64
+#define RTS_START_SIZE 16
+
+char xmt_buf[BUFFER_LENGTH];
+char rcv_buf[BUFFER_LENGTH];
+/* in: last entry into the buffer; always on a valid character */
+/* out: points to the next character to be pull from the buffer */
+/* in+1=out => buffer empty */
+/* in+2=out => buffer full */
+struct UART_buf {
+ char *offset;
+ char *in;
+ char *out;
+};
+static volatile struct UART_buf xmt = { xmt_buf, (char *)0, (char *)1};
+static volatile struct UART_buf rcv = { rcv_buf, (char *)0, (char *)1};
+static volatile char _debug_flag = 0;
+static volatile char _tx_stop = 0;
+
+/* _catchUARTint is the interrupt front-end */
+extern void _catchUARTint();
+asm(" .text
+ .align 2
+ .globl _catchUARTint
+_catchUARTint:
+ lea %sp@(4),%sp /* pop return address */
+ moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */
+ jbsr uart_interrupt
+ moveml %sp@+,%d0-%d7/%a0-%a6
+ rte
+ ");
+
+/* _fake_trap_1 will continue the UART interrupt (%sr *still*
+ UART_ISR_LEVEL) as a trap #1 to enter the debugger */
+asm(" .text
+ .align 2
+_fake_trap_1:
+ unlk %a6 /* clear interrupt frame */
+ lea %sp@(4),%sp /* remove jbsr instruction */
+ moveml %sp@+,%d0-%d7/%a0-%a6 /* pop registers */
+ jmp (33*6-12+_VBR) /* jump exception 1 */
+ ");
+
+/* dispatch UART interrupt */
+void xmit_interrupt(void);
+void rcvr_interrupt(void);
+void modem_status(void);
+void _fake_trap_1(void);
+void uart_interrupt(void) {
+ register char a;
+
+ a=*IIR & (NIP | IID_MASK); /* read interrupt id register */
+ switch (a) {
+ case 0x04: case 0x0c:
+ rcvr_interrupt();
+ break;
+ case 0x02:
+ xmit_interrupt();
+ break;
+ case 0x00:
+ modem_status();
+ break;
+ default:
+ break;
+ }
+ if (_debug_flag) {
+ _debug_flag = 0; /* reset the flag */
+ _fake_trap_1(); /* fake a trap #1 */
+ }
+}
+
+/* transfer received character to the buffer */
+void rcvr_interrupt(void) {
+ register char *a, c;
+ register int length;
+
+ while ( (*LSR & DR) != 0) {
+ if ((c=*RBR) == 0x1a) /* use ctl-z to reboot */
+ reboot();
+ else if (c == 0x03) { /* use ctl-c to enter debugger */
+ _debug_flag = 1;
+ continue;
+ }
+ *(char *)((int)rcv.offset +(int)
+ (a=(char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1)))) = c;
+ if ((char *)(((int)rcv.in+2) & ((int)BUFFER_LENGTH-1)) != rcv.out)
+ rcv.in=a;
+ }
+ length = (BUFFER_LENGTH -1) & (
+ ( ((int)rcv.out <= (int)rcv.in) ? 0 : BUFFER_LENGTH) - (int)rcv.out
+ + (int)rcv.in + 1);
+ if (length >= RTS_STOP_SIZE)
+ *MCR &= (char) (~RTS);
+}
+
+/* tranfer buffered characters to the UART */
+void xmit_interrupt(void) {
+ register short int i, oldsr;
+
+ _CPU_ISR_Disable( oldsr ); /* for when outbyte calls */
+ if ( (*LSR & THRE) != 0 && _tx_stop == 0 )
+ for (i=0;i<16;i++) {
+ if ((char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1))== xmt.out)
+ break;
+ *THR=*(char *)((int)xmt.offset+(int)xmt.out);
+ xmt.out= (char *)(((int)xmt.out+1) & ((int)BUFFER_LENGTH-1));
+ }
+ _CPU_ISR_Enable( oldsr );
+}
+
+void modem_status(void) {
+ register char a;
+
+ if ( ((a=*MDSR) & DCTS) != 0 )
+ if ( (a & CTS) == 0)
+ _tx_stop = 1;
+ else {
+ _tx_stop = 0;
+ xmit_interrupt();
+ }
+}
+
+/* transfer character from the buffer */
+char inbyte(void) {
+ register char a;
+ register int length;
+
+ while ((char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1))== rcv.out);
+ a=*(char *)((int)rcv.offset+(int)rcv.out);
+ rcv.out= (char *)(((int)rcv.out+1) & ((int)BUFFER_LENGTH-1));
+ length = (BUFFER_LENGTH -1) & (
+ ( ((int)rcv.out <= (int)rcv.in) ? 0 : BUFFER_LENGTH) - (int)rcv.out
+ + (int)rcv.in + 1);
+ if (length < RTS_START_SIZE)
+ *MCR |= (char) RTS;
+ return (a);
+}
+
+/* once room is avaliable in the buffer, transfer
+ the character into the buffer and enable
+ the xmtr interrupt */
+void outbyte(char c) {
+ register char *a;
+
+ while ((char *)(((int)xmt.in+2) & ((int)BUFFER_LENGTH-1)) == xmt.out);
+ *(char *)((int)xmt.offset+(int)
+ (a=(char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1))))=c;
+ xmt.in=a;
+
+ if ( (*LSR & THRE) != 0 ) /* if THRE, uart has already interrupted */
+ xmit_interrupt(); /* and was ignored. Need to restart. */
+}
+
+void _UART_flush(void) {
+ /* loop till xmt buffer empty. Works with interrupts disabled */
+ while ((char *)(((int)xmt.in+1) & ((int)BUFFER_LENGTH-1)) != xmt.out)
+ xmit_interrupt();
+ /* loop till UART buffer empty */
+ while ( (*LSR & TEMT) == 0 );
+}
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ /* set clock divisor */
+ *LCR = (char)(DLAB);
+ *DLL = (char)((int)(CLK_FREQ/BAUD/16.0+0.5) & 0xFF);
+ *DLM = (char)(((int)(CLK_FREQ/BAUD/16.0+0.5) & 0xFF00) >> 8);
+
+ /* Line control setup */
+ *LCR = (char)(WL_8 | NSB);
+
+ /* Interrupt setup */
+ *IER = (char) 0x0b; /* enable transmit, receive, modem stat int */
+
+ /* FIFO setup */
+ *FCR = (char)(FIFO_E | 0xc0);
+
+ /* Modem control setup */
+ *MCR = (char) RTS;
+
+ /* init tx_stop with CTS */
+ _tx_stop = ( (*MDSR & CTS) ? 0 : 1);
+
+ set_vector(_catchUARTint, UART_ISR_LEVEL+24, 0);
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ if ((char *)(((int)rcv.in+1) & ((int)BUFFER_LENGTH-1))== rcv.out)
+ return(FALSE);
+ else
+ return(TRUE);
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/16550.h b/c/src/lib/libbsp/m68k/efi68k/include/16550.h
new file mode 100644
index 0000000000..d13b5a1fc7
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/include/16550.h
@@ -0,0 +1,120 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * 16550 -- header file for National Semiconducor's 16550 UART
+ *
+ * This file has been created by John S. Gwynne for the efi68k
+ * project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _16550_H_
+#define _16550_H_
+
+/* base address is the physical location of register 0 */
+#define UART_BASE_ADDRESS 0x0400001
+
+/* definitions of register addresses and associate bits */
+
+#define RBR (volatile unsigned char * const)(0*2+UART_BASE_ADDRESS)
+ /* Receiver Buffer Register (w/DLAB=0)*/
+ /* 8-bit data */
+
+#define THR (volatile unsigned char * const)(0*2+UART_BASE_ADDRESS)
+ /* Transmitter Holding Register (w/DLAB=0) */
+ /* 8-bit data */
+
+#define DLL (volatile unsigned char * const)(0*2+UART_BASE_ADDRESS)
+ /* Divisor Latch (LS) (w/DLAB=1) */
+ /* LSB of Divisor */
+
+#define DLM (volatile unsigned char * const)(1*2+UART_BASE_ADDRESS)
+ /* Divisor Latch (MS) (w/DLAB=1) */
+ /* MSB of Divisor */
+
+#define IER (volatile unsigned char * const)(1*2+UART_BASE_ADDRESS)
+ /* Interrupt Enable Register (w/DLAB=0) */
+#define ERBFI 0x01 /* Enable Recv Data Available Interrupt */
+#define ETBEI 0x02 /* Enable Trans Holding Reg Empty Inter */
+#define ELSI 0x04 /* Enable Recv Line Status Interrupt */
+#define EDSSI 0x08 /* Enable Modem Status Interrupt */
+
+#define IIR (volatile unsigned char * const)(2*2+UART_BASE_ADDRESS)
+ /* Interrupt Ident Register (read only) */
+#define NIP 0x01 /* No Interrupt Pending */
+#define IID_MASK 0x0e /* Interrupt ID mask */
+#define FE_MASK 0xc0 /* FIFO's Enabled */
+
+#define FCR (volatile unsigned char * const)(2*2+UART_BASE_ADDRESS)
+ /* FIFO Control Register (write only) */
+#define FIFO_E 0x01 /* FIFO Enable */
+#define RFR 0x02 /* RCVR FIFO Reset */
+#define XFR 0x04 /* XMIT FIFO Reset */
+#define DMAMS 0x08 /* DMA Mode Select */
+#define RCVRTG_MASK 0xC0 /* RCVR Triger MSBit/LSBit */
+
+#define LCR (volatile unsigned char * const)(3*2+UART_BASE_ADDRESS)
+ /* Line Control Register */
+#define WLS_MASK 0x03 /* Word Legth Select Mask */
+#define WL_5 0x00 /* 5 bits */
+#define WL_6 0x01 /* 6 bits */
+#define WL_7 0x02 /* 7 bits */
+#define WL_8 0x03 /* 8 bits */
+#define NSB 0x04 /* Number of Stop Bits (set is 2/1.5) */
+#define PEN 0x08 /* Parity Enable */
+#define EPS 0x10 /* Even Parity Select */
+#define STP 0x20 /* Stick Parity */
+#define SETBK 0x40 /* Set Break */
+#define DLAB 0x80 /* Divisor Latch Access Bit */
+
+#define MCR (volatile unsigned char * const)(4*2+UART_BASE_ADDRESS)
+ /* Modem Control Register */
+#define DTR 0x01 /* Data Terminal Ready */
+#define RTS 0x02 /* Request to Send */
+#define OUT1 0x04 /* Out 1 */
+#define OUT2 0x08 /* Out 2 */
+#define LOOP 0x10 /* Loop */
+
+#define LSR (volatile unsigned char * const)(5*2+UART_BASE_ADDRESS)
+ /* Line Status Register */
+#define DR 0x01 /* Data Ready */
+#define OE 0x02 /* Overrun error */
+#define PE 0x04 /* Parity error */
+#define FE 0x08 /* Framing error */
+#define BI 0x10 /* Break Interrupt */
+#define THRE 0x20 /* Transmitter Holding Register */
+#define TEMT 0x40 /* Transmitter Empty */
+#define RCVFIE 0x80 /* Recv FIFO Error */
+
+#define MDSR (volatile unsigned char * const)(6*2+UART_BASE_ADDRESS)
+ /* Modem Status Register */
+#define DCTS 0x01 /* Delta Clear to Send */
+#define DDSR 0x02 /* Delta Data Set Ready */
+#define TERI 0x04 /* Trailing Edge Ring Indicator */
+#define DDCD 0x08 /* Delta Data Carrier Detect */
+#define CTS 0x10 /* Clear to Send */
+#define DSR 0x20 /* Data Set Ready */
+#define RI 0x40 /* Ring Indicator */
+#define DCD 0x80 /* Data Carrier Detect */
+
+#define SCR (volatile unsigned char * const)(7*2+UART_BASE_ADDRESS)
+ /* Scratch Register */
+ /* 8-bit register */
+#endif
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/DP8570A.h b/c/src/lib/libbsp/m68k/efi68k/include/DP8570A.h
new file mode 100644
index 0000000000..7409d489ce
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/include/DP8570A.h
@@ -0,0 +1,285 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * DP8570A -- header file for National Semiconducor's DP8570A TCP
+ *
+ * This file has been created by John S. Gwynne for the efi68k
+ * project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _DP8570A_H_
+#define _DP8570A_H_
+
+/* base address is the physical location of register 0 */
+#define TCP_BASE_ADDRESS 0x0600001
+
+
+/* definitions of register addresses and associate bits */
+
+/* ********************************************************* */
+/* Control Registers */
+/* ********************************************************* */
+
+/* REMEMBER: if you are in an interrupt routine, you must
+ reset RS and PS of MSR to the value they had on entry
+ to the ISR before exiting */
+
+#define MSR (volatile unsigned char * const)(0x00*2+TCP_BASE_ADDRESS)
+ /* Main Status Register */
+#define INT 0x01 /* Interrupt Status */
+#define PF 0x02 /* Power Fail Interrupt */
+#define PER 0x04 /* Period Interrupt */
+#define AL 0x08 /* Alarm Interrupt */
+#define T0 0x10 /* Timer 0 Interrupt */
+#define T1 0x20 /* Timer 1 Interrupt */
+#define RS 0x40 /* Register Select Bit */
+#define PS 0x80 /* Page Select Bit */
+
+#define T0CR (volatile unsigned char * const)(0x01*2+TCP_BASE_ADDRESS)
+ /* Timer 0 Control Register */
+#define T1CR (volatile unsigned char * const)(0x02*2+TCP_BASE_ADDRESS)
+ /* Timer 1 Control Register */
+#define TSS 0x01 /* Timer Start/!Stop */
+#define M0 0x02 /* Mode Select */
+#define M1 0x04 /* Mode Select */
+#define C0 0x08 /* Input Clock Select */
+#define C1 0x10 /* Input Clock Select */
+#define C2 0x20 /* Input Clock Select */
+#define RD 0x40 /* Timer Read */
+#define CHG 0x80 /* Count Hold/Gate */
+
+#define PFR (volatile unsigned char * const)(0x03*2+TCP_BASE_ADDRESS)
+ /* Periodic Flag Register */
+#define R_1MIN 0x01 /* Minute Flage */
+#define R_10S 0x02 /* 10 Second Flag */
+#define R_1S 0x04 /* Second Flag */
+#define R_100MS 0x08 /* 100 Millisec Flag */
+#define R_10MS 0x10 /* 10 Millisec Flag */
+#define R_1MS 0x20 /* 1 Millisec Flag */
+#define OSF 0x40 /* Oscillator Failed/Single Supply */
+#define TMODE 0x80 /* Test Mode Enable */
+
+#define IRR (volatile unsigned char * const)(0x04*2+TCP_BASE_ADDRESS)
+ /* Interrupt Routing Register */
+#define PF_R 0x01 /* Power Fail Route */
+#define PR_R 0x02 /* Periodic Route */
+#define AL_R 0x04 /* Alarm Route */
+#define T0_R 0x08 /* Timer 0 Route */
+#define T1_R 0x10 /* Timer 1 Route */
+#define PFD 0x20 /* PF Delay Enable */
+#define LBF 0x40 /* Low Battery Flag */
+#define TMSE 0x80 /* Time Save Enable */
+
+#define RTMR (volatile unsigned char * const)(0x01*2+TCP_BASE_ADDRESS)
+ /* Real Time Mode Register */
+#define LY0 0x01 /* Leap Year LSB */
+#define LY1 0x02 /* Leap Year MSB */
+#define H12 0x04 /* 12/!24 Hour Mode */
+#define CSS 0x08 /* Clock Start/!Stop */
+#define IPF 0x10 /* Interrupt PF Operation */
+#define TPF 0x20 /* Timer PF Operation */
+#define XT0 0x40 /* Crystal Frequency LSB */
+#define XT1 0x80 /* Crystal Frequency MSB */
+
+#define OMR (volatile unsigned char * const)(0x02*2+TCP_BASE_ADDRESS)
+ /* Output Mode Register */
+#define TH 0x01 /* T1 Active Hi/!Low */
+#define TP 0x02 /* T1 Push Pull/!Open Drain */
+#define IH 0x04 /* INTR Active Hi/!Low */
+#define IP 0x08 /* INTR Push Pull/!Open Drain */
+#define MH 0x10 /* MFO Active Hi/!Low */
+#define MP 0x20 /* MFO Push Pull/!Open Drain */
+#define MT 0x40 /* MFO Pin as Timer 0 */
+#define MO 0x80 /* MFO Pin as Oscillator */
+
+#define ICR0 (volatile unsigned char * const)(0x03*2+TCP_BASE_ADDRESS)
+ /* Interrupt control Register 0 */
+#define ME 0x01 /* Minutes Enable */
+#define TSE 0x02 /* 10 Second Enable */
+#define SE 0x04 /* Seconds Enable */
+#define HME 0x08 /* 100 Millisec Enable */
+#define TME 0x10 /* 10 Millisec Enable */
+#define OME 0x20 /* Millisec Enable */
+#define T0E 0x40 /* Timer 0 Enable */
+#define T1E 0x80 /* Timer 1 Enable */
+
+#define ICR1 (volatile unsigned char * const)(0x04*2+TCP_BASE_ADDRESS)
+ /* Interrupt control Register 1 */
+#define SCE 0x01 /* Second Compare Enable */
+#define MNE 0x02 /* Minute Compare Enable */
+#define HRE 0x04 /* Hour Compare Enable */
+#define DOME 0x08 /* Day of Month Compare Enable */
+#define MOE 0x10 /* Month Compare Enable */
+#define DOWE 0x20 /* Day of Week Compare Enable */
+#define ALE 0x40 /* Alarm Interrupt Enable */
+#define PFE 0x80 /* Power Fail Interrupt Enable */
+
+
+
+/* ********************************************************* */
+/* Counters: Clock and Calendar (data is stored in BCD) */
+/* ********************************************************* */
+#define HOFS (volatile unsigned char * const)(0x05*2+TCP_BASE_ADDRESS)
+ /* Hundredth of Seconds */
+#define SEC (volatile unsigned char * const)(0x06*2+TCP_BASE_ADDRESS)
+ /* Seconds */
+#define MIN (volatile unsigned char * const)(0x07*2+TCP_BASE_ADDRESS)
+ /* Minutes */
+#define HRS (volatile unsigned char * const)(0x08*2+TCP_BASE_ADDRESS)
+ /* Hours */
+#define DOM (volatile unsigned char * const)(0x09*2+TCP_BASE_ADDRESS)
+ /* Day of Month */
+#define MON (volatile unsigned char * const)(0x0a*2+TCP_BASE_ADDRESS)
+ /* Month */
+#define YR (volatile unsigned char * const)(0x0b*2+TCP_BASE_ADDRESS)
+ /* Year */
+#define JD_LSB (volatile unsigned char * const)(0x0c*2+TCP_BASE_ADDRESS)
+ /* Julian Date (LSB) */
+#define JD_MSM (volatile unsigned char * const)(0x0d*2+TCP_BASE_ADDRESS)
+ /* Julian Date (MSB) */
+#define DOW (volatile unsigned char * const)(0x0e*2+TCP_BASE_ADDRESS)
+ /* Day of week */
+
+
+/* ********************************************************* */
+/* Timer Data Registers */
+/* ********************************************************* */
+#define T0_LSB (volatile unsigned char * const)(0x0f*2+TCP_BASE_ADDRESS)
+ /* Timer 0 LSB */
+#define T0_MSB (volatile unsigned char * const)(0x10*2+TCP_BASE_ADDRESS)
+ /* Timer 0 MSB */
+#define T1_LSB (volatile unsigned char * const)(0x11*2+TCP_BASE_ADDRESS)
+ /* Timer 1 LSB */
+#define T1_MSB (volatile unsigned char * const)(0x12*2+TCP_BASE_ADDRESS)
+ /* Timer 1 MSB */
+
+
+/* ********************************************************* */
+/* Timer Compare RAM */
+/* ********************************************************* */
+#define TC_SEC (volatile unsigned char * const)(0x13*2+TCP_BASE_ADDRESS)
+ /* Seconds Compare RAM */
+#define TC_MIN (volatile unsigned char * const)(0x14*2+TCP_BASE_ADDRESS)
+ /* Minutes Compare RAM */
+#define TC_HRS (volatile unsigned char * const)(0x15*2+TCP_BASE_ADDRESS)
+ /* Hours Compare RAM */
+#define TC_DOM (volatile unsigned char * const)(0x16*2+TCP_BASE_ADDRESS)
+ /* Day of Month Compare RAM */
+#define TC_MON (volatile unsigned char * const)(0x17*2+TCP_BASE_ADDRESS)
+ /* Month Compare RAM */
+#define TC_DOW (volatile unsigned char * const)(0x18*2+TCP_BASE_ADDRESS)
+ /* Day of Week Compare RAM */
+
+
+/* ********************************************************* */
+/* Time Save RAM */
+/* ********************************************************* */
+#define S_SEC (volatile unsigned char * const)(0x19*2+TCP_BASE_ADDRESS)
+ /* Seconds Save RAM */
+#define S_MIN (volatile unsigned char * const)(0x1a*2+TCP_BASE_ADDRESS)
+ /* Minutes Save RAM */
+#define S_HRS (volatile unsigned char * const)(0x1b*2+TCP_BASE_ADDRESS)
+ /* Hours Save RAM */
+#define S_DOM (volatile unsigned char * const)(0x1c*2+TCP_BASE_ADDRESS)
+ /* Day of Month Save RAM */
+#define S_MON (volatile unsigned char * const)(0x1d*2+TCP_BASE_ADDRESS)
+ /* Month Save RAM */
+
+
+/* ********************************************************* */
+/* Miscellaneous Registers */
+/* ********************************************************* */
+ /* rem: 0x1e is general purpose RAM */
+#define TMR (volatile unsigned char * const)(0x1F*2+TCP_BASE_ADDRESS)
+ /* RAM/Test Mode Register */
+
+
+
+/* ********************************************************* */
+/* RAM allocation */
+/* ********************************************************* */
+#define RAM_OSC_FAIL (volatile unsigned char * const)(0x01*2+TCP_BASE_ADDRESS)
+ /* 1: osc. failed time lost */
+#define RAM_POWERUP (volatile unsigned char * const)(0x02*2+TCP_BASE_ADDRESS)
+ /* 1: power was removed and the applied
+ before last TCP init */
+#define RAM_LOWBAT (volatile unsigned char * const)(0x03*2+TCP_BASE_ADDRESS)
+ /* 1: battery voltage is low (2.2V) */
+ /* not valid in single supply mode */
+#define RAM_SINGLE_SUP (volatile unsigned char * const)(0x04*2+TCP_BASE_ADDRESS)
+ /* 1: single supply mode */
+ /* note: single supply mode will be
+ selected when no backup battery is
+ present and/or the first time the
+ system is booted after the loss of
+ backup battery voltage. */
+#define RAM_TCP_FAILURE (volatile unsigned char * const)(0x05*2+TCP_BASE_ADDRESS)
+ /* 1: TCP failed to start oscillating */
+
+
+/* ********************************************************* */
+/* TCP data structures */
+/* ********************************************************* */
+
+struct clock_counters {
+ unsigned char hofs;
+ unsigned char d0; /* the dx's are place holders since */
+ unsigned char sec; /* the TCP is addressable only on */
+ unsigned char d1; /* odd addresses. */
+ unsigned char min;
+ unsigned char d2;
+ unsigned char hrs;
+ unsigned char d3;
+ unsigned char dom;
+ unsigned char d4;
+ unsigned char mon;
+ unsigned char d5;
+ unsigned char yr;
+ unsigned char d6;
+ unsigned char jd0;
+ unsigned char d7;
+ unsigned char jd1;
+ unsigned char d8;
+ unsigned char dow;
+};
+
+extern struct clock_ram * const tcp_power_up;
+
+struct clock_ram {
+ unsigned char sec;
+ unsigned char d0; /* the dx's are place holders since */
+ unsigned char min; /* the TCP is addressable only on */
+ unsigned char d1; /* odd addresses. */
+ unsigned char hrs;
+ unsigned char d2;
+ unsigned char dom;
+ unsigned char d3;
+ unsigned char mon;
+};
+
+extern struct clock_ram * const tcp_power_up;
+extern struct clock_ram * const tcp_power_down;
+extern struct clock_counters * const tcp_clock;
+extern struct clock_ram * const tcp_save_ram;
+
+void tcp_init(void);
+
+#endif /* _DP8570A_H_ */
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/bsp.h b/c/src/lib/libbsp/m68k/efi68k/include/bsp.h
new file mode 100644
index 0000000000..988383c0d1
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/include/bsp.h
@@ -0,0 +1,153 @@
+/* bsp.h
+ *
+ * This include file contains all efi68k board IO definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EFI68K_BSP_h
+#define __EFI68K_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+#include <efi68k.h>
+#include <DP8570A.h>
+#include <16550.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ */
+
+/* XXX - JRS - I want to compile the tmtests */
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+#define Install_tm27_vector( handler )
+
+#define Cause_tm27_intr()
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* macros */
+
+#define RAM_START 0x200000
+#define RAM_END 0x240000
+
+#define RAW_PUTS(str) \
+ { register char *ptr = str; \
+ while (*ptr) outbyte(*ptr++); \
+ }
+
+#define RAW_PUTI(n) { \
+ register int i, j; \
+ \
+ RAW_PUTS("0x"); \
+ for (i=28;i>=0;i -= 4) { \
+ j = (n>>i) & 0xf; \
+ outbyte( (j>9 ? j-10+'a' : j+'0') ); \
+ } \
+ }
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+extern int stack_size;
+
+extern int stack_start;
+
+extern rtems_unsigned32 Timer_interrupts;
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+void console_init(void);
+
+void watch_dog_init(void);
+
+void tcp_init(void);
+
+void Spurious_Initialize(void);
+
+void _UART_flush(void);
+
+void Clock_exit(void);
+
+void outbyte(char);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/coverhd.h b/c/src/lib/libbsp/m68k/efi68k/include/coverhd.h
new file mode 100644
index 0000000000..671f20d197
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/include/coverhd.h
@@ -0,0 +1,106 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#endif
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/efi68k.h b/c/src/lib/libbsp/m68k/efi68k/include/efi68k.h
new file mode 100644
index 0000000000..398dbf2fb4
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/include/efi68k.h
@@ -0,0 +1,21 @@
+/* efi68k.h
+ *
+ * $Id$
+ */
+
+#ifndef _EFI68k_H_
+#define _EFI68k_H_
+
+
+/* interrupt levels */
+#define WD_ISR_LEVEL 1
+#define TCP_ISR_LEVEL 4
+#define UART_ISR_LEVEL 6
+#define INTR7 7
+
+
+/* macro/function definitions */
+static void reboot(void) __attribute__ ((noreturn));
+__inline__ static void reboot(void) {asm("trap #15");}
+
+#endif /* _EFI68k_H_ */
diff --git a/c/src/lib/libbsp/m68k/efi68k/spurious/spinit.c b/c/src/lib/libbsp/m68k/efi68k/spurious/spinit.c
new file mode 100644
index 0000000000..2b12880c8d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/spurious/spinit.c
@@ -0,0 +1,85 @@
+/* Spurious_driver
+ *
+ * This routine installs spurious interrupt handlers for the efi68k.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <stdio.h>
+
+const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
+ "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
+ "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
+ "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
+ "Coprocessor Protocal Violation",
+ "Format Error ans Uninitialized Interrupt","Unassigned",
+ "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
+ "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
+ "Reserved Unassigned","User Defined"};
+
+rtems_isr Spurious_Isr(
+ rtems_vector_number vector
+)
+{
+ int sp = 0;
+ const char * const VectDescrip[] = {
+ _Spurious_Error_[0], _Spurious_Error_[0], _Spurious_Error_[1],
+ _Spurious_Error_[2], _Spurious_Error_[3], _Spurious_Error_[4],
+ _Spurious_Error_[5], _Spurious_Error_[6], _Spurious_Error_[7],
+ _Spurious_Error_[8], _Spurious_Error_[9], _Spurious_Error_[10],
+ _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
+ _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
+ _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
+ _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
+ _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
+ _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
+ _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
+ _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
+ _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
+ _Spurious_Error_[27], _Spurious_Error_[28]};
+
+ asm volatile ( "movea.l %%sp,%0 " : "=a" (sp) : "0" (sp) );
+
+ _CPU_ISR_Set_level( 7 );
+ _UART_flush();
+
+ RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
+ RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
+ RAW_PUTS("\n\rRTEMS: Vector: ");
+ RAW_PUTI(vector);
+ RAW_PUTS(" sp: ");
+ RAW_PUTI(sp);
+ RAW_PUTS("\n\r");
+
+ bsp_cleanup();
+
+ for(;;);
+}
+
+void Spurious_Initialize(void)
+{
+ rtems_vector_number vector;
+
+ for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
+ (void) set_vector( Spurious_Isr, vector, 1 );
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/bspclean.c b/c/src/lib/libbsp/m68k/efi68k/startup/bspclean.c
new file mode 100644
index 0000000000..34a57b6b68
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/bspclean.c
@@ -0,0 +1,28 @@
+/* bsp_cleanup()
+ *
+ * This routine cleans up in the sense that it places the board
+ * in a safe state and flushes the I/O buffers before exiting.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+void bsp_cleanup(void)
+{
+ /* interrupt driven stdio must be flushed */
+ _CPU_ISR_Set_level( 7 );
+ _UART_flush();
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
new file mode 100644
index 0000000000..6e93953bc6
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
@@ -0,0 +1,232 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+rtems_unsigned32 Timer_interrupts;
+
+/* extern void set_debug_traps(void); */
+/* extern void breakpoint(void); */
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ void *vbr;
+
+/* set_debug_traps(); */
+/* breakpoint(); */
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ m68k_get_vbr( vbr );
+ Cpu_table.interrupt_vector_table = vbr;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ if ((unsigned int)BSP_Configuration.work_space_start <
+ (unsigned int)((stack_start + stack_size) & 0xffffffc0) ) {
+ /* rtems_fatal_error_occurred can not be used before initalization */
+ RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
+ RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
+ goto exit;
+ }
+
+ /*
+ * Add 1 region for Malloc in libc_low
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ /* Clock_exit is done as an atexit() function */
+
+exit:
+ /* configure peripherals for safe exit */
+ bsp_cleanup();
+
+ /* return like a "normal" subroutine to the monitor */
+ return 0;
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_tcp.c b/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_tcp.c
new file mode 100644
index 0000000000..9dd4836b25
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_tcp.c
@@ -0,0 +1,248 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * This file contains the subroutines necessary to initalize
+ * the DP8750A TCP on the efi68k board.
+ *
+ * This file has been created by John S. Gwynne for the efi68k
+ * project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+/* define tcp struct pointers */
+struct clock_ram * const tcp_power_up =
+ (struct clock_ram * const)(0x16*2+TCP_BASE_ADDRESS);
+
+struct clock_ram * const tcp_power_down =
+ (struct clock_ram * const)(0x1b*2+TCP_BASE_ADDRESS);
+
+struct clock_counters * const tcp_clock =
+ (struct clock_counters * const)(0x05*2+TCP_BASE_ADDRESS);
+
+struct clock_ram * const tcp_save_ram =
+ (struct clock_ram * const)(0x19*2+TCP_BASE_ADDRESS);
+
+#define X_DELAY 300 /* time-out delay for crystal start */
+#define X1_DELAY 100000
+
+void tcp_delay(int count)
+{
+ int i;
+ /* change latter to use a counter !!! */
+ for (i=0;i<count/4;i++);
+}
+
+void tcp_init()
+{
+ unsigned char low_bat, osc_fail, power_up;
+ unsigned char mon, dom, hrs, min, sec;
+ int i, count;
+
+ /* delay about 60us to ensure TCP is not locked-out */
+ tcp_delay(80);
+
+ /* set normal supply mode and reset test mode bit */
+ *MSR = 0;
+ *PFR = 0;
+
+ /* save oscillator failure condition */
+ *MSR = 0; /* set RS and PS to zero */
+ osc_fail = (*PFR & OSF ? 1 : 0);
+ *MSR = PS;
+ *RAM_OSC_FAIL = *RAM_OSC_FAIL || osc_fail;
+
+ *MSR = PS;
+ if (*RAM_OSC_FAIL) {
+ power_up = 1;
+ *MSR = PS;
+ *RAM_POWERUP = power_up;
+ /* clear time counters and power up & down ram */
+ *MSR = 0;
+ tcp_clock->hofs = 0;
+ tcp_clock->sec = 0;
+ tcp_clock->min = 0;
+ tcp_clock->hrs = 0;
+ tcp_clock->dom = 1;
+ tcp_clock->mon = 1;
+ tcp_clock->yr = 0x95;
+ tcp_clock->jd0 = 0x01;
+ tcp_clock->jd1 = 0;
+ tcp_clock->dow = 1;
+ *MSR = PS;
+ tcp_power_up->sec = 0;
+ tcp_power_up->min = 0;
+ tcp_power_up->hrs = 0;
+ tcp_power_up->dom = 0;
+ tcp_power_up->mon = 0;
+ tcp_power_down->sec = 0;
+ tcp_power_down->min = 0;
+ tcp_power_down->hrs = 0;
+ tcp_power_down->dom = 0;
+ tcp_power_down->mon = 0;
+ } else {
+ /* save for power-up test */
+ *MSR = 0;
+ power_up = (*IRR & TMSE ? 0 : 1);
+ *MSR = PS;
+ *RAM_POWERUP = power_up;
+
+ /* update tcp_power_up and tcp_power_down on power up */
+ if (power_up) {
+ *MSR = 0;
+ do {
+ *PFR;
+ sec = tcp_clock->sec;
+ min = tcp_clock->min;
+ hrs = tcp_clock->hrs;
+ dom = tcp_clock->dom;
+ mon = tcp_clock->mon;
+ } while (*PFR & R_1S);
+ *MSR = PS;
+ tcp_power_up->sec = sec;
+ tcp_power_up->min = min;
+ tcp_power_up->hrs = hrs;
+ tcp_power_up->dom = dom;
+ tcp_power_up->mon = ( (((mon>>4)*10)+(mon&0xf))>12 ? 0 : mon );
+ *MSR = 0; /* save ram is not running */
+ sec = tcp_save_ram->sec;
+ min = tcp_save_ram->min;
+ hrs = tcp_save_ram->hrs;
+ dom = tcp_save_ram->dom;
+ mon = tcp_save_ram->mon;
+ *MSR = PS;
+ tcp_power_down->sec = sec;
+ tcp_power_down->min = min;
+ tcp_power_down->hrs = hrs;
+ tcp_power_down->dom = dom;
+ tcp_power_down->mon = ( (((mon>>4)*10)+(mon&0xf))>12 ? 0 : mon );
+ }
+ }
+
+ /* load interrupt routing reg. PF must be enabled to test
+ for low battery, but I route it to MFO to avoid any
+ potential problems */
+ *MSR = 0;
+ *IRR = PF_R | TMSE;
+
+ /* initialize the output mode register */
+ *MSR = RS;
+ *OMR = IP | MP | MO; /* INTR active low and push/pull */
+
+ /* initialize interrupt control reg 0 */
+ *MSR = RS;
+ *ICR0 = 0; /* disable all interrupts */
+
+ /* initialize interrupt control reg 1 */
+ *MSR = RS;
+ *ICR1 = PFE; /* this also enables the low battery
+ detection circuit. */
+
+ /* I had trouble getting the tcp to be completely
+ flexabale to supply modes (i.e., automatically
+ selecting single or normal battery backup modes based
+ on inputs at power-up. If single supply mode is
+ selected, the low battery detect is disabled and the
+ low battery detect in normal mode does not seem to
+ detect when no battery is present at all. If normal
+ mode is selected and no battery is present, the
+ crystal will stop, but only if reset after
+ power-up. It would seem that after a power-up reset,
+ with no battery, the chip may automaticlly switch to
+ single supply mode which disables the low battery
+ detection circuit.) The following software tests
+ works for all permiatations of low batt, reset,
+ power-on reset, battery, no battery, battery on after
+ Vcc,.... *except* for battery switched on for the
+ first time before power up in which case the chip
+ will still be in single suppy mode till restarted (a
+ second call to tcp_init such as when the time is set
+ or a reboot.) The timer/clock itself should always
+ be completely functional regardless of the supply
+ mode. */
+
+
+ /* initialize the real time mode register */
+ /* note: write mode bits *before* CSS, then set CSS */
+ *MSR = 0; /* clear roll-over */
+ *PFR;
+ count=1;
+ for (i=0;i<X_DELAY;i++) { /* loop till xtal starts */
+ *MSR = RS;
+ *RTMR = (*RTMR & (LY0 | LY1 )) | CSS;
+ *MSR = 0;
+ if (*PFR & R_1MS)
+ if (!(count--)) break;
+ }
+ if (i>=X_DELAY) {
+ {
+ /* xtal didn't start; try single supply mode */
+ *MSR = 0; /* single supply */
+ *PFR = OSF;
+ *MSR = 0; /* clear roll-over */
+ *PFR;
+ count=1;
+ for (i=0;i<X1_DELAY;i++) { /* loop till xtal starts */
+ *MSR = RS;
+ *RTMR = (*RTMR & (LY0 | LY1 )) | CSS;
+ *MSR = 0;
+ if (*PFR & R_1MS)
+ if (!(count--)) break;
+ }
+ if (i>=X1_DELAY) {
+ /* xtal didn't start; fail tcp */
+ *MSR = PS;
+ *RAM_TCP_FAILURE = 1;
+ *MSR = PS;
+ *RAM_SINGLE_SUP=1;
+ } else {
+ *MSR = PS;
+ *RAM_TCP_FAILURE = 0;
+ *MSR = PS;
+ *RAM_SINGLE_SUP=1;
+ }
+ }
+ } else {
+ *MSR = PS;
+ *RAM_TCP_FAILURE = 0;
+ *MSR = PS;
+ *RAM_SINGLE_SUP=0;
+ }
+
+ /* wait for low battery detection circuit to stabalize */
+ tcp_delay(1000);
+
+ /* battery test */
+ *MSR = 0;
+ low_bat = (*IRR & LBF ? 1 : 0 );
+ *MSR = PS;
+ *RAM_LOWBAT = low_bat & !(*RAM_SINGLE_SUP);
+
+ /* reset pending interrupts */
+ *MSR = ( PER | AL | T0 | T1 );
+
+ /* resync the time save ram with the clock */
+ tcp_save_ram->sec = 0;
+ tcp_save_ram->min = 0;
+ tcp_save_ram->hrs = 0;
+ tcp_save_ram->dom = 0;
+ tcp_save_ram->mon = 0;
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_wd.c b/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_wd.c
new file mode 100644
index 0000000000..0ad4d87b82
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/efi68k_wd.c
@@ -0,0 +1,55 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * This file contains the subroutines necessary to initalize
+ * and maintain the MAX791 based watchdog timer used on efi68k
+ *
+ * This file has been created by John S. Gwynne for the efi68k
+ * project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+#include <bsp.h>
+
+void wd_interrupt(void) {
+ /* toggle WDI of the MAX791. A more sophisticated routine
+ can be inserted into the exception table after booting. */
+
+ /* 3 changes guaranty a pulse independent of initial state */
+ *MCR |= OUT1;
+ *MCR &= ~OUT1;
+ *MCR |= OUT1;
+}
+
+/* _catchWDint is the interrupt front-end */
+extern void _catchWDint();
+asm(" .text
+ .align 2
+ .globl _catchWDint
+_catchWDint:
+ lea %sp@(4),%sp /* pop return address */
+ moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */
+ jbsr wd_interrupt
+ moveml %sp@+,%d0-%d7/%a0-%a6
+ rte
+ ");
+
+void watch_dog_init(void) {
+ set_vector(_catchWDint, WD_ISR_LEVEL+24, 0);
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds b/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds
new file mode 100644
index 0000000000..f34bafab92
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds
@@ -0,0 +1,108 @@
+/* linkcmds
+ *
+ * $Id$
+ */
+
+OUTPUT_ARCH(m68k)
+__DYNAMIC = 0;
+
+/*
+ * The memory map looks like this:
+ * +--------------------+ <- low memory
+ * | .text |
+ * | etext |
+ * | ctor list | the ctor and dtor lists are for
+ * | dtor list | C++ support
+ * | _endtext |
+ * +--------------------+
+ * | .data | initialized data goes here
+ * | _sdata |
+ * | _edata |
+ * +--------------------+
+ * | .bss |
+ * | __bss_start | start of bss, cleared by crt0
+ * | _end | start of heap, used by sbrk()
+ * +--------------------+
+ * | heap space |
+ * | _ENDHEAP |
+ * | stack space |
+ * | __stack | top of stack
+ * +--------------------+ <- high memory
+ */
+
+
+/*
+ * User modifiable values:
+ *
+ * _VBR location of VBR table
+ */
+
+MEMORY
+{
+ ram : ORIGIN = 0x203000, LENGTH = 256K
+}
+
+_VBR = 0x200000; /* location of the VBR table (in RAM) */
+_copy_data_from_rom = 0;
+
+/*
+ * stick everything in ram (of course)
+ */
+SECTIONS
+{
+ .text :
+ {
+ CREATE_OBJECT_SYMBOLS
+ text_start = .;
+ _text_start = .;
+ *(.text)
+ etext = ALIGN(0x10);
+ _etext = .;
+ __CTOR_LIST__ = .;
+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
+ *(.ctors)
+ LONG(0)
+ __CTOR_END__ = .;
+ __DTOR_LIST__ = .;
+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
+ *(.dtors)
+ LONG(0)
+ __DTOR_END__ = .;
+ *(.lit)
+ *(.shdata)
+ _endtext = .;
+ } > ram
+ .data :
+ {
+ data_start = .;
+ _data_start = .;
+ _sdata = . ;
+ *(.data)
+ CONSTRUCTORS
+ edata = ALIGN(0x10);
+ _edata = .;
+ } > ram
+ .shbss :
+ {
+ *(.shbss)
+ } > ram
+ .bss :
+ {
+ __bss_start = ALIGN(0x8);
+ bss_start = .;
+ _bss_start = .;
+ *(.bss)
+ *(COMMON)
+ end = .;
+ _end = ALIGN(0x8);
+ __end = ALIGN(0x8);
+ } > ram
+ .stab . (NOLOAD) :
+ {
+ [ .stab ]
+ }
+ .stabstr . (NOLOAD) :
+ {
+ [ .stabstr ]
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/m68k-stub.c b/c/src/lib/libbsp/m68k/efi68k/startup/m68k-stub.c
new file mode 100644
index 0000000000..a37cd2dc83
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/m68k-stub.c
@@ -0,0 +1,782 @@
+/* m68k-stub.c
+ *
+ * $Id$
+ */
+
+#include <efi68k.h>
+#include <rtems.h>
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+
+void (*exceptionHook)() = 0;
+
+void outbyte(char c);
+char putDebugChar( char c)
+{
+ outbyte(c);
+ return c;
+}
+
+char inbyte(void);
+char getDebugChar(void)
+{
+ return inbyte();
+}
+
+void flush_i_cache(void)
+{
+ return;
+}
+
+void *memset(void *p, int c, int n)
+{
+ register int i;
+ void *s=p;
+
+ for (i=0;i<n;i++) *((char *)p)++=(char)c;
+ return s;
+}
+
+char *db_strcpy(char *s, const char *t)
+{
+ char *save=s;
+ while((*s++ = *t++) != '\0');
+ return save;
+}
+
+int db_strlen(const char *s)
+{
+ int n;
+
+ for (n=0; *s!='\0'; s++) n++;
+ return n;
+}
+
+/************************************************************************
+ *
+ * external low-level support routines
+ */
+typedef void (*ExceptionHook)(int); /* pointer to function with int parm */
+typedef void (*Function)(); /* pointer to a function */
+
+/* extern Function exceptionHandler(); */ /* assign an exception handler */
+extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */
+/* extern void exceptionHandler(int vect, void (*function)()); */
+
+/************************/
+/* FORWARD DECLARATIONS */
+/************************/
+static void initializeRemcomErrorFrame();
+
+/************************************************************************/
+/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
+/* at least NUMREGBYTES*2 are needed for register packets */
+#define BUFMAX 400
+
+static char initialized; /* boolean flag. != 0 means we've been initialized */
+
+int remote_debug;
+/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
+
+static const char hexchars[]="0123456789abcdef";
+
+/* there are 180 bytes of registers on a 68020 w/68881 */
+/* many of the fpa registers are 12 byte (96 bit) registers */
+#define NUMREGBYTES 180
+enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
+ A0,A1,A2,A3,A4,A5,A6,A7,
+ PS,PC,
+ FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7,
+ FPCONTROL,FPSTATUS,FPIADDR
+ };
+
+
+
+typedef struct FrameStruct
+{
+ struct FrameStruct *previous;
+ int exceptionPC; /* pc value when this frame created */
+ int exceptionVector; /* cpu vector causing exception */
+ short frameSize; /* size of cpu frame in words */
+ short sr; /* for 68000, this not always sr */
+ int pc;
+ short format;
+ int fsaveHeader;
+ int morejunk[0]; /* exception frame, fp save... */
+} Frame;
+
+#define FRAMESIZE 10
+int gdbFrameStack[FRAMESIZE];
+static Frame *lastFrame;
+
+/*
+ * these should not be static cuz they can be used outside this module
+ */
+int registers[NUMREGBYTES/4];
+int superStack;
+
+#define STACKSIZE 600
+int remcomStack[STACKSIZE/sizeof(int)];
+static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
+
+static ExceptionHook oldExceptionHook;
+
+#define SAVE_FP_REGS()
+#define RESTORE_FP_REGS()
+
+void return_to_super();
+void return_to_user();
+
+asm("
+.text
+.align 2
+.globl return_to_super
+return_to_super:
+ oriw #0x0700,%sr
+ movel registers+60,%sp /* get new stack pointer */
+ movel lastFrame,%a0 /* get last frame info */
+ bra return_to_any
+
+.globl return_to_user
+return_to_user:
+ oriw #0x0700,%sr
+ movel registers+60,%a0 /* get usp */
+ movel %a0,%usp /* set usp */
+ movel superStack,%sp /* get original stack pointer */
+
+return_to_any:
+ movel lastFrame,%a0 /* get last frame info */
+ movel %a0@+,lastFrame /* link in previous frame */
+ addql #8,%a0 /* skip over pc, vector#*/
+ movew %a0@+,%d0 /* get # of words in cpu frame */
+ addw %d0,%a0 /* point to end of data */
+ addw %d0,%a0 /* point to end of data */
+ movel %a0,%a1
+#
+# copy the stack frame
+ subql #1,%d0
+copyUserLoop:
+ movew %a1@-,%sp@-
+ dbf %d0,copyUserLoop
+");
+ RESTORE_FP_REGS()
+ asm(" moveml registers,%d0-%d7/%a0-%a6");
+ asm(" rte"); /* pop and go! */
+
+#define DISABLE_INTERRUPTS() asm(" oriw #0x0700,%sr");
+#define BREAKPOINT() asm(" trap #1");
+
+/* this function is called immediately when a level 7 interrupt occurs */
+/* if the previous interrupt level was 7 then we're already servicing */
+/* this interrupt and an rte is in order to return to the debugger. */
+/* For the 68000, the offset for sr is 6 due to the jsr return address */
+asm("
+.text
+.align 2
+.globl _debug_level7
+_debug_level7:
+ movew %d0,%sp@-");
+asm(" movew %sp@(6),%d0");
+
+asm(" andiw #0x700,%d0
+ cmpiw #0x700,%d0
+ beq already7
+ movew %sp@+,%d0
+ bra _catchException
+already7:
+ movew %sp@+,%d0");
+asm(" lea %sp@(4),%sp"); /* pull off 68000 return address */
+
+asm(" rte");
+
+extern void _catchException ();
+
+/* This function is called when an exception occurs. It translates the
+ * return address found on the stack into an exception vector # which
+ * is then handled by either handle_exception or a system handler.
+ * _catchException provides a front end for both.
+ *
+ * stack on entry: stack on exit:
+ * Program counter MSWord exception # MSWord
+ * Program counter LSWord exception # MSWord
+ * Status Register
+ * Return Address MSWord
+ * Return Address LSWord
+ */
+
+asm("
+.text
+.align 2
+.globl _catchException
+_catchException:
+");
+DISABLE_INTERRUPTS();
+asm("
+ moveml %d0-%d7/%a0-%a6,registers /* save registers */
+ movel lastFrame,%a0 /* last frame pointer */
+
+ move.b #64,(0x00600001)
+ move.b (0x00600007),%d0
+ andib #-64,%d0
+ move.b %d0,(0x00600007)
+
+");
+SAVE_FP_REGS();
+asm("
+ lea registers,%a5 /* get address of registers */
+ movel %sp@+,%d2 /* pop return address */
+ addq.l #6,%d2
+ sub.l #0x200000,%d2
+ divs #6,%d2
+/* addl #1530,%d2 */ /* convert return addr to */
+/* divs #6,%d2 */ /* exception number */
+ extl %d2
+
+ moveql #3,%d3 /* assume a three word frame */
+
+ cmpiw #3,%d2 /* bus error or address error ? */
+ bgt normal /* if >3 then normal error */
+ movel %sp@+,%a0@- /* copy error info to frame buff*/
+ movel %sp@+,%a0@- /* these are never used */
+ moveql #7,%d3 /* this is a 7 word frame */
+
+normal:
+ movew %sp@+,%d1 /* pop status register */
+ movel %sp@+,%a4 /* pop program counter */
+ movew %d1,%a5@(66) /* save sr */
+ movel %a4,%a5@(68) /* save pc in _regisers[] */
+ movel %a4,%a0@- /* copy pc to frame buffer */
+ movew %d1,%a0@- /* copy sr to frame buffer */
+
+ movel %sp,superStack /* save supervisor sp */
+
+ andiw #0x2000,%d1 /* were we in supervisor mode ? */
+ beq userMode
+ movel %a7,%a5@(60) /* save a7 */
+ bra saveDone
+userMode:
+ movel %usp,%a1 /* save user stack pointer */
+ movel %a1,%a5@(60) /* save user stack pointer */
+saveDone:
+
+ movew %d3,%a0@- /* push frame size in words */
+ movel %d2,%a0@- /* push vector number */
+ movel %a4,%a0@- /* push exception pc */
+
+#
+# save old frame link and set the new value
+ movel lastFrame,%a1 /* last frame pointer */
+ movel %a1,%a0@- /* save pointer to prev frame */
+ movel %a0,lastFrame
+
+ movel %d2,%sp@- /* push exception num */
+ movel exceptionHook,%a0 /* get address of handler */
+ jbsr %a0@ /* and call it */
+ clrl %sp@ /* replace exception num parm with frame ptr*/
+ jbsr _returnFromException /* jbsr, but never returns */
+");
+
+
+/*
+ * remcomHandler is a front end for handle_exception. It moves the
+ * stack pointer into an area reserved for debugger use in case the
+ * breakpoint happened in supervisor mode.
+ */
+asm("remcomHandler:");
+asm(" addl #4,%sp"); /* pop off return address */
+asm(" movel %sp@+,%d0"); /* get the exception number */
+asm(" movel stackPtr,%sp"); /* move to remcom stack area */
+asm(" movel %d0,%sp@-"); /* push exception onto stack */
+asm(" andiw #0xf8ff,%sr");
+asm(" jbsr handle_exception"); /* this never returns */
+asm(" rts"); /* return */
+
+void _returnFromException( Frame *frame )
+{
+ /* if no passed in frame, use the last one */
+ if (! frame)
+ {
+ frame = lastFrame;
+ frame->frameSize = 4;
+ frame->format = 0;
+ frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info*/
+ }
+
+
+ /* a 68000 cannot use the internal info pushed onto a bus error
+ * or address error frame when doing an RTE so don't put this info
+ * onto the stack or the stack will creep every time this happens.
+ */
+ frame->frameSize=3;
+
+
+ /* throw away any frames in the list after this frame */
+ lastFrame = frame;
+
+ frame->sr = registers[(int) PS];
+ frame->pc = registers[(int) PC];
+
+ if (registers[(int) PS] & 0x2000)
+ {
+ /* return to supervisor mode... */
+ return_to_super();
+ }
+ else
+ { /* return to user mode */
+ return_to_user();
+ }
+}
+
+int hex(ch)
+char ch;
+{
+ if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
+ if ((ch >= '0') && (ch <= '9')) return (ch-'0');
+ if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10);
+ return (-1);
+}
+
+
+/* scan for the sequence $<data>#<checksum> */
+void getpacket(buffer)
+char * buffer;
+{
+ unsigned char checksum;
+ unsigned char xmitcsum;
+ int i;
+ int count;
+ char ch;
+
+ do {
+ /* wait around for the start character, ignore all other characters */
+ while ((ch = getDebugChar()) != '$');
+ checksum = 0;
+ xmitcsum = -1;
+
+ count = 0;
+
+ /* now, read until a # or end of buffer is found */
+ while (count < BUFMAX) {
+ ch = getDebugChar();
+ if (ch == '#') break;
+ checksum = checksum + ch;
+ buffer[count] = ch;
+ count = count + 1;
+ }
+ buffer[count] = 0;
+
+ if (ch == '#') {
+ xmitcsum = hex(getDebugChar()) << 4;
+ xmitcsum += hex(getDebugChar());
+
+ if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */
+ else {
+ putDebugChar('+'); /* successful transfer */
+ /* if a sequence char is present, reply the sequence ID */
+ if (buffer[2] == ':') {
+ putDebugChar( buffer[0] );
+ putDebugChar( buffer[1] );
+ /* remove sequence chars from buffer */
+ count = db_strlen(buffer);
+ for (i=3; i <= count; i++) buffer[i-3] = buffer[i];
+ }
+ }
+ }
+ } while (checksum != xmitcsum);
+
+}
+
+/* send the packet in buffer. The host get's one chance to read it.
+ This routine does not wait for a positive acknowledge. */
+
+
+void putpacket(buffer)
+char * buffer;
+{
+ unsigned char checksum;
+ int count;
+ char ch;
+
+ /* $<packet info>#<checksum>. */
+ do {
+ putDebugChar('$');
+ checksum = 0;
+ count = 0;
+
+ while ((ch=buffer[count])) {
+ if (! putDebugChar(ch)) return;
+ checksum += ch;
+ count += 1;
+ }
+
+ putDebugChar('#');
+ putDebugChar(hexchars[checksum >> 4]);
+ putDebugChar(hexchars[checksum % 16]);
+
+ } while (1 == 0); /* (getDebugChar() != '+'); */
+
+}
+
+char remcomInBuffer[BUFMAX];
+char remcomOutBuffer[BUFMAX];
+static short error;
+
+
+void debug_error(format, parm)
+char * format;
+char * parm;
+{
+ return;
+}
+
+/* convert the memory pointed to by mem into hex, placing result in buf */
+/* return a pointer to the last char put in buf (null) */
+char* mem2hex(mem, buf, count)
+char* mem;
+char* buf;
+int count;
+{
+ int i;
+ unsigned char ch;
+ for (i=0;i<count;i++) {
+ ch = *mem++;
+ *buf++ = hexchars[ch >> 4];
+ *buf++ = hexchars[ch % 16];
+ }
+ *buf = 0;
+ return(buf);
+}
+
+/* convert the hex array pointed to by buf into binary to be placed in mem */
+/* return a pointer to the character AFTER the last byte written */
+char* hex2mem(buf, mem, count)
+char* buf;
+char* mem;
+int count;
+{
+ int i;
+ unsigned char ch;
+ for (i=0;i<count;i++) {
+ ch = hex(*buf++) << 4;
+ ch = ch + hex(*buf++);
+ *mem++ = ch;
+ }
+ return(mem);
+}
+
+/* this function takes the 68000 exception number and attempts to
+ translate this number into a unix compatible signal value */
+int computeSignal( exceptionVector )
+int exceptionVector;
+{
+ int sigval;
+ switch (exceptionVector) {
+ case 2 : sigval = 10; break; /* bus error */
+ case 3 : sigval = 10; break; /* address error */
+ case 4 : sigval = 4; break; /* illegal instruction */
+ case 5 : sigval = 8; break; /* zero divide */
+ case 6 : sigval = 8; break; /* chk instruction */
+ case 7 : sigval = 8; break; /* trapv instruction */
+ case 8 : sigval = 11; break; /* privilege violation */
+ case 9 : sigval = 5; break; /* trace trap */
+ case 10: sigval = 4; break; /* line 1010 emulator */
+ case 11: sigval = 4; break; /* line 1111 emulator */
+
+ /* Coprocessor protocol violation. Using a standard MMU or FPU
+ this cannot be triggered by software. Call it a SIGBUS. */
+ case 13: sigval = 10; break;
+
+ case 31: sigval = 2; break; /* interrupt */
+ case 33: sigval = 5; break; /* breakpoint */
+
+ /* This is a trap #8 instruction. Apparently it is someone's software
+ convention for some sort of SIGFPE condition. Whose? How many
+ people are being screwed by having this code the way it is?
+ Is there a clean solution? */
+ case 40: sigval = 8; break; /* floating point err */
+
+ case 48: sigval = 8; break; /* floating point err */
+ case 49: sigval = 8; break; /* floating point err */
+ case 50: sigval = 8; break; /* zero divide */
+ case 51: sigval = 8; break; /* underflow */
+ case 52: sigval = 8; break; /* operand error */
+ case 53: sigval = 8; break; /* overflow */
+ case 54: sigval = 8; break; /* NAN */
+ default:
+ sigval = 7; /* "software generated"*/
+ }
+ return (sigval);
+}
+
+/**********************************************/
+/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
+/* RETURN NUMBER OF CHARS PROCESSED */
+/**********************************************/
+int hexToInt(char **ptr, int *intValue)
+{
+ int numChars = 0;
+ int hexValue;
+
+ *intValue = 0;
+
+ while (**ptr)
+ {
+ hexValue = hex(**ptr);
+ if (hexValue >=0)
+ {
+ *intValue = (*intValue <<4) | hexValue;
+ numChars ++;
+ }
+ else
+ break;
+
+ (*ptr)++;
+ }
+
+ return (numChars);
+}
+
+/*
+ * This function does all command procesing for interfacing to gdb.
+ */
+void handle_exception(int exceptionVector)
+{
+ int sigval;
+ int addr, length;
+ char * ptr;
+ int newPC;
+ Frame *frame;
+
+ /* reply to host that an exception has occurred */
+ sigval = computeSignal( exceptionVector );
+ remcomOutBuffer[0] = 'S';
+ remcomOutBuffer[1] = hexchars[sigval >> 4];
+ remcomOutBuffer[2] = hexchars[sigval % 16];
+ remcomOutBuffer[3] = 0;
+
+ putpacket(remcomOutBuffer);
+
+ while (1==1) {
+ error = 0;
+ remcomOutBuffer[0] = 0;
+ getpacket(remcomInBuffer);
+ switch (remcomInBuffer[0]) {
+ case '?' : remcomOutBuffer[0] = 'S';
+ remcomOutBuffer[1] = hexchars[sigval >> 4];
+ remcomOutBuffer[2] = hexchars[sigval % 16];
+ remcomOutBuffer[3] = 0;
+ break;
+ case 'd' : remote_debug = !(remote_debug); /* toggle debug flag */
+ break;
+ case 'g' : /* return the value of the CPU registers */
+ mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES);
+ break;
+ case 'G' : /* set the value of the CPU registers - return OK */
+ hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES);
+ db_strcpy(remcomOutBuffer,"OK");
+ break;
+
+ /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+ case 'm' :
+ /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt(&ptr,&addr))
+ if (*(ptr++) == ',')
+ if (hexToInt(&ptr,&length))
+ {
+ ptr = 0;
+ mem2hex((char*) addr, remcomOutBuffer, length);
+ }
+
+ if (ptr)
+ {
+ db_strcpy(remcomOutBuffer,"E01");
+ debug_error("malformed read memory command: %s",remcomInBuffer);
+ }
+ break;
+
+ /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+ case 'M' :
+ /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt(&ptr,&addr))
+ if (*(ptr++) == ',')
+ if (hexToInt(&ptr,&length))
+ if (*(ptr++) == ':')
+ {
+ hex2mem(ptr, (char*) addr, length);
+ ptr = 0;
+ db_strcpy(remcomOutBuffer,"OK");
+ }
+ if (ptr)
+ {
+ db_strcpy(remcomOutBuffer,"E02");
+ debug_error("malformed write memory command: %s",remcomInBuffer);
+ }
+ break;
+
+ /* cAA..AA Continue at address AA..AA(optional) */
+ /* sAA..AA Step one instruction from AA..AA(optional) */
+ case 'c' :
+ case 's' :
+ /* try to read optional parameter, pc unchanged if no parm */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt(&ptr,&addr))
+ registers[ PC ] = addr;
+
+ newPC = registers[ PC];
+
+ /* clear the trace bit */
+ registers[ PS ] &= 0x7fff;
+
+ /* set the trace bit if we're stepping */
+ if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x8000;
+
+ /*
+ * look for newPC in the linked list of exception frames.
+ * if it is found, use the old frame it. otherwise,
+ * fake up a dummy frame in returnFromException().
+ */
+ frame = lastFrame;
+ while (frame)
+ {
+ if (frame->exceptionPC == newPC) break; /* bingo! a match */
+ /*
+ * for a breakpoint instruction, the saved pc may
+ * be off by two due to re-executing the instruction
+ * replaced by the trap instruction. Check for this.
+ */
+ if ((frame->exceptionVector == 33) &&
+ (frame->exceptionPC == (newPC+2))) break;
+ if (frame == frame->previous)
+ {
+ frame = 0; /* no match found */
+ break;
+ }
+ frame = frame->previous;
+ }
+
+ /*
+ * If we found a match for the PC AND we are not returning
+ * as a result of a breakpoint (33),
+ * trace exception (9), nmi (31), jmp to
+ * the old exception handler as if this code never ran.
+ */
+ if (frame)
+ {
+ if ((frame->exceptionVector != 9) &&
+ (frame->exceptionVector != 31) &&
+ (frame->exceptionVector != 33))
+ {
+ /*
+ * invoke the previous handler.
+ */
+ if (oldExceptionHook)
+ (*oldExceptionHook) (frame->exceptionVector);
+ newPC = registers[ PC ]; /* pc may have changed */
+ if (newPC != frame->exceptionPC)
+ {
+ /* re-use the last frame, we're skipping it (longjump?)*/
+ frame = (Frame *) 0;
+ _returnFromException( frame ); /* this is a jump */
+ }
+ }
+ }
+
+ /* if we couldn't find a frame, create one */
+ if (frame == 0)
+ {
+ frame = lastFrame -1 ;
+
+ /* by using a bunch of print commands with breakpoints,
+ it's possible for the frame stack to creep down. If it creeps
+ too far, give up and reset it to the top. Normal use should
+ not see this happen.
+ */
+ if ((unsigned int) (frame-2) < (unsigned int) &gdbFrameStack)
+ {
+ initializeRemcomErrorFrame();
+ frame = lastFrame;
+ }
+ frame->previous = lastFrame;
+ lastFrame = frame;
+ frame = 0; /* null so _return... will properly initialize it */
+ }
+
+ _returnFromException( frame ); /* this is a jump */
+
+ break;
+
+ /* kill the program */
+ case 'k' : /* do nothing */
+ break;
+ } /* switch */
+
+ /* reply to the request */
+ putpacket(remcomOutBuffer);
+ }
+}
+
+
+void
+initializeRemcomErrorFrame()
+{
+ lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1;
+ lastFrame->previous = lastFrame;
+}
+
+/* this function is used to set up exception handlers for tracing and
+ breakpoints */
+void set_debug_traps()
+{
+ extern void _debug_level7();
+ extern void remcomHandler();
+ int exception;
+
+ initializeRemcomErrorFrame();
+ stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
+
+ for (exception = 2; exception <= 23; exception++)
+ set_vector(_catchException,exception,0);
+
+ /* level 7 interrupt */
+ set_vector(_debug_level7,31,0);
+
+ /* breakpoint exception (trap #1) */
+ set_vector(_catchException,33,0);
+
+ /* This is a trap #8 instruction. Apparently it is someone's software
+ convention for some sort of SIGFPE condition. Whose? How many
+ people are being screwed by having this code the way it is?
+ Is there a clean solution? */
+ set_vector(_catchException,40,0);
+
+ /* 48 to 54 are floating point coprocessor errors */
+ for (exception = 48; exception <= 54; exception++)
+ set_vector(_catchException,exception,0);
+
+ if (oldExceptionHook != remcomHandler)
+ {
+ oldExceptionHook = exceptionHook;
+ exceptionHook = remcomHandler;
+ }
+
+ initialized = 1;
+
+}
+
+/* This function will generate a breakpoint exception. It is used at the
+ beginning of a program to sync up with a debugger and can be used
+ otherwise as a quick means to stop program execution and "break" into
+ the debugger. */
+
+void breakpoint()
+{
+ if (initialized) BREAKPOINT();
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/setvec.c b/c/src/lib/libbsp/m68k/efi68k/startup/setvec.c
new file mode 100644
index 0000000000..39eb7a1fa1
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/setvec.c
@@ -0,0 +1,45 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the efi68k.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+m68k_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ int *p;
+ m68k_isr_entry previous_isr;
+
+ if ( type )
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+ else {
+ p = (int *)(vector*6-12+2+(int)_VBR);
+ previous_isr = (m68k_isr_entry) *p; /* return old ISR */
+ *p = (int) handler; /* install new ISR */
+ }
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/m68k/efi68k/timer/timer.c b/c/src/lib/libbsp/m68k/efi68k/timer/timer.c
new file mode 100644
index 0000000000..b53e31ec0d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/timer/timer.c
@@ -0,0 +1,141 @@
+/* Timer_init()
+ *
+ * This routine initializes a timer in efi68k's DP8570A TCP
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <bsp.h>
+
+rtems_boolean Timer_driver_Find_average_overhead;
+
+extern rtems_isr Clock_isr();
+
+void Timer_initialize( void )
+{
+ /* stop counter */
+ *MSR = 0;
+ *T0CR = 0;
+
+ /*
+ * Make sure isr is installed
+ */
+
+ set_vector( Clock_isr, TCP_ISR_LEVEL+24, 1);
+
+ /* clear timer ISR count */
+ Timer_interrupts = 0;
+
+ /* load count (count down timer) */
+ *MSR = 0;
+ *T0_MSB = 0xff;
+ *T0_LSB = 0xff;
+
+ /* clear old interrupts */
+ *MSR = T0;
+
+ /* enable timer 0 interrupt */
+ *MSR = RS;
+ *ICR0 |= T0E;
+
+ /*
+ TSS = 1 starts the timer (timer resets on start)
+ M1/0 = 0/1 rate generator
+ C2/1/0 = 0/0/0 external clock (8MHz) (1/8 usec resolution)
+ RD = 0 read data (latchs count)
+ CHG = 0 hold
+ */
+ *MSR = 0;
+ *T0CR = (TSS | M0);
+}
+
+/*
+ * The following controls the behavior of Read_timer().
+ *
+ * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count.
+ *
+ * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
+ * is usually deducted from the number returned.
+ *
+ * LEAST_VALID is the lowest number this routine should trust. Numbers
+ * below this are "noise" and zero is returned.
+ */
+
+#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
+ /* (Y countdowns) to start/stop the timer. */
+ /* This value is in microseconds. */
+#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
+
+/*
+ * Return timer value in 1/2-microsecond units
+ */
+int Read_timer( void )
+{
+ rtems_unsigned16 clicks;
+ rtems_unsigned32 total;
+ rtems_unsigned32 msb, lsb;
+
+
+ /*
+ * Read the timer and see how many clicks it has been since counter
+ * rolled over.
+ */
+
+ *MSR = 0;
+ *T0CR |= RD;
+ /* must read MSB first */
+ msb = *T0_MSB;
+ lsb = *T0_LSB;
+ clicks = 0xffff - ((msb << 8) | lsb);
+
+ /*
+ * Total is calculated by taking into account the number of timer overflow
+ * interrupts since the timer was initialized and clicks since the last
+ * interrupts.
+ */
+
+ total = (Timer_interrupts * 0x10000 + clicks + 4)/8; /* in micoseconds */
+ /* ^^^ round to nearest int */
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ return (total - AVG_OVERHEAD);
+}
+
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+
+rtems_status_code Empty_function(void)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/times b/c/src/lib/libbsp/m68k/efi68k/times
new file mode 100644
index 0000000000..f13320d065
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/times
@@ -0,0 +1,193 @@
+#
+# Timing Test Suite Results for the EFI68k BSP
+#
+# $Id$
+#
+
+NOTE: This BSP is used submitted and no information is currently available.
+
+Board: EFI68k
+CPU: Motorola MC68HC000
+Clock Speed: 16 Mhz
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/gen68302/README b/c/src/lib/libbsp/m68k/gen68302/README
new file mode 100644
index 0000000000..0261083479
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/README
@@ -0,0 +1,154 @@
+#
+# $Id$
+#
+
+BSP NAME: gen68302
+BOARD: proprietary (see below for relevant information)
+BUS: none
+CPU FAMILY: MC68000
+COPROCESSORS: 68302 communications co-processor
+MODE: not applicable
+
+DEBUG MONITOR: none
+
+PERIPHERALS
+===========
+TIMERS: two 68302 timers, one 68302 watchdog timer
+ RESOLUTION: ?
+SERIAL PORTS: three 68302 SCCs
+REAL-TIME CLOCK:
+DMA: built-in 68302, not used
+VIDEO: none
+SCSI: none
+NETWORKING: none
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER: 68302 (TIMER1)
+IOSUPP DRIVER: 68302 SCC2
+SHMSUPP: none
+TIMER DRIVER: 68302 TIMER2
+
+STDIO
+=====
+PORT: ?
+ELECTRICAL: EIA-232
+BAUD: 9600
+BITS PER CHARACTER: 8
+PARITY: None
+STOP BITS: 1
+
+NOTES
+=====
+
+Board description
+-----------------
+clock rate: 16 MHz
+bus width: 16 bits
+ROM: 128 kbyte (flash, 0 wait states, chip select 0)
+RAM: 256 kbyte (static, 0 wait states, chip select 1)
+
+The 68302's built-in DRAM refresh controller circuitry is neither used
+nor configured at startup.
+
+Host System
+-----------
+HP 9000/715, HP-UX 9.05
+gcc-2.6.3
+binutils-2.5.2
+
+
+Verification
+------------
+The 1-ms clock ISR rate was verified with an in-circuit emulator.
+
+Single processor tests:
+Multi-processort tests: not applicable
+Timing tests: see results in c/src/tests/tmtests/times
+
+Note: The board has 256 kbyte RAM, so the timing tests would not run
+with the standard executive RAM size configuration of 256 K.
+Modifying the conftbl.h files to specify 160 kbyte for workspace
+seemed to work.
+
+* Porting
+
+** Mod c/src/tests/tmtests/*/conftbl.h
+
+Modified to use 160 kbyte for executive RAM size.
+
+** Add c/make/custom/gen68302.cfg
+
+Based on m68k_no_bsp.cfg. Turned off multiprocessor support. Had to
+use a BSP-specific compiler configuration file in order to link the
+proper startup file.
+
+** Mod c/make/compilers/gcc-m68000.cfg
+
+Added "-m68000" to the AS macro so that non-68000 instructions are
+neither generated nor allowed (remember that the GNU assembler
+supports pseudo-assembler instructions (e.g. jbsr) that will be
+"intelligently" assembled.) Added "m68000/" before libgcc.a so that
+non-68000 instructions aren't included.
+
+** Add c/make/compilers/gcc-gen68302.cfg
+
+Based on modified gcc-m68000.cfg.
+
+Changed make-exe define to produce IEEE-695 output files for loading
+into the emulator.
+
+The board has no debug monitor, so I had to create a 68302-specific
+startup file (c/src/lib/libbsp/m68k/gen68302/start302/start302.s) to
+override the c/src/lib/start/m68k/start.s. START_FILE entry was
+modified to causes start302.s to be linked first (in lieu of start.s).
+
+** Mod c/src/exec/cpu/m68k/cpu.h
+
+Turned off software and hardware interrupt stack support. Added
+support in _CPU_Bitfield_Find_first_bit() and
+_CPU_Priority_Bits_index() to replace the bfffo instruction.
+
+TODO: add software-maintained interrupt stack.
+
+TODO: optimize things so that subtracting _priority from 15 isn't
+required in _CPU_Priority_Bits_index().
+
+** Mod c/src/exec/cpu/m68k/cpu.c
+
+Added the log base 2 table (__log2table) that's required by the BFFFO
+replacement in cpu.h.
+
+** Mod c/src/exec/cpu/m68k/cpu_asm.s
+
+Added _ISR_Exit that's currently used in TBD.... Added ifdef wrapper
+around ISR exit code that accessed the format nibble. Added some code
+to restore the status register and call _Thread_Dispatch.
+
+TODO: add software-maintained interrupt stack.
+
+** Mod c/src/exec/cpu/m68k/m68k.h
+
+Changed "typedef char signed8" to "typedef signed char signed8".
+
+** Add c/src/lib/libbsp/m68k/gen68302/...
+*** clock/
+
+TODO: Add set_vector support. Figure out what to do with Clock_exit().
+TODO: Pre-compute (BSP_Configuration.microseconds_per_tick/1000) so that
+it doesn't have to be re-computed on each Clock_isr().
+
+*** console/
+
+These files assume SCC2, but it shouldn't be too difficult to re-write
+these to use any of the other SCCs.
+
+*** include/
+*** start302/
+
+This contains the start302.s file that does some fairly tricky memory
+re-mapping so that RAM ends up at 0 and ROM ends up at 0xc00000.
+
+*** startup/
+*** timer/
+*** wrapup/
diff --git a/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c b/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c
new file mode 100644
index 0000000000..386fc026a7
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c
@@ -0,0 +1,162 @@
+/* Clock_init()
+ *
+ * This routine initializes Timer 1 for an MC68302.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h> /* for atexit() */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include "m68302.h"
+
+#define CLOCK_VECTOR 137
+
+#define TMR1_VAL ( RBIT_TMR_RST /* software reset the timer */\
+ | RBIT_TMR_ICLK_MASTER16 /* master clock divided by 16 */\
+ | RBIT_TMR_FRR /* restart timer after ref reached */\
+ | RBIT_TMR_ORI) /* enable interrupt when ref reached */
+#define TRR1_VAL 1000 /* 1000 ticks @ 16MHz/16
+ * = 1 millisecond tick.
+ */
+
+/*
+ * Clock_driver_ticks is a monotonically increasing counter of the
+ * number of clock ticks since the driver was initialized.
+ */
+volatile rtems_unsigned32 Clock_driver_ticks;
+
+/*
+ * Clock_isrs is the number of clock ISRs until the next invocation of
+ * the RTEMS clock tick routine. The clock tick device driver
+ * gets an interrupt once a millisecond and counts down until the
+ * length of time between the user configured microseconds per tick
+ * has passed.
+ */
+rtems_unsigned32 Clock_isrs;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * ISR Handler
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ Clock_driver_ticks += 1;
+
+ m302.reg.isr = RBIT_ISR_TIMER1; /* clear in-service bit */
+ m302.reg.ter1 = (RBIT_TER_REF | RBIT_TER_CAP); /* clear timer intr request */
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ set_vector( clock_isr, CLOCK_VECTOR, 1 );
+
+ m302.reg.trr1 = TRR1_VAL; /* set timer reference register */
+ m302.reg.tmr1 = TMR1_VAL; /* set timer mode register & enable */
+ /*
+ * Enable TIMER1 interrupts only.
+ */
+ m302.reg.imr = RBIT_IMR_TIMER1; /* set 68302 int-mask to allow ints */
+
+ atexit( Clock_exit );
+ }
+}
+
+void Clock_exit( void )
+{
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ /* TODO: figure out what to do here */
+ /* do not restore old vector */
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr( CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/gen68302/console/console.c b/c/src/lib/libbsp/m68k/gen68302/console/console.c
new file mode 100644
index 0000000000..04820bf579
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/console/console.c
@@ -0,0 +1,304 @@
+/*
+ * Initialize the MC68302 SCC2 for console IO board support package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define GEN68302_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include "m68302.h"
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+ volatile m302_dualPortRAM_t *p = &m302;
+
+ p->reg.pacnt |= 0x0003; /* enable RXD2 and TXD2 signals */
+ /*
+ * TODO: Check assembly code. I think gcc's volatile semantics force
+ * this to not use a CLR.
+ */
+ p->reg.simode = 0; /* NMSI mode */
+
+ p->reg.scc[1].scon = 0x00d8; /* 9600 baud */
+ p->reg.scc[1].scm = 0x01b1;
+
+ p->scc2.parm.rfcr = 0x50; /* Rx buffers in supervisor data */
+ p->scc2.parm.tfcr = 0x50; /* Tx buffers in supervisor data */
+ p->scc2.parm.mrblr = 0x0001; /* Max Rx buffer length is 1 byte */
+
+ p->scc2.prot.uart.max_idl = 0x0000; /* 0 = maximum timeout value */
+ p->scc2.prot.uart.brkcr = 0x0001; /* send 1 break char on STOP TX cmd */
+ p->scc2.prot.uart.parec = 0x0000; /* reset parity error counter */
+ p->scc2.prot.uart.frmec = 0x0000; /* reset framing error counter */
+ p->scc2.prot.uart.nosec = 0x0000; /* reset noise error counter */
+ p->scc2.prot.uart.brkec = 0x0000; /* reset break condition counter */
+
+ p->scc2.prot.uart.character[0] = 0x0003; /* use <ctrl>c as control char */
+ p->scc2.prot.uart.character[1] = 0x8000; /* set end of cntrl char table */
+
+ p->scc2.bd.rx[0].status = 0xA000; /* RxBD0 empty, wrap, no intr */
+ p->scc2.bd.rx[0].length = 0x0000;
+ p->scc2.bd.rx[0].buffer =
+ (rtems_unsigned8 *) &m302.scc2.bd.rx[1]; /* RxBD1 is Rx buffer */
+
+ p->reg.scc[1].dsr = 0x7000; /* set full-length last stop bit */
+
+ p->scc2.bd.tx[0].status = 0x3000; /* TxBD0 not ready, wrap, intr */
+ p->scc2.bd.tx[0].length = 0x0001;
+ p->scc2.bd.tx[0].buffer =
+ (rtems_unsigned8 *) &m302.scc2.bd.tx[1]; /* TxBD1 is Tx buffer */
+
+ p->reg.scc[1].scce = 0xFF; /* clear all SCC event flags */
+ p->reg.scc[1].sccm = 0x03; /* enable only Tx & Rx interrupts */
+ p->reg.scc[1].scm = 0x01BD;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+
+}
+
+/* is_character_ready
+ *
+ * Check to see if a character is available on the MC68302's SCC2. If so,
+ * then return a TRUE (along with the character). Otherwise return FALSE.
+ *
+ * Input parameters: pointer to location in which to return character
+ *
+ * Output parameters: character (if available)
+ *
+ * Return values: TRUE - character available
+ * FALSE - no character available
+ */
+
+rtems_boolean is_character_ready(
+ char *ch /* -> character */
+)
+{
+#define RXS (m302.scc2.bd.rx[0].status)
+#define RXD (* ((volatile char *) m302.scc2.bd.rx[0].buffer))
+
+ for (;;) {
+ if (RXS & RBIT_HDLC_EMPTY_BIT)
+ return FALSE;
+
+ *ch = RXD;
+ RXS = RBIT_HDLC_EMPTY_BIT | RBIT_HDLC_WRAP_BIT;
+ if ( *ch >= ' ' && *ch <= '~' )
+ return TRUE;
+ }
+}
+
+
+/* inbyte
+ *
+ * Receive a character from the MC68302's SCC2.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values: character read
+ */
+
+char inbyte( void )
+{
+ char ch;
+
+#define RXS (m302.scc2.bd.rx[0].status)
+#define RXD (* ((volatile char *) m302.scc2.bd.rx[0].buffer))
+
+ do {
+ while (RXS & RBIT_HDLC_EMPTY_BIT)
+ /* Wait until character received */ ;
+
+ ch = RXD;
+ RXS = RBIT_HDLC_EMPTY_BIT | RBIT_HDLC_WRAP_BIT;
+
+ if (ch == '\r' || ch == '\n')
+ break;
+ } while (ch < ' ' || ch > '~');
+
+ return ch;
+}
+
+
+/* outbyte
+ *
+ * Transmit a character out on the MC68302's SCC2.
+ * It may support XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+#define TXS (m302.scc2.bd.tx[0].status)
+#define TXD (* ((volatile char *) m302.scc2.bd.tx[0].buffer))
+
+#define RXS (m302.scc2.bd.rx[0].status)
+#define RXD (* ((volatile char *) m302.scc2.bd.rx[0].buffer))
+
+ while (TXS & RBIT_HDLC_READY_BIT)
+ /* Wait until okay to transmit */ ;
+
+ /*
+ * Check for flow control requests and process.
+ */
+ while ( ! (RXS & RBIT_HDLC_EMPTY_BIT)) {
+ if (RXD == XOFF)
+ do {
+ RXS = RBIT_HDLC_EMPTY_BIT | RBIT_HDLC_WRAP_BIT;
+ while (RXS & RBIT_HDLC_EMPTY_BIT)
+ /* Wait until character received */ ;
+ } while (RXD != XON);
+ RXS = RBIT_HDLC_EMPTY_BIT | RBIT_HDLC_WRAP_BIT;
+ }
+
+ TXD = ch;
+ TXS = RBIT_HDLC_READY_BIT | RBIT_HDLC_WRAP_BIT;
+ if (ch == '\n')
+ outbyte('\r');
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68302/include/bsp.h b/c/src/lib/libbsp/m68k/gen68302/include/bsp.h
new file mode 100644
index 0000000000..eed274fb9a
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/include/bsp.h
@@ -0,0 +1,125 @@
+/* bsp.h
+ *
+ * This include file contains all board IO definitions.
+ *
+ * XXX : put yours in here
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __GEN68302_BSP_h
+#define __GEN68302_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <console.h>
+#include <iosupp.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Stuff for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
+
+#define Cause_tm27_intr()
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x040000
+
+/* Structures */
+
+#ifdef GEN68302_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/gen68302/include/coverhd.h b/c/src/lib/libbsp/m68k/gen68302/include/coverhd.h
new file mode 100644
index 0000000000..e41c72bf33
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/include/coverhd.h
@@ -0,0 +1,115 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 14
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 11
+#define CALLING_OVERHEAD_TASK_CREATE 22
+#define CALLING_OVERHEAD_TASK_IDENT 17
+#define CALLING_OVERHEAD_TASK_START 18
+#define CALLING_OVERHEAD_TASK_RESTART 15
+#define CALLING_OVERHEAD_TASK_DELETE 12
+#define CALLING_OVERHEAD_TASK_SUSPEND 12
+#define CALLING_OVERHEAD_TASK_RESUME 12
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 16
+#define CALLING_OVERHEAD_TASK_MODE 15
+#define CALLING_OVERHEAD_TASK_GET_NOTE 16
+#define CALLING_OVERHEAD_TASK_SET_NOTE 16
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 31
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 11
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 17
+#define CALLING_OVERHEAD_CLOCK_GET 32
+#define CALLING_OVERHEAD_CLOCK_SET 31
+#define CALLING_OVERHEAD_CLOCK_TICK 8
+
+#define CALLING_OVERHEAD_TIMER_CREATE 13
+#define CALLING_OVERHEAD_TIMER_IDENT 12
+#define CALLING_OVERHEAD_TIMER_DELETE 14
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 19
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 39
+#define CALLING_OVERHEAD_TIMER_RESET 12
+#define CALLING_OVERHEAD_TIMER_CANCEL 12
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 18
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 12
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 17
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 17
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 12
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 18
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 17
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 12
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 14
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 14
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 17
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 19
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 14
+
+#define CALLING_OVERHEAD_EVENT_SEND 15
+#define CALLING_OVERHEAD_EVENT_RECEIVE 18
+#define CALLING_OVERHEAD_SIGNAL_CATCH 14
+#define CALLING_OVERHEAD_SIGNAL_SEND 14
+#define CALLING_OVERHEAD_PARTITION_CREATE 23
+#define CALLING_OVERHEAD_PARTITION_IDENT 17
+#define CALLING_OVERHEAD_PARTITION_DELETE 12
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 15
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 15
+#define CALLING_OVERHEAD_REGION_CREATE 23
+#define CALLING_OVERHEAD_REGION_IDENT 14
+#define CALLING_OVERHEAD_REGION_DELETE 12
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 21
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 15
+#define CALLING_OVERHEAD_PORT_CREATE 20
+#define CALLING_OVERHEAD_PORT_IDENT 14
+#define CALLING_OVERHEAD_PORT_DELETE 12
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 18
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 18
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 18
+#define CALLING_OVERHEAD_IO_OPEN 18
+#define CALLING_OVERHEAD_IO_CLOSE 18
+#define CALLING_OVERHEAD_IO_READ 18
+#define CALLING_OVERHEAD_IO_WRITE 18
+#define CALLING_OVERHEAD_IO_CONTROL 18
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 11
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 13
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 14
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 12
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 12
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 14
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/gen68302/start/start302.s b/c/src/lib/libbsp/m68k/gen68302/start/start302.s
new file mode 100644
index 0000000000..311cd3fa39
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/start/start302.s
@@ -0,0 +1,267 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+ .set BAR, 0xF2 | Base Address Register location
+ .set SCR, 0xF4 | System Control Register location
+ .set BAR_VAL, 0x0f7f | BAR value
+ .set SCR_VAL, 0x00080f00 | SCR value
+ .set GIMR_VAL, 0x8780 |Global Interrupt Mode Register. (MUST BE WRITTEN).
+ .set BaseAddr,(BAR_VAL&0x0fff)<<12 | MC68302 internal base address
+
+ .set oSYSRAM, 0x000 | 576 bytes of internal system RAM
+
+ .set oGIMR, 0x812
+
+ .set oCS0_Base, 0x830 | 16 bits, Chip Sel 0 Base Reg
+ .set oCS0_Option, 0x832 | 16 bits, Chip Sel 0 Option Reg
+ .set oCS1_Base, 0x834 | 16 bits, Chip Sel 1 Base Reg
+ .set oCS1_Option, 0x836 | 16 bits, Chip Sel 1 Option Reg
+ .set oCS2_Base, 0x838 | 16 bits, Chip Sel 2 Base Reg
+ .set oCS2_Option, 0x83a | 16 bits, Chip Sel 2 Option Reg
+ .set oCS3_Base, 0x83c | 16 bits, Chip Sel 3 Base Reg
+ .set oCS3_Option, 0x83e | 16 bits, Chip Sel 3 Option Reg
+
+ .set tmpSRAM_BASE, 0x400000 | start of temporary SRAM
+ .set FLASH_BASE, 0xc00000 | start of FLASH''s normal location
+
+
+BEGIN_CODE
+ PUBLIC (M68Kvec) | Vector Table
+SYM (M68Kvec): | standard location for vectors
+V___ISSP: .long 0x00001000 |00 0 Reset: Initial SSP
+V____IPC: .long SYM(start)-V___ISSP |04 1 Reset: Initial PC
+V_BUSERR: .long Bad-V___ISSP |08 2 Bus Error
+V_ADRERR: .long Bad-V___ISSP |0c 3 Address Error
+ .space 240 | reserve space for reset of vectors
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+SYM (lowintstack):
+ .space 4092 | reserve for interrupt stack
+SYM (hiintstack):
+ .space 4 | end of interrupt stack
+#endif
+
+ PUBLIC (start) | Default entry point for GNU
+SYM (start):
+ move.w #0x2700,sr | Disable all interrupts
+ move.w #BAR_VAL,BAR | Set Base Address Register
+ move.l #SCR_VAL,SCR | Set System Control Register
+ lea BaseAddr,a5
+ move.w #GIMR_VAL,a5@(oGIMR) | Set Global Interrupt Mode Register
+
+|
+| Set up chip select registers for the remapping process.
+|
+
+|
+| 0 X x x x x
+| 0 000 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xc001,a5@(oCS0_Base) | Expand CS0 to full size (FLASH)
+ move.w #0x1f82,a5@(oCS0_Option) | 000000-03ffff, R, 0 WS
+
+|
+| X x x x x x
+| 0 100 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xa801,a5@(oCS1_Base) | Set up and enable CS1 (SRAM)
+ move.w #0x1f80,a5@(oCS1_Option) | 400000-43ffff, RW, 0 WS
+
+|
+| Copy the initial boot FLASH area to the temporary SRAM location.
+|
+ moveq #0,d0
+ movea.l d0,a0 | a0 -> start of FLASH
+ lea tmpSRAM_BASE,a1 | a1 -> start of tmp SRAM
+| moveq #(endPreBoot-V___ISSP)/4,d0 | # longs to copy
+ moveq #127,d0
+cpy_flash: move.l (a0)+,(a1)+ | copy
+ subq.l #1,d0
+ bne cpy_flash
+
+|
+| Copy remap code to 68302''s internal system RAM.
+|
+ movea.w #begRemap-V___ISSP,a0 | a0 -> remap code
+ lea a5@(oSYSRAM),a1 | a1 -> internal system RAM
+| moveq #(endRemap-begRemap)/2-1,d0 | d0 = # words to copy
+ moveq #11,d0
+cpy_remap: move.w (a0)+,(a1)+ | copy
+ dbra d0,cpy_remap
+
+|
+| Jump to the remap code in the 68302''s internal system RAM.
+|
+ jmp a5@(oSYSRAM) | (effectively a jmp begRemap)
+
+|
+| This remap code, when executed from the 68302''s internal system RAM
+| will 1) remap CS1 so that SRAM is at 0
+| 2) remap CS0 so that FLASH is at FLASH_BASE
+| and 3) jump to executable code in the remapped FLASH.
+|
+begRemap: move.w #0xa001,a5@(oCS1_Base) | Move CS1 (SRAM)
+ move.w #0xd801,a5@(oCS0_Base) | Move CS0 (FLASH)
+ lea FLASH_BASE,a0
+ jmp a0@(endRemap-V___ISSP.w) | Jump back to FLASH
+endRemap:
+|
+| Now set up the remaining chip select registers.
+|
+
+|
+| 4 0 x x x x
+| 1 000 1 111 0 000 0--- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xb1e1,a5@(oCS2_Base) | Set up and enable CS2 (dpRAM)
+ move.w #0x1ff0,a5@(oCS2_Option) | 8f0000-8f07ff, RW, 0 WS
+
+|
+| 8 X x x x x
+| 1 000 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xd001,a5@(oCS3_Base) | Set up and enable CS3 (IO)
+ move.w #0x1f80,a5@(oCS3_Option) | 800000-83ffff, RW, 0 WS
+
+endPreBoot:
+
+ move.b #0x30,0x800001 | set status LED amber
+
+ .set oPIOB_Ctrl, 0x824
+ .set oPIOB_DDR, 0x826
+ .set oPIOB_Data, 0x828
+
+ .set oPIOA_Ctrl, 0x81e
+ .set oPIOA_DDR, 0x820
+ .set oPIOA_Data, 0x822
+
+ move.w #0x0ff8,a5@(oPIOB_Data) | Make output follow resistors.
+ move.w #0x00ff,a5@(oPIOB_DDR) | Set up PB7-PB0 for output.
+ move.w #0x0080,a5@(oPIOB_Ctrl) | Set up WDOG* as dedicated
+ | peripheral pins.
+
+ move.w #0x1fff,a5@(oPIOA_Data) | Make output follow resistors.
+ move.w #0xea2a,a5@(oPIOA_DDR) | Set up PA15-PA0 for in/output.
+ move.w #0x0003,a5@(oPIOA_Ctrl) | Set up TXD2/RXD2 as dedicated
+ | peripheral pins.
+
+|
+| Place "Bad" in all vectors from 010 thru 0ec. Vectors 0f0 and 0f4
+| are not set because they are the 68302''s BAR and SCR.
+|
+ movea.w #0x010,a0
+ moveq #(0x0f0-0x010)/4-1,d0
+ move.l #Bad,d1
+cpy_Bad: move.l d1,(a0)+
+ dbra d0,cpy_Bad
+
+ .set vbase, 0x0200
+
+ lea vbase,a0
+ moveq #31,d0
+cpy_Bad1: move.l d1,(a0)+
+ dbra d0,cpy_Bad1
+
+|
+| Fill in special locations to configure OS
+|
+ move.l #Bad,0x008 | Bus Error
+ move.l #Bad,0x00c | Address Error
+ move.l #Bad,0x024 | Trace
+| move.l #KE_IRET,$0b4 | pSOS+ RET_I Call
+
+| move.l #_cnsl_isr,vbase+0x028 | SCC2
+ move.l #timerisr,vbase+0x018 | Timer ISR
+
+ |
+ | zero out uninitialized data area
+ |
+zerobss:
+ moveal # SYM (end),a0 | find end of .bss
+ moveal # SYM (bss_start),a1 | find beginning of .bss
+ moveq #0,d0
+
+loop: movel d0,a1@+ | to zero out uninitialized
+ cmpal a0,a1
+ jlt loop | loop until _end reached
+
+ movel # SYM (end),d0 | d0 = end of bss/start of heap
+ addl # SYM (heap_size),d0 | d0 = end of heap
+ movel d0, SYM (stack_start) | Save for brk() routine
+ addl # SYM (stack_size),d0 | make room for stack
+ andl #0xffffffc0,d0 | align it on 16 byte boundary
+ movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!!
+ movel d0,a7 | set master stack pointer
+ movel d0,a6 | set base pointer
+
+ /*
+ * RTEMS should maintiain a separate interrupt stack on CPUs
+ * without one in hardware. This is currently not supported
+ * on versions of the m68k without a HW intr stack.
+ */
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ lea SYM (hiintstack),a0 | a0 = high end of intr stack
+ movec a0,isp | set interrupt stack
+#endif
+
+ move.l #0,a7@- | environp
+ move.l #0,a7@- | argv
+ move.l #0,a7@- | argc
+ jsr SYM (main)
+
+ nop
+Bad: bra Bad
+
+ nop
+END_CODE
+
+
+BEGIN_DATA
+
+ PUBLIC (start_frame)
+SYM (start_frame):
+ .space 4,0
+
+ PUBLIC (stack_start)
+SYM (stack_start):
+ .space 4,0
+END_DATA
+
+BEGIN_BSS
+
+ PUBLIC (environ)
+ .align 2
+SYM (environ):
+ .long 0
+
+ PUBLIC (heap_size)
+ .set SYM (heap_size),0x2000
+
+ PUBLIC (stack_size)
+ .set SYM (stack_size),0x1000
+
+
+END_DATA
+END
diff --git a/c/src/lib/libbsp/m68k/gen68302/start302/start302.s b/c/src/lib/libbsp/m68k/gen68302/start302/start302.s
new file mode 100644
index 0000000000..311cd3fa39
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/start302/start302.s
@@ -0,0 +1,267 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+ .set BAR, 0xF2 | Base Address Register location
+ .set SCR, 0xF4 | System Control Register location
+ .set BAR_VAL, 0x0f7f | BAR value
+ .set SCR_VAL, 0x00080f00 | SCR value
+ .set GIMR_VAL, 0x8780 |Global Interrupt Mode Register. (MUST BE WRITTEN).
+ .set BaseAddr,(BAR_VAL&0x0fff)<<12 | MC68302 internal base address
+
+ .set oSYSRAM, 0x000 | 576 bytes of internal system RAM
+
+ .set oGIMR, 0x812
+
+ .set oCS0_Base, 0x830 | 16 bits, Chip Sel 0 Base Reg
+ .set oCS0_Option, 0x832 | 16 bits, Chip Sel 0 Option Reg
+ .set oCS1_Base, 0x834 | 16 bits, Chip Sel 1 Base Reg
+ .set oCS1_Option, 0x836 | 16 bits, Chip Sel 1 Option Reg
+ .set oCS2_Base, 0x838 | 16 bits, Chip Sel 2 Base Reg
+ .set oCS2_Option, 0x83a | 16 bits, Chip Sel 2 Option Reg
+ .set oCS3_Base, 0x83c | 16 bits, Chip Sel 3 Base Reg
+ .set oCS3_Option, 0x83e | 16 bits, Chip Sel 3 Option Reg
+
+ .set tmpSRAM_BASE, 0x400000 | start of temporary SRAM
+ .set FLASH_BASE, 0xc00000 | start of FLASH''s normal location
+
+
+BEGIN_CODE
+ PUBLIC (M68Kvec) | Vector Table
+SYM (M68Kvec): | standard location for vectors
+V___ISSP: .long 0x00001000 |00 0 Reset: Initial SSP
+V____IPC: .long SYM(start)-V___ISSP |04 1 Reset: Initial PC
+V_BUSERR: .long Bad-V___ISSP |08 2 Bus Error
+V_ADRERR: .long Bad-V___ISSP |0c 3 Address Error
+ .space 240 | reserve space for reset of vectors
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+SYM (lowintstack):
+ .space 4092 | reserve for interrupt stack
+SYM (hiintstack):
+ .space 4 | end of interrupt stack
+#endif
+
+ PUBLIC (start) | Default entry point for GNU
+SYM (start):
+ move.w #0x2700,sr | Disable all interrupts
+ move.w #BAR_VAL,BAR | Set Base Address Register
+ move.l #SCR_VAL,SCR | Set System Control Register
+ lea BaseAddr,a5
+ move.w #GIMR_VAL,a5@(oGIMR) | Set Global Interrupt Mode Register
+
+|
+| Set up chip select registers for the remapping process.
+|
+
+|
+| 0 X x x x x
+| 0 000 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xc001,a5@(oCS0_Base) | Expand CS0 to full size (FLASH)
+ move.w #0x1f82,a5@(oCS0_Option) | 000000-03ffff, R, 0 WS
+
+|
+| X x x x x x
+| 0 100 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xa801,a5@(oCS1_Base) | Set up and enable CS1 (SRAM)
+ move.w #0x1f80,a5@(oCS1_Option) | 400000-43ffff, RW, 0 WS
+
+|
+| Copy the initial boot FLASH area to the temporary SRAM location.
+|
+ moveq #0,d0
+ movea.l d0,a0 | a0 -> start of FLASH
+ lea tmpSRAM_BASE,a1 | a1 -> start of tmp SRAM
+| moveq #(endPreBoot-V___ISSP)/4,d0 | # longs to copy
+ moveq #127,d0
+cpy_flash: move.l (a0)+,(a1)+ | copy
+ subq.l #1,d0
+ bne cpy_flash
+
+|
+| Copy remap code to 68302''s internal system RAM.
+|
+ movea.w #begRemap-V___ISSP,a0 | a0 -> remap code
+ lea a5@(oSYSRAM),a1 | a1 -> internal system RAM
+| moveq #(endRemap-begRemap)/2-1,d0 | d0 = # words to copy
+ moveq #11,d0
+cpy_remap: move.w (a0)+,(a1)+ | copy
+ dbra d0,cpy_remap
+
+|
+| Jump to the remap code in the 68302''s internal system RAM.
+|
+ jmp a5@(oSYSRAM) | (effectively a jmp begRemap)
+
+|
+| This remap code, when executed from the 68302''s internal system RAM
+| will 1) remap CS1 so that SRAM is at 0
+| 2) remap CS0 so that FLASH is at FLASH_BASE
+| and 3) jump to executable code in the remapped FLASH.
+|
+begRemap: move.w #0xa001,a5@(oCS1_Base) | Move CS1 (SRAM)
+ move.w #0xd801,a5@(oCS0_Base) | Move CS0 (FLASH)
+ lea FLASH_BASE,a0
+ jmp a0@(endRemap-V___ISSP.w) | Jump back to FLASH
+endRemap:
+|
+| Now set up the remaining chip select registers.
+|
+
+|
+| 4 0 x x x x
+| 1 000 1 111 0 000 0--- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xb1e1,a5@(oCS2_Base) | Set up and enable CS2 (dpRAM)
+ move.w #0x1ff0,a5@(oCS2_Option) | 8f0000-8f07ff, RW, 0 WS
+
+|
+| 8 X x x x x
+| 1 000 0 0-- - --- ---- ---- ----
+| x xxx x xxx x xx
+|
+ move.w #0xd001,a5@(oCS3_Base) | Set up and enable CS3 (IO)
+ move.w #0x1f80,a5@(oCS3_Option) | 800000-83ffff, RW, 0 WS
+
+endPreBoot:
+
+ move.b #0x30,0x800001 | set status LED amber
+
+ .set oPIOB_Ctrl, 0x824
+ .set oPIOB_DDR, 0x826
+ .set oPIOB_Data, 0x828
+
+ .set oPIOA_Ctrl, 0x81e
+ .set oPIOA_DDR, 0x820
+ .set oPIOA_Data, 0x822
+
+ move.w #0x0ff8,a5@(oPIOB_Data) | Make output follow resistors.
+ move.w #0x00ff,a5@(oPIOB_DDR) | Set up PB7-PB0 for output.
+ move.w #0x0080,a5@(oPIOB_Ctrl) | Set up WDOG* as dedicated
+ | peripheral pins.
+
+ move.w #0x1fff,a5@(oPIOA_Data) | Make output follow resistors.
+ move.w #0xea2a,a5@(oPIOA_DDR) | Set up PA15-PA0 for in/output.
+ move.w #0x0003,a5@(oPIOA_Ctrl) | Set up TXD2/RXD2 as dedicated
+ | peripheral pins.
+
+|
+| Place "Bad" in all vectors from 010 thru 0ec. Vectors 0f0 and 0f4
+| are not set because they are the 68302''s BAR and SCR.
+|
+ movea.w #0x010,a0
+ moveq #(0x0f0-0x010)/4-1,d0
+ move.l #Bad,d1
+cpy_Bad: move.l d1,(a0)+
+ dbra d0,cpy_Bad
+
+ .set vbase, 0x0200
+
+ lea vbase,a0
+ moveq #31,d0
+cpy_Bad1: move.l d1,(a0)+
+ dbra d0,cpy_Bad1
+
+|
+| Fill in special locations to configure OS
+|
+ move.l #Bad,0x008 | Bus Error
+ move.l #Bad,0x00c | Address Error
+ move.l #Bad,0x024 | Trace
+| move.l #KE_IRET,$0b4 | pSOS+ RET_I Call
+
+| move.l #_cnsl_isr,vbase+0x028 | SCC2
+ move.l #timerisr,vbase+0x018 | Timer ISR
+
+ |
+ | zero out uninitialized data area
+ |
+zerobss:
+ moveal # SYM (end),a0 | find end of .bss
+ moveal # SYM (bss_start),a1 | find beginning of .bss
+ moveq #0,d0
+
+loop: movel d0,a1@+ | to zero out uninitialized
+ cmpal a0,a1
+ jlt loop | loop until _end reached
+
+ movel # SYM (end),d0 | d0 = end of bss/start of heap
+ addl # SYM (heap_size),d0 | d0 = end of heap
+ movel d0, SYM (stack_start) | Save for brk() routine
+ addl # SYM (stack_size),d0 | make room for stack
+ andl #0xffffffc0,d0 | align it on 16 byte boundary
+ movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!!
+ movel d0,a7 | set master stack pointer
+ movel d0,a6 | set base pointer
+
+ /*
+ * RTEMS should maintiain a separate interrupt stack on CPUs
+ * without one in hardware. This is currently not supported
+ * on versions of the m68k without a HW intr stack.
+ */
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ lea SYM (hiintstack),a0 | a0 = high end of intr stack
+ movec a0,isp | set interrupt stack
+#endif
+
+ move.l #0,a7@- | environp
+ move.l #0,a7@- | argv
+ move.l #0,a7@- | argc
+ jsr SYM (main)
+
+ nop
+Bad: bra Bad
+
+ nop
+END_CODE
+
+
+BEGIN_DATA
+
+ PUBLIC (start_frame)
+SYM (start_frame):
+ .space 4,0
+
+ PUBLIC (stack_start)
+SYM (stack_start):
+ .space 4,0
+END_DATA
+
+BEGIN_BSS
+
+ PUBLIC (environ)
+ .align 2
+SYM (environ):
+ .long 0
+
+ PUBLIC (heap_size)
+ .set SYM (heap_size),0x2000
+
+ PUBLIC (stack_size)
+ .set SYM (stack_size),0x1000
+
+
+END_DATA
+END
diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/bspclean.c b/c/src/lib/libbsp/m68k/gen68302/startup/bspclean.c
new file mode 100644
index 0000000000..ca498e7806
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/startup/bspclean.c
@@ -0,0 +1,26 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+}
diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
new file mode 100644
index 0000000000..307dc04d1e
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
@@ -0,0 +1,251 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * The last parameter to RTEMS_Malloc_Initialize is the "chunk"
+ * size which a multiple of will be requested on each sbrk()
+ * call by malloc(). A value of 0 indicates that sbrk() should
+ * not be called to extend the heap.
+ */
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+#if 0
+ Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/;
+#endif
+
+
+ /*
+ * Copy the Configuration Table .. so we can change it
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Need to "allocate" the memory for the RTEMS Workspace and
+ * tell the RTEMS configuration where it is. This memory is
+ * not malloc'ed. It is just "pulled from the air".
+ */
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ /*
+ * initialize the CPU table for this BSP
+ */
+
+ /*
+ * we do not use the pretasking_hook
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Don't forget the other CPU Table entries.
+ */
+
+ /*
+ * Start RTEMS
+ */
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds
new file mode 100644
index 0000000000..427adb0cd4
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds
@@ -0,0 +1,46 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the Generic MC68302 board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x0000, l = 16M
+ }
+
+m302 = 0xf7f000;
+_VBR = 0x000000; /* location of the VBR table (in RAM) */
+
+SECTIONS
+{
+ .text 0xc00000 :
+ {
+ text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+ }
+ .data 0x010000 :
+ {
+ data_start = . ;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/gen68302/timer/timer.c b/c/src/lib/libbsp/m68k/gen68302/timer/timer.c
new file mode 100644
index 0000000000..4d60b6a82b
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/timer/timer.c
@@ -0,0 +1,130 @@
+/* Timer_init()
+ *
+ * This routine initializes TIMER 2 for an MC68302.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+#include <bsp.h>
+#include "m68302.h"
+
+
+#define TMR2_VAL 0x071b /* Timer mode register
+ * (section 3.5.2.1 in 68302 manual)
+ * 15-8: "7" prescaler divide by 8 (x+1)
+ * 7-6: 00 dis. intr. on capture event
+ * 5: 0 active-low pulse
+ * 4: 1 intr. on reaching reference
+ * 3: 1 restart counter on reference
+ * 2-1: 01 master clock input source
+ * 0: 1 enable timer
+ */
+#define TRR2_VAL 2000 /* Timer reference register
+ * (section 3.5.2.2 in 68302 manual)
+ * 2000 ticks @ (16MHz/1)/8 = 1-ms count
+ */
+
+rtems_unsigned32 Timer_interrupts;
+
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize( void )
+{
+ m302.reg.tmr2 = 0; /* disable timer */
+
+ Timer_interrupts = 0; /* clear timer ISR count */
+
+ m302.reg.trr2 = TRR2_VAL; /* set timer reference register */
+ m302.reg.tmr2 = TMR2_VAL; /* set timer mode register */
+ m302.reg.imr |= RBIT_IMR_TIMER2; /* set 68302 int-mask to allow ints */
+}
+
+/*
+ * The following controls the behavior of Read_timer().
+ *
+ * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count.
+ *
+ * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
+ * is usually deducted from the number returned.
+ *
+ * LEAST_VALID is the lowest number this routine should trust. Numbers
+ * below this are "noise" and zero is returned.
+ */
+
+#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
+ /* (Y countdowns) to start/stop the timer. */
+ /* This value is in microseconds. */
+#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
+
+/*
+ * Return timer value in 1/2-microsecond units
+ */
+int Read_timer( void )
+{
+ rtems_unsigned16 clicks;
+ rtems_unsigned32 total;
+
+ /*
+ * Read the timer and see how many clicks it has been since counter
+ * rolled over.
+ */
+
+ clicks = m302.reg.tcn2;
+
+ /*
+ * Total is calculated by taking into account the number of timer overflow
+ * interrupts since the timer was initialized and clicks since the last
+ * interrupts.
+ */
+
+ total = (Timer_interrupts * TRR2_VAL) + clicks;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ /*
+ * Convert 1/2-microsecond count into microseconds
+ */
+
+ return (total - AVG_OVERHEAD) >> 1;
+}
+
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+
+rtems_status_code Empty_function(void)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68302/timer/timerisr.s b/c/src/lib/libbsp/m68k/gen68302/timer/timerisr.s
new file mode 100644
index 0000000000..c804b9dfa6
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/timer/timerisr.s
@@ -0,0 +1,28 @@
+/*
+ * Handle 68302 TIMER2 interrupts.
+ *
+ * All code in this routine is pure overhead which can perturb the
+ * accuracy of RTEMS' timing test suite.
+ *
+ * See also: Read_timer()
+ *
+ * To reduce overhead this is best to be the "rawest" hardware interupt
+ * handler you can write. This should be the only interrupt which can
+ * occur during the measured time period.
+ *
+ * An external counter, Timer_interrupts, is incremented.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+ PUBLIC(timerisr)
+SYM(timerisr):
+ move.w #0x0040,SYM(m302)+2072 | clear interrupt in-service bit
+ move.b #3,SYM(m302)+2137 | clear timer interrupt event register
+ addq.l #1,SYM(Timer_interrupts) | increment timer value
+ rte
+END_CODE
+END
diff --git a/c/src/lib/libbsp/m68k/gen68302/times b/c/src/lib/libbsp/m68k/gen68302/times
new file mode 100644
index 0000000000..dcb4aec1bd
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68302/times
@@ -0,0 +1,193 @@
+#
+# Timing Test Suite Results for the generic 68302 BSP
+#
+# $Id$
+#
+
+NOTE: This BSP is used submitted and no information is currently available.
+
+Board: gen68302
+CPU: Motorola 68302
+Clock Speed: 16 Mhz
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/gen68360/README b/c/src/lib/libbsp/m68k/gen68360/README
new file mode 100644
index 0000000000..cbbc295fab
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/README
@@ -0,0 +1,267 @@
+#
+# $Id$
+#
+
+#
+# This package requires a version of GCC that has been modified
+# to support the `-mcpu32' argument. I have submitted the required
+# changes to the GCC maintainers.
+#
+
+#
+# Please send any comments, improvements, or bug reports to:
+# W. Eric Norum
+# Saskatchewan Accelerator Laboratory
+# 107 North Road
+# University of Saskatchewan
+# Saskatoon, Saskatchewan, CANADA
+# S7N 5C6
+# eric@skatter.usask.ca
+#
+
+BSP NAME: gen68360
+BOARD: home-built
+BUS: none
+CPU FAMILY: Motorola CPU32+
+COPROCESSORS: none
+MODE: not applicable
+
+DEBUG MONITOR: none (Hardware provides BDM)
+
+PERIPHERALS
+===========
+TIMERS: PIT, Watchdog, 4 general purpose, 16 RISC
+ RESOLUTION: one microsecond
+SERIAL PORTS: 4 SCC, 2 SMC, 1 SPI
+REAL-TIME CLOCK:
+DMA: Each serial port, 2 general purpose
+VIDEO: none
+SCSI: none
+NETWORKING: Ethernet on SCC1.
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER: Programmable Interval Timer
+IOSUPP DRIVER: Serial Management Controller 1
+SHMSUPP: none
+TIMER DRIVER: Timer 1
+
+STDIO
+=====
+PORT: SMC1
+ELECTRICAL: EIA-232 (if board supplies level shifter)
+BAUD: 9600
+BITS PER CHARACTER: 8
+PARITY: None
+STOP BITS: 1
+
+NOTES
+=====
+
+Board description
+-----------------
+clock rate: 25 MHz
+bus width: 8-bit PROM, 32-bit DRAM
+ROM: To 1 MByte, 180 nsec (3 wait states), chip select 0
+RAM: 4 MByte DRAM SIMM, 60 nsec (0 wait states), parity
+
+Host System
+-----------
+NEXTSTEP 3.3 (Intel and Motorola), Solaris 2.5
+gcc-2.7.2
+binutils-2.6
+
+Verification
+------------
+Single processor tests: Passed
+Multi-processort tests: not applicable
+Timing tests:
+ Context Switch
+
+ context switch: self 10
+ context switch: to another task 11
+ context switch: no floating point contexts 40
+ fp context switch: restore 1st FP task 41
+ fp context switch: save initialized, restore initialized 14
+ fp context switch: save idle, restore initialized 14
+ fp context switch: save idle, restore idle 43
+
+ Task Manager
+
+ rtems_task_create 133
+ rtems_task_ident 351
+ rtems_task_start 77
+ rtems_task_restart: calling task 93
+ rtems_task_restart: suspended task -- returns to caller 90
+ rtems_task_restart: blocked task -- returns to caller 120
+ rtems_task_restart: ready task -- returns to caller 92
+ rtems_task_restart: suspended task -- preempts caller 121
+ rtems_task_restart: blocked task -- preempts caller 143
+ rtems_task_restart: ready task -- preempts caller 138
+ rtems_task_delete: calling task 158
+ rtems_task_delete: suspended task 129
+ rtems_task_delete: blocked task 134
+ rtems_task_delete: ready task 136
+ rtems_task_suspend: calling task 71
+ rtems_task_suspend: returns to caller 47
+ rtems_task_resume: task readied -- returns to caller 48
+ rtems_task_resume: task readied -- preempts caller 67
+ rtems_task_set_priority: obtain current priority 36
+ rtems_task_set_priority: returns to caller 65
+ rtems_task_set_priority: preempts caller 102
+ rtems_task_mode: obtain current mode 13
+ rtems_task_mode: no reschedule 15
+ rtems_task_mode: reschedule -- returns to caller 22
+ rtems_task_mode: reschedule -- preempts caller 61
+ rtems_task_get_note 38
+ rtems_task_set_note 37
+ rtems_task_wake_after: yield -- returns to caller 22
+ rtems_task_wake_after: yields -- preempts caller 56
+ rtems_task_wake_when 110
+
+ Interrupt Manager
+
+ interrupt entry overhead: returns to nested interrupt 8
+ interrupt entry overhead: returns to interrupted task 8
+ interrupt entry overhead: returns to preempting task 8
+ interrupt exit overhead: returns to nested interrupt 7
+ interrupt exit overhead: returns to interrupted task 8
+ interrupt exit overhead: returns to preempting task 52
+
+ Clock Manager
+
+ rtems_clock_set 82
+ rtems_clock_get 2
+ rtems_clock_tick 15
+
+ Timer Manager
+
+ rtems_timer_create 33
+ rtems_timer_ident 343
+ rtems_timer_delete: inactive 47
+ rtems_timer_delete: active 50
+ rtems_timer_fire_after: inactive 59
+ rtems_timer_fire_after: active 63
+ rtems_timer_fire_when: inactive 83
+ rtems_timer_fire_when: active 83
+ rtems_timer_reset: inactive 55
+ rtems_timer_reset: active 58
+ rtems_timer_cancel: inactive 35
+ rtems_timer_cancel: active 38
+
+ Semaphore Manager
+
+ rtems_semaphore_create 62
+ rtems_semaphore_ident 368
+ rtems_semaphore_delete 61
+ rtems_semaphore_obtain: available 42
+ rtems_semaphore_obtain: not available -- NO_WAIT 42
+ rtems_semaphore_obtain: not available -- caller blocks 105
+ rtems_semaphore_release: no waiting tasks 46
+ rtems_semaphore_release: task readied -- returns to caller 64
+ rtems_semaphore_release: task readied -- preempts caller 84
+
+ Message Queue Manager
+
+ rtems_message_queue_create 240
+ rtems_message_queue_ident 342
+ rtems_message_queue_delete 79
+ rtems_message_queue_send: no waiting tasks 93
+ rtems_message_queue_send: task readied -- returns to caller 96
+ rtems_message_queue_send: task readied -- preempts caller 116
+ rtems_message_queue_urgent: no waiting tasks 93
+ rtems_message_queue_urgent: task readied -- returns to caller 97
+ rtems_message_queue_urgent: task readied -- preempts caller 117
+ rtems_message_queue_broadcast: no waiting tasks 54
+ rtems_message_queue_broadcast: task readied -- returns to caller 106
+ rtems_message_queue_broadcast: task readied -- preempts caller 126
+ rtems_message_queue_receive: available 79
+ rtems_message_queue_receive: not available -- NO_WAIT 48
+ rtems_message_queue_receive: not available -- caller blocks 111
+ rtems_message_queue_flush: no messages flushed 35
+ rtems_message_queue_flush: messages flushed 44
+
+ Event Manager
+
+ rtems_event_send: no task readied 30
+ rtems_event_send: task readied -- returns to caller 59
+ rtems_event_send: task readied -- preempts caller 81
+ rtems_event_receive: obtain current events 1
+ rtems_event_receive: available 34
+ rtems_event_receive: not available -- NO_WAIT 31
+ rtems_event_receive: not available -- caller blocks 84
+
+ Signal Manager
+
+ rtems_signal_catch 24
+ rtems_signal_send: returns to caller 42
+ rtems_signal_send: signal to self 47
+ exit ASR overhead: returns to calling task 33
+ exit ASR overhead: returns to preempting task 58
+
+ Partition Manager
+
+ rtems_partition_create 78
+ rtems_partition_ident 342
+ rtems_partition_delete 46
+ rtems_partition_get_buffer: available 40
+ rtems_partition_get_buffer: not available 39
+ rtems_partition_return_buffer 47
+
+ Region Manager
+
+ rtems_region_create 65
+ rtems_region_ident 349
+ rtems_region_delete 45
+ rtems_region_get_segment: available 55
+ rtems_region_get_segment: not available -- NO_WAIT 52
+ rtems_region_get_segment: not available -- caller blocks 119
+ rtems_region_return_segment: no waiting tasks 57
+ rtems_region_return_segment: task readied -- returns to caller 106
+ rtems_region_return_segment: task readied -- preempts caller 127
+
+ Dual-Ported Memory Manager
+
+ rtems_port_create 40
+ rtems_port_ident 342
+ rtems_port_delete 44
+ rtems_port_internal_to_external 32
+ rtems_port_external_to_internal 32
+
+ IO Manager
+
+ rtems_io_initialize 4
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+ Rate Monotonic Manager
+
+ rtems_rate_monotonic_create 39
+ rtems_rate_monotonic_ident 343
+ rtems_rate_monotonic_cancel 43
+ rtems_rate_monotonic_delete: active 54
+ rtems_rate_monotonic_delete: inactive 52
+ rtems_rate_monotonic_period: obtain status 37
+ rtems_rate_monotonic_period: initiate period -- returns to caller 58
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 75
+
+Porting
+-------
+This board support package is written for a 68360 system similar to that
+described in chapter 9 of the Motorola MC68360 Quad Integrated Communication
+Processor Users' Manual. The salient details of this hardware are:
+
+ 25 MHz external clock
+ DRAM address multiplexing provided by 68360
+ 8-bit 180nsec PROM to CS0*
+ 4 MBytes of 60 nsec parity DRAM (1Mx36) to RAS1*/CAS1*
+ Console serial port on SMC1
+
+The board support package has been tested with a home-built board and with an
+ACE360A board produced by:
+ Atlas Computer Equipment
+ 703 Colina Lane
+ Santa Barbara, CA 93103
diff --git a/c/src/lib/libbsp/m68k/gen68360/clock/ckinit.c b/c/src/lib/libbsp/m68k/gen68360/clock/ckinit.c
new file mode 100644
index 0000000000..4a04d246bf
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/clock/ckinit.c
@@ -0,0 +1,149 @@
+/*
+ * This routine initializes the MC68360 Periodic Interval Timer
+ *
+ * The PIT has rather poor resolution, but it is easy to set up
+ * and requires no housekeeping once it is going.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ */
+
+#include <stdlib.h> /* for atexit() */
+#include <bsp.h>
+#include <rtems/libio.h>
+#include "m68360.h"
+
+#define CLOCK_VECTOR 120
+#define CLOCK_IRQ_LEVEL 6
+
+/*
+ * Clock_driver_ticks is a monotonically increasing counter of the
+ * number of clock ticks since the driver was initialized.
+ */
+volatile rtems_unsigned32 Clock_driver_ticks;
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * Periodic interval timer interrupt handler
+ */
+rtems_isr
+Clock_isr (rtems_vector_number vector)
+{
+ Clock_driver_ticks++;
+ rtems_clock_tick();
+}
+
+void
+Clock_exit (void)
+{
+ if (BSP_Configuration.ticks_per_timeslice ) {
+ /*
+ * Turn off periodic interval timer
+ */
+ m360.pitr &= ~0xFF;
+ }
+}
+
+static void
+Install_clock (rtems_isr_entry clock_isr)
+{
+ Clock_driver_ticks = 0;
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ int pitr;
+
+ /*
+ * Choose periodic interval timer register value
+ * For a 25 MHz external clock the basic clock rate is
+ * 40 nsec * 128 * 4 = 20.48 usec/tick
+ */
+ pitr = ((BSP_Configuration.microseconds_per_tick * 100) + 1023) / 2048;
+ if (pitr >= 256) {
+ pitr = (pitr + 255) / 512;
+ if (pitr >= 256)
+ pitr = 255;
+ else if (pitr == 0)
+ pitr = 1;
+ pitr |= 0x100;
+ }
+ else if (pitr == 0) {
+ pitr = 1;
+ }
+ m360.pitr &= ~0x1FF;
+ m360.picr = (CLOCK_IRQ_LEVEL << 8) | CLOCK_VECTOR;
+ set_vector (clock_isr, CLOCK_VECTOR, 1);
+ m360.pitr |= pitr;
+ atexit (Clock_exit);
+ }
+}
+
+rtems_device_driver
+Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock (Clock_isr);
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args) {
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+ if (args->command == rtems_build_name('I', 'S', 'R', ' ')) {
+ Clock_isr( CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+ }
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/console/console.c b/c/src/lib/libbsp/m68k/gen68360/console/console.c
new file mode 100644
index 0000000000..bc451e2609
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/console/console.c
@@ -0,0 +1,311 @@
+/*
+ * Initialize SMC1 for console IO.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ */
+
+#define GEN68360_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include "m68360.h"
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+/*
+ * Place buffer descriptors at end of User Data/BD space in dual-port RAM
+ */
+#define consoleRxBd ((volatile m360BufferDescriptor_t *)((char *)m360.dpram1 + \
+ (sizeof(m360.dpram2) - 2*sizeof(m360BufferDescriptor_t))))
+#define consoleTxBd ((volatile m360BufferDescriptor_t *)((char *)m360.dpram1 + \
+ (sizeof(m360.dpram2) - sizeof(m360BufferDescriptor_t))))
+
+/*
+ * I/O buffers can be in ordindary RAM
+ */
+static volatile char rxBuf, txBuf;
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ /*
+ * Configure port B pins to enable SMTXD1 and SMRXD1 pins
+ */
+ m360.pbpar |= 0xC0;
+ m360.pbdir &= ~0xC0;
+ m360.pbodr &= ~0xC0;
+
+ /*
+ * Set up BRG1 (9,600 baud)
+ */
+ m360.brgc1 = M360_BRG_RST;
+ m360.brgc1 = M360_BRG_EN | M360_BRG_EXTC_BRGCLK | M360_BRG_9600;
+
+ /*
+ * Put SMC1 in NMSI mode, connect SMC1 to BRG1
+ */
+ m360.simode |= M360_SI_SMC1_BRG1;
+
+ /*
+ * Set up SMC1 parameter RAM common to all protocols
+ */
+ m360.smc1p.rbase = (char *)consoleRxBd - (char *)&m360;
+ m360.smc1p.tbase = (char *)consoleTxBd - (char *)&m360;
+ m360.smc1p.rfcr = M360_RFCR_MOT | M360_RFCR_DMA_SPACE;
+ m360.smc1p.tfcr = M360_TFCR_MOT | M360_TFCR_DMA_SPACE;
+ m360.smc1p.mrblr = 1;
+
+ /*
+ * Set up SMC1 parameter RAM UART-specific parameters
+ */
+ m360.smc1p.un.uart.max_idl = 0;
+ m360.smc1p.un.uart.brklen = 0;
+ m360.smc1p.un.uart.brkec = 0;
+ m360.smc1p.un.uart.brkcr = 0;
+
+ /*
+ * Set up the Receive Buffer Descriptor
+ */
+ consoleRxBd->status = M360_BD_EMPTY | M360_BD_WRAP;
+ consoleRxBd->length = 0;
+ consoleRxBd->buffer = &rxBuf;
+
+ /*
+ * Setup the Transmit Buffer Descriptor
+ */
+ consoleTxBd->length = 1;
+ consoleTxBd->status = M360_BD_WRAP;
+ consoleTxBd->buffer = &txBuf;
+
+ /*
+ * Set up SMC1 general and protocol-specific mode registers
+ */
+ m360.smc1.smce = ~0; /* Clear any pending events */
+ m360.smc1.smcm = 0; /* Mask all interrupt/event sources */
+ m360.smc1.smcmr = M360_SMCMR_CLEN(9) | M360_SMCMR_SM_UART;
+
+ /*
+ * Send "Init parameters" command
+ */
+ m360.cr = M360_CR_OP_INIT_RX_TX | M360_CR_CHAN_SMC1 | M360_CR_FLG;
+ while (m360.cr & M360_CR_FLG)
+ continue;
+
+ /*
+ * Enable receiver and transmitter
+ */
+ m360.smc1.smcmr |= M360_SMCMR_TEN | M360_SMCMR_REN;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number)0);
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+ return RTEMS_SUCCESSFUL;
+}
+
+/* is_character_ready
+ *
+ * Check to see if a character is available on the console port. If so,
+ * then return a TRUE (along with the character). Otherwise return FALSE.
+ *
+ * Input parameters: pointer to location in which to return character
+ *
+ * Output parameters: character (if available)
+ *
+ * Return values: TRUE - character available
+ * FALSE - no character available
+ */
+
+rtems_boolean is_character_ready(
+ char *ch /* -> character */
+)
+{
+ if (consoleRxBd->status & M360_BD_EMPTY)
+ return FALSE;
+ *ch = rxBuf;
+ consoleRxBd->status = M360_BD_EMPTY | M360_BD_WRAP;
+ return TRUE;
+}
+
+
+/* inbyte
+ *
+ * Receive a character from the console port
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values: character read
+ */
+
+char inbyte( void )
+{
+ char ch;
+
+ while (is_character_ready (&ch) == FALSE)
+ continue;
+ return ch;
+}
+
+
+/* outbyte
+ *
+ * Transmit a character to the console serial port
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ if (ch == '\n')
+ outbyte('\r');
+ while (consoleTxBd->status & M360_BD_READY)
+ continue;
+ txBuf = ch;
+ consoleTxBd->status = M360_BD_READY | M360_BD_WRAP;
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/include/bsp.h b/c/src/lib/libbsp/m68k/gen68360/include/bsp.h
new file mode 100644
index 0000000000..508501e6e8
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/include/bsp.h
@@ -0,0 +1,134 @@
+/*
+ * Board Support Package for `Generic' Motorola MC68360
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/* bsp.h
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ */
+
+#ifndef __GEN68360_BSP_h
+#define __GEN68360_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <console.h>
+#include <iosupp.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Stuff for Time Test 27
+ * Don't bother with hardware -- just use a software-interrupt
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
+
+#define Cause_tm27_intr() asm volatile ("trap #2");
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* Constants */
+
+/* Structures */
+
+#ifdef GEN68360_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/* functions */
+
+void bsp_cleanup( void );
+
+void M360ExecuteRISC( rtems_unsigned16 command );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/gen68360/include/coverhd.h b/c/src/lib/libbsp/m68k/gen68360/include/coverhd.h
new file mode 100644
index 0000000000..020543466f
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/include/coverhd.h
@@ -0,0 +1,76 @@
+/*
+ * This file was machine-generated from the tmoverhd.exe output
+ *
+ * $Id$
+ */
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 2
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 2
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 3
+#define CALLING_OVERHEAD_TASK_START 3
+#define CALLING_OVERHEAD_TASK_RESTART 2
+#define CALLING_OVERHEAD_TASK_DELETE 2
+#define CALLING_OVERHEAD_TASK_SUSPEND 2
+#define CALLING_OVERHEAD_TASK_RESUME 2
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 3
+#define CALLING_OVERHEAD_TASK_MODE 3
+#define CALLING_OVERHEAD_TASK_GET_NOTE 3
+#define CALLING_OVERHEAD_TASK_SET_NOTE 3
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 5
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 2
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 3
+#define CALLING_OVERHEAD_CLOCK_GET 6
+#define CALLING_OVERHEAD_CLOCK_SET 5
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+#define CALLING_OVERHEAD_TIMER_CREATE 2
+#define CALLING_OVERHEAD_TIMER_DELETE 2
+#define CALLING_OVERHEAD_TIMER_IDENT 2
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 3
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 7
+#define CALLING_OVERHEAD_TIMER_RESET 2
+#define CALLING_OVERHEAD_TIMER_CANCEL 2
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 3
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 2
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 3
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 3
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 3
+#define CALLING_OVERHEAD_EVENT_SEND 3
+#define CALLING_OVERHEAD_EVENT_RECEIVE 3
+#define CALLING_OVERHEAD_SIGNAL_CATCH 2
+#define CALLING_OVERHEAD_SIGNAL_SEND 3
+#define CALLING_OVERHEAD_PARTITION_CREATE 4
+#define CALLING_OVERHEAD_PARTITION_IDENT 3
+#define CALLING_OVERHEAD_PARTITION_DELETE 2
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 3
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 3
+#define CALLING_OVERHEAD_REGION_CREATE 4
+#define CALLING_OVERHEAD_REGION_IDENT 2
+#define CALLING_OVERHEAD_REGION_DELETE 2
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 3
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 3
+#define CALLING_OVERHEAD_PORT_CREATE 4
+#define CALLING_OVERHEAD_PORT_IDENT 2
+#define CALLING_OVERHEAD_PORT_DELETE 2
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 3
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 3
+#define CALLING_OVERHEAD_IO_INITIALIZE 3
+#define CALLING_OVERHEAD_IO_OPEN 3
+#define CALLING_OVERHEAD_IO_CLOSE 3
+#define CALLING_OVERHEAD_IO_READ 3
+#define CALLING_OVERHEAD_IO_WRITE 3
+#define CALLING_OVERHEAD_IO_CONTROL 3
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 2
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
diff --git a/c/src/lib/libbsp/m68k/gen68360/start/start360.s b/c/src/lib/libbsp/m68k/gen68360/start/start360.s
new file mode 100644
index 0000000000..2c4ed13066
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/start/start360.s
@@ -0,0 +1,405 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+ /*
+ * Step 1: Decide on Reset Stack Pointer and Initial Program Counter
+ */
+Entry:
+ .long SYM(m360)+1024 | 0: Initial SSP
+ .long start | 1: Initial PC
+ .long uhoh | 2: Bus error
+ .long uhoh | 3: Address error
+ .long uhoh | 4: Illegal instruction
+ .long uhoh | 5: Zero division
+ .long uhoh | 6: CHK, CHK2 instruction
+ .long uhoh | 7: TRAPcc, TRAPV instructions
+ .long uhoh | 8: Privilege violation
+ .long uhoh | 9: Trace
+ .long uhoh | 10: Line 1010 emulator
+ .long uhoh | 11: Line 1111 emulator
+ .long uhoh | 12: Hardware breakpoint
+ .long uhoh | 13: Reserved for coprocessor violation
+ .long uhoh | 14: Format error
+ .long uhoh | 15: Uninitialized interrupt
+ .long uhoh | 16: Unassigned, reserved
+ .long uhoh | 17:
+ .long uhoh | 18:
+ .long uhoh | 19:
+ .long uhoh | 20:
+ .long uhoh | 21:
+ .long uhoh | 22:
+ .long uhoh | 23:
+ .long uhoh | 24: Spurious interrupt
+ .long uhoh | 25: Level 1 interrupt autovector
+ .long uhoh | 26: Level 2 interrupt autovector
+ .long uhoh | 27: Level 3 interrupt autovector
+ .long uhoh | 28: Level 4 interrupt autovector
+ .long uhoh | 29: Level 5 interrupt autovector
+ .long uhoh | 30: Level 6 interrupt autovector
+ .long uhoh | 31: Level 7 interrupt autovector
+ .long uhoh | 32: Trap instruction (0-15)
+ .long uhoh | 33:
+ .long uhoh | 34:
+ .long uhoh | 35:
+ .long uhoh | 36:
+ .long uhoh | 37:
+ .long uhoh | 38:
+ .long uhoh | 39:
+ .long uhoh | 40:
+ .long uhoh | 41:
+ .long uhoh | 42:
+ .long uhoh | 43:
+ .long uhoh | 44:
+ .long uhoh | 45:
+ .long uhoh | 46:
+ .long uhoh | 47:
+ .long uhoh | 48: Reserved for coprocessor
+ .long uhoh | 49:
+ .long uhoh | 50:
+ .long uhoh | 51:
+ .long uhoh | 52:
+ .long uhoh | 53:
+ .long uhoh | 54:
+ .long uhoh | 55:
+ .long uhoh | 56:
+ .long uhoh | 57:
+ .long uhoh | 58:
+ .long uhoh | 59: Unassigned, reserved
+ .long uhoh | 60:
+ .long uhoh | 61:
+ .long uhoh | 62:
+ .long uhoh | 63:
+ .long uhoh | 64: User defined vectors (192)
+ .long uhoh | 65:
+ .long uhoh | 66:
+ .long uhoh | 67:
+ .long uhoh | 68:
+ .long uhoh | 69:
+ .long uhoh | 70:
+ .long uhoh | 71:
+ .long uhoh | 72:
+ .long uhoh | 73:
+ .long uhoh | 74:
+ .long uhoh | 75:
+ .long uhoh | 76:
+ .long uhoh | 77:
+ .long uhoh | 78:
+ .long uhoh | 79:
+ .long uhoh | 80:
+ .long uhoh | 81:
+ .long uhoh | 82:
+ .long uhoh | 83:
+ .long uhoh | 84:
+ .long uhoh | 85:
+ .long uhoh | 86:
+ .long uhoh | 87:
+ .long uhoh | 88:
+ .long uhoh | 89:
+ .long uhoh | 90:
+ .long uhoh | 91:
+ .long uhoh | 92:
+ .long uhoh | 93:
+ .long uhoh | 94:
+ .long uhoh | 95:
+ .long uhoh | 96:
+ .long uhoh | 97:
+ .long uhoh | 98:
+ .long uhoh | 99:
+ .long uhoh | 100:
+ .long uhoh | 101:
+ .long uhoh | 102:
+ .long uhoh | 103:
+ .long uhoh | 104:
+ .long uhoh | 105:
+ .long uhoh | 106:
+ .long uhoh | 107:
+ .long uhoh | 108:
+ .long uhoh | 109:
+ .long uhoh | 110:
+ .long uhoh | 111:
+ .long uhoh | 112:
+ .long uhoh | 113:
+ .long uhoh | 114:
+ .long uhoh | 115:
+ .long uhoh | 116:
+ .long uhoh | 117:
+ .long uhoh | 118:
+ .long uhoh | 119:
+ .long uhoh | 120:
+ .long uhoh | 121:
+ .long uhoh | 122:
+ .long uhoh | 123:
+ .long uhoh | 124:
+ .long uhoh | 125:
+ .long uhoh | 126:
+ .long uhoh | 127:
+ .long uhoh | 128:
+ .long uhoh | 129:
+ .long uhoh | 130:
+ .long uhoh | 131:
+ .long uhoh | 132:
+ .long uhoh | 133:
+ .long uhoh | 134:
+ .long uhoh | 135:
+ .long uhoh | 136:
+ .long uhoh | 137:
+ .long uhoh | 138:
+ .long uhoh | 139:
+ .long uhoh | 140:
+ .long uhoh | 141:
+ .long uhoh | 142:
+ .long uhoh | 143:
+ .long uhoh | 144:
+ .long uhoh | 145:
+ .long uhoh | 146:
+ .long uhoh | 147:
+ .long uhoh | 148:
+ .long uhoh | 149:
+ .long uhoh | 150:
+ .long uhoh | 151:
+ .long uhoh | 152:
+ .long uhoh | 153:
+ .long uhoh | 154:
+ .long uhoh | 155:
+ .long uhoh | 156:
+ .long uhoh | 157:
+ .long uhoh | 158:
+ .long uhoh | 159:
+ .long uhoh | 160:
+ .long uhoh | 161:
+ .long uhoh | 162:
+ .long uhoh | 163:
+ .long uhoh | 164:
+ .long uhoh | 165:
+ .long uhoh | 166:
+ .long uhoh | 167:
+ .long uhoh | 168:
+ .long uhoh | 169:
+ .long uhoh | 170:
+ .long uhoh | 171:
+ .long uhoh | 172:
+ .long uhoh | 173:
+ .long uhoh | 174:
+ .long uhoh | 175:
+ .long uhoh | 176:
+ .long uhoh | 177:
+ .long uhoh | 178:
+ .long uhoh | 179:
+ .long uhoh | 180:
+ .long uhoh | 181:
+ .long uhoh | 182:
+ .long uhoh | 183:
+ .long uhoh | 184:
+ .long uhoh | 185:
+ .long uhoh | 186:
+ .long uhoh | 187:
+ .long uhoh | 188:
+ .long uhoh | 189:
+ .long uhoh | 190:
+ .long uhoh | 191:
+ .long uhoh | 192:
+ .long uhoh | 193:
+ .long uhoh | 194:
+ .long uhoh | 195:
+ .long uhoh | 196:
+ .long uhoh | 197:
+ .long uhoh | 198:
+ .long uhoh | 199:
+ .long uhoh | 200:
+ .long uhoh | 201:
+ .long uhoh | 202:
+ .long uhoh | 203:
+ .long uhoh | 204:
+ .long uhoh | 205:
+ .long uhoh | 206:
+ .long uhoh | 207:
+ .long uhoh | 208:
+ .long uhoh | 209:
+ .long uhoh | 210:
+ .long uhoh | 211:
+ .long uhoh | 212:
+ .long uhoh | 213:
+ .long uhoh | 214:
+ .long uhoh | 215:
+ .long uhoh | 216:
+ .long uhoh | 217:
+ .long uhoh | 218:
+ .long uhoh | 219:
+ .long uhoh | 220:
+ .long uhoh | 221:
+ .long uhoh | 222:
+ .long uhoh | 223:
+ .long uhoh | 224:
+ .long uhoh | 225:
+ .long uhoh | 226:
+ .long uhoh | 227:
+ .long uhoh | 228:
+ .long uhoh | 229:
+ .long uhoh | 230:
+ .long uhoh | 231:
+ .long uhoh | 232:
+ .long uhoh | 233:
+ .long uhoh | 234:
+ .long uhoh | 235:
+ .long uhoh | 236:
+ .long uhoh | 237:
+ .long uhoh | 238:
+ .long uhoh | 239:
+ .long uhoh | 240:
+ .long uhoh | 241:
+ .long uhoh | 242:
+ .long uhoh | 243:
+ .long uhoh | 244:
+ .long uhoh | 245:
+ .long uhoh | 246:
+ .long uhoh | 247:
+ .long uhoh | 248:
+ .long uhoh | 249:
+ .long uhoh | 250:
+ .long uhoh | 251:
+ .long uhoh | 252:
+ .long uhoh | 253:
+ .long uhoh | 254:
+ .long uhoh | 255:
+
+/*
+ * Default trap handler
+ * With an oscilloscope you can see AS* stop
+ */
+uhoh: nop | Leave spot for breakpoint
+ stop #0x2700 | Stop with interrupts disabled
+ bra.s uhoh | Stuck forever
+
+/*
+ * Place the low-order 3 octets of the board's ethernet address at
+ * a `well-known' fixed location relative to the beginning of ROM.
+ */
+ .align 2
+ .long ETHERNET_ADDRESS | Low-order 3 octets of ethernet address
+
+/*
+ * Initial PC
+ */
+start:
+ /*
+ * Step 2: Stay in Supervisor Mode
+ * (i.e. just do nothing for this step)
+ */
+
+ /*
+ * Step 3: Write the VBR
+ */
+ lea Entry,a0 | Get base of vector table
+ movec a0,vbr | Set up the VBR
+
+ /*
+ * Step 4: Write the MBAR
+ */
+ movec dfc,d1 | Save destination register
+ moveq #7,d0 | CPU-space funcction code
+ movec d0,dfc | Set destination function code register
+ movel #SYM(m360)+0x101,d0 | MBAR value (mask CPU space accesses)
+ movesl d0,0x3FF00 | Set MBAR
+ movec d1,dfc | Restore destination register
+
+ /*
+ * Step 5: Verify a dual-port RAM location
+ */
+ lea SYM(m360),a0 | Point a0 to first DPRAM location
+ moveb #0x33,d0 | Set the test value
+ moveb d0,a0@ | Set the memory location
+ cmpb a0@,d0 | Does it read back?
+ bne uhoh | If not, bad news!
+ notb d0 | Flip bits
+ moveb d0,a0@ | Set the memory location
+ cmpb a0@,d0 | Does it read back?
+ bne uhoh | If not, bad news!
+
+ /*
+ * Remaining steps are handled by C code
+ */
+ jmp SYM(_Init68360) | Start C code (which never returns)
+
+/*
+ * Copy DATA segment, clear BSS segment, set up real stack,
+ * initialize heap, start C program.
+ * Assume that DATA and BSS sizes are multiples of 4.
+ */
+ PUBLIC (_CopyDataClearBSSAndStart)
+SYM(_CopyDataClearBSSAndStart):
+ lea copy_start,a0 | Get start of DATA in RAM
+ lea SYM(etext),a2 | Get start of DATA in ROM
+ cmpl a0,a2 | Are they the same?
+ beq.s NOCOPY | Yes, no copy necessary
+ lea copy_end,a1 | Get end of DATA in RAM
+ bra.s COPYLOOPTEST | Branch into copy loop
+COPYLOOP:
+ movel a2@+,a0@+ | Copy word from ROM to RAM
+COPYLOOPTEST:
+ cmpl a1,a0 | Done?
+ bcs.s COPYLOOP | No, skip
+NOCOPY:
+
+ lea clear_start,a0 | Get start of BSS
+ lea clear_end,a1 | Get end of BSS
+ clrl d0 | Value to set
+ bra.s ZEROLOOPTEST | Branch into clear loop
+ZEROLOOP:
+ movel d0,a0@+ | Clear a word
+ZEROLOOPTEST:
+ cmpl a1,a0 | Done?
+ bcs.s ZEROLOOP | No, skip
+
+ movel #stack_init,a7 | set master stack pointer
+ movel d0,a7@- | environp
+ movel d0,a7@- | argv
+ movel d0,a7@- | argc
+ jsr SYM(main) | Call C main
+
+ | Should this just force a reset?
+mainDone: nop | Leave spot for breakpoint
+ stop #0x2700 | Stop with interrupts disabled
+ bra.s mainDone | Stuck forever
+
+ .align 2
+ PUBLIC (_HeapSize)
+SYM (_HeapSize):
+ .long HeapSize
+ PUBLIC (_StackSize)
+SYM (_StackSize):
+ .long StackSize
+END_CODE
+
+BEGIN_BSS
+ .align 2
+ PUBLIC (environ)
+SYM (environ):
+ .long 0
+END
diff --git a/c/src/lib/libbsp/m68k/gen68360/start360/start360.s b/c/src/lib/libbsp/m68k/gen68360/start360/start360.s
new file mode 100644
index 0000000000..2c4ed13066
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/start360/start360.s
@@ -0,0 +1,405 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+ /*
+ * Step 1: Decide on Reset Stack Pointer and Initial Program Counter
+ */
+Entry:
+ .long SYM(m360)+1024 | 0: Initial SSP
+ .long start | 1: Initial PC
+ .long uhoh | 2: Bus error
+ .long uhoh | 3: Address error
+ .long uhoh | 4: Illegal instruction
+ .long uhoh | 5: Zero division
+ .long uhoh | 6: CHK, CHK2 instruction
+ .long uhoh | 7: TRAPcc, TRAPV instructions
+ .long uhoh | 8: Privilege violation
+ .long uhoh | 9: Trace
+ .long uhoh | 10: Line 1010 emulator
+ .long uhoh | 11: Line 1111 emulator
+ .long uhoh | 12: Hardware breakpoint
+ .long uhoh | 13: Reserved for coprocessor violation
+ .long uhoh | 14: Format error
+ .long uhoh | 15: Uninitialized interrupt
+ .long uhoh | 16: Unassigned, reserved
+ .long uhoh | 17:
+ .long uhoh | 18:
+ .long uhoh | 19:
+ .long uhoh | 20:
+ .long uhoh | 21:
+ .long uhoh | 22:
+ .long uhoh | 23:
+ .long uhoh | 24: Spurious interrupt
+ .long uhoh | 25: Level 1 interrupt autovector
+ .long uhoh | 26: Level 2 interrupt autovector
+ .long uhoh | 27: Level 3 interrupt autovector
+ .long uhoh | 28: Level 4 interrupt autovector
+ .long uhoh | 29: Level 5 interrupt autovector
+ .long uhoh | 30: Level 6 interrupt autovector
+ .long uhoh | 31: Level 7 interrupt autovector
+ .long uhoh | 32: Trap instruction (0-15)
+ .long uhoh | 33:
+ .long uhoh | 34:
+ .long uhoh | 35:
+ .long uhoh | 36:
+ .long uhoh | 37:
+ .long uhoh | 38:
+ .long uhoh | 39:
+ .long uhoh | 40:
+ .long uhoh | 41:
+ .long uhoh | 42:
+ .long uhoh | 43:
+ .long uhoh | 44:
+ .long uhoh | 45:
+ .long uhoh | 46:
+ .long uhoh | 47:
+ .long uhoh | 48: Reserved for coprocessor
+ .long uhoh | 49:
+ .long uhoh | 50:
+ .long uhoh | 51:
+ .long uhoh | 52:
+ .long uhoh | 53:
+ .long uhoh | 54:
+ .long uhoh | 55:
+ .long uhoh | 56:
+ .long uhoh | 57:
+ .long uhoh | 58:
+ .long uhoh | 59: Unassigned, reserved
+ .long uhoh | 60:
+ .long uhoh | 61:
+ .long uhoh | 62:
+ .long uhoh | 63:
+ .long uhoh | 64: User defined vectors (192)
+ .long uhoh | 65:
+ .long uhoh | 66:
+ .long uhoh | 67:
+ .long uhoh | 68:
+ .long uhoh | 69:
+ .long uhoh | 70:
+ .long uhoh | 71:
+ .long uhoh | 72:
+ .long uhoh | 73:
+ .long uhoh | 74:
+ .long uhoh | 75:
+ .long uhoh | 76:
+ .long uhoh | 77:
+ .long uhoh | 78:
+ .long uhoh | 79:
+ .long uhoh | 80:
+ .long uhoh | 81:
+ .long uhoh | 82:
+ .long uhoh | 83:
+ .long uhoh | 84:
+ .long uhoh | 85:
+ .long uhoh | 86:
+ .long uhoh | 87:
+ .long uhoh | 88:
+ .long uhoh | 89:
+ .long uhoh | 90:
+ .long uhoh | 91:
+ .long uhoh | 92:
+ .long uhoh | 93:
+ .long uhoh | 94:
+ .long uhoh | 95:
+ .long uhoh | 96:
+ .long uhoh | 97:
+ .long uhoh | 98:
+ .long uhoh | 99:
+ .long uhoh | 100:
+ .long uhoh | 101:
+ .long uhoh | 102:
+ .long uhoh | 103:
+ .long uhoh | 104:
+ .long uhoh | 105:
+ .long uhoh | 106:
+ .long uhoh | 107:
+ .long uhoh | 108:
+ .long uhoh | 109:
+ .long uhoh | 110:
+ .long uhoh | 111:
+ .long uhoh | 112:
+ .long uhoh | 113:
+ .long uhoh | 114:
+ .long uhoh | 115:
+ .long uhoh | 116:
+ .long uhoh | 117:
+ .long uhoh | 118:
+ .long uhoh | 119:
+ .long uhoh | 120:
+ .long uhoh | 121:
+ .long uhoh | 122:
+ .long uhoh | 123:
+ .long uhoh | 124:
+ .long uhoh | 125:
+ .long uhoh | 126:
+ .long uhoh | 127:
+ .long uhoh | 128:
+ .long uhoh | 129:
+ .long uhoh | 130:
+ .long uhoh | 131:
+ .long uhoh | 132:
+ .long uhoh | 133:
+ .long uhoh | 134:
+ .long uhoh | 135:
+ .long uhoh | 136:
+ .long uhoh | 137:
+ .long uhoh | 138:
+ .long uhoh | 139:
+ .long uhoh | 140:
+ .long uhoh | 141:
+ .long uhoh | 142:
+ .long uhoh | 143:
+ .long uhoh | 144:
+ .long uhoh | 145:
+ .long uhoh | 146:
+ .long uhoh | 147:
+ .long uhoh | 148:
+ .long uhoh | 149:
+ .long uhoh | 150:
+ .long uhoh | 151:
+ .long uhoh | 152:
+ .long uhoh | 153:
+ .long uhoh | 154:
+ .long uhoh | 155:
+ .long uhoh | 156:
+ .long uhoh | 157:
+ .long uhoh | 158:
+ .long uhoh | 159:
+ .long uhoh | 160:
+ .long uhoh | 161:
+ .long uhoh | 162:
+ .long uhoh | 163:
+ .long uhoh | 164:
+ .long uhoh | 165:
+ .long uhoh | 166:
+ .long uhoh | 167:
+ .long uhoh | 168:
+ .long uhoh | 169:
+ .long uhoh | 170:
+ .long uhoh | 171:
+ .long uhoh | 172:
+ .long uhoh | 173:
+ .long uhoh | 174:
+ .long uhoh | 175:
+ .long uhoh | 176:
+ .long uhoh | 177:
+ .long uhoh | 178:
+ .long uhoh | 179:
+ .long uhoh | 180:
+ .long uhoh | 181:
+ .long uhoh | 182:
+ .long uhoh | 183:
+ .long uhoh | 184:
+ .long uhoh | 185:
+ .long uhoh | 186:
+ .long uhoh | 187:
+ .long uhoh | 188:
+ .long uhoh | 189:
+ .long uhoh | 190:
+ .long uhoh | 191:
+ .long uhoh | 192:
+ .long uhoh | 193:
+ .long uhoh | 194:
+ .long uhoh | 195:
+ .long uhoh | 196:
+ .long uhoh | 197:
+ .long uhoh | 198:
+ .long uhoh | 199:
+ .long uhoh | 200:
+ .long uhoh | 201:
+ .long uhoh | 202:
+ .long uhoh | 203:
+ .long uhoh | 204:
+ .long uhoh | 205:
+ .long uhoh | 206:
+ .long uhoh | 207:
+ .long uhoh | 208:
+ .long uhoh | 209:
+ .long uhoh | 210:
+ .long uhoh | 211:
+ .long uhoh | 212:
+ .long uhoh | 213:
+ .long uhoh | 214:
+ .long uhoh | 215:
+ .long uhoh | 216:
+ .long uhoh | 217:
+ .long uhoh | 218:
+ .long uhoh | 219:
+ .long uhoh | 220:
+ .long uhoh | 221:
+ .long uhoh | 222:
+ .long uhoh | 223:
+ .long uhoh | 224:
+ .long uhoh | 225:
+ .long uhoh | 226:
+ .long uhoh | 227:
+ .long uhoh | 228:
+ .long uhoh | 229:
+ .long uhoh | 230:
+ .long uhoh | 231:
+ .long uhoh | 232:
+ .long uhoh | 233:
+ .long uhoh | 234:
+ .long uhoh | 235:
+ .long uhoh | 236:
+ .long uhoh | 237:
+ .long uhoh | 238:
+ .long uhoh | 239:
+ .long uhoh | 240:
+ .long uhoh | 241:
+ .long uhoh | 242:
+ .long uhoh | 243:
+ .long uhoh | 244:
+ .long uhoh | 245:
+ .long uhoh | 246:
+ .long uhoh | 247:
+ .long uhoh | 248:
+ .long uhoh | 249:
+ .long uhoh | 250:
+ .long uhoh | 251:
+ .long uhoh | 252:
+ .long uhoh | 253:
+ .long uhoh | 254:
+ .long uhoh | 255:
+
+/*
+ * Default trap handler
+ * With an oscilloscope you can see AS* stop
+ */
+uhoh: nop | Leave spot for breakpoint
+ stop #0x2700 | Stop with interrupts disabled
+ bra.s uhoh | Stuck forever
+
+/*
+ * Place the low-order 3 octets of the board's ethernet address at
+ * a `well-known' fixed location relative to the beginning of ROM.
+ */
+ .align 2
+ .long ETHERNET_ADDRESS | Low-order 3 octets of ethernet address
+
+/*
+ * Initial PC
+ */
+start:
+ /*
+ * Step 2: Stay in Supervisor Mode
+ * (i.e. just do nothing for this step)
+ */
+
+ /*
+ * Step 3: Write the VBR
+ */
+ lea Entry,a0 | Get base of vector table
+ movec a0,vbr | Set up the VBR
+
+ /*
+ * Step 4: Write the MBAR
+ */
+ movec dfc,d1 | Save destination register
+ moveq #7,d0 | CPU-space funcction code
+ movec d0,dfc | Set destination function code register
+ movel #SYM(m360)+0x101,d0 | MBAR value (mask CPU space accesses)
+ movesl d0,0x3FF00 | Set MBAR
+ movec d1,dfc | Restore destination register
+
+ /*
+ * Step 5: Verify a dual-port RAM location
+ */
+ lea SYM(m360),a0 | Point a0 to first DPRAM location
+ moveb #0x33,d0 | Set the test value
+ moveb d0,a0@ | Set the memory location
+ cmpb a0@,d0 | Does it read back?
+ bne uhoh | If not, bad news!
+ notb d0 | Flip bits
+ moveb d0,a0@ | Set the memory location
+ cmpb a0@,d0 | Does it read back?
+ bne uhoh | If not, bad news!
+
+ /*
+ * Remaining steps are handled by C code
+ */
+ jmp SYM(_Init68360) | Start C code (which never returns)
+
+/*
+ * Copy DATA segment, clear BSS segment, set up real stack,
+ * initialize heap, start C program.
+ * Assume that DATA and BSS sizes are multiples of 4.
+ */
+ PUBLIC (_CopyDataClearBSSAndStart)
+SYM(_CopyDataClearBSSAndStart):
+ lea copy_start,a0 | Get start of DATA in RAM
+ lea SYM(etext),a2 | Get start of DATA in ROM
+ cmpl a0,a2 | Are they the same?
+ beq.s NOCOPY | Yes, no copy necessary
+ lea copy_end,a1 | Get end of DATA in RAM
+ bra.s COPYLOOPTEST | Branch into copy loop
+COPYLOOP:
+ movel a2@+,a0@+ | Copy word from ROM to RAM
+COPYLOOPTEST:
+ cmpl a1,a0 | Done?
+ bcs.s COPYLOOP | No, skip
+NOCOPY:
+
+ lea clear_start,a0 | Get start of BSS
+ lea clear_end,a1 | Get end of BSS
+ clrl d0 | Value to set
+ bra.s ZEROLOOPTEST | Branch into clear loop
+ZEROLOOP:
+ movel d0,a0@+ | Clear a word
+ZEROLOOPTEST:
+ cmpl a1,a0 | Done?
+ bcs.s ZEROLOOP | No, skip
+
+ movel #stack_init,a7 | set master stack pointer
+ movel d0,a7@- | environp
+ movel d0,a7@- | argv
+ movel d0,a7@- | argc
+ jsr SYM(main) | Call C main
+
+ | Should this just force a reset?
+mainDone: nop | Leave spot for breakpoint
+ stop #0x2700 | Stop with interrupts disabled
+ bra.s mainDone | Stuck forever
+
+ .align 2
+ PUBLIC (_HeapSize)
+SYM (_HeapSize):
+ .long HeapSize
+ PUBLIC (_StackSize)
+SYM (_StackSize):
+ .long StackSize
+END_CODE
+
+BEGIN_BSS
+ .align 2
+ PUBLIC (environ)
+SYM (environ):
+ .long 0
+END
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/bspclean.c b/c/src/lib/libbsp/m68k/gen68360/startup/bspclean.c
new file mode 100644
index 0000000000..d741ad47dc
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/bspclean.c
@@ -0,0 +1,27 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+ /* Cause double bus fault to force reset? */
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
new file mode 100644
index 0000000000..bbf1185f06
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
@@ -0,0 +1,247 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern void *_HeapStart;
+ extern rtems_unsigned32 _HeapSize;
+
+ /*
+ * The last parameter to RTEMS_Malloc_Initialize is the "chunk"
+ * size which a multiple of will be requested on each sbrk()
+ * call by malloc(). A value of 0 indicates that sbrk() should
+ * not be called to extend the heap.
+ */
+
+ RTEMS_Malloc_Initialize(&_HeapStart, _HeapSize, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ extern void *_WorkspaceBase;
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+#if 0
+ Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/;
+#endif
+
+
+ /*
+ * Copy the Configuration Table .. so we can change it
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Need to "allocate" the memory for the RTEMS Workspace and
+ * tell the RTEMS configuration where it is. This memory is
+ * not malloc'ed. It is just "pulled from the air".
+ */
+
+ BSP_Configuration.work_space_start = (void *)&_WorkspaceBase;
+
+ /*
+ * initialize the CPU table for this BSP
+ */
+
+ /*
+ * we do not use the pretasking_hook
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Don't forget the other CPU Table entries.
+ */
+
+ /*
+ * Start RTEMS
+ */
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c b/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c
new file mode 100644
index 0000000000..d0764453a8
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c
@@ -0,0 +1,190 @@
+/*
+ * MC68360 support routines
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <m68360.h>
+
+/*
+ * Send a command to the CPM RISC processer
+ */
+
+void M360ExecuteRISC(rtems_unsigned16 command)
+{
+ rtems_unsigned16 sr;
+
+ m68k_disable_interrupts (sr);
+ while (m360.cr & M360_CR_FLG)
+ continue;
+ m360.cr = command | M360_CR_FLG;
+ m68k_enable_interrupts (sr);
+}
+
+/*
+ * Initialize MC68360
+ */
+
+void _Init68360 (void)
+{
+ int i;
+ extern void *_RomBase, *_RamBase;
+ m68k_isr_entry *vbr;
+ extern void _CopyDataClearBSSAndStart (void);
+
+ /*
+ * Step 6: Is this a power-up reset?
+ * For now we just ignore this and do *all* the steps
+ * Someday we might want to:
+ * if (Hard, Loss of Clock, Power-up)
+ * Do all steps
+ * else if (Double bus fault, watchdog or soft reset)
+ * Skip to step 12
+ * else (must be a CPU32+ reset command)
+ * Skip to step 14
+ */
+
+ /*
+ * Step 7: Deal with clock synthesizer
+ * HARDWARE:
+ * Change if you're not using an external 25 MHz oscillator.
+ */
+ m360.clkocr = 0x8F; /* No more writes, no clock outputs */
+ m360.pllcr = 0xD000; /* PLL, no writes, no prescale, */
+ /* no LPSTOP slowdown, PLL X1 */
+ m360.cdvcr = 0x8000; /* No more writes, no clock division */
+
+ /*
+ * Step 8: Initialize system protection
+ * Disable watchdog FIXME: Should use watchdog!!!!
+ * Watchdog causes system reset
+ * Fastest watchdog timeout
+ * Enable double bus fault monitor
+ * Enable bus monitor external
+ * 128 clocks for external timeout
+ */
+ m360.sypcr = 0x4F;
+
+ /*
+ * Step 9: Clear parameter RAM and reset communication processor module
+ */
+ for (i = 0 ; i < 192 ; i += sizeof (long)) {
+ *((long *)((char *)&m360 + 0xC00 + i)) = 0;
+ *((long *)((char *)&m360 + 0xD00 + i)) = 0;
+ *((long *)((char *)&m360 + 0xE00 + i)) = 0;
+ *((long *)((char *)&m360 + 0xF00 + i)) = 0;
+ }
+ M360ExecuteRISC (M360_CR_RST);
+
+ /*
+ * Step 10: Write PEPAR
+ * SINTOUT not used (CPU32+ mode)
+ * CF1MODE=00 (CONFIG1 input)
+ * RAS1* double drive
+ * A31-A28
+ * OE* output
+ * CAS2* / CAS3*
+ * CAS0* / CAS1*
+ * CS7*
+ * AVEC*
+ * HARDWARE:
+ * Change if you are using a different memory configuration
+ * (static RAM, external address multiplexing, etc).
+ */
+ m360.pepar = 0x0100;
+
+ /*
+ * Step 11: Remap Chip Select 0 (CS0*), set up GMR
+ * 1024 addresses per DRAM page (1M DRAM chips)
+ * 60 nsec DRAM
+ * 180 nsec ROM (3 wait states)
+ * HARDWARE:
+ * Change if you are using a different memory configuration
+ */
+ m360.gmr = M360_GMR_RCNT(24) | M360_GMR_RFEN | M360_GMR_RCYC(0) |
+ M360_GMR_PGS(3) | M360_GMR_DPS_32BIT | M360_GMR_NCS |
+ M360_GMR_GAMX;
+ m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
+ M360_MEMC_BR_V;
+ m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_512KB |
+ M360_MEMC_OR_8BIT;
+
+ /*
+ * Step 12: Initialize the system RAM
+ * Set up option/base registers
+ * 4 MB DRAM
+ * 60 nsec DRAM
+ * Wait for chips to power up
+ * Perform 8 read cycles
+ * Set all parity bits to correct state
+ * Enable parity checking
+ * HARDWARE:
+ * Change if you are using a different memory configuration
+ */
+ m360.memc[1].or = M360_MEMC_OR_TCYC(0) | M360_MEMC_OR_4MB |
+ M360_MEMC_OR_DRAM;
+ m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
+ for (i = 0; i < 50000; i++)
+ continue;
+ for (i = 0; i < 8; ++i)
+ *((volatile unsigned long *)(unsigned long)&_RamBase);
+ for (i = 0 ; i < 4*1024*1024 ; i += sizeof (unsigned long)) {
+ volatile unsigned long *lp;
+ lp = (unsigned long *)((unsigned char *)&_RamBase + i);
+ *lp = *lp;
+ }
+ m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_PAREN |
+ M360_MEMC_BR_V;
+
+ /*
+ * Step 13: Copy the exception vector table to system RAM
+ */
+ m68k_get_vbr (vbr);
+ for (i = 0; i < 256; ++i)
+ M68Kvec[i] = vbr[i];
+ m68k_set_vbr (M68Kvec);
+
+ /*
+ * Step 14: More system initialization
+ * SDCR (Serial DMA configuratin register)
+ * Give SDMA priority over all interrupt handlers
+ * Set DMA arbiration level to 4
+ * CICR (CPM interrupt configuration register):
+ * SCC1 requests at SCCa position
+ * SCC2 requests at SCCb position
+ * SCC3 requests at SCCc position
+ * SCC4 requests at SCCd position
+ * Interrupt request level 4
+ * Maintain original priority order
+ * Vector base 128
+ * SCCs priority grouped at top of table
+ */
+ m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
+ m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
+ (4 << 13) | (0x1F << 8) | (128);
+
+ /*
+ * Step 15: Set module configuration register
+ * Disable timers during FREEZE
+ * Enable bus monitor during FREEZE
+ * BCLRO* arbitration level 3
+ * No show cycles
+ * User/supervisor access
+ * Bus clear interupt service level 7
+ * SIM60 interrupt sources higher priority than CPM
+ */
+ m360.mcr = 0x4C7F;
+
+ /*
+ * Copy data, clear BSS, switch stacks and call main()
+ */
+ _CopyDataClearBSSAndStart ();
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds
new file mode 100644
index 0000000000..8869c380a7
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds
@@ -0,0 +1,105 @@
+/*
+ * This file contains GNU linker directives for a generic MC68360 board.
+ *
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ * Declare on-board memory
+ */
+MEMORY {
+ ram : ORIGIN = 0x00000000, LENGTH = 4M
+ rom : ORIGIN = 0xFF000000, LENGTH = 1M
+ dpram : ORIGIN = 0xFE000000, LENGTH = 8k
+}
+
+/*
+ * Declare some sizes
+ * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
+ * number used there is not constant. If this happens to you, edit
+ * the lines marked below to use a constant value.
+ */
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
+StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
+
+/*
+ * Declare low-order three octets of Ethernet address
+ */
+ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
+
+/*
+ * Load objects
+ */
+SECTIONS {
+ /*
+ * Boot PROM
+ */
+ rom : {
+ _RomBase = .;
+ __RomBase = .;
+ } >rom
+
+ /*
+ * Dynamic RAM
+ */
+ ram : {
+ _RamBase = .;
+ __RamBase = .;
+ } >ram
+
+ /*
+ * Text, data and bss segments
+ */
+ .text : {
+ CREATE_OBJECT_SYMBOLS
+ *(.text)
+ . = ALIGN (16);
+ etext = .;
+ _etext = .;
+ } >ram
+ .data : {
+ copy_start = .;
+ *(.data)
+ . = ALIGN (16);
+ _edata = .;
+ copy_end = .;
+ } >ram
+ .bss : {
+ M68Kvec = .;
+ _M68Kvec = .;
+ . += (256 * 4);
+ clear_start = .;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (16);
+ _end = .;
+
+ _HeapStart = .;
+ __HeapStart = .;
+ . += HeapSize; /* XXX -- Old gld can't handle this */
+ . += StackSize; /* XXX -- Old gld can't handle this */
+ /* . += 0x10000; */ /* HeapSize for old gld */
+ /* . += 0x1000; */ /* StackSize for old gld */
+ . = ALIGN (16);
+ stack_init = .;
+ clear_end = .;
+
+ _WorkspaceBase = .;
+ __WorkspaceBase = .;
+ } >ram
+
+ /*
+ * On-chip memory/peripherals
+ */
+ dpram : {
+ m360 = .;
+ _m360 = .;
+ . += (8 * 1024);
+
+ } >dpram
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom
new file mode 100644
index 0000000000..ef1c3ee6e2
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom
@@ -0,0 +1,111 @@
+/*
+ * This file contains GNU linker directives for a generic MC68360 board.
+ * These linker directives are for producing a PROM version..
+ * To create the PROM image from the linkter output you must use objcopy
+ * (--adjust-section-vma) to place the data segment at the end of the text
+ * segment in the PROM. The start-up code takes care of copying this region
+ * to RAM.
+ *
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ * a.out format doesn't handle prom images very well
+ */
+OUTPUT_FORMAT(coff-m68k)
+
+/*
+ * Declare on-board memory
+ */
+MEMORY {
+ ram : ORIGIN = 0x00000000, LENGTH = 4M
+ rom : ORIGIN = 0xFF000000, LENGTH = 1M
+ dpram : ORIGIN = 0xFE000000, LENGTH = 8k
+}
+
+/*
+ * Declare some sizes
+ */
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
+StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
+
+/*
+ * Declare low-order three octets of Ethernet address
+ */
+ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
+
+/*
+ * Load objects
+ */
+SECTIONS {
+ /*
+ * Boot PROM
+ */
+ rom : {
+ _RomBase = .;
+ __RomBase = .;
+ } >rom
+
+ /*
+ * Dynamic RAM
+ */
+ ram : {
+ _RamBase = .;
+ __RamBase = .;
+ } >ram
+
+ /*
+ * Text, data and bss segments
+ */
+ .text : {
+ CREATE_OBJECT_SYMBOLS
+ *(.text)
+ . = ALIGN (16);
+ etext = .;
+ _etext = .;
+ } >rom
+ .data : {
+ copy_start = .;
+ *(.data)
+ . = ALIGN (16);
+ _edata = .;
+ copy_end = .;
+ } >ram
+ .bss : {
+ M68Kvec = .;
+ _M68Kvec = .;
+ . += (256 * 4);
+ clear_start = .;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (16);
+ _end = .;
+
+ _HeapStart = .;
+ __HeapStart = .;
+ . += HeapSize;
+ . += StackSize;
+ . = ALIGN (16);
+ stack_init = .;
+ clear_end = .;
+
+ _WorkspaceBase = .;
+ __WorkspaceBase = .;
+ } >ram
+
+ /*
+ * On-chip memory/peripherals
+ */
+ dpram : {
+ m360 = .;
+ _m360 = .;
+ . += (8 * 1024);
+
+ } >dpram
+
+}
diff --git a/c/src/lib/libbsp/m68k/gen68360/timer/timer.c b/c/src/lib/libbsp/m68k/gen68360/timer/timer.c
new file mode 100644
index 0000000000..1f43115539
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/timer/timer.c
@@ -0,0 +1,95 @@
+/*
+ * Timer_init()
+ *
+ * Use TIMER 1 and TIMER 2 for Timing Test Suite
+ *
+ * The hardware on the MC68360 makes these routines very simple.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include "m68360.h"
+
+void
+Timer_initialize (void)
+{
+ /*
+ * Reset timers 1 and 2
+ */
+ m360.tgcr &= ~0x00FF;
+ m360.tcn1 = 0;
+ m360.tcn2 = 0;
+ m360.ter1 = 0xFFFF;
+ m360.ter2 = 0xFFFF;
+
+ /*
+ * Cascade timers 1 and 2
+ */
+ m360.tgcr |= 0x0080;
+
+ /*
+ * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
+ * HARDWARE:
+ * Change the `25' to match your processor clock
+ */
+ m360.tmr2 = ((25-1) << 8) | 0x2;
+ m360.tmr1 = 0;
+
+ /*
+ * Start the timers
+ */
+ m360.tgcr |= 0x0011;
+}
+
+/*
+ * Return timer value in microsecond units
+ */
+int
+Read_timer (void)
+{
+ return *(rtems_unsigned32 *)&m360.tcn1;
+}
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+rtems_status_code
+Empty_function (void)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void
+Set_find_average_overhead(rtems_boolean find_flag)
+{
+}
diff --git a/c/src/lib/libbsp/m68k/idp/README b/c/src/lib/libbsp/m68k/idp/README
new file mode 100644
index 0000000000..f02ced80b9
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/README
@@ -0,0 +1,35 @@
+#
+# $Id$
+#
+
+This board support package has not been tested with multiprocessor
+or the timing support. The uniprocessor IDP package was tested though
+with a fairly large application (although bugs may exist). The
+$RTEMS_ROOT/src/tests/Makefile should therefore have the samples and
+the tests directories compiled first with the tmtests (timing) and
+multiprocessor directories optional.
+
+Let me know if you have any problems or bug fixes. Bug fixes are greatly
+appreciated. I do not work for RTEMS or am a member of the RTEMS support
+group in any way, however. I am just one of many that appreciate
+"free" software and enjoy contributing when possible :). You can do it too!
+
+ -- doug mcbride
+ mcbride@rodin.colorado.edu
+
+==============================================================
+Notes: Make sure that -msoft-float is defined when compiling in the
+newlib-beta-rtems/newlib/msoft-float directory subtree. You also probably
+want to add the following line to line 413 of
+newlib-beta-rtems/newlib/msoft-float/libc/stdio/vfprintf.c:
+
+#define INTEGER_ONLY
+
+That allows you to pass most of the paranoia test in the samples
+directory of RTEMS although you can't see the floating point values actually
+printed (software floating point tends to make that difficult anyway).
+In order to pass the whole paranoia test (with one flaw), however, I had to
+comment out the following line in milestone 140 (why?):
+
+/* printf ("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n",
+ Exp2); */
diff --git a/c/src/lib/libbsp/m68k/idp/clock/ckinit.c b/c/src/lib/libbsp/m68k/idp/clock/ckinit.c
new file mode 100644
index 0000000000..6d93523563
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/clock/ckinit.c
@@ -0,0 +1,199 @@
+/* Clock_init()
+ *
+ *
+ * This is modified by Doug McBride to get it to work for the MC68EC040
+ * IDP board. The below comments are kept to show that some prior work
+ * was done in the area and the modifications performed was application
+ * specific for the IDP board to port it to.
+ *
+ * This routine initializes the mc68230 on the MC68EC040 board.
+ * The tick frequency is 40 milliseconds.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+volatile rtems_unsigned32 Clock_driver_ticks;
+ /* ticks since initialization */
+rtems_isr_entry Old_ticker;
+
+extern rtems_configuration_table Configuration;
+extern void led_putnum();
+void Disable_clock();
+
+#define CLOCK_VECTOR 0x4D
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+
+/*
+ * ISR Handler
+ *
+ *
+ * ((1ms * 6.5 MHz) / 2^5) = 203.125) where 6.5 MHz is the clock rate of the
+ * MC68230, 2^5 is the prescaler factor, and 1ms is the common interrupt
+ * interval for the Clock_isr routine.
+ * Therefore, 203 (decimal) is the number to program into the CPRH-L registers
+ * of the MC68230 for countdown. However, I have found that 193 instead of
+ * 203 provides greater accuracy -- why? The crystal should be more accurate
+ * than that
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ Clock_driver_ticks += 1;
+ /* acknowledge interrupt
+ TSR = 1; */
+ MC68230_WRITE (TSR, 1);
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ /* Cast to an integer so that 68EC040 IDP which doesn't have an FPU doesn't
+ have a heart attack -- if you use newlib1.6 or greater and get
+ libgcc.a for gcc with software floating point support, this is not
+ a problem */
+ Clock_isrs =
+ (int)(BSP_Configuration.microseconds_per_tick / 1000);
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Disable_clock()
+{
+ /* Disable timer */
+ MC68230_WRITE (TCR, 0x00);
+}
+
+void Install_clock( clock_isr )
+rtems_isr_entry clock_isr;
+{
+ Clock_driver_ticks = 0;
+ Clock_isrs = (int)(Configuration.microseconds_per_tick / 1000);
+
+ if ( Configuration.ticks_per_timeslice ) {
+/* led_putnum('c'); * for debugging purposes */
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+
+ /* Disable timer for initialization */
+ MC68230_WRITE (TCR, 0x00);
+
+ /* some PI/T initialization stuff here -- see comment in the ckisr.c
+ file in this directory to understand why I use the values that I do */
+ /* Set up the interrupt vector on the MC68230 chip:
+ TIVR = CLOCK_VECTOR; */
+ MC68230_WRITE (TIVR, CLOCK_VECTOR);
+
+ /* Set CPRH through CPRL to 193 (not 203) decimal for countdown--see ckisr.c
+ CPRH = 0x00;
+ CPRM = 0x00;
+ CPRL = 0xC1; */
+ MC68230_WRITE (CPRH, 0x00);
+ MC68230_WRITE (CPRM, 0x00);
+ MC68230_WRITE (CPRL, 0xC1);
+
+ /* Enable timer and use it as an external periodic interrupt generator
+ TCR = 0xA1; */
+/* led_putnum('a'); * for debugging purposes */
+ MC68230_WRITE (TCR, 0xA1);
+
+ /*
+ * Schedule the clock cleanup routine to execute if the application exits.
+ */
+ atexit( Clock_exit );
+ }
+}
+
+/* The following was added for debugging purposes */
+void Clock_exit( void )
+{
+ rtems_unsigned8 data;
+
+ if ( Configuration.ticks_per_timeslice ) {
+
+ /* disable timer
+ data = TCR;
+ TCR = (data & 0xFE); */
+ MC68230_READ (TCR, data);
+ MC68230_WRITE (TCR, (data & 0xFE));
+
+ /* do not restore old vector */
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/idp/console/console.c b/c/src/lib/libbsp/m68k/idp/console/console.c
new file mode 100644
index 0000000000..cd64e27e84
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/console/console.c
@@ -0,0 +1,284 @@
+/*
+ * This file contains the Motorola IDP console IO package.
+ *
+ * Written by Doug McBride, Colorado Space Grant College
+ * Based off of the board support packages of RTEMS
+ *
+ * Updated to RTEMS 3.2.0 by Joel Sherrill.
+ *
+ * $Id$
+ */
+
+#define MIDP_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <ringbuf.h>
+
+Ring_buffer_t Buffer[ 2 ];
+
+rtems_isr C_Receive_ISR(rtems_vector_number vector);
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ Ring_buffer_Initialize( &Buffer[ 0 ] );
+ Ring_buffer_Initialize( &Buffer[ 1 ] );
+
+ init_pit();
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ status = rtems_io_register_name(
+ "/dev/tty00",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ status = rtems_io_register_name(
+ "/dev/tty01",
+ major,
+ (rtems_device_minor_number) 1
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch,
+ int port
+)
+{
+ if ( Ring_buffer_Is_empty( &Buffer[ port ] ) )
+ return FALSE;
+
+ Ring_buffer_Remove_character( &Buffer[ port ], *ch );
+ return TRUE;
+}
+
+/* quick_char_check
+ *
+ * This routine returns TRUE if a character is available.
+ * It is different from above because it does not disturb the ring buffer
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean quick_char_check(
+ int port
+)
+{
+ if ( Ring_buffer_Is_empty( &Buffer[ port ] ) )
+ return FALSE;
+
+ return TRUE;
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the UART through a buffer.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from UART
+ */
+
+char inbyte(
+ int port
+)
+{
+ unsigned char tmp_char;
+
+ /* If you come into this routine without checking is_character_ready() first
+ and you want nonblocking code, then it's your own fault */
+
+ while ( !is_character_ready( &tmp_char, port ) );
+
+ return tmp_char;
+}
+
+
+/* outbyte
+ *
+ * This routine transmits a character out the M68681. It supports
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch,
+ int port
+)
+{
+ switch ( port ) {
+ case 0:
+ transmit_char( ch );
+ break;
+ case 1:
+ transmit_char_portb( ch );
+ break;
+ }
+
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ if ( minor > 1 )
+ return RTEMS_INVALID_NUMBER;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte( minor );
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ if ( minor > 1 )
+ return RTEMS_INVALID_NUMBER;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r', minor );
+ }
+ outbyte( buffer[ count ], minor );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/idp/console/duart.c b/c/src/lib/libbsp/m68k/idp/console/duart.c
new file mode 100644
index 0000000000..2d82590a49
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/console/duart.c
@@ -0,0 +1,174 @@
+/*
+ * $Id$
+ */
+
+/*#########################################################
+#
+# This code is a modified version of what you will find at the
+# end of the IDP User's manual. The original code is copyrighted
+# by Motorola and Motorola Semiconductor Products as well as
+# Motorola Software products group.
+#
+# Modifications to the original IDP code by Doug McBride, Colorado
+# Space Grant College. Modifications include a means of accessing
+# port B of the duart as well as port A as well as modifications for
+# buffering and RTEMS support. Modifications are provided
+# as is and may not be correct.
+#
+# Rob Savoye provided the format for the mc68681 header file
+#
+# Joel Sherrill provided inspiration for recoding my original assembly
+# for this file into C (a good idea)
+#
+##########################################################*/
+
+#include "mc68230.h"
+#include "mc68681.h"
+#include "ringbuf.h"
+#include "rtems.h"
+#include "bsp.h"
+
+rtems_isr C_Receive_ISR(rtems_vector_number vector);
+extern Ring_buffer_t Buffer[];
+
+extern unsigned char inbuf[];
+extern unsigned char inbuf_portb[];
+extern unsigned tail;
+extern unsigned tail_portb;
+unsigned char Pit_initialized = 0;
+
+/*#####################################################################
+# The volatile routine to initialize the duart -- port a and port b
+######################################################################*/
+volatile void init_pit()
+{
+ /* Disable ports A & B while configuring PIT */
+ MC68681_WRITE(DUART_IMR, 0x00); /* disable imr */
+ MC68681_WRITE(DUART_CRA, 0x08); /* disable port a transmitter */
+ MC68681_WRITE(DUART_CRA, 0x02); /* disable port a receiver */
+ MC68681_WRITE(DUART_CRB, 0x08); /* disable port b transmitter */
+ MC68681_WRITE(DUART_CRB, 0x02); /* disable port b receiver */
+
+ /* install ISR for ports A and B */
+ set_vector(C_Receive_ISR, (VECT+H3VECT), 1);
+
+ /* initialize pit */
+ MC68230_WRITE(PGCR, 0x00); /* set mode to 0 -- disable all ports */
+ MC68230_WRITE(PSRR, 0x18); /* set up pirq and piack */
+ MC68230_WRITE(PBDDR, 0x00); /* all pins on port b are input */
+ MC68230_WRITE(PBCR, 0x82); /* submode 1x, h3 interrupt enabled */
+ MC68230_WRITE(PIVR, VECT); /* setup pivr */
+ MC68230_WRITE(PGCR, 0x20); /* turn on all ports */
+
+ /* For some reason, the reset of receiver/transmitter only works for
+ the first time around -- it garbles the output otherwise (e.g., sp21) */
+ if (!Pit_initialized)
+ {
+ /* now initialize the duart registers on port b */
+ /* WARNING:OPTIMIZER MAY ONLY EXECUTE THIRD STATEMENT IF NOT VOLATILE */
+ MC68681_WRITE(DUART_CRB, 0x30); /* reset tx, channel b */
+ MC68681_WRITE(DUART_CRB, 0x20); /* reset rx, channel b */
+ MC68681_WRITE(DUART_CRB, 0x10); /* reset mr pointer, channel b */
+
+ /* now initialize the duart registers on port a */
+ /* WARNING:OPTIMIZER MAY ONLY EXECUTE THIRD STATEMENT IF NOT VOLATILE */
+ MC68681_WRITE(DUART_CRA, 0x30); /* reset tx, channel a */
+ MC68681_WRITE(DUART_CRA, 0x20); /* reset rx, channel a */
+ MC68681_WRITE(DUART_CRA, 0x10); /* reset mr pointer, channel a */
+ Pit_initialized = 1;
+ }
+
+ /* init the general registers of the duart */
+ MC68681_WRITE(DUART_IVR, 0x0f); /* init ivr */
+ MC68681_WRITE(DUART_IMR, 0x22); /* init imr */
+ MC68681_WRITE(DUART_ACR, 0x00); /* init acr */
+ MC68681_WRITE(DUART_CTUR, 0x00); /* init ctur */
+ MC68681_WRITE(DUART_CTLR, 0x02); /* init ctlr */
+ MC68681_WRITE(DUART_OPCR, 0x00); /* init opcr */
+ MC68681_WRITE(DUART_OPRSET, 0x01); /* init cts */
+
+ /* init the actual serial port for port a */
+ MC68681_WRITE(DUART_CSRA, 0xbb); /* init csra -- 9600 baud */
+ MC68681_WRITE(DUART_MR1A, 0x13); /* init mr1a */
+ MC68681_WRITE(DUART_MR2A, 0x07); /* init mr2a */
+ MC68681_WRITE(DUART_CRA, 0x05); /* init cra */
+
+ /* init the actual serial port for port b */
+ MC68681_WRITE(DUART_CSRB, 0xbb); /* init csrb -- 9600 baud */
+#define EIGHT_BITS_NO_PARITY
+#ifdef EIGHT_BITS_NO_PARITY
+ MC68681_WRITE(DUART_MR1B, 0x13); /* init mr1b */
+#else /* 7 bits, even parity */
+ MC68681_WRITE(DUART_MR1B, 0x02); /* init mr1b */
+#endif
+ MC68681_WRITE(DUART_MR2B, 0x07); /* init mr2b -- one stop bit */
+ MC68681_WRITE(DUART_CRB, 0x05); /* init crb */
+}
+
+/*#####################################################################
+# interrupt handler for receive of character from duart on ports A & B
+#####################################################################*/
+rtems_isr C_Receive_ISR(rtems_vector_number vector)
+{
+ volatile unsigned char *_addr;
+
+ _addr = (unsigned char *) (PIT_ADDR + PITSR);
+ *_addr = 0x04; /* clear pit interrupt */
+
+ /* Let's check port A first for input */
+ _addr = (unsigned char *) (DUART_ADDR + DUART_SRA);
+ if (*_addr & 0x01) /* extract rcvrdy on port A */
+ {
+ /* Read input on port A */
+ _addr = (unsigned char *) (DUART_ADDR + DUART_RBA);
+ Ring_buffer_Add_character( &Buffer[ 0 ], *_addr );
+ }
+ else /* If not on port A, let's check port B */
+ {
+ _addr = (unsigned char *) (DUART_ADDR + DUART_SRB);
+ if (*_addr & 0x01) /* extract rcvrdy on port B */
+ {
+ /* Read input on port B */
+ _addr = (unsigned char *) (DUART_ADDR + DUART_RBB);
+ Ring_buffer_Add_character( &Buffer[ 1 ], *_addr );
+ }
+ /* if not ready on port A or port B, must be an error */
+ /* if error, get out so that fifo is undisturbed */
+ }
+}
+
+/*#####################################################################
+# This is the routine that actually transmits a character one at a time
+# This routine transmits on port A of the IDP board
+#####################################################################*/
+void transmit_char(char ch)
+{
+ volatile unsigned char *_addr;
+
+ /* Get SRA (extract txrdy) */
+ _addr = (unsigned char *) (DUART_ADDR + DUART_SRA);
+ while (!(*_addr & 0x04))
+ {
+ }
+
+ /* transmit character over port A */
+ MC68681_WRITE(DUART_TBA, ch);
+}
+
+/*#####################################################################
+# This is the routine that actually transmits a character one at a time
+# This routine transmits on port B of the IDP board
+#####################################################################*/
+void transmit_char_portb(char ch)
+{
+ volatile unsigned char *_addr;
+
+ /* Get SRB (extract txrdy) */
+ _addr = (unsigned char *) (DUART_ADDR + DUART_SRB);
+ while (!(*_addr & 0x04))
+ {
+ }
+
+ /* transmit character over port B */
+ MC68681_WRITE(DUART_TBB, ch);
+}
diff --git a/c/src/lib/libbsp/m68k/idp/console/leds.c b/c/src/lib/libbsp/m68k/idp/console/leds.c
new file mode 100644
index 0000000000..de4200e1c4
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/console/leds.c
@@ -0,0 +1,82 @@
+/*
+ * leds.c -- control the led's on a Motorola mc68ec0x0 board.
+ * Written by rob@cygnus.com (Rob Savoye)
+ *
+ * $Id$
+ */
+#include "leds.h"
+
+void zylons();
+void led_putnum();
+void clear_leds();
+
+/*
+ * led_putnum -- print a hex number on the LED. the value of num must be a char with
+ * the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears
+ * the led display.
+ * Setting the bit to 0 turns it on, 1 turns it off.
+ * the LED's are controlled by setting the right bit mask in the base
+ * address.
+ * The bits are:
+ * [d.p | g | f | e | d | c | b | a ] is the byte.
+ *
+ * The locations are:
+ *
+ * a
+ * -----
+ * f | | b
+ * | g |
+ * -----
+ * | |
+ * e | | c
+ * -----
+ * d . d.p (decimal point)
+ */
+void
+led_putnum ( num )
+char num;
+{
+ static unsigned char *leds = (unsigned char *)LED_ADDR;
+ static unsigned char num_bits [18] = {
+ 0xff, /* clear all */
+ 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, /* numbers 0-9 */
+ 0x98, 0x20, 0x3, 0x27, 0x21, 0x4, 0xe /* letters a-f */
+ };
+
+ if (num >= '0' && num <= '9')
+ num = (num - '0') + 1;
+
+ if (num >= 'a' && num <= 'f')
+ num = (num - 'a') + 12;
+
+ if (num == ' ')
+ num = 0;
+
+ *leds = num_bits[(int)num];
+}
+
+/* This procedure added by Doug McBride, Colorado Space Grant College --
+ Probably should be a macro instead */
+void
+clear_leds ( )
+{
+ static unsigned char *leds = (unsigned char *)LED_ADDR;
+ *leds = 0xFF;
+}
+
+/*
+ * zylons -- draw a rotating pattern. NOTE: this function never returns.
+ */
+void
+zylons()
+{
+ unsigned char *leds = (unsigned char *)LED_ADDR;
+ unsigned char curled = 0xfe;
+
+ while (1)
+ {
+ *leds = curled;
+ curled = (curled >> 1) | (curled << 7);
+ delay ( 8000 );
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/idp/console/mc68ec.c b/c/src/lib/libbsp/m68k/idp/console/mc68ec.c
new file mode 100644
index 0000000000..fd837981d2
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/console/mc68ec.c
@@ -0,0 +1,21 @@
+/*
+ * mc68ec.c -- Low level support for the Motorola mc68ec0x0 board.
+ * Written by rob@cygnus.com (Rob Savoye)
+ *
+ * $Id$
+ */
+
+#include "leds.h"
+
+/*
+ * delay -- delay execution. This is an ugly hack. It should
+ * use the timer, but I'm waiting for docs. (sigh)
+ */
+void delay(num)
+int num;
+{
+ while (num--)
+ {
+ asm ("nop");
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/idp/include/README b/c/src/lib/libbsp/m68k/idp/include/README
new file mode 100644
index 0000000000..940cadb13d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/include/README
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+
+The following files really should be made generic and allowed to
+be shared between BSPs:
+
+ mc68230.h
+ mc68681.h
+ ringbuf.h
+
+However at the moment the BSP is not tested under 3.2.0 so it is
+dangerous to do so.
diff --git a/c/src/lib/libbsp/m68k/idp/include/bsp.h b/c/src/lib/libbsp/m68k/idp/include/bsp.h
new file mode 100644
index 0000000000..65fcfe1e6e
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/include/bsp.h
@@ -0,0 +1,97 @@
+/* bsp.h
+ *
+ * This include file contains all Motorola 680x0 IDP board IO definitions.
+ *
+ * $Id$
+ */
+
+#ifndef __IDP_BSP_H
+#define __IDP_BSP_H
+
+#include <rtems.h>
+#include <console.h>
+#include <clockdrv.h>
+#include <mc68230.h>
+#include <mc68681.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: tm27 apparently not supported.
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler )
+
+#define Cause_tm27_intr()
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x200000
+
+#ifdef MIDP_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+void init_pit( void );
+
+void transmit_char( char ch );
+
+void transmit_char_portb( char ch );
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/idp/include/coverhd.h b/c/src/lib/libbsp/m68k/idp/include/coverhd.h
new file mode 100644
index 0000000000..671f20d197
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/include/coverhd.h
@@ -0,0 +1,106 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#endif
diff --git a/c/src/lib/libbsp/m68k/idp/include/leds.h b/c/src/lib/libbsp/m68k/idp/include/leds.h
new file mode 100644
index 0000000000..f2c3257dd4
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/include/leds.h
@@ -0,0 +1,27 @@
+/*
+ * leds.c -- control the led's on a Motorola mc68ec0x0 board.
+ * Written by rob@cygnus.com (Rob Savoye)
+ *
+ * $Id$
+ */
+
+#ifndef __LEDS_H__
+#define __LEDS_H__
+
+#define LED_ADDR 0xd00003
+#define LED_0 ~0x1
+#define LED_1 ~0x2
+#define LED_2 ~0x4
+#define LED_3 ~0x8
+#define LED_4 ~0x10
+#define LED_5 ~0x20
+#define LED_6 ~0x40
+#define LED_7 ~0x80
+#define LEDS_OFF 0xff
+#define LEDS_ON 0x0
+
+#define FUDGE(x) ((x >= 0xa && x <= 0xf) ? (x + 'a') & 0x7f : (x + '0') & 0x7f)
+
+extern void led_putnum( char );
+
+#endif /* __LEDS_H__ */
diff --git a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c
new file mode 100644
index 0000000000..2c71a1d8e9
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c
@@ -0,0 +1,256 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+unsigned char *duart_base;
+extern struct duart_regs duart_info;
+
+#define DELAY 5000
+
+void led_putnum();
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /* Create 64 KByte memory region for RTEMS executive */
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ m68k_isr_entry *monitors_vector_table;
+ int index;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ duart_base = (unsigned char *)DUART_ADDR;
+
+ /*
+ * Set the VBR here to the monitor's default.
+ */
+
+ monitors_vector_table = (m68k_isr_entry *)0;
+ /* This is where you set vector base register = 0 */
+ m68k_set_vbr( monitors_vector_table );
+
+ /* The vector interrupt table for the 680x0 is in appendix B-2
+ of the M68000 Family Programmer's reference table */
+ for ( index=2 ; index<=255 ; index++ )
+ M68Kvec[ index ] = monitors_vector_table[ 32 ];
+
+
+ M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
+ M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
+ M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
+
+ /*
+ * Set the VBR here if you do not want to use the monitor's vector table.
+ */
+
+ m68k_set_vbr( &M68Kvec );
+
+ m68k_enable_caching();
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+/* led_putnum('e'); * for debugging purposes only */
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
+
+ /* Clock_exit is done as an atexit() function */
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/idp/startup/linkcmds b/c/src/lib/libbsp/m68k/idp/startup/linkcmds
new file mode 100644
index 0000000000..150d397467
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/startup/linkcmds
@@ -0,0 +1,46 @@
+/* This file is a derivation of that found with the newlib-1.6 distribution
+ * for the idp.ld file. That file, it appears, was originally written by
+ * Rob Savoye. Other ideas came from Joel Sherrill for the RTEMS linkcmds
+ * file (this is basically a mixture of the two).
+ *
+ * $Id$
+ */
+
+/*
+ * Setup the memory map of the MC68ec0x0 Board (IDP)
+ * stack grows up towards high memory. This works for
+ * both the rom68k and the mon68k monitors.
+ */
+MEMORY
+{
+ ram : org = 0x10000, l = 2M
+}
+
+SECTIONS
+{
+ .text 0x10000:
+ {
+ text_start = . ;
+ _text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+ _etext = .;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ _data_start = .;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+ _edata = .;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/idp/timer/timer.c b/c/src/lib/libbsp/m68k/idp/timer/timer.c
new file mode 100644
index 0000000000..6fa1ae206d
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/timer/timer.c
@@ -0,0 +1,120 @@
+/* Timer_init()
+ *
+ * This routine initializes the MC68230 timer on the Motorola IDP board.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: This routine will not work if the optimizer is enabled
+ * for some compilers. The multiple writes to the MC68230
+ * may be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * Code Modified for the MC68230 by Doug McBride, Colorado Space Grant College
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+#include <bsp.h>
+#include <mc68230.h>
+
+#define TIMER_VECTOR 0x4D
+
+int Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+ (void) set_vector( timerisr, TIMER_VECTOR, 0 ); /* install ISR */
+
+ Ttimer_val = 0; /* clear timer ISR count */
+
+ /* some PI/T initialization stuff here */
+ /* Set up the interrupt vector on the MC68230 chip:
+ TIVR = TIMER_VECTOR; */
+ MC68230_WRITE (TIVR, TIMER_VECTOR);
+
+ /* Set CPRH through CPRL to maximum count to reduce interrupt overhead
+ CPRH = 0xFF;
+ CPRM = 0xFF;
+ CPRL = 0xFF; */
+ MC68230_WRITE (CPRH, 0xFF);
+ MC68230_WRITE (CPRM, 0xFF);
+ MC68230_WRITE (CPRL, 0xFF);
+
+ /* Enable timer and use it as an external periodic interrupt generator
+ TCR = 0xA1; */
+ MC68230_WRITE (TCR, 0xA1);
+
+}
+
+#define AVG_OVERHEAD 9 /* may not be right -- do this later */
+#define LEAST_VALID 10 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ rtems_unsigned8 data;
+ rtems_unsigned8 msb, osb, lsb;
+ rtems_unsigned32 remaining, total;
+
+ /* Disable timer so that timer can be read
+ data = TCR;
+ TCR = (data & 0xFE); */
+ MC68230_READ (TCR, data);
+ MC68230_WRITE (TCR, (data & 0xFE));
+
+ /* Read the counter value
+ msb = CNTRH;
+ osb = CNTRM;
+ lsb = CNTRL; */
+ MC68230_READ (CNTRH, msb);
+ MC68230_READ (CNTRM, osb);
+ MC68230_READ (CNTRL, lsb);
+
+ /* Calculate the time so far */
+ remaining = 0x1000000 - ((msb << 16) + (osb << 8) + lsb);
+ total = (Ttimer_val * 0x1000000) + remaining;
+
+ /* Enable timer so that timer can continue
+ TCR = 0xA1; */
+ MC68230_WRITE (TCR, 0xA1);
+
+ /* do not restore old vector */
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in countdown units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ /* Clocked at 6.5 Mhz */
+ /* Avoid floating point problems, be lazy, and return the total minus
+ the average overhead */
+ return (total - AVG_OVERHEAD);
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/idp/timer/timerisr.s b/c/src/lib/libbsp/m68k/idp/timer/timerisr.s
new file mode 100644
index 0000000000..cd8173be52
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/timer/timerisr.s
@@ -0,0 +1,38 @@
+/* timer_isr()
+ *
+ * This routine provides the ISR for the MC68230 timer on the Motorola
+ * IDP board. The timer is set up to generate an interrupt at maximum
+ * intervals.
+ *
+ * Code modified by Doug McBride, Colorado Space Grant College
+ * countdown should be loaded automatically
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+
+.set TSR, 0x00c0106B | base address of PIT register "TSR"
+
+ PUBLIC (timerisr)
+SYM (timerisr):
+ movb #1,TSR | acknowledge interrupt
+ addql #1, SYM (Ttimer_val) | increment timer value
+ rte
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/m68k/idp/times b/c/src/lib/libbsp/m68k/idp/times
new file mode 100644
index 0000000000..92864585f3
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/idp/times
@@ -0,0 +1,193 @@
+#
+# Timing Test Suite Results for the Motorola IDP BSP
+#
+# $Id$
+#
+
+NOTE: This BSP is used submitted and no information is currently available.
+
+Board: IDP
+CPU:
+Clock Speed:
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c b/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c
new file mode 100644
index 0000000000..0ba674aee9
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c
@@ -0,0 +1,173 @@
+/* Clock_init()
+ *
+ * This routine initializes the Z80386 1 on the MVME136 board.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <z8036.h>
+
+#define MICRVAL 0xe2 /* disable lower chain, no vec */
+ /* set right justified addr */
+ /* and master int enable */
+#define MCCRVAL 0xc4 /* enable T1 and port B */
+ /* timers independent */
+#define MS_COUNT 0x07d0 /* T1's countdown constant (1 ms) */
+#define T1MSRVAL 0x80 /* T1 cont. cycle/pulse output */
+#define T1CSRVAL 0xc6 /* enable interrupt, allow and */
+ /* and trigger countdown */
+
+#define TIMER 0xfffb0000
+#define RELOAD 0x24 /* clr IP & IUS,allow countdown */
+
+#define CLOCK_VECTOR 66
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+
+volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */
+
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * ISR Handler
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+ Clock_driver_ticks += 1;
+ ((volatile struct z8036_map *) TIMER)->CT1_CMD_STATUS = RELOAD;
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ volatile struct z8036_map *timer;
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ timer = (struct z8036_map *) 0xfffb0000;
+ timer->MASTER_INTR = MICRVAL;
+ timer->CT1_MODE_SPEC = T1MSRVAL;
+
+ *((rtems_unsigned16 *)0xfffb0016) = MS_COUNT; /* write countdown value */
+
+ /*
+ * timer->CT1_TIME_CONST_MSB = (MS_COUNT >> 8);
+ * timer->CT1_TIME_CONST_LSB = (MS_COUNT & 0xff);
+ */
+
+ timer->MASTER_CFG = MCCRVAL;
+ timer->CT1_CMD_STATUS = T1CSRVAL;
+
+ /*
+ * Enable interrupt via VME interrupt mask register
+ */
+ (*(rtems_unsigned8 *)0xfffb0038) &= 0xfd;
+
+ atexit( Clock_exit );
+ }
+
+}
+
+void Clock_exit( void )
+{
+ volatile struct z8036_map *timer;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ timer = (struct z8036_map *) 0xfffb0000;
+ timer->MASTER_INTR = 0x62;
+ timer->CT1_MODE_SPEC = 0x00;
+ timer->MASTER_CFG = 0xf4;
+ timer->CT1_CMD_STATUS = 0x00;
+ /* do not restore old vector */
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/console/console.c b/c/src/lib/libbsp/m68k/mvme136/console/console.c
new file mode 100644
index 0000000000..1c65707dc0
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/console/console.c
@@ -0,0 +1,224 @@
+/*
+ * This file contains the MVME136 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define M136_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ _Write_m681 = ( struct w_m681_info * ) M681ADDR;
+ _Read_m681 = ( struct r_m681_info * ) M681ADDR;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ if ( !(_Read_m681->srb & RXRDYB) )
+ return(FALSE);
+
+ *ch = _Read_m681->rbb;
+ return(TRUE);
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the UART.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from UART
+ */
+
+char inbyte( void )
+{
+ while ( !(_Read_m681->srb & RXRDYB) );
+ return _Read_m681->rbb;
+}
+
+
+/* outbyte
+ *
+ * This routine transmits a character out the M68681. It supports
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ while ( ! (_Read_m681->srb & TXRDYB) ) ;
+ while ( _Read_m681->srb & RXRDYB ) /* must be an XOFF */
+ if ( _Read_m681->rbb == XOFF )
+ do {
+ while ( ! (_Read_m681->srb & RXRDYB) ) ;
+ } while ( _Read_m681->rbb != XON );
+
+ _Write_m681->tbb = ch;
+ if ( ch == '\n' )
+ outbyte( CR );
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/include/bsp.h b/c/src/lib/libbsp/m68k/mvme136/include/bsp.h
new file mode 100644
index 0000000000..85d899ee7c
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/include/bsp.h
@@ -0,0 +1,162 @@
+/* bsp.h
+ *
+ * This include file contains all MVME136 board IO definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MVME136_h
+#define __MVME136_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: Use the MPCSR vector for the MVME136
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 75, 1 )
+
+#define Cause_tm27_intr() (*(volatile rtems_unsigned8 *)0xfffb006b) = 0x80
+
+#define Clear_tm27_intr() (*(volatile rtems_unsigned8 *)0xfffb006b) = 0x00
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { register rtems_unsigned32 _delay=(microseconds); \
+ register rtems_unsigned32 _tmp=123; \
+ asm volatile( "0: \
+ nbcd %0 ; \
+ nbcd %0 ; \
+ dbf %1,0b" \
+ : "=d" (_tmp), "=d" (_delay) \
+ : "0" (_tmp), "1" (_delay) ); \
+ }
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+#define M681ADDR 0xfffb0040 /* address of the M68681 chip */
+#define RXRDYB 0x01 /* status reg recv ready mask */
+#define TXRDYB 0x04 /* status reg trans ready mask */
+#define PARITYERR 0x20 /* status reg parity error mask */
+#define FRAMEERR 0x40 /* status reg frame error mask */
+
+
+#define FOREVER 1 /* infinite loop */
+
+/* Structures */
+
+struct r_m681_info {
+ char fill1[ 5 ]; /* channel A regs ( not used ) */
+ char isr; /* interrupt status reg */
+ char fill2[ 2 ]; /* counter regs (not used) */
+ char mr1mr2b; /* MR1B and MR2B regs */
+ char srb; /* status reg channel B */
+ char fill3; /* do not access */
+ char rbb; /* receive buffer channel B */
+ char ivr; /* interrupt vector register */
+};
+
+struct w_m681_info {
+ char fill1[ 4 ]; /* channel A regs (not used) */
+ char acr; /* auxillary control reg */
+ char imr; /* interrupt mask reg */
+ char fill2[ 2 ]; /* counter regs (not used) */
+ char mr1mr2b; /* MR1B and MR2B regs */
+ char csrb; /* clock select reg */
+ char crb; /* command reg */
+ char tbb; /* transmit buffer channel B */
+ char ivr; /* interrupt vector register */
+};
+
+#ifdef M136_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+/* M68681 DUART chip register variables */
+
+EXTERN volatile struct r_m681_info *_Read_m681; /* M68681 read registers */
+EXTERN volatile struct w_m681_info *_Write_m681; /* M68681 write registers */
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme136/include/coverhd.h b/c/src/lib/libbsp/m68k/mvme136/include/coverhd.h
new file mode 100644
index 0000000000..7497514e97
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 2
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 2
+#define CALLING_OVERHEAD_TASK_START 2
+#define CALLING_OVERHEAD_TASK_RESTART 2
+#define CALLING_OVERHEAD_TASK_DELETE 1
+#define CALLING_OVERHEAD_TASK_SUSPEND 1
+#define CALLING_OVERHEAD_TASK_RESUME 2
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 2
+#define CALLING_OVERHEAD_TASK_MODE 2
+#define CALLING_OVERHEAD_TASK_GET_NOTE 2
+#define CALLING_OVERHEAD_TASK_SET_NOTE 2
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 2
+#define CALLING_OVERHEAD_CLOCK_GET 5
+#define CALLING_OVERHEAD_CLOCK_SET 4
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+
+#define CALLING_OVERHEAD_TIMER_CREATE 2
+#define CALLING_OVERHEAD_TIMER_IDENT 1
+#define CALLING_OVERHEAD_TIMER_DELETE 2
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
+#define CALLING_OVERHEAD_TIMER_RESET 1
+#define CALLING_OVERHEAD_TIMER_CANCEL 1
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 3
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 1
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 2
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 2
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 3
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 2
+
+#define CALLING_OVERHEAD_EVENT_SEND 2
+#define CALLING_OVERHEAD_EVENT_RECEIVE 2
+#define CALLING_OVERHEAD_SIGNAL_CATCH 2
+#define CALLING_OVERHEAD_SIGNAL_SEND 2
+#define CALLING_OVERHEAD_PARTITION_CREATE 3
+#define CALLING_OVERHEAD_PARTITION_IDENT 2
+#define CALLING_OVERHEAD_PARTITION_DELETE 1
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 2
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 2
+#define CALLING_OVERHEAD_REGION_CREATE 3
+#define CALLING_OVERHEAD_REGION_IDENT 2
+#define CALLING_OVERHEAD_REGION_DELETE 2
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 3
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 2
+#define CALLING_OVERHEAD_PORT_CREATE 3
+#define CALLING_OVERHEAD_PORT_IDENT 2
+#define CALLING_OVERHEAD_PORT_DELETE 1
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 2
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 2
+#define CALLING_OVERHEAD_IO_OPEN 2
+#define CALLING_OVERHEAD_IO_CLOSE 3
+#define CALLING_OVERHEAD_IO_READ 2
+#define CALLING_OVERHEAD_IO_WRITE 2
+#define CALLING_OVERHEAD_IO_CONTROL 2
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 2
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme136/shmsupp/addrconv.c b/c/src/lib/libbsp/m68k/mvme136/shmsupp/addrconv.c
new file mode 100644
index 0000000000..8e1502f789
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/shmsupp/addrconv.c
@@ -0,0 +1,32 @@
+/* Shm_Convert_address
+ *
+ * This MVME136 has a "normal" view of the VME address space.
+ * No address range conversion is required.
+ *
+ * Input parameters:
+ * address - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+void *Shm_Convert_address(
+ void *address
+)
+{
+ return ( address );
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/shmsupp/getcfg.c b/c/src/lib/libbsp/m68k/mvme136/shmsupp/getcfg.c
new file mode 100644
index 0000000000..d4db200ad2
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/shmsupp/getcfg.c
@@ -0,0 +1,85 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the Cyclone CVME961.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+ * NOTES: The MPCSR interrupt on the MVME136 is used as an interprocessor
+ * interrupt. The capablities of the MPCSR are used to generate
+ * interprocessor interrupts for up to eight nodes.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED LITTLE 2+
+ * INTERRUPT LITTLE 2-8
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+#define INTERRUPT 1 /* MVME136 target supports both */
+#define POLLING 0 /* polling and interrupt modes */
+
+shm_config_table BSP_shm_cfgtbl;
+
+rtems_unsigned32 *BSP_int_address()
+{
+ rtems_unsigned32 id, offset;
+
+ id = (rtems_unsigned32) *(rtems_unsigned8 *)0xfffb0061;
+ offset = ((id & 0x1f) << 5) | ((id & 0xe0) << 8);
+ offset |= 0xffff000b;
+ return( (rtems_unsigned32 * ) offset );
+}
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x20000000;
+ BSP_shm_cfgtbl.length = 1 * MEGABYTE;
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+#if (POLLING==1)
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+#else
+ BSP_shm_cfgtbl.poll_intr = INTR_MODE;
+ BSP_shm_cfgtbl.Intr.address = BSP_int_address();
+ BSP_shm_cfgtbl.Intr.value = 0x80;
+ BSP_shm_cfgtbl.Intr.length = BYTE;
+#endif
+
+ *shmcfg = &BSP_shm_cfgtbl;
+
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/shmsupp/lock.c b/c/src/lib/libbsp/m68k/mvme136/shmsupp/lock.c
new file mode 100644
index 0000000000..5ccc406af5
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/shmsupp/lock.c
@@ -0,0 +1,75 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = LQ_UNLOCKED;
+}
+
+/* void _Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+ rtems_unsigned32 *lockptr = (rtems_unsigned32 *)&lq_cb->lock;
+
+ rtems_interrupt_disable( isr_level );
+ Shm_isrstat = isr_level;
+ asm volatile( "lockit:" : : );
+ asm volatile( "tas %0@" : "=a" (lockptr) : "0" (lockptr) );
+ asm volatile( "bne lockit" : : );
+/* should delay */
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ lq_cb->lock = SHM_UNLOCK_VALUE;
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
+
diff --git a/c/src/lib/libbsp/m68k/mvme136/shmsupp/mpisr.c b/c/src/lib/libbsp/m68k/mvme136/shmsupp/mpisr.c
new file mode 100644
index 0000000000..6591d28a11
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/shmsupp/mpisr.c
@@ -0,0 +1,42 @@
+/* Shm_isr_mvme136()
+ *
+ * NOTE: This routine is not used when in polling mode. Either
+ * this routine OR Shm_clockisr is used in a particular system.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+rtems_isr Shm_isr_mvme136()
+{
+ Shm_Interrupt_count += 1;
+ rtems_multiprocessing_announce();
+ (*(volatile rtems_unsigned8 *)0xfffb006b) = 0; /* clear MPCSR intr */
+}
+
+/* void _Shm_setvec( )
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void Shm_setvec()
+{
+ /* may need to disable intr */
+ set_vector( Shm_isr_mvme136, 75, 1 );
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c
new file mode 100644
index 0000000000..4366603a55
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c
@@ -0,0 +1,46 @@
+/*
+ * This routine returns control to 135Bug.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <clockdrv.h>
+#include <z8036.h>
+
+void bsp_return_to_monitor_trap()
+{
+ extern void start( void );
+
+ register volatile void *start_addr;
+
+ m68k_set_vbr( 0 ); /* restore 135Bug vectors */
+ asm volatile( "trap #15" ); /* trap to 135Bug */
+ asm volatile( ".short 0x63" ); /* return to 135Bug (.RETURN) */
+ /* restart program */
+ start_addr = start;
+
+ asm volatile ( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
+}
+
+#define TIMER 0xfffb0000
+
+void bsp_cleanup( void )
+{
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0x62 ); /* redo timer */
+ Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x00 );
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xf4 );
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x00 );
+
+ M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */
+ asm volatile( "trap #13" ); /* insures SUPV mode */
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
new file mode 100644
index 0000000000..40f9c171cb
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
@@ -0,0 +1,239 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+#include <z8036.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ m68k_isr_entry *monitors_vector_table;
+ int index;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ monitors_vector_table = (m68k_isr_entry *)0; /* 135Bug Vectors are at 0 */
+ m68k_set_vbr( monitors_vector_table );
+
+ for ( index=2 ; index<=255 ; index++ )
+ M68Kvec[ index ] = monitors_vector_table[ 32 ];
+
+ M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
+ M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
+ M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
+ M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
+
+ m68k_set_vbr( &M68Kvec );
+
+ (*(rtems_unsigned8 *)0xfffb0067) = 0x7f; /* make VME access round-robin */
+
+ m68k_enable_caching();
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds
new file mode 100644
index 0000000000..13317a724e
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds
@@ -0,0 +1,48 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the Motorola MVME136/MVME135 boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x3000, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x3000 :
+ {
+ text_start = . ;
+ _text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+ _etext = .;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ _data_start = .;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+ _edata = .;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/timer/timer.c b/c/src/lib/libbsp/m68k/mvme136/timer/timer.c
new file mode 100644
index 0000000000..23cbc46ffd
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/timer/timer.c
@@ -0,0 +1,107 @@
+/* Timer_init()
+ *
+ * This routine initializes the Z8036 timer on the MVME136 board.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: This routine will not work if the optimizer is enabled
+ * for some compilers. The multiple writes to the Z8036
+ * may be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <bsp.h>
+#include <z8036.h>
+
+#define TIMER 0xfffb0000 /* address of Z8036 on MVME136 */
+
+int Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+ (void) set_vector( timerisr, 66, 0 ); /* install ISR */
+
+ Ttimer_val = 0; /* clear timer ISR count */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0x01 ); /* reset */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0x00 ); /* clear reset */
+ Z8x36_WRITE( TIMER, MASTER_INTR, 0xe2 ); /* disable lower chain, no vec */
+ /* set right justified addr */
+ /* and master int enable */
+ Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x80 ); /* T1 continuous, and */
+ /* cycle/pulse output */
+
+ *((rtems_unsigned16 *)0xfffb0016) = 0x0000; /* write countdown value */
+/*
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_MSB, 0x00 );
+ Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0x00 );
+*/
+ Z8x36_WRITE( TIMER, MASTER_CFG, 0xc4 ); /* enable timer1 */
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xc6 ); /* set INTR enable (IE), */
+ /* trigger command */
+ /* (TCB) and gate */
+ /* command (GCB) bits */
+ *((rtems_unsigned8 *)0xfffb0038) &= 0xfd; /* enable timer INTR on */
+ /* VME controller */
+}
+
+#define AVG_OVERHEAD 6 /* It typically takes 3.0 microseconds */
+ /* (6 countdowns) to start/stop the timer. */
+#define LEAST_VALID 10 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+/*
+ rtems_unsigned8 msb, lsb;
+*/
+ rtems_unsigned32 remaining, total;
+
+ Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xce ); /* read the counter value */
+remaining = 0xffff - *((rtems_unsigned16 *) 0xfffb0010);
+/*
+ Z8x36_READ( TIMER, CT1_CUR_CNT_MSB, msb );
+ Z8x36_READ( TIMER, CT1_CUR_CNT_LSB, lsb );
+
+ remaining = 0xffff - ((msb << 8) + lsb);
+*/
+ total = (Ttimer_val * 0x10000) + remaining;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in one-half microsecond units */
+
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ return (total-AVG_OVERHEAD) >> 1;
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme136/timer/timerisr.s b/c/src/lib/libbsp/m68k/mvme136/timer/timerisr.s
new file mode 100644
index 0000000000..a8f7e7b212
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/timer/timerisr.s
@@ -0,0 +1,39 @@
+# timer_isr()
+#
+# This routine provides the ISR for the Z8036 timer on the MVME136
+# board. The timer is set up to generate an interrupt at maximum
+# intervals.
+#
+# Input parameters: NONE
+#
+# Output parameters: NONE
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+# $Id$
+#
+
+#include "asm.h"
+
+BEGIN_CODE
+
+.set CT1_CMD_STATUS, 0xfffb000a | port A
+.set RELOAD, 0x24 | clr IP & IUS,allow countdown
+
+ PUBLIC (timerisr)
+SYM (timerisr):
+ movl a0,a7@- | save a0
+ movl #CT1_CMD_STATUS,a0 | a0 = addr of cmd status reg
+ movb #RELOAD,a0@ | reload countdown
+ addql #1, SYM (Ttimer_val) | increment timer value
+ movl a7@+,a0 | save a0
+ rte
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/m68k/mvme136/times b/c/src/lib/libbsp/m68k/mvme136/times
new file mode 100644
index 0000000000..dfea1044ff
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme136/times
@@ -0,0 +1,191 @@
+#
+# Timing Test Suite Results for the Motorola MVME136 BSP
+#
+# $Id$
+#
+
+Board: Motorola MVME136
+CPU: Motorola MC68020 + MC68881 FPU
+Clock Speed: 20 Mhz
+Memory Configuration: DRAM w/no cache
+Wait States: 1 wait state
+
+Times Reported in: microseconds
+Timer Source: Zilog Z8036
+
+Column A: 3.5.1 pre-release
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 67
+ rtems_semaphore_delete 64
+ rtems_semaphore_obtain: available 46
+ rtems_semaphore_obtain: not available -- NO_WAIT 45
+ rtems_semaphore_release: no waiting tasks 51
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 113 115
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 94
+
+ 4 rtems_task_restart: blocked task -- preempts caller 152
+ rtems_task_restart: ready task -- preempts caller 145
+ rtems_semaphore_release: task readied -- returns to caller 71
+ rtems_task_create 154
+ rtems_task_start 82
+ rtems_task_restart: suspended task -- returns to caller 94 97
+ rtems_task_delete: suspended task 145
+ rtems_task_restart: ready task -- returns to caller 97 99
+ rtems_task_restart: blocked task -- returns to caller 128 130
+ rtems_task_delete: blocked task 149 151
+
+ 5 rtems_task_suspend: calling task 77
+ rtems_task_resume: task readied -- preempts caller 74
+
+ 6 rtems_task_restart: calling task 101
+ rtems_task_suspend: returns to caller 50
+ rtems_task_resume: task readied -- returns to caller 50
+ rtems_task_delete: ready task 151
+
+ 7 rtems_task_restart: suspended task -- preempts caller 130 129
+
+ 8 rtems_task_set_priority: obtain current priority 38
+ rtems_task_set_priority: returns to caller 71
+ rtems_task_mode: obtain current mode 16
+ rtems_task_mode: no reschedule 18
+ rtems_task_mode: reschedule -- returns to caller 24
+ rtems_task_mode: reschedule -- preempts caller 68 67
+ rtems_task_set_note 39 41
+ rtems_task_get_note 40 41
+ rtems_clock_set 93 91
+ rtems_clock_get 1
+
+ 9 rtems_message_queue_create 207
+ rtems_message_queue_send: no waiting tasks 103
+ rtems_message_queue_urgent: no waiting tasks 103
+ rtems_message_queue_receive: available 87
+ rtems_message_queue_flush: no messages flushed 36
+ rtems_message_queue_flush: messages flushed 46
+ rtems_message_queue_delete 85
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 51 51
+ rtems_message_queue_receive: not available -- caller blocks 115 119
+
+11 rtems_message_queue_send: task readied -- preempts caller 129
+
+12 rtems_message_queue_send: task readied -- returns to caller 107
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 130
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 107
+
+15 rtems_event_receive: obtain current events 0
+ rtems_event_receive: not available -- NO_WAIT 33
+ rtems_event_receive: not available -- caller blocks 92
+ rtems_event_send: no task readied 34
+ rtems_event_receive: available 36
+ rtems_event_send: task readied -- returns to caller 67
+
+16 rtems_event_send: task readied -- preempts caller 90
+
+17 rtems_task_set_priority: preempts caller 110
+
+18 rtems_task_delete: calling task 175
+
+19 rtems_signal_catch 23
+ rtems_signal_send: returns to caller 43 42
+ rtems_signal_send: signal to self 52 51
+ exit ASR overhead: returns to calling task 37
+ exit ASR overhead: returns to preempting task 65
+
+20 rtems_partition_create 77
+ rtems_region_create 70
+ rtems_partition_get_buffer: available 42
+ rtems_partition_get_buffer: not available 40
+ rtems_partition_return_buffer 50
+ rtems_partition_delete 47
+ rtems_region_get_segment: available 58
+ rtems_region_get_segment: not available -- NO_WAIT 55
+ rtems_region_return_segment: no waiting tasks 60
+ rtems_region_get_segment: not available -- caller blocks 126
+ rtems_region_return_segment: task readied -- preempts caller 143
+ rtems_region_return_segment: task readied -- returns to caller 120
+ rtems_region_delete 45
+ rtems_io_initialize 6
+ rtems_io_open 2
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 2
+
+21 rtems_task_ident 353
+ rtems_message_queue_ident 344
+ rtems_semaphore_ident 369
+ rtems_partition_ident 344
+ rtems_region_ident 350
+ rtems_port_ident 343
+ rtems_timer_ident 345
+ rtems_rate_monotonic_ident 344
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 115
+ rtems_message_queue_broadcast: no waiting tasks 60
+ rtems_message_queue_broadcast: task readied -- preempts caller 138
+
+23 rtems_timer_create 37
+ rtems_timer_fire_after: inactive 66
+ rtems_timer_fire_after: active 70 69
+ rtems_timer_cancel: active 42
+ rtems_timer_cancel: inactive 39
+ rtems_timer_reset: inactive 60
+ rtems_timer_reset: active 65 64
+ rtems_timer_fire_when: inactive 96
+ rtems_timer_fire_when: active 96
+ rtems_timer_delete: active 55
+ rtems_timer_delete: inactive 51 50
+ rtems_task_wake_when 125
+
+24 rtems_task_wake_after: yield -- returns to caller 26
+ rtems_task_wake_after: yields -- preempts caller 65 63
+
+25 rtems_clock_tick 14
+
+26 _ISR_Disable 0
+ _ISR_Flash 0
+ _ISR_Enable 0
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 19
+ _Thread_Set_state 24
+ _Thread_Disptach (NO FP) 50
+ context switch: no floating point contexts 41
+ context switch: self 9
+ context switch: to another task 9
+ context switch: restore 1st FP task 46
+ fp context switch: save idle, restore idle 75
+ fp context switch: save idle, restore initialized 66
+ fp context switch: save initialized, restore initialized 65
+ _Thread_Resume 18 17
+ _Thread_Unblock 18 17
+ _Thread_Ready 22 21
+ _Thread_Get 12
+ _Semaphore_Get 10
+ _Thread_Get: invalid id 2
+
+27 interrupt entry overhead: returns to interrupted task 9
+ interrupt exit overhead: returns to interrupted task 8
+ interrupt entry overhead: returns to nested interrupt 14
+ interrupt exit overhead: returns to nested interrupt 0
+ interrupt entry overhead: returns to preempting task 8
+ interrupt exit overhead: returns to preempting task 62
+
+28 rtems_port_create 44
+ rtems_port_external_to_internal 35 34
+ rtems_port_internal_to_external 34
+ rtems_port_delete 46 45
+
+29 rtems_rate_monotonic_create 40
+ rtems_rate_monotonic_period: initiate period -- returns to caller 60
+ rtems_rate_monotonic_period: obtain status 38
+ rtems_rate_monotonic_cancel 46
+ rtems_rate_monotonic_delete: inactive 54
+ rtems_rate_monotonic_delete: active 57
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 83
diff --git a/c/src/lib/libbsp/m68k/mvme162/README b/c/src/lib/libbsp/m68k/mvme162/README
new file mode 100644
index 0000000000..af6082db21
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/README
@@ -0,0 +1,151 @@
+--
+-- EISCAT Scientific Association. M.Savitski
+--
+-- This material is a part of the MVME162 Board Support Package
+-- for the RTEMS executive. Its licensing policies are those of the
+-- RTEMS distribution.
+--
+-- Updated by Joel Sherrill (jsherril@redstone.army.mil) after
+-- inclusion in the standard release.
+--
+-- $Id$
+--
+
+This is a README file for the MVME162 port of RTEMS.
+
+Disclaimer
+----------
+This is my first attempt at porting RTEMS. The resulting code obviously
+contains bugs (know and unknown) and limitations. I assume no
+responsibility for quality and support of the software in question.
+
+Now on more optimistic note:
+
+I have run most of the standard RTEMS sptests, and neither of them
+failed. My present (short) experience of developing RTEMS applications
+is essentially positive and suggestive of a long-term commitment. In
+any case I am ready to answer questions regarding the port and intend
+to follow the future RTEMS versions. I will do my best to provide
+whatever support I can afford time-wise.
+
+MVME162FX and DMA on the IP bus
+-------------------------------
+
+From Eric Vaitl <eric@viasat.com>:
+
+If you have any customers that will be using the 162FX, tell them to
+be careful. The main difference between the 162 and the 162FX is DMA
+on the IP bus. I spent over a month trying to write a DMA HDLC driver
+for GreenSprings IP-MP and couldn't get it to work. I talked to some
+people at GreenSprings, and they agreed that there really is no way to
+get DMA to work unless you know the size of the packets in advance.
+Once the IP2 chip DMA controller is given the character count and
+enabled, it doesn't accept further commands until all of the
+characters have arrived. The only way to terminate a DMA transfer
+prematurely is by raising DMAEND* during the last read. None of the IP
+modules that I know of are currently able to do that. GreenSprings is
+working on the problem, but nothing is going to available for a few
+months.
+
+Installation
+------------
+Nothing unique to the MVME162. It has been incorporated into the
+standard release.
+
+Port Description
+----------------
+The port was done using already existing ports to the M68020 boards,
+DMV152 and MVME136.
+
+The host system was SUN/Solaris 2.3, and the cross-development
+environment consisted of Free Software Foundation (FSF)'s GNU C
+compiler (version 2.6), GNU Assembler (version 2.3) and GNU binary
+utilities binutils version 2.5.2, built with m68k as a target. The
+recent/latest versions of other GNU programs (flex, make, etc) were
+also used at the build stage.
+
+In all subdirectories of the RTEMS distribution tree, the directories
+mvme136 were duplicated as mvme162.
+
+Essential modifications are detailed below:
+
+- the MVME162-specific hardware registers were described in bsp.h
+
+- timer and clock routines were made to use the MVME162's Tick Timers 1
+and 2, respectively
+
+- shared memory support was replaced by stubs for the time being
+
+- console IO was lifted entirely from the DMV152 support code, thanks
+to the fact that Z8530 SCC used in DMV152 is upwards compatible with
+the Z85230 SCC of the MVME162. (Only the memory mapping of the SCC
+registers had to be changed.)
+
+- symbols in several *.s files were prepended with underscores to
+comply with the xgcc configuration used (it prepends underscores to all
+symbols defined in c code)
+
+- linkcmds file was modified to place the linked code into the memory
+configured for the board in use
+
+- bspstart.c was modified as follows:
+
+ monitors_vector_table = (m68k_isr *)0xFFE00000;
+
+was made to point to the power-up location of MVME162 interrupt vector
+table.
+
+- The shutdown is a temporary solution. To exit cleanly, it has to disable
+all enabled interrupts and restore the board to its power-up status.
+Presently this is not done satisfactorily, as a result, the board needs
+a hardware reset from the external VMEbus master or from the front
+panel to ensure correct operation for subsequent downloads.
+
+Host System
+-----------
+The VMEbus master used to externally control and download the MVME162
+is a FORCE CPU-2CE board running Solaris 2.3. A simple program to load
+s-records and start/reset the MVME162 was written. The code is in the
+file tools/sload.c
+
+This code depends on the external VMEbus master's vme driver and is
+provided as an example, without the Makefile. The bulk of the program
+which parses the s-records is courtesy of Kym Newbery,
+(8918927y@lux.levels.unisa.edu.au).
+
+In general, apart from x-gcc, the tools most often used while building
+RTEMS for MVME162 were: find, grep, diff, and, of course
+
+MVME162 Embedded Controller Programmer's Reference Guide,
+Motorola, MVME162PG/D1.
+
+Thanks
+------
+- to On-Line Applications Research Corporation (OAR) for developing
+RTEMS and making it available on a Technology Transfer basis;
+- to Joel Sherril, the leader of the RTEMS development group for
+stimulating and helpful discussions;
+- to Kym Newbery (8918927y@lux.levels.unisa.edu.au) for his s-record
+parser;
+- to Gerd Truschinski (gt@first.gmd.de) for creating and running the
+crossgcc mailing list
+- to FSF and Cygnus Support for great free software;
+
+What's new
+----------
+ - 28.07.95 BSP adjusted to rtems-3.2.0.
+ - Now console driver uses interrupts on receive (ring buffer
+ code lifted with thanks from the IDP BSP next door (../idp))
+ - both front-panel serial interfaces are supported
+ - serious bug in timer interrupts fixed
+ - interrupt test tm27 now supported
+
++----------------------------------+-------------------------------+
+| Dr. Mikhail (Misha) Savitski | Voice : +46-980-79162 |
+| Software Systems Engineer | Fax : +46-980-79161 |
+| EISCAT Svalbard Radar Project | E-mail: mms@eiscathq.irf.se |
+| EISCAT Scientific Association |----------- /\_/\ -----------|
+| Box 812 S-98128 Kiruna, Sweden | EIS { o o } CAT |
++----------------------------------+-------oQQQ--(>I<)--QQQo-------+
+
+
diff --git a/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c b/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c
new file mode 100644
index 0000000000..57afd71292
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c
@@ -0,0 +1,146 @@
+/* Clock_init()
+ *
+ * This routine initializes the Tick Timer 2 on the MVME162 board.
+ * The tick frequency is 1 millisecond.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#define MS_COUNT 1000 /* T2's countdown constant (1 ms) */
+#define CLOCK_INT_LEVEL 6 /* T2's interrupt level */
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+#define CLOCK_VECTOR (VBR0 * 0x10 + 0x9)
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+
+/*
+ * ISR Handler
+ */
+
+rtems_isr Clock_isr(rtems_vector_number vector)
+{
+ Clock_driver_ticks += 1;
+ lcsr->timer_cnt_2 = 0; /* clear counter */
+ lcsr->intr_clear |= 0x02000000;
+
+ if ( Clock_isrs == 1 ) {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+ }
+ else
+ Clock_isrs -= 1;
+}
+
+void Install_clock(rtems_isr_entry clock_isr )
+{
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker =
+ (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ lcsr->vector_base |= MASK_INT; /* unmask VMEchip2 interrupts */
+ lcsr->to_ctl = 0xE7; /* prescaler to 1 MHz (see Appendix A1) */
+ lcsr->timer_cmp_2 = MS_COUNT;
+ lcsr->timer_cnt_2 = 0; /* clear counter */
+ lcsr->board_ctl |= 0x700; /* increment, reset-on-compare, and */
+ /* clear-overflow-cnt */
+
+ lcsr->intr_level[0] |= CLOCK_INT_LEVEL * 0x10; /* set int level */
+ lcsr->intr_ena |= 0x02000000; /* enable tick timer 2 interrupt */
+
+ atexit( Clock_exit );
+ }
+}
+
+void Clock_exit( void )
+{
+/* Dummy for now. See other m68k BSP's for code examples */
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libbsp/m68k/mvme162/console/console.c b/c/src/lib/libbsp/m68k/mvme162/console/console.c
new file mode 100644
index 0000000000..cdac9bf75c
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/console/console.c
@@ -0,0 +1,256 @@
+/*
+ * This file contains the MVME162 console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#define M162_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <ringbuf.h>
+
+Ring_buffer_t Buffer[2];
+
+/*
+ * Interrupt handler for receiver interrupts
+ */
+
+rtems_isr C_Receive_ISR(rtems_vector_number vector)
+{
+ register int ipend, port;
+
+ ZWRITE0(1, 0x38); /* reset highest IUS */
+
+ ipend = ZREAD(1, 3); /* read int pending from A side */
+
+ if (ipend == 0x04) port = 0; /* channel B intr pending */
+ else if (ipend == 0x20) port = 1; /* channel A intr pending */
+ else return;
+
+ Ring_buffer_Add_character(&Buffer[port], ZREADD(port));
+
+ if (ZREAD(port, 1) & 0x70) { /* check error stat */
+ ZWRITE0(port, 0x30); /* reset error */
+ }
+}
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ int i;
+ rtems_status_code status;
+
+ /*
+ * Initialise receiver interrupts on both ports
+ */
+
+ for (i = 0; i <= 1; i++) {
+ Ring_buffer_Initialize( &Buffer[i] );
+ ZWRITE(i, 2, SCC_VECTOR);
+ ZWRITE(i, 10, 0);
+ ZWRITE(i, 1, 0x10); /* int on all Rx chars or special condition */
+ ZWRITE(i, 9, 8); /* master interrupt enable */
+ }
+
+ set_vector(C_Receive_ISR, SCC_VECTOR, 1); /* install ISR for ports A and B */
+
+ mcchip->vector_base = 0;
+ mcchip->gen_control = 2; /* MIEN */
+ mcchip->SCC_int_ctl = 0x13; /* SCC IEN, IPL3 */
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 1
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ status = rtems_io_register_name(
+ "/dev/tty00",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ status = rtems_io_register_name(
+ "/dev/tty01",
+ major,
+ (rtems_device_minor_number) 1
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Non-blocking char input
+ */
+
+rtems_boolean char_ready(int port, char *ch)
+{
+ if ( Ring_buffer_Is_empty( &Buffer[port] ) )
+ return FALSE;
+
+ Ring_buffer_Remove_character( &Buffer[port], *ch );
+
+ return TRUE;
+}
+
+/*
+ * Block on char input
+ */
+
+char inbyte(int port)
+{
+ unsigned char tmp_char;
+
+ while ( !char_ready(port, &tmp_char) );
+ return tmp_char;
+}
+
+/*
+ * This routine transmits a character out the SCC. It no longer supports
+ * XON/XOFF flow control.
+ */
+
+void outbyte(char ch, int port)
+{
+ while (1) {
+ if (ZREAD0(port) & TX_BUFFER_EMPTY) break;
+ }
+ ZWRITED(port, ch);
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ if ( minor > 1 )
+ return RTEMS_INVALID_NUMBER;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte( minor );
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ if ( minor > 1 )
+ return RTEMS_INVALID_NUMBER;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r', minor );
+ }
+ outbyte( buffer[ count ], minor );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
new file mode 100644
index 0000000000..37b16cb69b
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
@@ -0,0 +1,300 @@
+/* bsp.h
+ *
+ * This include file contains all MVME162fx board IO definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#ifndef __MVME162_h
+#define __MVME162_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+
+/*
+ * Following defines must reflect the setup of the particular MVME162
+ */
+
+#define GROUP_BASE_ADDRESS 0x0000F200
+#define BOARD_BASE_ADDRESS 0xFFFF0000
+
+/* Base for local interrupters' vectors (with enable bit set) */
+
+#define MASK_INT 0x00800000
+#define VBR0 0x6
+#define VBR1 0x7
+
+/* RAM limits */
+
+#define RAM_START 0x00100000
+#define RAM_END 0x00200000
+
+/*
+ * ----------------------------------
+ */
+
+typedef volatile struct lcsr_regs {
+ unsigned long slave_adr[2];
+ unsigned long slave_trn[2];
+ unsigned long slave_ctl;
+ unsigned long mastr_adr[4];
+ unsigned long mastr_trn;
+ unsigned long mastr_att;
+ unsigned long mastr_ctl;
+ unsigned long dma_ctl_1;
+ unsigned long dma_ctl_2;
+ unsigned long dma_loc_cnt;
+ unsigned long dma_vme_cnt;
+ unsigned long dma_byte_cnt;
+ unsigned long dma_adr_cnt;
+ unsigned long dma_status;
+ unsigned long to_ctl;
+ unsigned long timer_cmp_1;
+ unsigned long timer_cnt_1;
+ unsigned long timer_cmp_2;
+ unsigned long timer_cnt_2;
+ unsigned long board_ctl;
+ unsigned long prescaler_cnt;
+ unsigned long intr_stat;
+ unsigned long intr_ena;
+ unsigned long intr_soft_set;
+ unsigned long intr_clear;
+ unsigned long intr_level[4];
+ unsigned long vector_base;
+} lcsr_regs;
+
+#define lcsr ((lcsr_regs * const) 0xFFF40000)
+
+typedef volatile struct mcchip_regs {
+
+ unsigned char chipID;
+ unsigned char chipREV;
+ unsigned char gen_control;
+ unsigned char vector_base;
+
+ unsigned long timer_cmp_1;
+ unsigned long timer_cnt_1;
+ unsigned long timer_cmp_2;
+ unsigned long timer_cnt_2;
+
+ unsigned char LSB_prescaler_count;
+ unsigned char prescaler_clock_adjust;
+ unsigned char time_ctl_2;
+ unsigned char time_ctl_1;
+
+ unsigned char time_int_ctl_4;
+ unsigned char time_int_ctl_3;
+ unsigned char time_int_ctl_2;
+ unsigned char time_int_ctl_1;
+
+ unsigned char dram_err_int_ctl;
+ unsigned char SCC_int_ctl;
+ unsigned char time_ctl_4;
+ unsigned char time_ctl_3;
+
+ unsigned short DRAM_space_base;
+ unsigned short SRAM_space_base;
+
+ unsigned char DRAM_size;
+ unsigned char DRAM_SRAM_opt;
+ unsigned char SRAM_size;
+ unsigned char reserved;
+
+ unsigned char LANC_error;
+ unsigned char reserved1;
+ unsigned char LANC_int_ctl;
+ unsigned char LANC_berr_ctl;
+
+ unsigned char SCSI_error;
+ unsigned char general_inputs;
+ unsigned char MVME_162_version;
+ unsigned char SCSI_int_ctl;
+
+ unsigned long timer_cmp_3;
+ unsigned long timer_cnt_3;
+ unsigned long timer_cmp_4;
+ unsigned long timer_cnt_4;
+
+ unsigned char bus_clk;
+ unsigned char PROM_acc_time_ctl;
+ unsigned char FLASH_acc_time_ctl;
+ unsigned char ABORT_int_ctl;
+
+ unsigned char RESET_ctl;
+ unsigned char watchdog_timer_ctl;
+ unsigned char acc_watchdog_time_base_sel;
+ unsigned char reserved2;
+
+ unsigned char DRAM_ctl;
+ unsigned char reserved4;
+ unsigned char MPU_status;
+ unsigned char reserved3;
+
+ unsigned long prescaler_count;
+
+} mcchip_regs;
+
+#define mcchip ((mcchip_regs * const) 0xFFF42000)
+
+/*----------------------------------------------------------------*/
+
+/*
+ * SCC Z8523(0) defines and macros
+ * -------------------------------
+ * Prototypes for the low-level serial io are also included here,
+ * because such stuff is bsp-specific (yet). The function bodies
+ * are in console.c
+ *
+ * NOTE from Eric Vaitl <evaitl@viasat.com>:
+ *
+ * I dropped RTEMS into a 162FX today (the MVME162-513). The 162FX has a
+ * bug in the MC2 chip (revision 1) such that the SCC data register is
+ * not accessible, it has to be accessed indirectly through the SCC
+ * control register.
+ */
+
+enum {portB, portA};
+
+rtems_boolean char_ready(int port, char *ch);
+char char_wait(int port);
+void char_put(int port, char ch);
+
+#define TX_BUFFER_EMPTY 0x04
+#define RX_DATA_AVAILABLE 0x01
+#define SCC_VECTOR 0x40
+
+typedef volatile struct scc_regs {
+ unsigned char pad1;
+ volatile unsigned char csr;
+ unsigned char pad2;
+ volatile unsigned char buf;
+} scc_regs;
+
+#define scc ((scc_regs * const) 0xFFF45000)
+
+#define ZWRITE0(port, v) (scc[port].csr = (unsigned char)(v))
+#define ZREAD0(port) (scc[port].csr)
+
+#define ZREAD(port, n) (ZWRITE0(port, n), (scc[port].csr))
+#define ZREADD(port) (scc[port].csr=0x08, scc[port].csr )
+
+#define ZWRITE(port, n, v) (ZWRITE0(port, n), ZWRITE0(port, v))
+#define ZWRITED(port, v) (scc[port].csr = 0x08, \
+ scc[port].csr = (unsigned char)(v))
+/*----------------------------------------------------------------*/
+
+/*
+ * The following registers are located in the VMEbus short
+ * IO space and respond to address modifier codes $29 and $2D.
+ * On FORCE CPU use address gcsr_vme and device /dev/vme16d32.
+*/
+typedef volatile struct gcsr_regs {
+ unsigned char chip_revision;
+ unsigned char chip_id;
+ unsigned char lmsig;
+ unsigned char board_scr;
+ unsigned short gpr[6];
+} gcsr_regs;
+
+#define gcsr_vme ((gcsr_regs * const) (GROUP_BASE_ADDRESS + BOARD_BASE_ADDRESS))
+#define gcsr ((gcsr_regs * const) 0xFFF40100)
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Define the interrupt mechanism for Time Test 27
+ *
+ * NOTE: We use software interrupt 0
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) \
+ set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
+ lcsr->intr_level[2] |= 3; \
+ lcsr->intr_ena |= 0x100;
+
+#define Cause_tm27_intr() lcsr->intr_soft_set |= 0x100
+
+#define Clear_tm27_intr() lcsr->intr_clear |= 0x100
+
+#define Lower_tm27_intr()
+
+#ifdef M162_INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+extern m68k_isr_entry M68Kvec[]; /* vector table address */
+
+/* functions */
+
+void bsp_cleanup( void );
+
+m68k_isr_entry set_vector(
+ rtems_isr_entry handler,
+ rtems_vector_number vector,
+ int type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h b/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h
new file mode 100644
index 0000000000..0033a50502
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h
@@ -0,0 +1,104 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C on this target.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 2
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 2
+#define CALLING_OVERHEAD_TASK_START 2
+#define CALLING_OVERHEAD_TASK_RESTART 2
+#define CALLING_OVERHEAD_TASK_DELETE 1
+#define CALLING_OVERHEAD_TASK_SUSPEND 1
+#define CALLING_OVERHEAD_TASK_RESUME 2
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 2
+#define CALLING_OVERHEAD_TASK_MODE 2
+#define CALLING_OVERHEAD_TASK_GET_NOTE 2
+#define CALLING_OVERHEAD_TASK_SET_NOTE 2
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 2
+#define CALLING_OVERHEAD_CLOCK_GET 4
+#define CALLING_OVERHEAD_CLOCK_SET 4
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+
+#define CALLING_OVERHEAD_TIMER_CREATE 2
+#define CALLING_OVERHEAD_TIMER_IDENT 1
+#define CALLING_OVERHEAD_TIMER_DELETE 2
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
+#define CALLING_OVERHEAD_TIMER_RESET 1
+#define CALLING_OVERHEAD_TIMER_CANCEL 1
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 2
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 1
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 2
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 2
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 2
+
+#define CALLING_OVERHEAD_EVENT_SEND 2
+#define CALLING_OVERHEAD_EVENT_RECEIVE 2
+#define CALLING_OVERHEAD_SIGNAL_CATCH 2
+#define CALLING_OVERHEAD_SIGNAL_SEND 2
+#define CALLING_OVERHEAD_PARTITION_CREATE 3
+#define CALLING_OVERHEAD_PARTITION_IDENT 2
+#define CALLING_OVERHEAD_PARTITION_DELETE 2
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 2
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 2
+#define CALLING_OVERHEAD_REGION_CREATE 3
+#define CALLING_OVERHEAD_REGION_IDENT 2
+#define CALLING_OVERHEAD_REGION_DELETE 1
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 3
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 2
+#define CALLING_OVERHEAD_PORT_CREATE 3
+#define CALLING_OVERHEAD_PORT_IDENT 2
+#define CALLING_OVERHEAD_PORT_DELETE 2
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 2
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 3
+#define CALLING_OVERHEAD_IO_OPEN 2
+#define CALLING_OVERHEAD_IO_CLOSE 2
+#define CALLING_OVERHEAD_IO_READ 2
+#define CALLING_OVERHEAD_IO_WRITE 2
+#define CALLING_OVERHEAD_IO_CONTROL 2
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 2
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 2
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/page_table.h b/c/src/lib/libbsp/m68k/mvme162/include/page_table.h
new file mode 100644
index 0000000000..a5685245f2
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/include/page_table.h
@@ -0,0 +1,45 @@
+/*
+ * $Id$
+ *
+ * This file was submitted by Eric Vaitl <vaitl@viasat.com> and
+ * supports page table initialization.
+ *
+ * $Log$
+ * Revision 1.1 1995/12/19 19:22:36 joel
+ * file lost in crash and re-added
+ *
+ * Revision 1.1 1995/12/05 15:29:19 joel
+ * added.. submitted by Eric Vaitl <vaitl@viasat.com>
+ *
+ * Revision 1.2 1995/10/27 21:00:33 vaitl
+ * Modified page table routines so application code can map
+ * VME space.
+ *
+ * Revision 1.1 1995/10/25 17:16:06 vaitl
+ * Working on page table. Caching partially set up, but can't currently
+ * set tc register.
+ *
+ */
+
+#ifndef PAGE_TABLE_H
+#define PAGE_TABLE_H
+
+extern void page_table_teardown(void);
+extern void page_table_init(void);
+extern int page_table_map(void *addr, unsigned long size, int cache_type);
+
+enum {
+ CACHE_WRITE_THROUGH,
+ CACHE_COPYBACK,
+ CACHE_NONE_SERIALIZED,
+ CACHE_NONE
+};
+enum {
+ PTM_SUCCESS,
+ PTM_BAD_ADDR,
+ PTM_BAD_SIZE,
+ PTM_BAD_CACHE,
+ PTM_NO_TABLE_SPACE
+};
+
+#endif
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
new file mode 100644
index 0000000000..8c8497aaf5
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
@@ -0,0 +1,55 @@
+/*
+ * This routine returns control to 162Bug.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <z8036.h>
+
+void bsp_return_to_monitor_trap()
+{
+ extern void start( void );
+
+ page_table_teardown();
+
+ lcsr->intr_ena = 0; /* disable interrupts */
+ m68k_set_vbr(0xFFE00000); /* restore 162Bug vectors */
+ asm volatile( "trap #15" ); /* trap to 162Bug */
+ asm volatile( ".short 0x63" ); /* return to 162Bug (.RETURN) */
+ /* restart program */
+ /*
+ * This does not work on the 162....
+ */
+#if 0
+ { register volatile void *start_addr;
+
+ start_addr = start;
+
+ asm volatile ( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
+ }
+#endif
+}
+
+void bsp_cleanup( void )
+{
+ M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */
+ asm volatile( "trap #13" ); /* insures SUPV mode */
+}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
new file mode 100644
index 0000000000..bc26a8be93
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
@@ -0,0 +1,256 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ m68k_isr_entry *monitors_vector_table;
+ int index;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * 162Bug Vectors are at 0xFFE00000
+ */
+
+ monitors_vector_table = (m68k_isr_entry *)0xFFE00000;
+
+ m68k_set_vbr( monitors_vector_table );
+
+ for ( index=2 ; index<=255 ; index++ )
+ M68Kvec[ index ] = monitors_vector_table[ 32 ];
+
+ M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
+ M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
+ M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
+ M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
+
+ m68k_set_vbr( &M68Kvec );
+
+ /*
+ * You may wish to make the VME arbitration round-robin here, currently
+ * we leave it as it is.
+ */
+
+ /* set the Interrupt Base Vectors */
+
+ lcsr->vector_base = (VBR0 << 28) | (VBR1 << 24);
+
+ page_table_init();
+
+ /*
+ * we only use a hook to get the C library initialized.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add another extension if using the stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ BSP_Configuration.work_space_start = (void *)
+ (RAM_END - BSP_Configuration.work_space_size);
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+ /* does not return */
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds
new file mode 100644
index 0000000000..21a844ca88
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds
@@ -0,0 +1,50 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the Motorola MVME162 board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x100000, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x100000 :
+ {
+ text_start = . ;
+ *(.text)
+ etext = ALIGN( 0x10 ) ;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ *(.data)
+ edata = ALIGN( 0x10 ) ;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ _end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/page_table.c b/c/src/lib/libbsp/m68k/mvme162/startup/page_table.c
new file mode 100644
index 0000000000..76f0d5d52b
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/page_table.c
@@ -0,0 +1,201 @@
+/*
+ * $Id$
+ *
+ * This file was submitted by Eric Vaitl <vaitl@viasat.com>.
+ * The manipulation of the page table has a very positive impact on
+ * the performance of the MVME162.
+ *
+ * The following history is included verbatim from the submitter.
+ *
+ * Revision 1.8 1995/11/18 00:07:25 vaitl
+ * Modified asm statements to get rid of the register hard-codes.
+ *
+ * Revision 1.7 1995/10/27 21:00:32 vaitl
+ * Modified page table routines so application code can map
+ * VME space.
+ *
+ * Revision 1.6 1995/10/26 17:40:01 vaitl
+ * Two cache changes after reading the mvme162 users manual.
+ *
+ * 1) The users manual says that the MPU can act as a source for the
+ * VME2 chip, so I made the VME accessable memory copy-back instead
+ * of write through. I have't changed the comments yet. If this
+ * causes problems, I'll change it back.
+ *
+ * 2) The 162 book also says that IO space should be serialized as well as
+ * non-cacheable. I flipped the appropriate dttr0 and ittr0 registers. I
+ * don't think this is really necessary because we don't recover from any
+ * exceptions. If it slows down IO addresses too much, I'll change it back
+ * and see what happens.
+ *
+ * Revision 1.5 1995/10/25 19:32:38 vaitl
+ * Got it. Three problems:
+ * 1) Must cpusha instead of cinva.
+ * 2) On page descriptors the PDT field of 1 or 3 is resident. On pointer
+ * descriptors resident is 2 or 3. I was using 2 for everything.
+ * Changed it to 3 for everything.
+ * 3) Forgot to do a pflusha.
+ *
+ * Revision 1.4 1995/10/25 17:47:11 vaitl
+ * Still working on it.
+ *
+ * Revision 1.3 1995/10/25 17:16:05 vaitl
+ * Working on page table. Caching partially set up, but can't currently
+ * set tc register.
+ *
+*/
+#include <string.h>
+#include "page_table.h"
+
+/* All page table must fit between BASE_TABLE_ADDR and
+ MAX_TABLE_ADDR. */
+
+#define BASE_TABLE_ADDR 0x10000
+#define MAX_TABLE_ADDR 0x20000
+#define ROOT_TABLE_SIZE 512
+#define POINTER_TABLE_SIZE 512
+#define PAGE_TABLE_SIZE 256
+
+static unsigned long *root_table;
+static unsigned long *next_avail;
+
+/* Returns a zeroed out table. */
+static unsigned long *table_alloc(int size){
+ unsigned long *addr=next_avail;
+ if(((unsigned long)next_avail + size) > MAX_TABLE_ADDR){
+ return 0;
+ }
+ bzero((void *)addr,size);
+ next_avail =(unsigned long *)((unsigned long)next_avail + size);
+ return addr;
+}
+
+
+
+/*
+ void page_table_init();
+
+ This should transparently map the first 4 Meg of ram. Caching is
+ turned off from 0x00000000 to 0x00020000 (this region is used by
+ 162Bug and contains the page tables). From 0x00020000 to 0x00400000
+ we are using copy back caching. DTTR0 and ITTR0 are set up to
+ directly translate from 0x80000000-0xffffffff with caching turned
+ off and serialized. Addresses between 0x400000 and 0x80000000 are
+ illegal.
+*/
+void page_table_init(){
+
+ /* put everything in a known state */
+ page_table_teardown();
+
+ root_table=table_alloc(ROOT_TABLE_SIZE);
+
+ /* First set up TTR.
+ base address = 0x80000000
+ address mask = 0x7f
+ Ignore FC2 for match.
+ Noncachable.
+ Not write protected.*/
+ asm volatile ("movec %0,%%dtt0
+ movec %0,%%itt0"
+ :: "d" (0x807fc040));
+
+ /* Point urp and srp at root page table. */
+ asm volatile ("movec %0,%%urp
+ movec %0,%%srp"
+ :: "d" (BASE_TABLE_ADDR));
+
+ page_table_map((void *)0,0x20000, CACHE_NONE);
+ page_table_map((void *)0x20000,0x400000-0x20000,CACHE_COPYBACK);
+
+ /* Turn on paging with a 4 k page size.*/
+ asm volatile ("movec %0,%%tc"
+ :: "d" (0x8000));
+
+ /* Turn on the cache. */
+ asm volatile ("movec %0,%%cacr"
+ :: "d" (0x80008000));
+}
+
+void page_table_teardown(){
+ next_avail=(unsigned long *)BASE_TABLE_ADDR;
+ /* Turn off paging. Turn off the cache. Flush the cache. Tear down
+ the transparent translations. */
+ asm volatile ("movec %0,%%tc
+ movec %0,%%cacr
+ cpusha %%bc
+ movec %0,%%dtt0
+ movec %0,%%itt0
+ movec %0,%%dtt1
+ movec %0,%%itt1"
+ :: "d" (0) );
+}
+
+/* Identity maps addr to addr+size with caching cache_type. */
+int page_table_map(void *addr, unsigned long size, int cache_type){
+ unsigned long *pointer_table;
+ unsigned long *page_table;
+ unsigned long root_index, pointer_index, page_index;
+ /* addr must be a multiple of 4k */
+ if((unsigned long)addr & 0xfff){
+ return PTM_BAD_ADDR;
+ }
+ /* size must also be a multiple of 4k */
+ if(size & 0xfff){
+ return PTM_BAD_SIZE;
+ }
+ /* check for valid cache type */
+ if( (cache_type>CACHE_NONE) || (cache_type<CACHE_WRITE_THROUGH)){
+ return PTM_BAD_CACHE;
+ }
+
+ while(size){
+ root_index=(unsigned long)addr;
+ root_index >>= 25;
+ root_index &= 0x7f;
+
+ if(root_table[root_index]){
+ pointer_table =
+ (unsigned long *) (root_table[root_index] & 0xfffffe00);
+ }else{
+ if(!(pointer_table=table_alloc(POINTER_TABLE_SIZE))){
+ return PTM_NO_TABLE_SPACE;
+ }
+ root_table[root_index]=((unsigned long)pointer_table) + 0x03;
+ }
+
+ pointer_index=(unsigned long)addr;
+ pointer_index >>=18;
+ pointer_index &= 0x7f;
+
+ if(pointer_table[pointer_index]){
+ page_table =
+ (unsigned long *) (pointer_table[pointer_index] &
+ 0xffffff00);
+ }else{
+ if(!(page_table=table_alloc(PAGE_TABLE_SIZE))){
+ return PTM_NO_TABLE_SPACE;
+ }
+ pointer_table[pointer_index]=
+ ((unsigned long)page_table) + 0x03;
+ }
+
+ page_index=(unsigned long)addr;
+ page_index >>=12;
+ page_index &= 0x3f;
+
+ page_table[page_index] =
+ ((unsigned long) addr & 0xfffff000) + 0x03 + (cache_type << 5);
+
+ size -= 4096;
+ addr = (void *) ((unsigned long)addr + 4096);
+ }
+
+ /* Flush the ATC. Push and invalidate the cache. */
+ asm volatile ("pflusha
+ cpusha %bc");
+
+ return PTM_SUCCESS;
+}
+
+
diff --git a/c/src/lib/libbsp/m68k/mvme162/timer/timer.c b/c/src/lib/libbsp/m68k/mvme162/timer/timer.c
new file mode 100644
index 0000000000..5eb1493c90
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/timer/timer.c
@@ -0,0 +1,93 @@
+/* Timer_init()
+ *
+ * This routine initializes the Tick Timer 1 on the MVME162 board.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: This routine will not work if the optimizer is enabled
+ * for some compilers. The multiple writes
+ * may be optimized away.
+ *
+ * It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+/* Periodic tick interval */
+#define TICK_INTERVAL 0x10000U
+#define TIMER_INT_LEVEL 6
+
+rtems_unsigned32 Ttimer_val;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+rtems_isr timerisr();
+
+void Timer_initialize()
+{
+ (void) set_vector( timerisr, VBR0 * 0x10 + 0x8, 0 );
+
+ Ttimer_val = 0; /* clear timer ISR count */
+ lcsr->vector_base |= MASK_INT; /* unmask VMEchip2 interrupts */
+ lcsr->intr_clear |= 0x01000000; /* clear pending interrupt */
+ lcsr->to_ctl = 0xE7; /* prescaler to 1 MHz (see Appendix A1) */
+ lcsr->timer_cmp_1 = TICK_INTERVAL;
+ lcsr->timer_cnt_1 = 0; /* clear counter */
+ lcsr->board_ctl |= 7; /* increment, reset-on-compare, */
+ /* and clear-overflow-cnt */
+
+ lcsr->intr_level[0] |= TIMER_INT_LEVEL; /* set int level */
+ lcsr->intr_ena |= 0x01000000; /* enable tick timer 1 interrupt */
+}
+
+#define AVG_OVERHEAD 3U /* It typically takes 3.0 microseconds */
+ /* (3 countdowns) to start/stop the timer. */
+#define LEAST_VALID 10U /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ rtems_unsigned32 total;
+
+ total = (Ttimer_val * TICK_INTERVAL) + lcsr->timer_cnt_1;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in one-half microsecond units */
+
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+
+ return (total-AVG_OVERHEAD) >> 1;
+}
+
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s b/c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s
new file mode 100644
index 0000000000..5563d1fcd8
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s
@@ -0,0 +1,47 @@
+/* timer_isr()
+ *
+ * This routine provides the ISR for the Z8036 timer on the MVME136
+ * board. The timer is set up to generate an interrupt at maximum
+ * intervals.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
+ * EISCAT Scientific Association. M.Savitski
+ *
+ * This material is a part of the MVME162 Board Support Package
+ * for the RTEMS executive. Its licensing policies are those of the
+ * RTEMS above.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+
+.set INTR_CLEAR_REG, 0xfff40074 | interrupt clear register
+.set RELOAD, 0x01000000 | clear tick 1 interrupt
+
+ PUBLIC (Ttimer_val)
+ PUBLIC (timerisr)
+SYM (timerisr):
+ move.l a0, -(a7) | save a0
+ movea.l #INTR_CLEAR_REG, a0 | a0 = addr of cmd status reg
+ ori.l #RELOAD, (a0) | reload countdown
+ addq.l #1, SYM (Ttimer_val) | increment timer value
+ move.l (a7)+, a0 | restore a0
+ rte
+
+END_CODE
+END
diff --git a/c/src/lib/libbsp/m68k/mvme162/times b/c/src/lib/libbsp/m68k/mvme162/times
new file mode 100644
index 0000000000..7f37dc4176
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/times
@@ -0,0 +1,193 @@
+#
+# Timing Test Suite Results for the Motorola MVME162 BSP
+#
+# $Id$
+#
+
+NOTE: This BSP is used submitted and no information is currently available.
+
+Board: Motorola MVME162
+CPU: Motorola MC68040
+Clock Speed:
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/m68k/mvme162/tools/sload.c b/c/src/lib/libbsp/m68k/mvme162/tools/sload.c
new file mode 100644
index 0000000000..1fe0ecd421
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/mvme162/tools/sload.c
@@ -0,0 +1,511 @@
+/*
+ *
+ * Copyright (c) 1994 by EISCAT Scientific Association.
+ * All Rights Reserved.
+ * M.Savitski
+ *
+ * S-record code - courtesy of Kym Newbery
+ * 8918927y@lux.levels.unisa.edu.au
+ *
+ * Loading S-records into the VMEbus memory.
+ *
+ * Loads an executable in s-record format into the MVME dual-ported
+ * memory and directs the MVME CPU to start execution.
+ * VMEbus access is done via the FORCE CPU-2CE vmeplus driver in
+ * read/write mode for loading and in mmap mode for accessing MVME registers.
+ * See mvme162.h for #define's dependent on the MVME162 setup.
+ *
+ * $Id$
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#include <sys/vme.h>
+#include <sys/mman.h>
+
+#include "../include/bsp.h"
+
+#define FALSE 0
+#define TRUE 1
+
+#define DATA19 0
+#define DATA28 1
+#define DATA37 3
+#define HEADER 4
+#define TERMINATOR 5
+#define NONE 6
+
+unsigned int ahdtoi(unsigned char digit);
+int issrec(char *str);
+int validrec(char *str);
+void hdr2str(char *sstr, char *pstr);
+unsigned long getaddr(char *str);
+unsigned int datasize(char *str);
+void usage (void);
+int MVMEControl(u_long entry, int reset, int go);
+
+unsigned int ahdtoi(unsigned char digit)
+/* converts a hexadecimal char to an integer
+ *
+ * entry : digit = character to convert
+ * : 0..15 = result
+ * : -1 = char is not a digit
+ */
+{
+/* check digit */
+ if (!isxdigit(digit))
+ return(-1);
+
+ switch (toupper(digit)) {
+ case 'A' : return(0xA);
+ case 'B' : return(0xB);
+ case 'C' : return(0xC);
+ case 'D' : return(0xD);
+ case 'E' : return(0xE);
+ case 'F' : return(0xF);
+ default : return(digit - 0x30);
+ }
+}
+
+int issrec(char *str)
+/* attempts to identify the type of Srecord string passed
+ *
+ * entry : str = pointer to null terminated string
+ * returns : 0,1,2,3,5,7,8,9 for S0..S9 except S6 & S4
+ * : -1 = invalid header or header not found
+ * : -2 = invalid header number
+ */
+{
+/* Check first character for S */
+ if ((isupper(str[0]) && (str[0] == 'S')) || (islower(str[0]) && (str[0] == 's')))
+ {
+ /* check for valid header number */
+ switch (str[1]) {
+ case '0' : return 0; /* header record */
+ case '1' : return 1; /* data record, 2byte addr */
+ case '2' : return 2; /* " " , 3byte addr */
+ case '3' : return 3; /* " " , 4byte addr */
+ case '5' : return 5; /* number of S1,S2,S3 blocks */
+ case '7' : return 7; /* S3 terminator */
+ case '8' : return 8; /* S2 terminator */
+ case '9' : return 9; /* S1 terminator */
+ default : return -2; /* all others are invalid */
+ }
+ }
+ return(-1);
+}
+
+int validrec(char *str)
+/* Tests for a valid srecord. tests checksum & for nondigit characters
+ * doesn't rely on any other srecord routines.
+ *
+ * entry : str = pointer to null terminated string
+ * returns : -1 = srecord contains invalid characters
+ * : -2 = srecord checksum is invalid
+ * : -3 = srecord record length is invalid
+ * : 0 = srecord is valid
+ */
+{
+ int cn = 1, rlen=0;
+ int mchksum=0, rchksum=0;
+
+/* first check if there are any non-digit characters except S */
+ while (str[cn]!=0)
+ if (!isxdigit(str[cn++]))
+ return(-1);
+
+/* test number of data bytes */
+ rlen = ahdtoi(str[2])* 0x10 + ahdtoi(str[3]);
+ if (((strlen(str)-4)/2U) != rlen) return(-3);
+
+/* get checksum from string */
+ rchksum = ahdtoi(str[rlen*2+2])*0x10 + ahdtoi(str[rlen*2+3]); /* string chksum */
+
+/* now calculate my own checksum */
+ for (cn=2; cn <= rlen*2; )
+ mchksum += ahdtoi(str[cn++])*0x10 + ahdtoi(str[cn++]);
+ mchksum = ~mchksum & 0xFF;
+ if (mchksum != rchksum) return(-2); /* return -2 in not equal */
+
+/* return OK if we didn't fail any of these tests */
+ return(0);
+}
+
+void hdr2str(char *sstr, char *pstr)
+/* converts header record (S0) string into a plain string
+ *
+ * entry : sstr = pointer to S0 string record
+ * exit : pstr = pointer to string long enough to hold string
+ * (caller must allocate enough space for string)
+ */
+{
+ int rlen, cn, pn=0;
+
+ rlen = ahdtoi(sstr[2])*0x10 + ahdtoi(sstr[3]);
+ for (cn=8; cn <= rlen*2; )
+ pstr[pn++] = ahdtoi(sstr[cn++])*0x10 + ahdtoi(sstr[cn++]);
+ pstr[pn]=0;
+}
+
+unsigned long getaddr(char *str)
+/* returns the address of the srecord in str. assumes record is valid.
+ *
+ * entry : str = pointer to srecord string
+ * exit : address of data, word or long.
+ */
+{
+ unsigned long addr=0;
+
+ switch (issrec(str)) {
+ case 0 :
+ case 1 :
+ case 5 :
+ case 9 : addr = ahdtoi(str[4])*0x1000 + ahdtoi(str[5])*0x100
+ + ahdtoi(str[6])*0x10 + ahdtoi(str[7]);
+ return(addr);
+ case 2 :
+ case 8 : addr = ahdtoi(str[4])*0x100000 + ahdtoi(str[5])*0x10000
+ + ahdtoi(str[6])*0x1000 + ahdtoi(str[7])*0x100
+ + ahdtoi(str[8])*0x10 + ahdtoi(str[9]);
+ return(addr);
+ case 3 :
+ case 7 : addr = ahdtoi(str[4])*0x10000000 + ahdtoi(str[5])*0x1000000
+ + ahdtoi(str[6])*0x100000 + ahdtoi(str[7])*0x10000
+ + ahdtoi(str[8])*0x1000 + ahdtoi(str[9])*0x100
+ + ahdtoi(str[10])*0x10 + ahdtoi(str[11]);
+ return(addr);
+ default : return(-1);
+ }
+}
+
+unsigned int datasize(char *str)
+/*
+ * returns the number of data bytes in the srecord. assumes record is valid.
+ *
+ * entry : str = pointer to srecord string
+ * exit : number of bytes of data in the data field.
+ */
+{
+ unsigned int size=0;
+
+ switch (issrec(str)) {
+ case 0 :
+ case 1 :
+ case 5 :
+ case 7 :
+ case 8 :
+ case 9 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
+ return(size-3);
+ case 2 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
+ return(size-4);
+ case 3 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
+ return(size-5);
+ default : return(-1);
+ }
+}
+
+void usage (void)
+/*
+ * prints correct usage on stdout
+ */
+{
+ printf("\nUSAGE : sload [-v][-g][-r] [file]\n");
+ printf(" file is an s-record file\n");
+ printf(" -v for verbose summary of s-records loaded\n");
+ printf(" -g to start execution\n");
+ printf(" -r to reset MVME162\n\n");
+}
+
+int MVMEControl(u_long entry, int reset, int go)
+/* Controls MVME-162 from other VME master:
+ * if entry != 0, loads it as start address
+ * if go != 0, starts program execution from entry
+ * if reset != 0, resets mvme162's local bus
+ * Depends upon #define'ed GROUP_BASE_ADDRESS and BOARD_BASE_ADDRESS
+ * which in turn are set by the 162-BUG's ENV command.
+ */
+{
+ int vme;
+ char vmedev[32] = "/dev/vme16d32"; /* d32 is important !!! */
+ u_long pagesize;
+ struct gcsr *gcsr_map;
+
+ pagesize = sysconf(_SC_PAGESIZE); /* mmap likes to be page-aligned */
+
+ if ((vme = open(vmedev, O_RDWR)) == -1) {
+ perror("open");
+ fprintf(stderr, "Cannot open vme as %s to access GCSR\n", vmedev);
+ return 1;
+ }
+
+/* "MAP_SHARED" is important here */
+ gcsr_map = (struct gcsr *) mmap(0, 0x1000, PROT_WRITE|PROT_READ, MAP_SHARED,
+ vme, (u_long)gcsr_vme / pagesize * pagesize);
+ if (gcsr_map == (struct gcsr *) - 1) {
+ perror("mmap");
+ fprintf(stderr, "Cannot mmap() to remote bus address 0x%08X\n",
+ (u_long)gcsr_vme / pagesize * pagesize);
+ return 1;
+ }
+
+/*
+ * use GCSR to start execution in MVME162
+ * adjust pointer to compensate for page alignement
+ */
+ gcsr_map = (struct gcsr *)((u_long)gcsr_map + (u_long)gcsr_vme % pagesize);
+
+ if (reset) { /* reset the local bus... */
+ gcsr_map->board_scr |= 0x80;
+ }
+ if (entry) { /* ...load start address... */
+ gcsr_map->gpr[0] = entry >> 16U;
+ gcsr_map->gpr[1] = entry & 0x0000FFFF;
+ }
+ if (go) { /* ... and kick it in the ass! */
+ gcsr_map->lmsig = 0x1;
+ }
+}
+
+/*=================================================================== */
+main(int argc, char *argv[])
+{
+ char inpstr[256];
+ u_char image[256];
+ char hdrstr[64];
+ int i, j, k, result, size, line=0, lastrec=0;
+ long addr, tsize=0, naddr=0, blksize=0, blknum=1;
+ FILE *in;
+ char infile[256] = "";
+ char vmedev[32] = "/dev/vme32d32"; /* Assume "/dev/vme32d32" */
+ int vme, verbose = 0, go = 0, reset = 0, havefile = 0;
+
+/* Parse the command line */
+
+ --argc;
+
+ while (argv++, argc--) {
+ if (**argv != '-') {
+ strcpy(infile, *argv);
+ havefile = 1;
+ } else if (!strcmp(*argv, "-v")) {
+ verbose = 1;
+ } else if (!strcmp(*argv, "-g")) {
+ go = 1;
+ } else if (!strcmp(*argv, "-r")) {
+ reset = 1;
+/* } else if (!strcmp(*argv, "-vme32")) { */
+/* strcpy(vmedev, "/dev/vme32d32"); */
+/* } else if (!strcmp(*argv, "-vme24")) { */
+/* strcpy(vmedev, "/dev/vme24d32"); */
+/* } else if (!strcmp(*argv, "-vme16")) { */
+/* strcpy(vmedev, "/dev/vme16d32"); */
+ } else if (!strcmp(*argv, "-")) {
+ usage();
+ exit(0);
+ } else {
+ usage();
+ exit(0);
+ }
+ }
+
+ if (!havefile) {
+ if (!reset && !go) {
+ usage();
+ }
+ else {
+ MVMEControl(0, reset, go);
+ }
+ exit(0);
+ }
+
+ if ((in = fopen(infile, "r")) == NULL) {
+ perror("open");
+ fprintf(stderr, "Cannot open input file %s\n", infile);
+ exit(1);
+ }
+
+ if ((vme = open(vmedev, O_RDWR)) == -1) {
+ fprintf(stderr, "Cannot open vme as %s\n", vmedev);
+ }
+
+ while (fscanf(in, "%s", &inpstr) != EOF) {
+ line++;
+ if (validrec(inpstr) == 0) {
+ switch (issrec(inpstr)) {
+ case 0 :
+ hdr2str(inpstr, hdrstr);
+ if (verbose) printf("HEADER string = `%s'\n", hdrstr);
+ lastrec=HEADER;
+ break;
+ case 1 :
+ addr = getaddr(inpstr);
+ size = datasize(inpstr);
+ if (blksize == 0) {
+ blksize+=size;
+ naddr=addr+size;
+ if (verbose) printf("DATA\tS19\t$%04lX", addr);
+ lastrec=DATA19;
+ }
+ else if ((blksize!=0) && (addr==naddr)) {
+ blksize+=size;
+ naddr=addr+size;
+ }
+ else {
+ if (verbose) printf("\t$%04lX\t%lu", naddr-1, blksize);
+ if (verbose) printf("\t%d\n", blknum);
+ blknum+=1;
+ naddr=addr+size;
+ blksize=size;
+ if (verbose) printf("DATA\tS19\t$%04lX", addr);
+ lastrec=DATA19;
+ }
+ tsize += size;
+ if (vme == -1) break;
+ for (i = 0, j = 8, k = size; k-- > 0; i += 1, j += 2) {
+ image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
+ }
+ if (lseek(vme, addr, SEEK_SET) == -1) {
+ fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
+ }
+ else {
+ if (write(vme, (u_char *)image, size) != size) {
+ fprintf(stderr, "Write to vme address %08X failed\n", addr);
+ }
+ }
+ break;
+ case 2 :
+ addr = getaddr(inpstr);
+ size = datasize(inpstr);
+ if (blksize == 0) {
+ blksize+=size;
+ naddr=addr+size;
+ if (verbose) printf("DATA\tS28\t$%06lX",addr);
+ lastrec=DATA28;
+ }
+ else if ((blksize!=0) && (addr==naddr)) {
+ blksize+=size;
+ naddr=addr+size;
+ }
+ else {
+ if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
+ if (verbose) printf("\t%d\n",blknum);
+ blknum+=1;
+ naddr=addr+size;
+ blksize=size;
+ if (verbose) printf("DATA\tS28\t$%06lX",addr);
+ lastrec=DATA28;
+ }
+ tsize += size;
+ if (vme == -1) break;
+ for (i = 0, j = 10, k = size; k-- > 0; i += 1, j += 2) {
+ image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
+ }
+ if (lseek(vme, addr, SEEK_SET) == -1) {
+ fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
+ }
+ else {
+ if (write(vme, (u_char *)image, size) != size) {
+ fprintf(stderr, "Write to vme address %08X failed\n", addr);
+ }
+ }
+ break;
+ case 3 :
+ addr = getaddr(inpstr);
+ size = datasize(inpstr);
+ if (blksize == 0) {
+ blksize+=size;
+ naddr=addr+size;
+ if (verbose) printf("DATA\tS37\t$%08lX",addr);
+ lastrec=DATA37;
+ }
+ else if ((blksize!=0) && (addr==naddr)) {
+ blksize+=size;
+ naddr=addr+size;
+ }
+ else {
+ if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
+ if (verbose) printf("\t%d\n",blknum);
+ blknum+=1;
+ naddr=addr+size;
+ blksize=size;
+ if (verbose) printf("DATA\tS37\t$%08lX",addr);
+ lastrec=DATA37;
+ }
+ tsize += size;
+ if (vme == -1) break;
+ for (i = 0, j = 12, k = size; k-- > 0; i += 1, j += 2) {
+ image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
+ }
+ if (lseek(vme, addr, SEEK_SET) == -1) {
+ fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
+ }
+ else {
+ if (write(vme, (u_char *)image, size) != size) {
+ fprintf(stderr, "Write to vme address %08X failed\n", addr);
+ }
+ }
+ break;
+ case 7 :
+ if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);}
+ if (verbose) printf("\t%d\n",blknum);
+ addr = getaddr(inpstr);
+ if (verbose) printf("TERM\tS37");
+ printf("\nExecution address = $%08lX\n", addr);
+ lastrec=TERMINATOR;
+ break;
+ case 8 :
+ if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);}
+ if (verbose) printf("\t%d\n",blknum);
+ addr = getaddr(inpstr);
+ if (verbose) printf("TERM\tS28");
+ printf("\nExecution address = $%06lX\n", addr);
+ lastrec=TERMINATOR;
+ break;
+ case 9 :
+ if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);}
+ if (verbose) printf("\t%d\n",blknum);
+ addr = getaddr(inpstr);
+ if (verbose) printf("TERM\tS19");
+ printf("\nExecution address = $%04lX\n", addr);
+ lastrec=TERMINATOR;
+ break;
+ }
+ }
+ else {
+ printf("\nError on line %d. ",line);
+ switch (validrec(inpstr)) {
+ case -1 : {printf("SRecord contains invalid characters.\n"); break; }
+ case -2 : {printf("SRecord checksum is invalid.\n"); break;}
+ case -3 : {printf("SRecord length is invalid.\n"); break;}
+ }
+ exit(1);
+ }
+ }
+
+ if ((lastrec==DATA19) || (lastrec==DATA28) || (lastrec==DATA37)) {
+ if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);}
+ if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);}
+ if (verbose) printf("\t%d\n",blknum);
+ printf("ERROR: terminator record not found.\n");
+ }
+ else {
+ for (i = 0x000FFFF; i-- > 0;) ; /* mystique delay... */
+ MVMEControl(addr, reset, go);
+ }
+ if (verbose) printf("total data size = %lu bytes\n", tsize);
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/README b/c/src/lib/libbsp/no_cpu/no_bsp/README
new file mode 100644
index 0000000000..8ed80e29f8
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/README
@@ -0,0 +1,69 @@
+#
+# $Id$
+#
+# This is a sample hardware description file for a BSP. This comment
+# block does not have to appear in a real one. The intention of this
+# file is to provide a central place to look when searching for
+# information about a board when starting a new BSP. For example,
+# you may want to find an existing timer driver for the chip you are
+# using on your board. It is easier to grep for the chip name in
+# all of the HARDWARE files than to peruse the source tree. Hopefully,
+# making the HARDDWARE files accurate will also alleviate the common
+# problem of not knowing anything about a board based on its BSP
+# name.
+#
+# NOTE: If you have a class of peripheral chip on board which
+# is not in this list please add it to this file so
+# others will also use the same name.
+#
+# Timer resolution is the way it is configured in this BSP.
+# On a counting timer, this is the length of time which
+# corresponds to 1 count.
+#
+
+BSP NAME: fastsbc1
+BOARD: Fasssst Computers, Fast SBC-1
+BUS: SchoolBus
+CPU FAMILY: i386
+CPU: Intel Hexium
+COPROCESSORS: Witch Hex87
+MODE: 32 bit mode
+
+DEBUG MONITOR: HexBug
+
+PERIPHERALS
+===========
+TIMERS: Intel i8254
+ RESOLUTION: .0001 microseconds
+SERIAL PORTS: Zilog Z8530 (with 2 ports)
+REAL-TIME CLOCK: RTC-4
+DMA: Intel i8259
+VIDEO: none
+SCSI: none
+NETWORKING: none
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER: RTC-4
+IOSUPP DRIVER: Zilog Z8530 port A
+SHMSUPP: polled and interrupts
+TIMER DRIVER: Intel i8254
+TTY DRIVER: stub only
+
+STDIO
+=====
+PORT: Console port 0
+ELECTRICAL: RS-232
+BAUD: 9600
+BITS PER CHARACTER: 8
+PARITY: None
+STOP BITS: 1
+
+NOTES
+=====
+
+(1) 900 Mhz and 950 Mhz versions.
+
+(2) 1 Gb or 2 Gb RAM.
+
+(3) PC compatible if HexBug not enabled.
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c b/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c
new file mode 100644
index 0000000000..7c8f9617e7
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c
@@ -0,0 +1,191 @@
+/* ckinit.c
+ *
+ * This file provides a template for the clock device driver initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <bsp.h>
+
+void Clock_exit( void );
+rtems_isr Clock_isr( rtems_vector_number vector );
+
+
+/*
+ * The interrupt vector number associated with the clock tick device
+ * driver.
+ */
+
+#define CLOCK_VECTOR 4
+
+/*
+ * Clock_driver_ticks is a monotonically increasing counter of the
+ * number of clock ticks since the driver was initialized.
+ */
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+
+/*
+ * Clock_isrs is the number of clock ISRs until the next invocation of
+ * the RTEMS clock tick routine. The clock tick device driver
+ * gets an interrupt once a millisecond and counts down until the
+ * length of time between the user configured microseconds per tick
+ * has passed.
+ */
+
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * The previous ISR on this clock tick interrupt vector.
+ */
+
+rtems_isr_entry Old_ticker;
+
+void Clock_exit( void );
+
+
+/*
+ * Isr Handler
+ */
+
+rtems_isr Clock_isr(
+ rtems_vector_number vector
+)
+{
+/*
+ * bump the number of clock driver ticks since initialization
+ *
+ * determine if it is time to announce the passing of tick as configured
+ * to RTEMS through the rtems_clock_tick directive
+ *
+ * perform any timer dependent tasks
+ */
+}
+
+/*
+ * Install_clock
+ *
+ * Install a clock tick handler and reprograms the chip. This
+ * is used to initially establish the clock tick.
+ */
+
+void Install_clock(
+ rtems_isr_entry clock_isr
+)
+{
+ /*
+ * Initialize the clock tick device driver variables
+ */
+
+ Clock_driver_ticks = 0;
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ /*
+ * If ticks_per_timeslice is configured as non-zero, then the user
+ * wants a clock tick.
+ */
+
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+ Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+ /*
+ * Hardware specific initialize goes here
+ */
+
+ /* XXX */
+ }
+
+ /*
+ * Schedule the clock cleanup routine to execute if the application exits.
+ */
+
+ atexit( Clock_exit );
+}
+
+/*
+ * Clean up before the application exits
+ */
+
+void Clock_exit( void )
+{
+ if ( BSP_Configuration.ticks_per_timeslice ) {
+
+ /* XXX: turn off the timer interrupts */
+
+ /* XXX: If necessary, restore the old vector */
+ }
+}
+
+/*
+ * Clock_initialize
+ *
+ * Device driver entry point for clock tick driver initialization.
+ */
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(CLOCK_VECTOR);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c b/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c
new file mode 100644
index 0000000000..5b12e09532
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c
@@ -0,0 +1,223 @@
+/*
+ * This file contains the template for a console IO package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define NO_BSP_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ *ch = '\0'; /* return NULL for no particular reason */
+ return(TRUE);
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the SOURCE.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from SOURCE
+ */
+
+char inbyte( void )
+{
+ /*
+ * If polling, wait until a character is available.
+ */
+
+ return '\0';
+}
+
+/* outbyte
+ *
+ * This routine transmits a character out the SOURCE. It may support
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ /*
+ * If polling, wait for the transmitter to be ready.
+ * Check for flow control requests and process.
+ * Then output the character.
+ */
+
+ /*
+ * Carriage Return/New line translation.
+ */
+
+ if ( ch == '\n' )
+ outbyte( '\r' );
+}
+
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+
+ rw_args->bytes_moved = maximum;
+ return 0;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h b/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h
new file mode 100644
index 0000000000..fa09cbb5bf
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h
@@ -0,0 +1,105 @@
+/* bsp.h
+ *
+ * This include file contains all board IO definitions.
+ *
+ * XXX : put yours in here
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __NO_BSP_h
+#define __NO_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <console.h>
+#include <clockdrv.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Stuff for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
+
+#define Cause_tm27_intr()
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { \
+ }
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+void bsp_cleanup( void );
+
+no_cpu_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/include/coverhd.h b/c/src/lib/libbsp/no_cpu/no_bsp/include/coverhd.h
new file mode 100644
index 0000000000..88435c5348
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/include/coverhd.h
@@ -0,0 +1,115 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/addrconv.c b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/addrconv.c
new file mode 100644
index 0000000000..0e188fc941
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/addrconv.c
@@ -0,0 +1,31 @@
+/* Shm_Convert_address
+ *
+ * No address range conversion is required.
+ *
+ * Input parameters:
+ * address - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+void *Shm_Convert_address(
+ void *address
+)
+{
+ return ( address );
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/getcfg.c b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/getcfg.c
new file mode 100644
index 0000000000..ca8409a3f0
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/getcfg.c
@@ -0,0 +1,77 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the XXX target.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+XXX: FIX THE COMMENTS BELOW WHEN THE CPU IS KNOWN
+ * NOTES: The XYZ does not have an interprocessor interrupt.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED BIG 2+
+ * INTERRUPT **** NOT SUPPORTED ****
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * configured if currently polling of interrupt driven
+ */
+
+#define INTERRUPT 0 /* XXX: */
+#define POLLING 1 /* XXX: fix me -- is polling ONLY!!! */
+
+
+shm_config_table BSP_shm_cfgtbl;
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ BSP_shm_cfgtbl.base = 0x0;
+ BSP_shm_cfgtbl.length = 1 * MEGABYTE;
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ /*
+ * Override cause_intr or shm_isr if your target has
+ * special requirements.
+ */
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+
+ *shmcfg = &BSP_shm_cfgtbl;
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/lock.c b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/lock.c
new file mode 100644
index 0000000000..acdc8b7b48
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/lock.c
@@ -0,0 +1,86 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = LQ_UNLOCKED;
+}
+
+/* void _Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+ rtems_unsigned32 *lockptr = &lq_cb->lock;
+ rtems_unsigned32 lock_value;
+
+ lock_value = 0x80000000;
+ rtems_interrupt_disable( isr_level );
+
+ Shm_isrstat = isr_level;
+ while ( lock_value ) {
+ asm volatile( ""
+ : "=r" (lockptr), "=r" (lock_value)
+ : "0" (lockptr), "1" (lock_value)
+ );
+ /*
+ * If not available, then may want to delay to reduce load on lock.
+ */
+
+ if ( lock_value )
+ delay( 10 ); /* approximately 10 microseconds */
+ }
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ lq_cb->lock = SHM_UNLOCK_VALUE;
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
+
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/mpisr.c b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/mpisr.c
new file mode 100644
index 0000000000..592c0cfcc5
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/shmsupp/mpisr.c
@@ -0,0 +1,47 @@
+/* Shm_isr_nobsp()
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm.h>
+
+rtems_isr Shm_isr_nobsp( void )
+{
+ /*
+ * If this routine has to do anything other than the mpisr.c
+ * found in the generic driver, then copy the contents of the generic
+ * mpisr.c and augment it to satisfy this particular board. Typically,
+ * you need to have a board specific mpisr.c when the interrupt
+ * must be cleared.
+ *
+ * If the generic mpisr.c satisifies your requirements, then
+ * remove this routine from your target's shmsupp/mpisb.c file.
+ * Then simply install the generic Shm_isr in the Shm_setvec
+ * routine below.
+ */
+}
+
+/* Shm_setvec
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void Shm_setvec( void )
+{
+ /* XXX: FIX ME!!! */
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c
new file mode 100644
index 0000000000..ca498e7806
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c
@@ -0,0 +1,26 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
new file mode 100644
index 0000000000..8ab251b791
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
@@ -0,0 +1,255 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * The last parameter to RTEMS_Malloc_Initialize is the "chunk"
+ * size which a multiple of will be requested on each sbrk()
+ * call by malloc(). A value of 0 indicates that sbrk() should
+ * not be called to extend the heap.
+ */
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int bsp_start(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+
+ /*
+ * Copy the Configuration Table .. so we can change it
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Add 1 extension for stack checker
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Need to "allocate" the memory for the RTEMS Workspace and
+ * tell the RTEMS configuration where it is. This memory is
+ * not malloc'ed. It is just "pulled from the air".
+ */
+
+ BSP_Configuration.work_space_start = (void *) 0;
+
+ /*
+ * initialize the CPU table for this BSP
+ */
+
+ /*
+ * we do not use the pretasking_hook
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Don't forget the other CPU Table entries.
+ */
+
+ /*
+ * Start RTEMS
+ */
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/linkcmds b/c/src/lib/libbsp/no_cpu/no_bsp/startup/linkcmds
new file mode 100644
index 0000000000..144b9e68a0
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/linkcmds
@@ -0,0 +1,46 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the FORCE CPU386 board.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+MEMORY
+ {
+ ram : org = 0x0, l = 1M
+ }
+
+SECTIONS
+{
+ .text 0x0 :
+ {
+ text_start = . ;
+ _text_start = . ;
+ *(.text)
+ _etext = ALIGN( 0x10 ) ;
+ }
+ .data ADDR( .text ) + SIZEOF( .text ):
+ {
+ data_start = . ;
+ _data_start = . ;
+ *(.data)
+ _edata = ALIGN( 0x10 ) ;
+ }
+ .bss ADDR( .data ) + SIZEOF( .data ):
+ {
+ bss_start = . ;
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ end = . ;
+ __end = . ;
+ }
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c
new file mode 100644
index 0000000000..62126647e7
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c
@@ -0,0 +1,34 @@
+/* main()
+ *
+ * This is the entry point for the application. It calls
+ * the bsp_start routine to the actual dirty work.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ bsp_start( argc, argv, environp );
+
+ /*
+ * May be able to return to the "crt/start.s" code but also
+ * may not be able to. Do something here which is board dependent.
+ */
+
+ rtems_fatal_error_occurred( 0 );
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c
new file mode 100644
index 0000000000..0f556a4d5e
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c
@@ -0,0 +1,44 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the target Board/CPU.
+ * This routine is allowed to be as board dependent as necessary.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+no_cpu_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ no_cpu_isr_entry previous_isr;
+
+ if ( type )
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+ else {
+ /* XXX: install non-RTEMS ISR as "raw" interupt */
+ }
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/timer/timer.c b/c/src/lib/libbsp/no_cpu/no_bsp/timer/timer.c
new file mode 100644
index 0000000000..a3b8775444
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/timer/timer.c
@@ -0,0 +1,105 @@
+/* timer.c
+ *
+ * This file manages the benchmark timer used by the RTEMS Timing Test
+ * Suite. Each measured time period is demarcated by calls to
+ * Timer_initialize() and Read_timer(). Read_timer() usually returns
+ * the number of microseconds since Timer_initialize() exitted.
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+rtems_unsigned32 Timer_interrupts;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+void Timer_initialize( void )
+{
+
+ /*
+ * Timer has never overflowed. This may not be necessary on some
+ * implemenations of timer but ....
+ */
+
+ Timer_interrupts = 0;
+
+ /*
+ * Somehow start the timer
+ */
+}
+
+/*
+ * The following controls the behavior of Read_timer().
+ *
+ * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
+ * is usually deducted from the number returned.
+ *
+ * LEAST_VALID is the lowest number this routine should trust. Numbers
+ * below this are "noise" and zero is returned.
+ */
+
+#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
+ /* (Y countdowns) to start/stop the timer. */
+ /* This value is in microseconds. */
+#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
+
+int Read_timer( void )
+{
+ rtems_unsigned32 clicks;
+ rtems_unsigned32 total;
+
+ /*
+ * Read the timer and see how many clicks it has been since we started.
+ */
+
+ clicks = 0; /* XXX: read some HW here */
+
+ /*
+ * Total is calculated by taking into account the number of timer overflow
+ * interrupts since the timer was initialized and clicks since the last
+ * interrupts.
+ */
+
+ total = clicks * 0;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ /*
+ * Somehow convert total into microseconds
+ */
+ return (total - AVG_OVERHEAD);
+ }
+}
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
+
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/timer/timerisr.c b/c/src/lib/libbsp/no_cpu/no_bsp/timer/timerisr.c
new file mode 100644
index 0000000000..f52774b75e
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/timer/timerisr.c
@@ -0,0 +1,37 @@
+/* timerisr.s
+ *
+ * If required this ISR is used to bump a count of interval "overflow"
+ * interrupts which have occurred since the timer was started. The
+ * number of overflows is taken into account in the Read_timer()
+ * routine if necessary.
+ *
+ * To reduce overhead this is best to be the "rawest" hardware interupt
+ * handler you can write. This should be the only interrupt which can
+ * occur during the measured time period.
+ *
+ * NOTE: This file is USUALLY in assembly and is LEAN AND MEAN.
+ * Any code in this isr is pure overhead which can perturb
+ * the accuracy of the Timing Test Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+extern rtems_unsigned32 _Timer_interrupts;
+
+void timerisr( void )
+{
+ /*
+ * _Timer_interrupts += TIMER_BETWEEN_OVERFLOWS (usually in microseconds)
+ * return from interrupt
+ */
+}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/times b/c/src/lib/libbsp/no_cpu/no_bsp/times
new file mode 100644
index 0000000000..2ac0b9ee22
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/times
@@ -0,0 +1,194 @@
+#
+# Timing Test Suite Results for the NO_BSP
+#
+# NOTE: This is just a template. The times are irrelevant since this BSP
+# can only be compiled -- not executed.
+#
+# $Id$
+#
+
+Board:
+CPU: include coprocessor if applicable
+Clock Speed:
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column X:
+Column Y:
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/powerpc/papyrus/README b/c/src/lib/libbsp/powerpc/papyrus/README
new file mode 100644
index 0000000000..9d3e20b592
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/README
@@ -0,0 +1,50 @@
+#
+# $Id$
+#
+
+BSP NAME: papyrus
+BOARD: i cubed, papyrus development board
+BUS: N/A
+CPU FAMILY: ppc
+CPU: PowerPC 403GA
+COPROCESSORS: N/A
+MODE: 32 bit mode
+
+DEBUG MONITOR: Modified IBM OpenBios
+
+PERIPHERALS
+===========
+TIMERS: 403GA internal
+ RESOLUTION: .1 microseconds
+SERIAL PORTS: 403GA internal with extra lines
+REAL-TIME CLOCK: 403GA internal
+DMA: 403GA internal
+VIDEO: Laser Printer
+SCSI: none
+NETWORKING: AMD PCNet32
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER: 403GA internal
+IOSUPP DRIVER: N/A
+SHMSUPP: N/A
+TIMER DRIVER: 403GA internal
+TTY DRIVER: 403GA internal
+
+STDIO
+=====
+PORT: Console port 0
+ELECTRICAL: RS-232
+BAUD: 9600
+BITS PER CHARACTER: 8
+PARITY: None
+STOP BITS: 1
+
+Notes
+=====
+
+Papyrus only supports single processor operations.
+
+The code under c/src/lib/libbsp/ppc/papyrus only really supports
+the PowerOpen ABI with an ELF assembler.
+
diff --git a/c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s b/c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s
new file mode 100644
index 0000000000..e5df33a114
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s
@@ -0,0 +1,251 @@
+/* dlentry.s 1.0 - 95/08/08
+ *
+ * This file contains the entry veneer for RTEMS programs
+ * downloaded to Papyrus.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+/*
+ * The Papyrus ELF link scripts support three special sections:
+ * .entry The actual entry point, this must contain less
+ * than 256 bytes of code/data to fit below the
+ * .vectors section. This always preceeds any other
+ * code or data.
+ * .vectors The section containing the interrupt entry veneers.
+ * .entry2 Any code overflowing from .entry
+ * .descriptors The PowerOpen function indirection blocks.
+ */
+
+/*
+ * Downloaded code loads the vectors separately to 0x00000100,
+ * so .entry can be over 256 bytes.
+ *
+ * The other sections are linked in the following order:
+ * .entry
+ * .entry2
+ * .text
+ * .descriptors
+ * .data
+ * .bss
+ * usually starting from 0x00020000.
+ *
+ * The initial stack is set to run BELOW the code base address.
+ *
+ * All the entry veneer has to do is to clear the BSS.
+ */
+
+/*
+ * GDB likes to have debugging information for the entry veneer.
+ * Here is some DWARF information.
+ */
+
+#if PPC_ASM == PPC_ASM_ELF
+ .section .entry,"ax",@progbits
+.L_text_b:
+.L_LC1:
+ .previous
+
+.section .debug_sfnames
+.L_sfnames_b:
+ .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/dlentry/"
+ .byte 0
+.L_F0:
+ .byte "dlentry.s"
+ .byte 0
+ .previous
+
+.section .line
+.L_line_b:
+ .4byte .L_line_e-.L_line_b
+ .4byte .L_text_b
+.L_LE1:
+.L_line_last:
+ .4byte 0x0
+ .2byte 0xffff
+ .4byte .L_text_e-.L_text_b
+.L_line_e:
+ .previous
+
+.section .debug_srcinfo
+.L_srcinfo_b:
+ .4byte .L_line_b
+ .4byte .L_sfnames_b
+ .4byte .L_text_b
+ .4byte .L_text_e
+ .4byte 0xffffffff
+ .4byte .L_LE1-.L_line_b
+ .4byte .L_F0-.L_sfnames_b
+ .4byte .L_line_last-.L_line_b
+ .4byte 0xffffffff
+ .previous
+
+.section .debug_pubnames
+ .4byte .L_debug_b
+ .4byte .L_P0
+ .byte "download_entry"
+ .byte 0
+ .4byte 0x0
+ .byte 0
+ .previous
+
+.section .debug_aranges
+ .4byte .L_debug_b
+ .4byte .L_text_b
+ .4byte .L_text_e-.L_text_b
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0x0
+ .4byte 0x0
+ .previous
+
+.section .debug
+.L_debug_b:
+.L_D1:
+ .4byte .L_D1_e-.L_D1
+ .2byte 0x11 /* TAG_compile_unit */
+ .2byte 0x12 /* AT_sibling */
+ .4byte .L_D2
+ .2byte 0x38 /* AT_name */
+ .byte "dlentry.s"
+ .byte 0
+ .2byte 0x258 /* AT_producer */
+ .byte "GAS 2.5.2"
+ .byte 0
+ .2byte 0x111 /* AT_low_pc */
+ .4byte .L_text_b
+ .2byte 0x121 /* AT_high_pc */
+ .4byte .L_text_e
+ .2byte 0x106 /* AT_stmt_list */
+ .4byte .L_line_b
+ .2byte 0x1b8 /* AT_comp_dir */
+ .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/dlentry/"
+ .byte 0
+ .2byte 0x8006 /* AT_sf_names */
+ .4byte .L_sfnames_b
+ .2byte 0x8016 /* AT_src_info */
+ .4byte .L_srcinfo_b
+.L_D1_e:
+.L_P0:
+.L_D3:
+ .4byte .L_D3_e-.L_D3
+ .2byte 0x6 /* TAG_global_subroutine */
+ .2byte 0x12 /* AT_sibling */
+ .4byte .L_D4
+ .2byte 0x38 /* AT_name */
+ .byte "download_entry"
+ .byte 0
+ .2byte 0x278 /* AT_prototyped */
+ .byte 0
+ .2byte 0x111 /* AT_low_pc */
+ .4byte .L_text_b
+ .2byte 0x121 /* AT_high_pc */
+ .4byte .L_text_e
+ .2byte 0x8041 /* AT_body_begin */
+ .4byte .L_text_b
+ .2byte 0x8051 /* AT_body_end */
+ .4byte .L_text_e
+.L_D3_e:
+
+.L_D4:
+ .4byte .L_D4_e-.L_D4
+ .align 2
+.L_D4_e:
+.L_D2:
+ .previous
+#endif
+
+/*-------------------------------------------------------------------------------
+ * ROM Vector area.
+ *------------------------------------------------------------------------------*/
+#if PPC_ASM == PPC_ASM_ELF
+ .section .entry
+#else
+ .csect .text[PR]
+#endif
+
+ PUBLIC_VAR (download_entry)
+SYM(download_entry):
+ bl .startup
+base_addr:
+
+/*-------------------------------------------------------------------------------
+ * Parameters from linker
+ *------------------------------------------------------------------------------*/
+toc_pointer:
+#if PPC_ASM == PPC_ASM_ELF
+ .long s.got
+#else
+ .long TOC[tc0]
+#endif
+bss_length:
+ .long bss.size
+bss_addr:
+ .long bss.start
+/*-------------------------------------------------------------------------------
+ * Reset_entry.
+ *------------------------------------------------------------------------------*/
+.startup:
+ /* Get start address, stack grows down from here... */
+ mflr r1
+
+ /* Assume Bank regs set up..., cache etc. */
+ bl bssclr
+
+ /*-----------------------------------------------------------------------
+ * C_setup.
+ *----------------------------------------------------------------------*/
+ lwz r2,toc_pointer-base_addr(r1) /* set r2 to toc */
+ addi r1,r1,-56-4 /* start stack at text_addr - 56 */
+ addi r3,r0,0x0 /* clear r3 */
+ stw r3, 0(r1) /* Clear stack chain */
+ stw r3, 4(r1)
+ stw r3, 8(r1)
+ stw r3, 12(r1)
+ .extern SYM (main)
+ b SYM (main) /* call the first C routine */
+
+/*-------------------------------------------------------------------------------
+ * bssclr.
+ *------------------------------------------------------------------------------*/
+bssclr:
+ /*-----------------------------------------------------------------------
+ * Data move finished, zero out bss.
+ *----------------------------------------------------------------------*/
+ lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */
+ lwz r3,bss_length-base_addr(r1) /* bss length */
+ rlwinm. r3,r3,30,0x3FFFFFFF /* form length/4 */
+ beqlr /* no bss */
+ mtctr r3 /* set ctr reg */
+ xor r6,r6,r6 /* r6 = 0 */
+clear_bss:
+ stswi r6,r2,0x4 /* store r6 */
+ addi r3,r2,0x4 /* update r2 */
+ bdnz clear_bss /* decrement counter and loop */
+ blr /* return */
+.L_text_e:
+
+#if PPC_ABI == PPC_ABI_POWEROPEN
+ DESCRIPTOR (startup)
+#endif
diff --git a/c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s b/c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s
new file mode 100644
index 0000000000..a6a8f5ff86
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s
@@ -0,0 +1,289 @@
+/* dlentry.s 1.0 - 95/08/08
+ *
+ * This file contains the entry veneer for RTEMS programs
+ * stored in Papyrus' flash ROM.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+/*
+ * The Papyrus ELF link scripts support three special sections:
+ * .entry The actual entry point, this must contain less
+ * than 256 bytes of code/data to fit below the
+ * .vectors section. This always preceeds any other
+ * code or data.
+ * .vectors The section containing the interrupt entry veneers.
+ * .entry2 Any code overflowing from .entry
+ * .descriptors The PowerOpen function indirection blocks.
+ */
+
+/*
+ * Flash sections are linked in the following order:
+ * .entry
+ * .vectors
+ * .entry2
+ * .text
+ * .descriptors
+ * .data
+ * .bss
+ * usually starting from 0xFFF00000.
+ *
+ * The initial stack is set to run BELOW the final location of
+ * the initialised data.
+ *
+ * All the entry veneer has to do is to copy the initialised data
+ * to its final location and clear the BSS.
+ */
+
+/*
+ * GDB likes to have debugging information for the entry veneer.
+ * Here is some DWARF information.
+ */
+
+#if PPC_ASM == PPC_ASM_ELF
+ .section .entry,"ax",@progbits
+.L_text_b:
+.L_LC1:
+ .previous
+
+.section .debug_sfnames
+.L_sfnames_b:
+ .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/flashentry/"
+ .byte 0
+.L_F0:
+ .byte "flashentry.s"
+ .byte 0
+ .previous
+
+.section .line
+.L_line_b:
+ .4byte .L_line_e-.L_line_b
+ .4byte .L_text_b
+.L_LE1:
+.L_line_last:
+ .4byte 0x0
+ .2byte 0xffff
+ .4byte .L_text_e-.L_text_b
+.L_line_e:
+ .previous
+
+.section .debug_srcinfo
+.L_srcinfo_b:
+ .4byte .L_line_b
+ .4byte .L_sfnames_b
+ .4byte .L_text_b
+ .4byte .L_text_e
+ .4byte 0xffffffff
+ .4byte .L_LE1-.L_line_b
+ .4byte .L_F0-.L_sfnames_b
+ .4byte .L_line_last-.L_line_b
+ .4byte 0xffffffff
+ .previous
+
+.section .debug_pubnames
+ .4byte .L_debug_b
+ .4byte .L_P0
+ .byte "flash_entry"
+ .byte 0
+ .4byte 0x0
+ .byte 0
+ .previous
+
+.section .debug_aranges
+ .4byte .L_debug_b
+ .4byte .L_text_b
+ .4byte .L_text_e-.L_text_b
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0
+ .4byte 0x0
+ .4byte 0x0
+ .previous
+
+.section .debug
+.L_debug_b:
+.L_D1:
+ .4byte .L_D1_e-.L_D1
+ .2byte 0x11 /* TAG_compile_unit */
+ .2byte 0x12 /* AT_sibling */
+ .4byte .L_D2
+ .2byte 0x38 /* AT_name */
+ .byte "flashentry.s"
+ .byte 0
+ .2byte 0x258 /* AT_producer */
+ .byte "GAS 2.5.2"
+ .byte 0
+ .2byte 0x111 /* AT_low_pc */
+ .4byte .L_text_b
+ .2byte 0x121 /* AT_high_pc */
+ .4byte .L_text_e
+ .2byte 0x106 /* AT_stmt_list */
+ .4byte .L_line_b
+ .2byte 0x1b8 /* AT_comp_dir */
+ .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/dlentry/"
+ .byte 0
+ .2byte 0x8006 /* AT_sf_names */
+ .4byte .L_sfnames_b
+ .2byte 0x8016 /* AT_src_info */
+ .4byte .L_srcinfo_b
+.L_D1_e:
+.L_P0:
+.L_D3:
+ .4byte .L_D3_e-.L_D3
+ .2byte 0x6 /* TAG_global_subroutine */
+ .2byte 0x12 /* AT_sibling */
+ .4byte .L_D4
+ .2byte 0x38 /* AT_name */
+ .byte "flash_entry"
+ .byte 0
+ .2byte 0x278 /* AT_prototyped */
+ .byte 0
+ .2byte 0x111 /* AT_low_pc */
+ .4byte .L_text_b
+ .2byte 0x121 /* AT_high_pc */
+ .4byte .L_text_e
+ .2byte 0x8041 /* AT_body_begin */
+ .4byte .L_text_b
+ .2byte 0x8051 /* AT_body_end */
+ .4byte .L_text_e
+.L_D3_e:
+
+.L_D4:
+ .4byte .L_D4_e-.L_D4
+ .align 2
+.L_D4_e:
+.L_D2:
+ .previous
+#endif
+
+/*-------------------------------------------------------------------------------
+ * ROM Vector area.
+ *------------------------------------------------------------------------------*/
+#if PPC_ASM == PPC_ASM_ELF
+ .section .entry
+#else
+ .csect .text[PR]
+#endif
+ PUBLIC_VAR (flash_entry)
+SYM (flash_entry):
+ bl .startup
+base_addr:
+
+/*-------------------------------------------------------------------------------
+ * Parameters from linker
+ *------------------------------------------------------------------------------*/
+toc_pointer:
+#if PPC_ASM == PPC_ASM_ELF
+ .long s.got
+#else
+ .long TOC[tc0]
+#endif
+text_length:
+ .long t.size
+text_addr:
+ .long t.start
+data_length:
+ .long copy.size
+data_addr:
+ .long copy.dest
+bss_length:
+ .long bss.size
+bss_addr:
+ .long bss.start
+
+/*-------------------------------------------------------------------------------
+ * Reset_entry.
+ *------------------------------------------------------------------------------*/
+.startup:
+ /* Get start address */
+ mflr r1
+
+ /* Assume Bank regs set up..., cache etc. */
+
+ /*-----------------------------------------------------------------------
+ * Check the DRAM where STACK+ DATA+ BBS will be placed. If this is OK
+ * we will return here.
+ *----------------------------------------------------------------------*/
+ bl rom2ram
+ /*-----------------------------------------------------------------------
+ * Enable two 128MB cachable regions.
+ *----------------------------------------------------------------------*/
+ addis r2,r0,0x8000
+ addi r2,r2,0x0001
+
+ mtspr 0x3fb, r2 /* ICCR */
+ mtspr 0x3fa, r2 /* DCCR */
+
+ /*-----------------------------------------------------------------------
+ * C_setup.
+ *----------------------------------------------------------------------*/
+ lwz r2,toc_pointer-base_addr(r1) /* set r2 to toc */
+ lwz r1,data_addr-base_addr(r1) /* set r1 to data_addr */
+ addi r1,r1,-56 /* start stack at data_addr - 56 */
+ addi r3,r0,0x0 /* clear r3 */
+ stw r3, 0(r1) /* Clear stack chain */
+ stw r3, 4(r1)
+ stw r3, 8(r1)
+ stw r3, 12(r1)
+ .extern SYM (main)
+ b SYM (main) /* call the first C routine */
+
+/*-------------------------------------------------------------------------------
+ * Rom2ram.
+ *------------------------------------------------------------------------------*/
+rom2ram:
+ lwz r2,data_addr-base_addr(r1) /* start of data set by loader */
+ lwz r3,data_length-base_addr(r1) /* data length */
+ rlwinm r3,r3,30,0x3FFFFFFF /* form length/4 */
+ mtctr r3 /* set ctr reg */
+ /*-----------------------------------------------------------------------
+ * Calculate offset of data in image.
+ *----------------------------------------------------------------------*/
+ lwz r5,text_length-base_addr(r1) /* get text length */
+ lwz r4,text_addr-base_addr(r1) /* get text length */
+ add r4,r4,r5 /* r4 = data pointer */
+move_data:
+ lswi r6,r4,0x4 /* load r6 */
+ stswi r6,r2,0x4 /* store r6 */
+ addi r4,r4,0x4 /* update r4 */
+ addi r2,r2,0x4 /* update r2 */
+ bdnz move_data /* decrement counter and loop */
+ /*-----------------------------------------------------------------------
+ * Data move finished, zero out bss.
+ *----------------------------------------------------------------------*/
+ lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */
+ lwz r3,bss_length-base_addr(r1) /* bss length */
+ rlwinm. r3,r3,30,0x3FFFFFFF /* form length/4 */
+ beqlr /* no bss */
+ mtctr r3 /* set ctr reg */
+ xor r6,r6,r6 /* r6 = 0 */
+clear_bss:
+ stswi r6,r2,0x4 /* store r6 */
+ addi r3,r2,0x4 /* update r2 */
+ bdnz clear_bss /* decrement counter and loop */
+ blr /* return */
+.L_text_e:
+
+#if PPC_ABI == PPC_ABI_POWEROPEN
+ DESCRIPTOR (startup)
+#endif
diff --git a/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h b/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h
new file mode 100644
index 0000000000..4025a8796e
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h
@@ -0,0 +1,154 @@
+/* bsp.h
+ *
+ * This include file contains all Papyrus board IO definitions.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PAPYRUS_h
+#define __PAPYRUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef ASM
+/* Definition of where to store registers in alignment handler */
+#define ALIGN_REGS 0x0140
+
+#else
+#include <rtems.h>
+#include <console.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+
+/*
+ * Stuff for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), PPC_IRQ_SCALL, 1 )
+
+#define Cause_tm27_intr() asm volatile ("sc")
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr()
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define delay( microseconds ) \
+ { \
+ unsigned32 start, ticks, now; \
+ asm volatile ("mfspr %0, 0x3dd" : "=r" (start)); /* TBLO */ \
+ ticks = (microseconds) * Cpu_table.clicks_per_usec; \
+ do \
+ asm volatile ("mfspr %0, 0x3dd" : "=r" (now)); /* TBLO */ \
+ while (now - start < ticks); \
+ }
+
+
+/* Constants */
+
+#define RAM_START 0
+#define RAM_END 0x00200000
+
+
+/* Some useful LED debugging bits */
+/* LED numbers are from 0-2 */
+#define __led_base ((volatile int *)0x7F200000)
+
+/* Turn a LED on */
+#define led_on(n) (__led_base[n] = 0)
+
+/* Turn a LED off */
+#define led_off(n) (__led_base[n] = 1)
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+int bsp_start(
+ int argc,
+ char **argv,
+ char **environp
+);
+
+void bsp_cleanup( void );
+
+rtems_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+);
+#endif /* ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/powerpc/papyrus/include/coverhd.h b/c/src/lib/libbsp/powerpc/papyrus/include/coverhd.h
new file mode 100644
index 0000000000..71684ad0d5
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/include/coverhd.h
@@ -0,0 +1,135 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * Updated for a 25MHz Papyrus by Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * Units are 100ns.
+ *
+ * These numbers are of questionable use, as they are developed by calling
+ * the routine many times, thus getting its entry veneer into the (small)
+ * cache on the 403GA. This in general is not true of the RTEMS timing
+ * tests, which usually call a routine only once, thus having no cache loaded
+ * advantage.
+ *
+ * Whether the directive times are useful after deducting the function call
+ * overhead is also questionable. The user is more interested generally
+ * in the total cost of a directive, not the cost if the procedure call
+ * is inlined! (In general this is not true).
+ *
+ * Andrew Bray 18/08/1995
+ *
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 1
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 1
+#define CALLING_OVERHEAD_TASK_START 1
+#define CALLING_OVERHEAD_TASK_RESTART 1
+#define CALLING_OVERHEAD_TASK_DELETE 1
+#define CALLING_OVERHEAD_TASK_SUSPEND 1
+#define CALLING_OVERHEAD_TASK_RESUME 1
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 1
+#define CALLING_OVERHEAD_TASK_MODE 1
+#define CALLING_OVERHEAD_TASK_GET_NOTE 1
+#define CALLING_OVERHEAD_TASK_SET_NOTE 1
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 1
+#define CALLING_OVERHEAD_CLOCK_GET 4
+#define CALLING_OVERHEAD_CLOCK_SET 3
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+
+#define CALLING_OVERHEAD_TIMER_CREATE 1
+#define CALLING_OVERHEAD_TIMER_IDENT 1
+#define CALLING_OVERHEAD_TIMER_DELETE 1
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
+#define CALLING_OVERHEAD_TIMER_RESET 1
+#define CALLING_OVERHEAD_TIMER_CANCEL 1
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 2
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 1
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 1
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 1
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 1
+
+#define CALLING_OVERHEAD_EVENT_SEND 1
+#define CALLING_OVERHEAD_EVENT_RECEIVE 2
+#define CALLING_OVERHEAD_SIGNAL_CATCH 1
+#define CALLING_OVERHEAD_SIGNAL_SEND 1
+#define CALLING_OVERHEAD_PARTITION_CREATE 3
+#define CALLING_OVERHEAD_PARTITION_IDENT 1
+#define CALLING_OVERHEAD_PARTITION_DELETE 1
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 1
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 1
+#define CALLING_OVERHEAD_REGION_CREATE 3
+#define CALLING_OVERHEAD_REGION_IDENT 1
+#define CALLING_OVERHEAD_REGION_DELETE 1
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 2
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 1
+#define CALLING_OVERHEAD_PORT_CREATE 2
+#define CALLING_OVERHEAD_PORT_IDENT 1
+#define CALLING_OVERHEAD_PORT_DELETE 1
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 1
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 2
+#define CALLING_OVERHEAD_IO_OPEN 2
+#define CALLING_OVERHEAD_IO_CLOSE 2
+#define CALLING_OVERHEAD_IO_READ 2
+#define CALLING_OVERHEAD_IO_WRITE 2
+#define CALLING_OVERHEAD_IO_CONTROL 2
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 1
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/bspclean.c b/c/src/lib/libbsp/powerpc/papyrus/startup/bspclean.c
new file mode 100644
index 0000000000..eab849d5e1
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/bspclean.c
@@ -0,0 +1,44 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+ rtems_fatal_error_occurred(0);
+}
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
new file mode 100644
index 0000000000..9358e77ee8
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
@@ -0,0 +1,276 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_libc_init()
+{
+ extern int _end;
+ rtems_unsigned32 heap_start;
+
+ heap_start = (rtems_unsigned32) &_end;
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * The last parameter to RTEMS_Malloc_Initialize is the "chunk"
+ * size which a multiple of will be requested on each sbrk()
+ * call by malloc(). A value of 0 indicates that sbrk() should
+ * not be called to extend the heap.
+ */
+
+ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
+int bsp_start(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+
+ /*
+ * Copy the Configuration Table .. so we can change it
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add 1 extension for stack checker
+ */
+
+#ifdef STACK_CHECKER_ON
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Need to "allocate" the memory for the RTEMS Workspace and
+ * tell the RTEMS configuration where it is. This memory is
+ * not malloc'ed. It is just "pulled from the air".
+ */
+
+ BSP_Configuration.work_space_start = (void *)
+ RAM_END - BSP_Configuration.work_space_size;
+
+ /*
+ * initialize the CPU table for this BSP
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4 * 1024;
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Don't forget the other CPU Table entries.
+ */
+
+ Cpu_table.clicks_per_usec = 10;
+
+ Cpu_table.serial_per_sec = 10000000;
+
+ Cpu_table.serial_external_clock = 1;
+
+ Cpu_table.serial_xon_xoff = 0;
+
+ Cpu_table.serial_cts_rts = 1;
+
+ Cpu_table.serial_rate = 9600;
+
+ Cpu_table.timer_average_overhead = 2;
+
+ Cpu_table.timer_least_valid = 3;
+
+ /*
+ * Start RTEMS
+ */
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+
+ bsp_cleanup();
+}
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/linkcmds b/c/src/lib/libbsp/powerpc/papyrus/startup/linkcmds
new file mode 100644
index 0000000000..df1997639f
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/linkcmds
@@ -0,0 +1,77 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the Papyrus.
+ *
+ * $Id$
+ */
+
+OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
+ "elf32-powerpc")
+OUTPUT_ARCH(powerpc)
+ SEARCH_DIR(/usr/local/powerpc-rtems/lib);
+
+ENTRY(download_entry)
+
+MEMORY
+ {
+ RAM : ORIGIN = 0, LENGTH = 4M
+ FLASH : ORIGIN = 0xFF000000, LENGTH = 0x80000
+ EPROM : ORIGIN = 0xFFFE0000, LENGTH = 0x20000
+ }
+
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; */
+SECTIONS
+{
+ .vectors 0x0100 :
+ {
+ *(.vectors)
+ }
+
+ .text 0x20000 :
+ {
+ *(.entry)
+ *(.entry2)
+ *(.text)
+ *(.rodata)
+ *(.rodata1)
+ *(.descriptors)
+ *(rom_ver)
+ } > RAM
+
+ /* R/W Data */
+ .data :
+ {
+ *(.data)
+ *(.data1)
+ } > RAM
+
+ .got :
+ {
+ s.got = .;
+ *(.got.plt) *(.got)
+ } > RAM
+
+ .bss :
+ {
+ bss.start = .;
+ *(.bss) *(.sbss) *(COMMON)
+ bss.end = ALIGN(4);
+ } > RAM
+
+ bss.size = bss.end - bss.start;
+ PROVIDE(_end = bss.end);
+
+ .line 0 : { *(.line) }
+ .debug 0 : { *(.debug) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_aregion 0 : { *(.debug_aregion) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+}
+
+
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/setvec.c b/c/src/lib/libbsp/powerpc/papyrus/startup/setvec.c
new file mode 100644
index 0000000000..efb3e9d8e0
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/setvec.c
@@ -0,0 +1,58 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the target Board/CPU.
+ * This routine is allowed to be as board dependent as necessary.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+rtems_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ rtems_isr_entry previous_isr;
+
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+
+ return previous_isr;
+}
+
diff --git a/c/src/lib/libbsp/powerpc/papyrus/times b/c/src/lib/libbsp/powerpc/papyrus/times
new file mode 100644
index 0000000000..da260853bf
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/papyrus/times
@@ -0,0 +1,197 @@
+#
+# Timing Test Suite Results for the Papyrus BSP
+#
+# NOTE: The Papyrus is a proprietary PPC403 based board. But it is the
+# only BSP currently available for the PowerPC family.
+#
+# $Id$
+#
+
+NOTE: This BSP is user submitted and no timing information
+ is currently avaiable.
+
+Board: Papyrus
+CPU: IBM 403GA
+Clock Speed: 33 Mhz
+Memory Configuration: SRAM, DRAM, cache, etc
+Wait States:
+
+Times Reported in: cycles, microseconds, etc
+Timer Source: Count Down Timer, on-CPU cycle counter, etc
+
+Column A: unused
+Column B: unused
+
+# DESCRIPTION A B
+== ================================================================= ==== ====
+ 1 rtems_semaphore_create 20
+ rtems_semaphore_delete 21
+ rtems_semaphore_obtain: available 15
+ rtems_semaphore_obtain: not available -- NO_WAIT 15
+ rtems_semaphore_release: no waiting tasks 16
+
+ 2 rtems_semaphore_obtain: not available -- caller blocks 62
+
+ 3 rtems_semaphore_release: task readied -- preempts caller 55
+
+ 4 rtems_task_restart: blocked task -- preempts caller 77
+ rtems_task_restart: ready task -- preempts caller 70
+ rtems_semaphore_release: task readied -- returns to caller 25
+ rtems_task_create 57
+ rtems_task_start 31
+ rtems_task_restart: suspended task -- returns to caller 36
+ rtems_task_delete: suspended task 47
+ rtems_task_restart: ready task -- returns to caller 37
+ rtems_task_restart: blocked task -- returns to caller 46
+ rtems_task_delete: blocked task 50
+
+ 5 rtems_task_suspend: calling task 51
+ rtems_task_resume: task readied -- preempts caller 49
+
+ 6 rtems_task_restart: calling task 59
+ rtems_task_suspend: returns to caller 18
+ rtems_task_resume: task readied -- returns to caller 19
+ rtems_task_delete: ready task 50
+
+ 7 rtems_task_restart: suspended task -- preempts caller 70
+
+ 8 rtems_task_set_priority: obtain current priority 12
+ rtems_task_set_priority: returns to caller 27
+ rtems_task_mode: obtain current mode 5
+ rtems_task_mode: no reschedule 5
+ rtems_task_mode: reschedule -- returns to caller 8
+ rtems_task_mode: reschedule -- preempts caller 39
+ rtems_task_set_note 13
+ rtems_task_get_note 13
+ rtems_clock_set 33
+ rtems_clock_get 3
+
+ 9 rtems_message_queue_create 110
+ rtems_message_queue_send: no waiting tasks 37
+ rtems_message_queue_urgent: no waiting tasks 37
+ rtems_message_queue_receive: available 31
+ rtems_message_queue_flush: no messages flushed 12
+ rtems_message_queue_flush: messages flushed 16
+ rtems_message_queue_delete 26
+
+10 rtems_message_queue_receive: not available -- NO_WAIT 15
+ rtems_message_queue_receive: not available -- caller blocks 62
+
+11 rtems_message_queue_send: task readied -- preempts caller 72
+
+12 rtems_message_queue_send: task readied -- returns to caller 39
+
+13 rtems_message_queue_urgent: task readied -- preempts caller 72
+
+14 rtems_message_queue_urgent: task readied -- returns to caller 39
+
+15 rtems_event_receive: obtain current events 1
+ rtems_event_receive: not available -- NO_WAIT 12
+ rtems_event_receive: not available -- caller blocks 56
+ rtems_event_send: no task readied 12
+ rtems_event_receive: available 12
+ rtems_event_send: task readied -- returns to caller 24
+
+16 rtems_event_send: task readied -- preempts caller 55
+
+17 rtems_task_set_priority: preempts caller 62
+
+18 rtems_task_delete: calling task 83
+
+19 rtems_signal_catch 9
+ rtems_signal_send: returns to caller 15
+ rtems_signal_send: signal to self 18
+ exit ASR overhead: returns to calling task 22
+ exit ASR overhead: returns to preempting task 49
+
+20 rtems_partition_create 35
+ rtems_region_create 23
+ rtems_partition_get_buffer: available 15
+ rtems_partition_get_buffer: not available 13
+ rtems_partition_return_buffer 18
+ rtems_partition_delete 16
+ rtems_region_get_segment: available 22
+ rtems_region_get_segment: not available -- NO_WAIT 21
+ rtems_region_return_segment: no waiting tasks 19
+ rtems_region_get_segment: not available -- caller blocks 64
+ rtems_region_return_segment: task readied -- preempts caller 74
+ rtems_region_return_segment: task readied -- returns to caller 44
+ rtems_region_delete 16
+ rtems_io_initialize 2
+ rtems_io_open 1
+ rtems_io_close 1
+ rtems_io_read 1
+ rtems_io_write 1
+ rtems_io_control 1
+
+21 rtems_task_ident 149
+ rtems_message_queue_ident 145
+ rtems_semaphore_ident 156
+ rtems_partition_ident 145
+ rtems_region_ident 148
+ rtems_port_ident 145
+ rtems_timer_ident 145
+ rtems_rate_monotonic_ident 145
+
+22 rtems_message_queue_broadcast: task readied -- returns to caller 42
+ rtems_message_queue_broadcast: no waiting tasks 17
+ rtems_message_queue_broadcast: task readied -- preempts caller 78
+
+23 rtems_timer_create 14
+ rtems_timer_fire_after: inactive 22
+ rtems_timer_fire_after: active 24
+ rtems_timer_cancel: active 15
+ rtems_timer_cancel: inactive 13
+ rtems_timer_reset: inactive 21
+ rtems_timer_reset: active 23
+ rtems_timer_fire_when: inactive 34
+ rtems_timer_fire_when: active 34
+ rtems_timer_delete: active 19
+ rtems_timer_delete: inactive 17
+ rtems_task_wake_when 69
+
+24 rtems_task_wake_after: yield -- returns to caller 9
+ rtems_task_wake_after: yields -- preempts caller 45
+
+25 rtems_clock_tick 4
+
+26 _ISR_Disable 0
+ _ISR_Flash 1
+ _ISR_Enable 1
+ _Thread_Disable_dispatch 0
+ _Thread_Enable_dispatch 7
+ _Thread_Set_state 11
+ _Thread_Disptach (NO FP) 31
+ context switch: no floating point contexts 21
+ context switch: self 10
+ context switch: to another task 10
+ context switch: restore 1st FP task 25
+ fp context switch: save idle, restore idle 31
+ fp context switch: save idle, restore initialized 19
+ fp context switch: save initialized, restore initialized 20
+ _Thread_Resume 7
+ _Thread_Unblock 7
+ _Thread_Ready 9
+ _Thread_Get 4
+ _Semaphore_Get 2
+ _Thread_Get: invalid id 0
+
+27 interrupt entry overhead: returns to interrupted task 6
+ interrupt exit overhead: returns to interrupted task 6
+ interrupt entry overhead: returns to nested interrupt 6
+ interrupt exit overhead: returns to nested interrupt 5
+ interrupt entry overhead: returns to preempting task 7
+ interrupt exit overhead: returns to preempting task 36
+
+28 rtems_port_create 16
+ rtems_port_external_to_internal 11
+ rtems_port_internal_to_external 11
+ rtems_port_delete 16
+
+29 rtems_rate_monotonic_create 15
+ rtems_rate_monotonic_period: initiate period -- returns to caller 21
+ rtems_rate_monotonic_period: obtain status 13
+ rtems_rate_monotonic_cancel 16
+ rtems_rate_monotonic_delete: inactive 18
+ rtems_rate_monotonic_delete: active 20
+ rtems_rate_monotonic_period: conclude periods -- caller blocks 53
diff --git a/c/src/lib/libbsp/shmdr/README b/c/src/lib/libbsp/shmdr/README
new file mode 100644
index 0000000000..5ed9e861b0
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+The mpci.h file provided in here is too simple for an MPCI with
+multiple ways to get to a node.
+
+This version of the shm driver needs to be reorganized to follow
+the better model of the Ada version.
diff --git a/c/src/lib/libbsp/shmdr/addlq.c b/c/src/lib/libbsp/shmdr/addlq.c
new file mode 100644
index 0000000000..2c2529c834
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/addlq.c
@@ -0,0 +1,43 @@
+/* void Shm_Locked_queue_Add( lq_cb, ecb )
+ *
+ * This routine adds an envelope control block to a shared memory queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to a locked queue control block
+ * ecb - pointer to an envelope control block
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Locked_queue_Add(
+ Shm_Locked_queue_Control *lq_cb,
+ Shm_Envelope_control *ecb
+)
+{
+ rtems_unsigned32 index;
+
+ ecb->next = Shm_Locked_queue_End_of_list;
+ ecb->queue = lq_cb->owner;
+ index = ecb->index;
+
+ Shm_Lock( lq_cb );
+ if ( Shm_Convert(lq_cb->front) != Shm_Locked_queue_End_of_list )
+ Shm_Envelopes[ Shm_Convert(lq_cb->rear) ].next = index;
+ else
+ lq_cb->front = index;
+ lq_cb->rear = index;
+ Shm_Unlock( lq_cb );
+}
diff --git a/c/src/lib/libbsp/shmdr/cnvpkt.c b/c/src/lib/libbsp/shmdr/cnvpkt.c
new file mode 100644
index 0000000000..2c3a144167
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/cnvpkt.c
@@ -0,0 +1,42 @@
+/* void Shm_Convert_packet( &packet )
+ *
+ * This routine is the shared memory locked queue MPCI driver routine
+ * used to convert the RTEMS's information in a packet from non-native
+ * format to processor native format.
+ *
+ * Input parameters:
+ * packet - pointer to a packet
+ *
+ * Output parameters:
+ * *packet - packet in native format
+ *
+ * NOTE: Message buffers are not manipulated.
+ * Endian conversion is currently the only conversion.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Convert_packet(
+ rtems_packet_prefix *packet
+)
+{
+ rtems_unsigned32 *pkt, i;
+
+ pkt = (rtems_unsigned32 *) packet;
+ for ( i=RTEMS_MINIMUN_HETERO_CONVERSION ; i ; i--, pkt++ )
+ *pkt = CPU_swap_u32( *pkt );
+
+ for ( i=packet->to_convert ; i ; i--, pkt++ )
+ *pkt = CPU_swap_u32( *pkt );
+}
diff --git a/c/src/lib/libbsp/shmdr/dump.c b/c/src/lib/libbsp/shmdr/dump.c
new file mode 100644
index 0000000000..dc02961138
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/dump.c
@@ -0,0 +1,49 @@
+/*
+ * This routine is invoked following a reset to report the statistics
+ * gathered during the previous execution.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+
+#include "shm.h"
+
+void
+Shm_Print_statistics(void)
+{
+ rtems_unsigned32 ticks;
+ rtems_unsigned32 ticks_per_second;
+ rtems_unsigned32 seconds;
+ int packets_per_second;
+
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks );
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
+
+ seconds = ticks / ticks_per_second;
+
+ packets_per_second = Shm_Receive_message_count / seconds;
+ if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) )
+ packets_per_second++;
+
+ printf( "\n\nSHMDR STATISTICS (NODE %d)\n", Shm_Local_node );
+ printf( "TICKS SINCE BOOT = %d\n", ticks );
+ printf( "TICKS PER SECOND = %d\n", ticks_per_second );
+ printf( "ISRs=%d\n", Shm_Interrupt_count );
+ printf( "RECV=%d\n", Shm_Receive_message_count );
+ printf( "NULL=%d\n", Shm_Null_message_count );
+ printf( "PKTS/SEC=%d\n", packets_per_second );
+}
diff --git a/c/src/lib/libbsp/shmdr/fatal.c b/c/src/lib/libbsp/shmdr/fatal.c
new file mode 100644
index 0000000000..b36ff8da41
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/fatal.c
@@ -0,0 +1,39 @@
+/* void MPCI_Fatal( error )
+ *
+ * This routine is the shared memory driver fatal error handler.
+ *
+ * Input parameters:
+ * error - fatal error code
+ *
+ * Output parameters: NEVER RETURNS
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void MPCI_Fatal(
+ Internal_errors_Source source,
+ boolean is_internal,
+ rtems_unsigned32 error
+)
+{
+ /* Eventually need to attempt to broadcast a K_FATAL message
+ * without checking for all possible errors (do not want to
+ * recurse).
+ *
+ * Also need to avoid using Shm_Node_statuses if the driver has not been
+ * initialized.
+ */
+
+ Shm_Local_node_status->error = Shm_Convert(error);
+}
diff --git a/c/src/lib/libbsp/shmdr/getlq.c b/c/src/lib/libbsp/shmdr/getlq.c
new file mode 100644
index 0000000000..efc7b0996c
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/getlq.c
@@ -0,0 +1,48 @@
+/* Shm_Envelope_control *Shm_Locked_queue_Get( lq_cb )
+ *
+ * This routine returns an envelope control block from a shared
+ * memory queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to a locked queue control block
+ *
+ * Output parameters:
+ * returns - pointer to an envelope control block
+ * - NULL if no envelopes on specified queue
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <shm.h>
+
+Shm_Envelope_control *Shm_Locked_queue_Get(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ Shm_Envelope_control *tmp_ecb;
+ rtems_unsigned32 tmpfront;
+
+ tmp_ecb = NULL;
+ Shm_Lock( lq_cb );
+
+ tmpfront = Shm_Convert(lq_cb->front);
+ if ( tmpfront != Shm_Locked_queue_End_of_list ) {
+ tmp_ecb = &Shm_Envelopes[ tmpfront ];
+ lq_cb->front = tmp_ecb->next;
+ if ( tmp_ecb->next == Shm_Locked_queue_End_of_list )
+ lq_cb->rear = Shm_Locked_queue_End_of_list;
+ tmp_ecb->next = Shm_Locked_queue_Not_on_list;
+ }
+
+ Shm_Unlock( lq_cb );
+ return( tmp_ecb );
+}
diff --git a/c/src/lib/libbsp/shmdr/getpkt.c b/c/src/lib/libbsp/shmdr/getpkt.c
new file mode 100644
index 0000000000..c80b3ed282
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/getpkt.c
@@ -0,0 +1,36 @@
+/* Shm_Get_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver
+ * routine used to obtain an empty message packet.
+ *
+ * Input parameters:
+ * packet - address of pointer to packet
+ *
+ * Output parameters:
+ * *(cpb->get_packet) - address of allocated packet
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **packet
+)
+{
+ Shm_Envelope_control *ecb;
+
+ ecb = Shm_Allocate_envelope();
+ if ( !ecb )
+ rtems_fatal_error_occurred ( SHM_NO_FREE_PKTS );
+ *packet = Shm_Envelope_control_to_packet_prefix_pointer( ecb );
+}
diff --git a/c/src/lib/libbsp/shmdr/init.c b/c/src/lib/libbsp/shmdr/init.c
new file mode 100644
index 0000000000..a553e4ff9b
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/init.c
@@ -0,0 +1,254 @@
+/* Shm_Initialization
+ *
+ * This routine is the shared memory communications initerface
+ * driver initialization routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define _SHM_INIT
+
+#include <rtems.h>
+#include <shm.h>
+
+#include <string.h> /* memset() */
+#include <stdlib.h> /* malloc() */
+#include <assert.h>
+
+/*
+ * User extension to install MPCI_Fatal as a fatal error
+ * handler extension
+ */
+
+rtems_extensions_table MPCI_Shm_extensions;
+
+rtems_mpci_entry Shm_Initialization( void )
+
+{
+ rtems_unsigned32 i, all_initialized;
+ rtems_unsigned32 interrupt_cause, interrupt_value;
+ void *interrupt_address;
+ Shm_Node_status_control *nscb;
+ rtems_unsigned32 extension_id; /* for installation of MPCI_Fatal */
+ rtems_unsigned32 remaining_memory;
+/* XXX these should use "public" methods to set their values.... */
+ rtems_configuration_table *configuration = _Configuration_Table;
+ rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table;
+
+ Shm_RTEMS_Configuration = configuration;
+ Shm_RTEMS_MP_Configuration = mp_configuration;
+
+ Shm_Local_node = Shm_RTEMS_MP_Configuration->node;
+ Shm_Maximum_nodes = Shm_RTEMS_MP_Configuration->maximum_nodes;
+
+ Shm_Get_configuration( Shm_Local_node, &Shm_Configuration );
+
+ Shm_Interrupt_table = (Shm_Interrupt_information *) malloc(
+ sizeof(Shm_Interrupt_information) * (Shm_Maximum_nodes + 1)
+ );
+
+ assert( Shm_Interrupt_table );
+
+
+ Shm_Receive_message_count = 0;
+ Shm_Null_message_count = 0;
+ Shm_Interrupt_count = 0;
+
+ /*
+ * Set the Node Status indicators
+ */
+
+ Shm_Pending_initialization =
+ Shm_Convert(rtems_build_name( 'P', 'E', 'N', 'D' ));
+ Shm_Initialization_complete =
+ Shm_Convert(rtems_build_name( 'C', 'O', 'M', 'P' ));
+ Shm_Active_node =
+ Shm_Convert(rtems_build_name( 'A', 'C', 'T', 'V' ));
+
+ /*
+ * Initialize the constants used by the Locked Queue code.
+ */
+
+ Shm_Locked_queue_End_of_list = Shm_Convert( 0xffffffff );
+ Shm_Locked_queue_Not_on_list = Shm_Convert( 0xfffffffe );
+
+ /*
+ * Set the base addresses for the:
+ * + Node Status Table
+ * + Free Pool and Receive Queues
+ * + Envelopes
+ */
+
+ Shm_Node_statuses = (Shm_Node_status_control *) START_NS_CBS;
+ Shm_Locked_queues = (Shm_Locked_queue_Control *) START_LQ_CBS;
+ Shm_Envelopes = (Shm_Envelope_control *) START_ENVELOPES;
+
+ /*
+ * Calculate the maximum number of envelopes which can be
+ * placed the remaining shared memory.
+ */
+
+ remaining_memory =
+ ((void *)Shm_Configuration->base + Shm_Configuration->length) -
+ ((void *)Shm_Envelopes);
+
+ Shm_Maximum_envelopes = remaining_memory / sizeof( Shm_Envelope_control );
+ Shm_Maximum_envelopes -= 1;
+
+ /*
+ * Set the pointer to the receive queue for the local node.
+ * When we receive a node, we will get it from here before
+ * processing it.
+ */
+
+ Shm_Local_receive_queue = &Shm_Locked_queues[ Shm_Local_node ];
+ Shm_Local_node_status = &Shm_Node_statuses[ Shm_Local_node ];
+
+ /*
+ * Convert local interrupt cause information into the
+ * neutral format so other nodes will be able to
+ * understand it.
+ */
+
+ interrupt_address =
+ (void *) Shm_Convert( (rtems_unsigned32)Shm_Configuration->Intr.address );
+ interrupt_value = Shm_Convert( Shm_Configuration->Intr.value );
+ interrupt_cause = Shm_Convert( Shm_Configuration->Intr.length );
+
+ if ( Shm_Configuration->poll_intr == POLLED_MODE ) Shm_setclockvec();
+ else Shm_setvec();
+
+ if ( Shm_Is_master_node() ) {
+
+ /*
+ * Zero out the shared memory area.
+ */
+
+ (void) memset(
+ (void *) Shm_Configuration->base,
+ 0,
+ Shm_Configuration->length
+ );
+
+ /*
+ * Initialize all of the locked queues (the free envelope
+ * pool and a receive queue per node) and set all of the
+ * node's status so they will be waiting to initialization
+ * to complete.
+ */
+
+ Shm_Locked_queue_Initialize( FREE_ENV_CB, FREE_ENV_POOL );
+
+ for ( i=SHM_FIRST_NODE ; i<=Shm_Maximum_nodes ; i++ ) {
+ Shm_Initialize_receive_queue( i );
+
+ Shm_Node_statuses[ i ].status = Shm_Pending_initialization;
+ Shm_Node_statuses[ i ].error = 0;
+ }
+
+ /*
+ * Initialize all of the envelopes and place them in the
+ * free pool.
+ */
+
+ for ( i=0 ; i<Shm_Maximum_envelopes ; i++ ) {
+ Shm_Envelopes[ i ].index = Shm_Convert(i);
+ Shm_Free_envelope( &Shm_Envelopes[ i ] );
+ }
+
+ /*
+ * Initialize this node's interrupt information in the
+ * shared area so other nodes can interrupt us.
+ */
+
+ Shm_Local_node_status->int_address = (rtems_unsigned32) interrupt_address;
+ Shm_Local_node_status->int_value = interrupt_value;
+ Shm_Local_node_status->int_length = interrupt_cause;
+
+ Shm_Local_node_status->status = Shm_Initialization_complete;
+
+ /*
+ * Loop until all nodes have completed initialization.
+ */
+
+ do {
+ all_initialized = 1;
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ )
+ if ( Shm_Node_statuses[ i ].status != Shm_Initialization_complete )
+ all_initialized = 0;
+
+ } while ( all_initialized == 0 );
+
+ /*
+ * Tell the other nodes we think that the system is up.
+ */
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ )
+ Shm_Node_statuses[ i ].status = Shm_Active_node;
+
+ } else { /* is not MASTER node */
+
+ /*
+ * Initialize the node status for the non-master nodes.
+ * Because the master node zeroes out memory, it is
+ * necessary for them to keep putting their values in
+ * the node status area until the master says they
+ * should become active.
+ */
+
+ Shm_Local_node_status->status = Shm_Pending_initialization;
+
+ do {
+
+ if ( Shm_Local_node_status->status == Shm_Pending_initialization ) {
+
+ /*
+ * Initialize this node's interrupt information in the
+ * shared area so other nodes can interrupt us.
+ */
+
+ Shm_Local_node_status->int_address =
+ (rtems_unsigned32) interrupt_address;
+ Shm_Local_node_status->int_value = interrupt_value;
+ Shm_Local_node_status->int_length = interrupt_cause;
+
+ Shm_Local_node_status->status = Shm_Initialization_complete;
+ }
+ } while ( Shm_Local_node_status->status != Shm_Active_node ) ;
+ }
+
+ /*
+ * Initialize the Interrupt Information Table
+ */
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ ) {
+ nscb = &Shm_Node_statuses[ i ];
+
+ Shm_Interrupt_table[i].address = Shm_Convert_address(
+ (void *)Shm_Convert(((vol_u32) nscb->int_address))
+ );
+ Shm_Interrupt_table[i].value = Shm_Convert( nscb->int_value );
+ Shm_Interrupt_table[i].length = Shm_Convert( nscb->int_length );
+ }
+
+ MPCI_Shm_extensions.fatal = MPCI_Fatal;
+
+ (void) rtems_extension_create(
+ rtems_build_name( 'M', 'P', 'E', 'X' ),
+ &MPCI_Shm_extensions,
+ &extension_id
+ );
+}
diff --git a/c/src/lib/libbsp/shmdr/initlq.c b/c/src/lib/libbsp/shmdr/initlq.c
new file mode 100644
index 0000000000..3f44cf577d
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/initlq.c
@@ -0,0 +1,35 @@
+/* void Shm_Locked_queue_Initialize( lq_cb, owner )
+ *
+ * This routine initializes a shared memory locked queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to the control block of the queue
+ * to be initialized
+ * owner - unique idenitifier of who owns this queue.
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Locked_queue_Initialize(
+ Shm_Locked_queue_Control *lq_cb,
+ rtems_unsigned32 owner
+)
+{
+ Shm_Initialize_lock( lq_cb );
+ lq_cb->front = Shm_Locked_queue_End_of_list;
+ lq_cb->rear = Shm_Locked_queue_End_of_list;
+ lq_cb->owner = Shm_Convert(owner);
+}
diff --git a/c/src/lib/libbsp/shmdr/intr.c b/c/src/lib/libbsp/shmdr/intr.c
new file mode 100644
index 0000000000..8982103227
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/intr.c
@@ -0,0 +1,58 @@
+/* void Shm_Cause_interrupt( node )
+ *
+ * This routine is the shared memory driver routine which
+ * generates interrupts to other CPUs.
+ *
+ * It uses the information placed in the node status control
+ * block by each node. For example, when used with the Motorola
+ * MVME136 board, the MPCSR is used.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Cause_interrupt(
+ rtems_unsigned32 node
+)
+{
+ Shm_Interrupt_information *intr;
+ rtems_unsigned8 *u8;
+ rtems_unsigned16 *u16;
+ rtems_unsigned32 *u32;
+ rtems_unsigned32 value;
+
+ intr = &Shm_Interrupt_table[node];
+ value = intr->value;
+
+ switch ( intr->length ) {
+ case NO_INTERRUPT:
+ break;
+ case BYTE:
+ u8 = (rtems_unsigned8 *)intr->address;
+ *u8 = (rtems_unsigned8) value;
+ break;
+ case WORD:
+ u16 = (rtems_unsigned16 *)intr->address;
+ *u16 = (rtems_unsigned16) value;
+ break;
+ case LONG:
+ u32 = (rtems_unsigned32 *)intr->address;
+ *u32 = (rtems_unsigned32) value;
+ break;
+ }
+}
diff --git a/c/src/lib/libbsp/shmdr/mpci.h b/c/src/lib/libbsp/shmdr/mpci.h
new file mode 100644
index 0000000000..c5646a61d7
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/mpci.h
@@ -0,0 +1,59 @@
+/* mpci.h
+ *
+ * This include file contains all the renaming necessary to
+ * have an application use the Shared Memory Driver as its
+ * sole mechanism for MPCI.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SHM_MPCI_h
+#define __SHM_MPCI_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <shm.h>
+
+#define MPCI_Initialization( _configuration ) \
+ Shm_Initialization( _configuration )
+
+#define MPCI_Get_packet( _the_packet ) \
+ Shm_Get_packet( _the_packet )
+
+#define MPCI_Return_packet( _the_packet ) \
+ Shm_Return_packet( _the_packet )
+
+#define MPCI_Receive_packet( _the_packet ) \
+ Shm_Receive_packet( _the_packet )
+
+#define MPCI_Send_packet( _destination, _the_packet ) \
+ Shm_Send_packet( _destination, _the_packet )
+
+/* Unnecessary... mapped in shm.h
+#define MPCI_Fatal( _the_error ) \
+ Shm_Fatal( _the_error )
+*/
+
+#define MPCI_Enable_statistics()
+
+#define MPCI_Print_statistics() \
+ Shm_Print_statistics()
+
+/* no need to rename the MPCI_Table either */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/shmdr/mpisr.c b/c/src/lib/libbsp/shmdr/mpisr.c
new file mode 100644
index 0000000000..93ced3d351
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/mpisr.c
@@ -0,0 +1,23 @@
+/* _Shm_isr()
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_isr Shm_isr(
+ rtems_vector_number vector
+)
+{
+ Shm_Interrupt_count += 1;
+ rtems_multiprocessing_announce();
+}
diff --git a/c/src/lib/libbsp/shmdr/poll.c b/c/src/lib/libbsp/shmdr/poll.c
new file mode 100644
index 0000000000..27361f08eb
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/poll.c
@@ -0,0 +1,53 @@
+/* void Shm_Poll()
+ *
+ * This routine polls to see if a packet has arrived. If one
+ * has it informs the executive. It is typically called from
+ * the clock tick interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/libio.h>
+
+#include "shm.h"
+
+void Shm_Poll()
+{
+ rtems_unsigned32 tmpfront;
+ rtems_libio_ioctl_args_t args;
+
+ /* invoke clock isr */
+ args.iop = 0;
+ args.command = rtems_build_name('I', 'S', 'R', ' ');
+ (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
+
+ /*
+ * Check for msgs only if we are "up"
+ * This avoids a race condition where we may get a clock
+ * interrupt before MPCI has completed its init
+ */
+
+ if (_System_state_Is_up(_System_state_Get()))
+ {
+ tmpfront = Shm_Local_receive_queue->front;
+ if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list )
+ {
+ rtems_multiprocessing_announce();
+ Shm_Interrupt_count++;
+ }
+ }
+}
diff --git a/c/src/lib/libbsp/shmdr/receive.c b/c/src/lib/libbsp/shmdr/receive.c
new file mode 100644
index 0000000000..e094a2df6b
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/receive.c
@@ -0,0 +1,44 @@
+/* Shm_Receive_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver routine
+ * used to obtain a packet containing a message from this node's
+ * receive queue.
+ *
+ * Input parameters:
+ * packet - address of a pointer to a packet
+ *
+ * Output parameters:
+ * *(rpb->packet) - pointer to packet
+ * NULL if no packet currently available
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **packet
+)
+{
+ Shm_Envelope_control *ecb;
+
+ ecb = Shm_Locked_queue_Get( Shm_Local_receive_queue );
+ if ( ecb ) {
+ *(packet) = Shm_Envelope_control_to_packet_prefix_pointer( ecb );
+ if ( ecb->Preamble.endian != Shm_Configuration->format )
+ Shm_Convert_packet( *packet );
+ Shm_Receive_message_count++;
+ } else {
+ *(packet) = NULL;
+ Shm_Null_message_count++;
+ }
+}
diff --git a/c/src/lib/libbsp/shmdr/retpkt.c b/c/src/lib/libbsp/shmdr/retpkt.c
new file mode 100644
index 0000000000..973b84ab0d
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/retpkt.c
@@ -0,0 +1,32 @@
+/* Shm_Return_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver
+ * routine used to return a message packet to a free envelope
+ * pool accessible by this node.
+ *
+ * Input parameters:
+ * packet - address of pointer to packet
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *packet
+)
+{
+ Shm_Free_envelope( Shm_Packet_prefix_to_envelope_control_pointer(packet) );
+}
+
diff --git a/c/src/lib/libbsp/shmdr/send.c b/c/src/lib/libbsp/shmdr/send.c
new file mode 100644
index 0000000000..58a5bb93b9
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/send.c
@@ -0,0 +1,61 @@
+/* Shm_Send_packet
+ *
+ * This routine is the shared memory driver locked queue write
+ * MPCI driver routine. This routine sends the specified packet
+ * to the destination specified by "node". A "node" value of
+ * zero designates that this packet is to be broadcasted.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ * packet - address of packet
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+struct pkt_cpy {
+ rtems_unsigned32 packet[MAX_PACKET_SIZE/4];
+};
+
+rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32 node,
+ rtems_packet_prefix *packet
+)
+{
+ Shm_Envelope_control *ecb, *tmp_ecb;
+ rtems_unsigned32 nnum;
+
+ ecb = Shm_Packet_prefix_to_envelope_control_pointer( packet );
+ if ( node ) {
+ Shm_Build_preamble( ecb, node );
+ Shm_Build_postamble( ecb );
+ Shm_Append_to_receive_queue( node, ecb );
+ (*Shm_Configuration->cause_intr)( node );
+ }
+ else {
+ for( nnum = SHM_FIRST_NODE ; nnum <= Shm_Maximum_nodes ; nnum++ )
+ if ( Shm_Local_node != nnum ) {
+ tmp_ecb = Shm_Allocate_envelope();
+ if ( !tmp_ecb )
+ rtems_fatal_error_occurred( SHM_NO_FREE_PKTS );
+ Shm_Build_preamble( tmp_ecb, nnum );
+ *((struct pkt_cpy *)tmp_ecb->packet) = *((struct pkt_cpy *)packet);
+ Shm_Build_postamble( tmp_ecb );
+ Shm_Append_to_receive_queue( nnum, tmp_ecb );
+ (*Shm_Configuration->cause_intr)( nnum );
+ }
+ Shm_Free_envelope( ecb );
+ }
+}
diff --git a/c/src/lib/libbsp/shmdr/setckvec.c b/c/src/lib/libbsp/shmdr/setckvec.c
new file mode 100644
index 0000000000..bb3a19e1c8
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/setckvec.c
@@ -0,0 +1,34 @@
+/* Shm_setclockvec
+ *
+ * This routines installs the shared memory clock interrupt handler
+ * used when the driver is used in polling mode.
+ *
+ * INPUT PARAMETERS: NONE
+ *
+ * OUTPUT PARAMETERS: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/libio.h>
+
+#include "shm.h"
+
+rtems_isr Shm_setclockvec()
+{
+ rtems_libio_ioctl_args_t args;
+ args.iop = 0;
+ args.command = rtems_build_name('N', 'E', 'W', ' ');
+ args.buffer = (void *) Shm_Poll;
+
+ (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
+}
diff --git a/c/src/lib/libbsp/shmdr/shm.h b/c/src/lib/libbsp/shmdr/shm.h
new file mode 100644
index 0000000000..e7a8ae0496
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/shm.h
@@ -0,0 +1,534 @@
+/* shm.h
+ *
+ * This include file contains all the constants, structures,
+ * and global variables for this RTEMS based shared memory
+ * communications interface driver.
+ *
+ * Processor board dependencies are in other files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SHM_h
+#define __SHM_h
+
+#include <clockdrv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The information contained in the Node Status, Locked Queue, and
+ * Envelope Control Blocks must be maintained in a NEUTRAL format.
+ * Currently the neutral format may be selected as big or little
+ * endian by simply defining either NEUTRAL_BIG or NEUTRAL_LITTLE.
+ *
+ * It is CRITICAL to note that the neutral format can ONLY be
+ * changed by modifying this file and recompiling the ENTIRE
+ * SHM driver including ALL target specific support files.
+ *
+ * The following table details the memory contents for the endian
+ * field of the Node Status Control Block in the various
+ * data format configurations (data is in hexadecimal):
+ *
+ * NEUTRAL NATIVE BYTE 0 BYTE 1 BYTE 2 BYTE 3
+ * ======= ====== ====== ====== ====== ======
+ * BIG BIG 00 00 00 01
+ * BIG LITTLE 10 00 00 00
+ * LITTLE BIG 01 00 00 00
+ * LITTLE LITTLE 00 00 00 10
+ *
+ *
+ * NOTE: XXX
+ * PORTABILITY OF LOCKING INSTRUCTIONS
+ * ===================================
+ * The locking mechanism described below is not
+ * general enough. Where the hardware supports
+ * it we should use "atomic swap" instructions
+ * so the values in the lock can be tailored to
+ * support a CPU with only weak atomic memory
+ * instructions. There are combinations of
+ * CPUs with inflexible atomic memory instructions
+ * which appear to be incompatible. For example,
+ * the SPARClite instruction uses a byte which is
+ * 0xFF when locked. The PA-RISC uses 1 to indicate
+ * locked and 0 when unlocked. These CPUs appear to
+ * have incompatible lock instructions. But
+ * they could be used in a heterogenous system
+ * with does not mix SPARCs and PA-RISCs. For
+ * example, the i386 and SPARC or i386 and SPARC
+ * could work together. The bottom line is that
+ * not every CPU will work together using this
+ * locking scheme. There are supposed to be
+ * algorithms to do this without hardware assist
+ * and one of these should be incorporated into
+ * the shared memory driver.
+ *
+ * The most flexible scheme using the instructions
+ * of the various CPUs for efficiency would be to use
+ * "atomic swaps" wherever possible. Make the lock
+ * and unlock configurable much like BIG vs LITTLE
+ * endian use of shared memory is now. The values
+ * of the lock could then reflect the "worst"
+ * CPU in a system. This still results in mixes
+ * of CPUs which are incompatible.
+ *
+ * The current locking mechanism is based upon the MC68020
+ * "tas" instruction which is atomic. All ports to other CPUs
+ * comply with the restrictive placement of lock bit by this
+ * instruction. The lock bit is the most significant bit in a
+ * big-endian rtems_unsigned32. On other processors, the lock is
+ * typically implemented via an atomic swap or atomic modify
+ * bits type instruction.
+ */
+
+#define NEUTRAL_BIG
+
+#ifdef NEUTRAL_BIG
+#define SHM_BIG 0x00000001
+#define SHM_LITTLE 0x10000000
+#endif
+
+#ifdef NEUTRAL_LITTLE
+#define SHM_BIG 0x01000000
+#define SHM_LITTLE 0x00000010
+#endif
+
+/*
+ * The following are the values used to fill in the lock field. Some CPUs
+ * are able to write only a single value into field. By making the
+ * lock and unlock values configurable, CPUs which support "atomic swap"
+ * instructions can generally be made to work in any heterogeneous
+ * configuration. However, it is possible for two CPUs to be incompatible
+ * in regards to the lock field values. This occurs when two CPUs
+ * which write only a single value to the field are used in a system
+ * but the two CPUs write different incompatible values.
+ *
+ * NOTE: The following is a first attempt at defining values which
+ * have a chance at working together. The m68k should use
+ * chk2 instead of tas to be less restrictive. Target endian
+ * problems (like the Force CPU386 which has (broken) big endian
+ * view of the VMEbus address space) are not addressed yet.
+ */
+
+#if defined(i960)
+#define SHM_LOCK_VALUE 0x00000080
+#define SHM_UNLOCK_VALUE 0
+#elif defined(m68k)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(i386)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(hppa1_1)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(unix)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(no_cpu) /* for this values are irrelevant */
+#define SHM_LOCK_VALUE 1
+#define SHM_UNLOCK_VALUE 0
+#endif
+
+#define Shm_Convert( value ) \
+ ((Shm_Configuration->convert) ? \
+ (*Shm_Configuration->convert)(value) : (value))
+
+/* constants */
+
+#define SHM_MASTER 1 /* master initialization node */
+#define SHM_FIRST_NODE 1
+
+/* size constants */
+
+#define KILOBYTE (1024)
+#define MEGABYTE (1024*1024)
+
+/* inter-node interrupt values */
+
+#define NO_INTERRUPT 0 /* used for polled nodes */
+#define BYTE 1
+#define WORD 2
+#define LONG 4
+
+/* operational mode constants -- used in SHM Configuration Table */
+#define POLLED_MODE 0
+#define INTR_MODE 1
+
+/* error codes */
+
+#define NO_ERROR 0
+#define SHM_NO_FREE_PKTS 0xf0000
+
+/* null pointers of different types */
+
+#define NULL_ENV_CB ((Shm_Envelope_control *) 0)
+#define NULL_CONVERT 0
+
+/*
+ * size of stuff before preamble in envelope.
+ * It must be a constant since we will use it to generate MAX_PACKET_SIZE
+ */
+
+#define SHM_ENVELOPE_PREFIX_OVERHEAD (4 * sizeof(vol_u32))
+
+/*
+ * The following is adjusted so envelopes are MAX_ENVELOPE_SIZE bytes long.
+ * It must be >= RTEMS_MINIMUM_PACKET_SIZE in mppkt.h.
+ */
+
+#ifndef MAX_ENVELOPE_SIZE
+#define MAX_ENVELOPE_SIZE 0x180
+#endif
+
+#define MAX_PACKET_SIZE (MAX_ENVELOPE_SIZE - \
+ SHM_ENVELOPE_PREFIX_OVERHEAD + \
+ sizeof(Shm_Envelope_preamble) + \
+ sizeof(Shm_Envelope_postamble))
+
+
+/* constants pertinent to Locked Queue routines */
+
+#define LQ_UNLOCKED SHM_UNLOCK_VALUE
+#define LQ_LOCKED SHM_LOCK_VALUE
+
+/* constants related to the Free Envelope Pool */
+
+#define FREE_ENV_POOL 0
+#define FREE_ENV_CB (&Shm_Locked_queues[ FREE_ENV_POOL ])
+
+/* The following are important when dealing with
+ * the shared memory communications interface area.
+ *
+ * NOTE: The starting address and length of the shared memory
+ * is defined in a system dependent file.
+ */
+
+#define START_NS_CBS ((void *)Shm_Configuration->base)
+#define START_LQ_CBS ((START_NS_CBS) + \
+ ( (sizeof (Shm_Node_status_control)) * (Shm_Maximum_nodes + 1) ) )
+#define START_ENVELOPES ( ((void *) START_LQ_CBS) + \
+ ( (sizeof (Shm_Locked_queue_Control)) * (Shm_Maximum_nodes + 1) ) )
+#define END_SHMCI_AREA ( (void *) START_ENVELOPES + \
+ ( (sizeof (Shm_Envelope_control)) * Shm_Maximum_envelopes ) )
+#define END_SHARED_MEM (START_NS_CBS+Shm_Configuration->length)
+
+/* macros */
+
+#define Shm_Is_master_node() \
+ ( SHM_MASTER == Shm_Local_node )
+
+#define Shm_Free_envelope( ecb ) \
+ Shm_Locked_queue_Add( FREE_ENV_CB, (ecb) )
+#define Shm_Allocate_envelope() \
+ Shm_Locked_queue_Get(FREE_ENV_CB)
+
+#define Shm_Initialize_receive_queue(node) \
+ Shm_Locked_queue_Initialize( &Shm_Locked_queues[node], node )
+
+#define Shm_Append_to_receive_queue(node, ecb) \
+ Shm_Locked_queue_Add( &Shm_Locked_queues[node], (ecb) )
+
+#define Shm_Envelope_control_to_packet_prefix_pointer(ecb) \
+ ((void *)(ecb)->packet)
+
+#define Shm_Packet_prefix_to_envelope_control_pointer( pkt ) \
+ ((Shm_Envelope_control *)((rtems_unsigned8 *)(pkt) - \
+ (sizeof(Shm_Envelope_preamble) + SHM_ENVELOPE_PREFIX_OVERHEAD)))
+
+#define Shm_Build_preamble(ecb, node) \
+ (ecb)->Preamble.endian = Shm_Configuration->format
+
+#define Shm_Build_postamble( ecb )
+
+/* volatile types */
+
+typedef volatile rtems_unsigned8 vol_u8;
+typedef volatile rtems_unsigned32 vol_u32;
+
+/* shm control information */
+
+struct shm_info {
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+ vol_u32 not_currently_used_3;
+};
+
+typedef struct {
+ /*byte start_of_text;*/
+ vol_u32 endian;
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Envelope_preamble;
+
+typedef struct {
+} Shm_Envelope_postamble;
+
+/* WARNING! If you change this structure, don't forget to change
+ * SHM_ENVELOPE_PREFIX_OVERHEAD and
+ * Shm_Packet_prefix_to_envelope_control_pointer() above.
+ */
+
+/* This comment block describes the contents of each field
+ * of the Envelope Control Block:
+ *
+ * next - The index of the next envelope on this queue.
+ * queue - The index of the queue this envelope is on.
+ * index - The index of this envelope.
+ * Preamble - Generic packet preamble. One day this structure
+ * could be enhanced to contain routing information.
+ * packet - RTEMS MPCI packet. Untouched by SHM Driver
+ * other than copying and format conversion as
+ * documented in the RTEMS User's Guide.
+ * Postamble - Generic packet postamble. One day this structure
+ * could be enhanced to contain checksum information.
+ */
+
+typedef struct {
+ vol_u32 next; /* next envelope on queue */
+ vol_u32 queue; /* queue on which this resides */
+ vol_u32 index; /* index into array of envelopes*/
+ vol_u32 pad0; /* insure the next one is aligned */
+ Shm_Envelope_preamble Preamble; /* header information */
+ vol_u8 packet[MAX_PACKET_SIZE]; /* RTEMS INFO */
+ Shm_Envelope_postamble Postamble;/* trailer information */
+} Shm_Envelope_control;
+
+/* This comment block describes the contents of each field
+ * of the Locked Queue Control Block:
+ *
+ * lock - Lock used to insure mutually exclusive access.
+ * front - Index of first envelope on queue. This field
+ * is used to remove head of queue (receive).
+ * rear - Index of last envelope on queue. This field
+ * is used to add evelope to queue (send).
+ * owner - The node number of the recipient (owning) node.
+ * RTEMS does not use the node number zero (0).
+ * The zero node is used by the SHM Driver for the
+ * Free Envelope Queue shared by all nodes.
+ */
+
+typedef struct {
+ vol_u32 lock; /* lock field for this queue */
+ vol_u32 front; /* first envelope on queue */
+ vol_u32 rear; /* last envelope on queue */
+ vol_u32 owner; /* receiving (i.e. owning) node */
+} Shm_Locked_queue_Control;
+
+/* This comment block describes the contents of each field
+ * of the Node Status Control Block:
+ *
+ * status - Node status. Current values are Pending Initialization,
+ * Initialization Complete, and Active Node. Other values
+ * could be added to enhance fault tolerance.
+ * error - Zero if the node has not failed. Otherwise,
+ * this field contains a status indicating the
+ * failure reason.
+ * int_address, int_value, and int_length
+ * - These field are the Interrupt Information table
+ * for this node in neutral format. This is how
+ * each node knows how to generate interrupts.
+ */
+
+typedef struct {
+ vol_u32 status; /* node status information */
+ vol_u32 error; /* fatal error code */
+ vol_u32 int_address; /* write here for interrupt */
+ vol_u32 int_value; /* this value causes interrupt */
+ vol_u32 int_length; /* for this length (0,1,2,4) */
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Node_status_control;
+
+/* This comment block describes the contents of each field
+ * of the Interrupt Information Table. This table describes
+ * how another node can generate an interrupt to this node.
+ * This information is target board dependent. If the
+ * SHM Driver is in POLLED_MODE, then all fields should
+ * be initialized to NO_INTERRUPT.
+ *
+ * address - The address to which another node should
+ * write to cause an interrupt.
+ * value - The value which must be written
+ * length - The size of the value to write. Valid
+ * values are BYTE, WORD, and LONG.
+ *
+ * NOTE: The Node Status Control Block contains this
+ * information in neutral format and not in a
+ * structure to avoid potential alignment problems.
+ */
+
+typedef struct {
+ vol_u32 *address; /* write here for interrupt */
+ vol_u32 value; /* this value causes interrupt */
+ vol_u32 length; /* for this length (0,1,2,4) */
+} Shm_Interrupt_information;
+
+/* SHM Configuration Table
+ *
+ * This comment block describes the contents of each field
+ * of the SHM Configuration Table.
+ *
+ * base - The base address of the shared memory. This
+ * address may be specific to this node.
+ * length - The length of the shared memory in bytes.
+ * format - The natural format for rtems_unsigned32's in the
+ * shared memory. Valid values are currently
+ * only SHM_LITTLE and SHM_BIG.
+ * convert - The address of the routine which converts
+ * between neutral and local format.
+ * poll_intr - The operational mode of the driver. Some
+ * target boards may not provide hardware for
+ * an interprocessor interrupt. If POLLED_MODE
+ * is selected, the SHM driver will install a
+ * wrapper around the Clock_isr() to poll for
+ * incoming packets. Throughput is dependent
+ * on the time between clock interrupts.
+ * Valid values are POLLED_MODE and INTR_MODE.
+ * cause_intr - This is the address of the routine used to
+ * write to a particular address and cause an
+ * interrupt on another node. This routine
+ * may need to be target dependent if something
+ * other than a normal write from C does not work.
+ * Intr - This structure describes the operation required
+ * to cause an interrupt to this node. The actual
+ * contents of this structure are described above.
+ */
+
+struct shm_config_info {
+ vol_u32 *base; /* base address of SHM */
+ vol_u32 length; /* length (in bytes) of SHM */
+ vol_u32 format; /* SHM is big or little endian */
+ vol_u32 (*convert)();/* neutral conversion routine */
+ vol_u32 poll_intr;/* POLLED or INTR driven mode */
+ void (*cause_intr)( rtems_unsigned32 );
+ Shm_Interrupt_information Intr; /* cause intr information */
+};
+
+typedef struct shm_config_info shm_config_table;
+
+/* global variables */
+
+#ifdef _SHM_INIT
+#define SHM_EXTERN
+#else
+#define SHM_EXTERN extern
+#endif
+
+SHM_EXTERN shm_config_table *Shm_Configuration;
+SHM_EXTERN Shm_Interrupt_information *Shm_Interrupt_table;
+SHM_EXTERN Shm_Node_status_control *Shm_Node_statuses;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Locked_queues;
+SHM_EXTERN Shm_Envelope_control *Shm_Envelopes;
+SHM_EXTERN rtems_configuration_table *Shm_RTEMS_Configuration;
+SHM_EXTERN rtems_multiprocessing_table *Shm_RTEMS_MP_Configuration;
+SHM_EXTERN rtems_unsigned32 Shm_Receive_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Null_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Interrupt_count;
+SHM_EXTERN rtems_unsigned32 Shm_Local_node;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Local_receive_queue;
+SHM_EXTERN Shm_Node_status_control *Shm_Local_node_status;
+SHM_EXTERN rtems_unsigned32 Shm_isrstat;
+ /* reported by shmdr */
+
+SHM_EXTERN rtems_unsigned32 Shm_Pending_initialization;
+SHM_EXTERN rtems_unsigned32 Shm_Initialization_complete;
+SHM_EXTERN rtems_unsigned32 Shm_Active_node;
+
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_nodes;
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_envelopes;
+
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_End_of_list;
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_Not_on_list;
+
+/* functions */
+
+/* locked queue routines */
+void Shm_Locked_queue_Add(
+ Shm_Locked_queue_Control *, Shm_Envelope_control * );
+Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control * );
+void Shm_Locked_queue_Initialize(
+ Shm_Locked_queue_Control *, rtems_unsigned32 );
+ /* Shm_Initialize_lock is CPU dependent */
+ /* Shm_Lock is CPU dependent */
+ /* Shm_Unlock is CPU dependent */
+
+/* portable routines */
+void Init_env_pool();
+void Shm_Print_statistics( void );
+void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 );
+rtems_task Shm_Cause_interrupt( rtems_unsigned32 );
+void Shm_Poll();
+void Shm_setclockvec();
+void Shm_Convert_packet( rtems_packet_prefix * );
+
+/* CPU specific routines are inlined in shmcpu.h */
+
+/* target specific routines */
+void *Shm_Convert_address( void * );
+void Shm_Get_configuration( rtems_unsigned32, shm_config_table ** );
+void Shm_isr();
+void Shm_setvec( void );
+
+void Shm_Initialize_lock( Shm_Locked_queue_Control * );
+void Shm_Lock( Shm_Locked_queue_Control * );
+void Shm_Unlock( Shm_Locked_queue_Control * );
+
+/* MPCI entry points */
+rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Initialization( void );
+
+rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *
+);
+
+rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32,
+ rtems_packet_prefix *
+);
+
+extern rtems_mpci_table MPCI_table;
+
+#ifdef _SHM_INIT
+
+/* multiprocessor communications interface (MPCI) table */
+
+rtems_mpci_table MPCI_table = {
+ 100000, /* default timeout value in ticks */
+ MAX_PACKET_SIZE, /* maximum packet size */
+ Shm_Initialization, /* initialization procedure */
+ Shm_Get_packet, /* get packet procedure */
+ Shm_Return_packet, /* return packet procedure */
+ Shm_Send_packet, /* packet send procedure */
+ Shm_Receive_packet /* packet receive procedure */
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/shmdr/shm_driver.h b/c/src/lib/libbsp/shmdr/shm_driver.h
new file mode 100644
index 0000000000..e7a8ae0496
--- /dev/null
+++ b/c/src/lib/libbsp/shmdr/shm_driver.h
@@ -0,0 +1,534 @@
+/* shm.h
+ *
+ * This include file contains all the constants, structures,
+ * and global variables for this RTEMS based shared memory
+ * communications interface driver.
+ *
+ * Processor board dependencies are in other files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SHM_h
+#define __SHM_h
+
+#include <clockdrv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The information contained in the Node Status, Locked Queue, and
+ * Envelope Control Blocks must be maintained in a NEUTRAL format.
+ * Currently the neutral format may be selected as big or little
+ * endian by simply defining either NEUTRAL_BIG or NEUTRAL_LITTLE.
+ *
+ * It is CRITICAL to note that the neutral format can ONLY be
+ * changed by modifying this file and recompiling the ENTIRE
+ * SHM driver including ALL target specific support files.
+ *
+ * The following table details the memory contents for the endian
+ * field of the Node Status Control Block in the various
+ * data format configurations (data is in hexadecimal):
+ *
+ * NEUTRAL NATIVE BYTE 0 BYTE 1 BYTE 2 BYTE 3
+ * ======= ====== ====== ====== ====== ======
+ * BIG BIG 00 00 00 01
+ * BIG LITTLE 10 00 00 00
+ * LITTLE BIG 01 00 00 00
+ * LITTLE LITTLE 00 00 00 10
+ *
+ *
+ * NOTE: XXX
+ * PORTABILITY OF LOCKING INSTRUCTIONS
+ * ===================================
+ * The locking mechanism described below is not
+ * general enough. Where the hardware supports
+ * it we should use "atomic swap" instructions
+ * so the values in the lock can be tailored to
+ * support a CPU with only weak atomic memory
+ * instructions. There are combinations of
+ * CPUs with inflexible atomic memory instructions
+ * which appear to be incompatible. For example,
+ * the SPARClite instruction uses a byte which is
+ * 0xFF when locked. The PA-RISC uses 1 to indicate
+ * locked and 0 when unlocked. These CPUs appear to
+ * have incompatible lock instructions. But
+ * they could be used in a heterogenous system
+ * with does not mix SPARCs and PA-RISCs. For
+ * example, the i386 and SPARC or i386 and SPARC
+ * could work together. The bottom line is that
+ * not every CPU will work together using this
+ * locking scheme. There are supposed to be
+ * algorithms to do this without hardware assist
+ * and one of these should be incorporated into
+ * the shared memory driver.
+ *
+ * The most flexible scheme using the instructions
+ * of the various CPUs for efficiency would be to use
+ * "atomic swaps" wherever possible. Make the lock
+ * and unlock configurable much like BIG vs LITTLE
+ * endian use of shared memory is now. The values
+ * of the lock could then reflect the "worst"
+ * CPU in a system. This still results in mixes
+ * of CPUs which are incompatible.
+ *
+ * The current locking mechanism is based upon the MC68020
+ * "tas" instruction which is atomic. All ports to other CPUs
+ * comply with the restrictive placement of lock bit by this
+ * instruction. The lock bit is the most significant bit in a
+ * big-endian rtems_unsigned32. On other processors, the lock is
+ * typically implemented via an atomic swap or atomic modify
+ * bits type instruction.
+ */
+
+#define NEUTRAL_BIG
+
+#ifdef NEUTRAL_BIG
+#define SHM_BIG 0x00000001
+#define SHM_LITTLE 0x10000000
+#endif
+
+#ifdef NEUTRAL_LITTLE
+#define SHM_BIG 0x01000000
+#define SHM_LITTLE 0x00000010
+#endif
+
+/*
+ * The following are the values used to fill in the lock field. Some CPUs
+ * are able to write only a single value into field. By making the
+ * lock and unlock values configurable, CPUs which support "atomic swap"
+ * instructions can generally be made to work in any heterogeneous
+ * configuration. However, it is possible for two CPUs to be incompatible
+ * in regards to the lock field values. This occurs when two CPUs
+ * which write only a single value to the field are used in a system
+ * but the two CPUs write different incompatible values.
+ *
+ * NOTE: The following is a first attempt at defining values which
+ * have a chance at working together. The m68k should use
+ * chk2 instead of tas to be less restrictive. Target endian
+ * problems (like the Force CPU386 which has (broken) big endian
+ * view of the VMEbus address space) are not addressed yet.
+ */
+
+#if defined(i960)
+#define SHM_LOCK_VALUE 0x00000080
+#define SHM_UNLOCK_VALUE 0
+#elif defined(m68k)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(i386)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(hppa1_1)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(unix)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(no_cpu) /* for this values are irrelevant */
+#define SHM_LOCK_VALUE 1
+#define SHM_UNLOCK_VALUE 0
+#endif
+
+#define Shm_Convert( value ) \
+ ((Shm_Configuration->convert) ? \
+ (*Shm_Configuration->convert)(value) : (value))
+
+/* constants */
+
+#define SHM_MASTER 1 /* master initialization node */
+#define SHM_FIRST_NODE 1
+
+/* size constants */
+
+#define KILOBYTE (1024)
+#define MEGABYTE (1024*1024)
+
+/* inter-node interrupt values */
+
+#define NO_INTERRUPT 0 /* used for polled nodes */
+#define BYTE 1
+#define WORD 2
+#define LONG 4
+
+/* operational mode constants -- used in SHM Configuration Table */
+#define POLLED_MODE 0
+#define INTR_MODE 1
+
+/* error codes */
+
+#define NO_ERROR 0
+#define SHM_NO_FREE_PKTS 0xf0000
+
+/* null pointers of different types */
+
+#define NULL_ENV_CB ((Shm_Envelope_control *) 0)
+#define NULL_CONVERT 0
+
+/*
+ * size of stuff before preamble in envelope.
+ * It must be a constant since we will use it to generate MAX_PACKET_SIZE
+ */
+
+#define SHM_ENVELOPE_PREFIX_OVERHEAD (4 * sizeof(vol_u32))
+
+/*
+ * The following is adjusted so envelopes are MAX_ENVELOPE_SIZE bytes long.
+ * It must be >= RTEMS_MINIMUM_PACKET_SIZE in mppkt.h.
+ */
+
+#ifndef MAX_ENVELOPE_SIZE
+#define MAX_ENVELOPE_SIZE 0x180
+#endif
+
+#define MAX_PACKET_SIZE (MAX_ENVELOPE_SIZE - \
+ SHM_ENVELOPE_PREFIX_OVERHEAD + \
+ sizeof(Shm_Envelope_preamble) + \
+ sizeof(Shm_Envelope_postamble))
+
+
+/* constants pertinent to Locked Queue routines */
+
+#define LQ_UNLOCKED SHM_UNLOCK_VALUE
+#define LQ_LOCKED SHM_LOCK_VALUE
+
+/* constants related to the Free Envelope Pool */
+
+#define FREE_ENV_POOL 0
+#define FREE_ENV_CB (&Shm_Locked_queues[ FREE_ENV_POOL ])
+
+/* The following are important when dealing with
+ * the shared memory communications interface area.
+ *
+ * NOTE: The starting address and length of the shared memory
+ * is defined in a system dependent file.
+ */
+
+#define START_NS_CBS ((void *)Shm_Configuration->base)
+#define START_LQ_CBS ((START_NS_CBS) + \
+ ( (sizeof (Shm_Node_status_control)) * (Shm_Maximum_nodes + 1) ) )
+#define START_ENVELOPES ( ((void *) START_LQ_CBS) + \
+ ( (sizeof (Shm_Locked_queue_Control)) * (Shm_Maximum_nodes + 1) ) )
+#define END_SHMCI_AREA ( (void *) START_ENVELOPES + \
+ ( (sizeof (Shm_Envelope_control)) * Shm_Maximum_envelopes ) )
+#define END_SHARED_MEM (START_NS_CBS+Shm_Configuration->length)
+
+/* macros */
+
+#define Shm_Is_master_node() \
+ ( SHM_MASTER == Shm_Local_node )
+
+#define Shm_Free_envelope( ecb ) \
+ Shm_Locked_queue_Add( FREE_ENV_CB, (ecb) )
+#define Shm_Allocate_envelope() \
+ Shm_Locked_queue_Get(FREE_ENV_CB)
+
+#define Shm_Initialize_receive_queue(node) \
+ Shm_Locked_queue_Initialize( &Shm_Locked_queues[node], node )
+
+#define Shm_Append_to_receive_queue(node, ecb) \
+ Shm_Locked_queue_Add( &Shm_Locked_queues[node], (ecb) )
+
+#define Shm_Envelope_control_to_packet_prefix_pointer(ecb) \
+ ((void *)(ecb)->packet)
+
+#define Shm_Packet_prefix_to_envelope_control_pointer( pkt ) \
+ ((Shm_Envelope_control *)((rtems_unsigned8 *)(pkt) - \
+ (sizeof(Shm_Envelope_preamble) + SHM_ENVELOPE_PREFIX_OVERHEAD)))
+
+#define Shm_Build_preamble(ecb, node) \
+ (ecb)->Preamble.endian = Shm_Configuration->format
+
+#define Shm_Build_postamble( ecb )
+
+/* volatile types */
+
+typedef volatile rtems_unsigned8 vol_u8;
+typedef volatile rtems_unsigned32 vol_u32;
+
+/* shm control information */
+
+struct shm_info {
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+ vol_u32 not_currently_used_3;
+};
+
+typedef struct {
+ /*byte start_of_text;*/
+ vol_u32 endian;
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Envelope_preamble;
+
+typedef struct {
+} Shm_Envelope_postamble;
+
+/* WARNING! If you change this structure, don't forget to change
+ * SHM_ENVELOPE_PREFIX_OVERHEAD and
+ * Shm_Packet_prefix_to_envelope_control_pointer() above.
+ */
+
+/* This comment block describes the contents of each field
+ * of the Envelope Control Block:
+ *
+ * next - The index of the next envelope on this queue.
+ * queue - The index of the queue this envelope is on.
+ * index - The index of this envelope.
+ * Preamble - Generic packet preamble. One day this structure
+ * could be enhanced to contain routing information.
+ * packet - RTEMS MPCI packet. Untouched by SHM Driver
+ * other than copying and format conversion as
+ * documented in the RTEMS User's Guide.
+ * Postamble - Generic packet postamble. One day this structure
+ * could be enhanced to contain checksum information.
+ */
+
+typedef struct {
+ vol_u32 next; /* next envelope on queue */
+ vol_u32 queue; /* queue on which this resides */
+ vol_u32 index; /* index into array of envelopes*/
+ vol_u32 pad0; /* insure the next one is aligned */
+ Shm_Envelope_preamble Preamble; /* header information */
+ vol_u8 packet[MAX_PACKET_SIZE]; /* RTEMS INFO */
+ Shm_Envelope_postamble Postamble;/* trailer information */
+} Shm_Envelope_control;
+
+/* This comment block describes the contents of each field
+ * of the Locked Queue Control Block:
+ *
+ * lock - Lock used to insure mutually exclusive access.
+ * front - Index of first envelope on queue. This field
+ * is used to remove head of queue (receive).
+ * rear - Index of last envelope on queue. This field
+ * is used to add evelope to queue (send).
+ * owner - The node number of the recipient (owning) node.
+ * RTEMS does not use the node number zero (0).
+ * The zero node is used by the SHM Driver for the
+ * Free Envelope Queue shared by all nodes.
+ */
+
+typedef struct {
+ vol_u32 lock; /* lock field for this queue */
+ vol_u32 front; /* first envelope on queue */
+ vol_u32 rear; /* last envelope on queue */
+ vol_u32 owner; /* receiving (i.e. owning) node */
+} Shm_Locked_queue_Control;
+
+/* This comment block describes the contents of each field
+ * of the Node Status Control Block:
+ *
+ * status - Node status. Current values are Pending Initialization,
+ * Initialization Complete, and Active Node. Other values
+ * could be added to enhance fault tolerance.
+ * error - Zero if the node has not failed. Otherwise,
+ * this field contains a status indicating the
+ * failure reason.
+ * int_address, int_value, and int_length
+ * - These field are the Interrupt Information table
+ * for this node in neutral format. This is how
+ * each node knows how to generate interrupts.
+ */
+
+typedef struct {
+ vol_u32 status; /* node status information */
+ vol_u32 error; /* fatal error code */
+ vol_u32 int_address; /* write here for interrupt */
+ vol_u32 int_value; /* this value causes interrupt */
+ vol_u32 int_length; /* for this length (0,1,2,4) */
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Node_status_control;
+
+/* This comment block describes the contents of each field
+ * of the Interrupt Information Table. This table describes
+ * how another node can generate an interrupt to this node.
+ * This information is target board dependent. If the
+ * SHM Driver is in POLLED_MODE, then all fields should
+ * be initialized to NO_INTERRUPT.
+ *
+ * address - The address to which another node should
+ * write to cause an interrupt.
+ * value - The value which must be written
+ * length - The size of the value to write. Valid
+ * values are BYTE, WORD, and LONG.
+ *
+ * NOTE: The Node Status Control Block contains this
+ * information in neutral format and not in a
+ * structure to avoid potential alignment problems.
+ */
+
+typedef struct {
+ vol_u32 *address; /* write here for interrupt */
+ vol_u32 value; /* this value causes interrupt */
+ vol_u32 length; /* for this length (0,1,2,4) */
+} Shm_Interrupt_information;
+
+/* SHM Configuration Table
+ *
+ * This comment block describes the contents of each field
+ * of the SHM Configuration Table.
+ *
+ * base - The base address of the shared memory. This
+ * address may be specific to this node.
+ * length - The length of the shared memory in bytes.
+ * format - The natural format for rtems_unsigned32's in the
+ * shared memory. Valid values are currently
+ * only SHM_LITTLE and SHM_BIG.
+ * convert - The address of the routine which converts
+ * between neutral and local format.
+ * poll_intr - The operational mode of the driver. Some
+ * target boards may not provide hardware for
+ * an interprocessor interrupt. If POLLED_MODE
+ * is selected, the SHM driver will install a
+ * wrapper around the Clock_isr() to poll for
+ * incoming packets. Throughput is dependent
+ * on the time between clock interrupts.
+ * Valid values are POLLED_MODE and INTR_MODE.
+ * cause_intr - This is the address of the routine used to
+ * write to a particular address and cause an
+ * interrupt on another node. This routine
+ * may need to be target dependent if something
+ * other than a normal write from C does not work.
+ * Intr - This structure describes the operation required
+ * to cause an interrupt to this node. The actual
+ * contents of this structure are described above.
+ */
+
+struct shm_config_info {
+ vol_u32 *base; /* base address of SHM */
+ vol_u32 length; /* length (in bytes) of SHM */
+ vol_u32 format; /* SHM is big or little endian */
+ vol_u32 (*convert)();/* neutral conversion routine */
+ vol_u32 poll_intr;/* POLLED or INTR driven mode */
+ void (*cause_intr)( rtems_unsigned32 );
+ Shm_Interrupt_information Intr; /* cause intr information */
+};
+
+typedef struct shm_config_info shm_config_table;
+
+/* global variables */
+
+#ifdef _SHM_INIT
+#define SHM_EXTERN
+#else
+#define SHM_EXTERN extern
+#endif
+
+SHM_EXTERN shm_config_table *Shm_Configuration;
+SHM_EXTERN Shm_Interrupt_information *Shm_Interrupt_table;
+SHM_EXTERN Shm_Node_status_control *Shm_Node_statuses;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Locked_queues;
+SHM_EXTERN Shm_Envelope_control *Shm_Envelopes;
+SHM_EXTERN rtems_configuration_table *Shm_RTEMS_Configuration;
+SHM_EXTERN rtems_multiprocessing_table *Shm_RTEMS_MP_Configuration;
+SHM_EXTERN rtems_unsigned32 Shm_Receive_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Null_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Interrupt_count;
+SHM_EXTERN rtems_unsigned32 Shm_Local_node;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Local_receive_queue;
+SHM_EXTERN Shm_Node_status_control *Shm_Local_node_status;
+SHM_EXTERN rtems_unsigned32 Shm_isrstat;
+ /* reported by shmdr */
+
+SHM_EXTERN rtems_unsigned32 Shm_Pending_initialization;
+SHM_EXTERN rtems_unsigned32 Shm_Initialization_complete;
+SHM_EXTERN rtems_unsigned32 Shm_Active_node;
+
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_nodes;
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_envelopes;
+
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_End_of_list;
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_Not_on_list;
+
+/* functions */
+
+/* locked queue routines */
+void Shm_Locked_queue_Add(
+ Shm_Locked_queue_Control *, Shm_Envelope_control * );
+Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control * );
+void Shm_Locked_queue_Initialize(
+ Shm_Locked_queue_Control *, rtems_unsigned32 );
+ /* Shm_Initialize_lock is CPU dependent */
+ /* Shm_Lock is CPU dependent */
+ /* Shm_Unlock is CPU dependent */
+
+/* portable routines */
+void Init_env_pool();
+void Shm_Print_statistics( void );
+void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 );
+rtems_task Shm_Cause_interrupt( rtems_unsigned32 );
+void Shm_Poll();
+void Shm_setclockvec();
+void Shm_Convert_packet( rtems_packet_prefix * );
+
+/* CPU specific routines are inlined in shmcpu.h */
+
+/* target specific routines */
+void *Shm_Convert_address( void * );
+void Shm_Get_configuration( rtems_unsigned32, shm_config_table ** );
+void Shm_isr();
+void Shm_setvec( void );
+
+void Shm_Initialize_lock( Shm_Locked_queue_Control * );
+void Shm_Lock( Shm_Locked_queue_Control * );
+void Shm_Unlock( Shm_Locked_queue_Control * );
+
+/* MPCI entry points */
+rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Initialization( void );
+
+rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *
+);
+
+rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32,
+ rtems_packet_prefix *
+);
+
+extern rtems_mpci_table MPCI_table;
+
+#ifdef _SHM_INIT
+
+/* multiprocessor communications interface (MPCI) table */
+
+rtems_mpci_table MPCI_table = {
+ 100000, /* default timeout value in ticks */
+ MAX_PACKET_SIZE, /* maximum packet size */
+ Shm_Initialization, /* initialization procedure */
+ Shm_Get_packet, /* get packet procedure */
+ Shm_Return_packet, /* return packet procedure */
+ Shm_Send_packet, /* packet send procedure */
+ Shm_Receive_packet /* packet receive procedure */
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/unix/posix/README b/c/src/lib/libbsp/unix/posix/README
new file mode 100644
index 0000000000..0bf0782737
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/README
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+
+This is a "generic" BSP for a modern UNIX system which is enough
+System V and POSIX compliant to support at least the following:
+
+ + semaphores
+ + itimers
+ + mmap
+ + shared memory
+
+At the moment, this BSP is known to work with the following UNIXes:
+
+ + HP-UX 9.0.x
+ + Solaris 2.x
+ + Linux 1.1.x (single processor only -- mmap is broken)
diff --git a/c/src/lib/libbsp/unix/posix/clock/clock.c b/c/src/lib/libbsp/unix/posix/clock/clock.c
new file mode 100644
index 0000000000..3e05b694a7
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/clock/clock.c
@@ -0,0 +1,112 @@
+/* Clock
+ *
+ * This routine generates clock ticks using standard POSIX services.
+ * The tick frequency is specified by the bsp.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <stdlib.h>
+
+void Clock_exit(void);
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+
+rtems_unsigned32 Clock_driver_vector;
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+void Install_clock(rtems_isr_entry clock_isr)
+{
+ Clock_driver_ticks = 0;
+
+ (void) set_vector( clock_isr, Clock_driver_vector, 1 );
+
+ _CPU_Start_clock( BSP_Configuration.microseconds_per_tick );
+
+ atexit(Clock_exit);
+}
+
+void Clock_isr(int vector)
+{
+ Clock_driver_ticks++;
+ rtems_clock_tick();
+}
+
+/*
+ * Called via atexit()
+ * Remove the clock signal
+ */
+
+void Clock_exit(void)
+{
+ _CPU_Stop_clock();
+
+ (void) set_vector( 0, Clock_driver_vector, 1 );
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Clock_driver_vector = _CPU_Get_clock_vector();
+
+ Install_clock((rtems_isr_entry) Clock_isr);
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_unsigned32 isrlevel;
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(Clock_driver_vector);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ rtems_interrupt_disable( isrlevel );
+ (void) set_vector( args->buffer, Clock_driver_vector, 1 );
+ rtems_interrupt_enable( isrlevel );
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/unix/posix/console/console.c b/c/src/lib/libbsp/unix/posix/console/console.c
new file mode 100644
index 0000000000..de478328bb
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/console/console.c
@@ -0,0 +1,102 @@
+/*
+ * Console IO Support Routines
+ *
+ * These provide UNIX-like read and write calls for the C library.
+ *
+ * NOTE: For the most part, this is just a space holder.
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+rtems_device_driver
+console_initialize(rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return 0;
+}
+
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return -1;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/unix/posix/include/bsp.h b/c/src/lib/libbsp/unix/posix/include/bsp.h
new file mode 100644
index 0000000000..ede63e24b1
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/include/bsp.h
@@ -0,0 +1,106 @@
+/* bsp.h
+ *
+ * This include file contains all POSIX BSP definitions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_BSP_h
+#define __POSIX_BSP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
+#include <iosupp.h>
+
+/*
+ * Define the time limits for RTEMS Test Suite test durations.
+ * Long test and short test duration limits are provided. These
+ * values are in seconds and need to be converted to ticks for the
+ * application.
+ *
+ */
+
+#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
+#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
+
+/*
+ * Stuff for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+#define Install_tm27_vector( handler ) \
+ set_vector( (handler), 16, 1 )
+
+#define Cause_tm27_intr() \
+ raise( 16 )
+
+#define Clear_tm27_intr()
+
+#define Lower_tm27_intr() \
+ _ISR_Set_level( 0 );
+
+#define RAM_START 0
+#define RAM_END 0x100000
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration;
+
+/*
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
+/* functions */
+
+rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
+void bsp_start( void );
+void bsp_cleanup( void );
+
+/* miscellaneous stuff assumed to exist */
+
+extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+extern int rtems_argc;
+extern char **rtems_argv;
+
+extern rtems_unsigned32 bsp_isr_level;
+
+extern char *rtems_progname; /* UNIX executable name */
+
+extern int cpu_number;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/unix/posix/include/coverhd.h b/c/src/lib/libbsp/unix/posix/include/coverhd.h
new file mode 100644
index 0000000000..16d62e5e75
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/include/coverhd.h
@@ -0,0 +1,111 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ *
+ * NOTE: If these are all zero, then the times reported include all
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
+#define CALLING_OVERHEAD_TASK_CREATE 0
+#define CALLING_OVERHEAD_TASK_IDENT 0
+#define CALLING_OVERHEAD_TASK_START 0
+#define CALLING_OVERHEAD_TASK_RESTART 0
+#define CALLING_OVERHEAD_TASK_DELETE 0
+#define CALLING_OVERHEAD_TASK_SUSPEND 0
+#define CALLING_OVERHEAD_TASK_RESUME 0
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
+#define CALLING_OVERHEAD_TASK_MODE 0
+#define CALLING_OVERHEAD_TASK_GET_NOTE 0
+#define CALLING_OVERHEAD_TASK_SET_NOTE 0
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
+#define CALLING_OVERHEAD_CLOCK_GET 0
+#define CALLING_OVERHEAD_CLOCK_SET 0
+#define CALLING_OVERHEAD_CLOCK_TICK 0
+
+#define CALLING_OVERHEAD_TIMER_CREATE 0
+#define CALLING_OVERHEAD_TIMER_IDENT 0
+#define CALLING_OVERHEAD_TIMER_DELETE 0
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
+#define CALLING_OVERHEAD_TIMER_RESET 0
+#define CALLING_OVERHEAD_TIMER_CANCEL 0
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
+
+#define CALLING_OVERHEAD_EVENT_SEND 0
+#define CALLING_OVERHEAD_EVENT_RECEIVE 0
+#define CALLING_OVERHEAD_SIGNAL_CATCH 0
+#define CALLING_OVERHEAD_SIGNAL_SEND 0
+#define CALLING_OVERHEAD_PARTITION_CREATE 0
+#define CALLING_OVERHEAD_PARTITION_IDENT 0
+#define CALLING_OVERHEAD_PARTITION_DELETE 0
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
+#define CALLING_OVERHEAD_REGION_CREATE 0
+#define CALLING_OVERHEAD_REGION_IDENT 0
+#define CALLING_OVERHEAD_REGION_DELETE 0
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
+#define CALLING_OVERHEAD_PORT_CREATE 0
+#define CALLING_OVERHEAD_PORT_IDENT 0
+#define CALLING_OVERHEAD_PORT_DELETE 0
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 0
+#define CALLING_OVERHEAD_IO_OPEN 0
+#define CALLING_OVERHEAD_IO_CLOSE 0
+#define CALLING_OVERHEAD_IO_READ 0
+#define CALLING_OVERHEAD_IO_WRITE 0
+#define CALLING_OVERHEAD_IO_CONTROL 0
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/README b/c/src/lib/libbsp/unix/posix/shmsupp/README
new file mode 100644
index 0000000000..93d6fcbe8c
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+This directory contains the SHM driver support files for
+System V/POSIX derived UNIX flavors.
+
+WARNING: The interrupt support in this directory currently will
+ only work in a homogeneous system.
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/addrconv.c b/c/src/lib/libbsp/unix/posix/shmsupp/addrconv.c
new file mode 100644
index 0000000000..2b34ec8584
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/addrconv.c
@@ -0,0 +1,30 @@
+/* addrconv.v
+ *
+ * No address range conversion is required.
+ *
+ * Input parameters:
+ * addr - address to convert
+ *
+ * Output parameters:
+ * returns - converted address
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+void *Shm_Convert_address(
+ void *addr
+)
+{
+ return ( addr );
+}
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c b/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c
new file mode 100644
index 0000000000..cb3afabf98
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c
@@ -0,0 +1,75 @@
+/* void Shm_get_config( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the UNIX
+ * simulator.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+ * NOTES: This driver is capable of supporting a practically unlimited
+ * number of nodes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+#include <sys/types.h> /* pid_t */
+
+shm_config_table BSP_shm_cfgtbl;
+
+int semid;
+
+void Shm_Cause_interrupt_unix(
+ rtems_unsigned32 node
+);
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ _CPU_SHM_Init(
+ Shm_Maximum_nodes,
+ Shm_Is_master_node(),
+ (void **)&BSP_shm_cfgtbl.base,
+ (unsigned32 *)&BSP_shm_cfgtbl.length
+ );
+
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt_unix;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+ if ( _CPU_SHM_Get_vector() ) {
+ BSP_shm_cfgtbl.poll_intr = INTR_MODE;
+ BSP_shm_cfgtbl.Intr.address = (vol_u32 *) _CPU_Get_pid(); /* process id */
+ BSP_shm_cfgtbl.Intr.value = _CPU_SHM_Get_vector(); /* signal to send */
+ BSP_shm_cfgtbl.Intr.length = LONG;
+ } else {
+ BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
+ BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
+ BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
+ }
+
+ *shmcfg = &BSP_shm_cfgtbl;
+}
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/intr.c b/c/src/lib/libbsp/unix/posix/shmsupp/intr.c
new file mode 100644
index 0000000000..845cedd36f
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/intr.c
@@ -0,0 +1,34 @@
+/* void Shm_interrupt_unix( node )
+ *
+ * This routine is the shared memory driver routine which
+ * generates interrupts to other CPUs.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+#include <sys/types.h> /* pid_t */
+
+void Shm_Cause_interrupt_unix(
+ rtems_unsigned32 node
+)
+{
+ Shm_Interrupt_information *intr;
+ intr = &Shm_Interrupt_table[node];
+
+ _CPU_SHM_Send_interrupt( (pid_t) intr->address, intr->value );
+}
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/lock.c b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c
new file mode 100644
index 0000000000..6ccd680842
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c
@@ -0,0 +1,72 @@
+/* Shared Memory Lock Routines
+ *
+ * This shared memory locked queue support routine need to be
+ * able to lock the specified locked queue. Interrupts are
+ * disabled while the queue is locked to prevent preemption
+ * and deadlock when two tasks poll for the same lock.
+ * previous level.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+/*
+ * Shm_Initialize_lock
+ *
+ * Initialize the lock for the specified locked queue.
+ */
+
+void Shm_Initialize_lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ lq_cb->lock = lq_cb - Shm_Locked_queues;
+}
+
+/* Shm_Lock( &lq_cb )
+ *
+ * This shared memory locked queue support routine locks the
+ * specified locked queue. It disables interrupts to prevent
+ * a deadlock condition.
+ */
+
+void Shm_Lock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ rtems_interrupt_disable( isr_level );
+
+ Shm_isrstat = isr_level;
+
+ _CPU_SHM_Lock( lq_cb->lock );
+}
+
+/*
+ * Shm_Unlock
+ *
+ * Unlock the lock for the specified locked queue.
+ */
+
+void Shm_Unlock(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ rtems_unsigned32 isr_level;
+
+ _CPU_SHM_Unlock( lq_cb->lock );
+
+ isr_level = Shm_isrstat;
+ rtems_interrupt_enable( isr_level );
+}
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/mpisr.c b/c/src/lib/libbsp/unix/posix/shmsupp/mpisr.c
new file mode 100644
index 0000000000..a047edf2f2
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/shmsupp/mpisr.c
@@ -0,0 +1,32 @@
+/* Shm_setvec
+ *
+ * This driver routine sets the SHM interrupt vector to point to the
+ * driver's SHM interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <shm.h>
+
+void Shm_setvec( void )
+{
+ int vector;
+
+ vector = _CPU_SHM_Get_vector();
+
+ if ( vector )
+ set_vector( Shm_isr, vector, 1 );
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/bspclean.c b/c/src/lib/libbsp/unix/posix/startup/bspclean.c
new file mode 100644
index 0000000000..1fe2de4439
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/bspclean.c
@@ -0,0 +1,41 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and returns
+ * control to a monitor but on the UNIX simulator
+ * we do that directly from main.c.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include <stdio.h>
+
+/*
+ * The app has "exited" (called rtems_shutdown_executive)
+ */
+
+void bsp_cleanup( void )
+{
+ /*
+ * Invoke any fatal error extension and "halt"
+ * By definition, rtems_fatal_error_occurred does not return.
+ */
+
+ fflush(stdout);
+ fflush(stderr);
+
+ rtems_fatal_error_occurred(0);
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/bspstart.c b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
new file mode 100644
index 0000000000..8f8344523a
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
@@ -0,0 +1,368 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * Called by RTEMS::RTEMS constructor in startup-ctor.cc
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <bsp.h>
+#include <libcsupport.h>
+
+#include <rtems/libio.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+extern rtems_configuration_table Configuration;
+
+/*
+ * A copy of the configuration table from the application
+ * with some changes applied to it.
+ */
+
+rtems_configuration_table BSP_Configuration;
+rtems_multiprocessing_table BSP_Multiprocessing;
+rtems_cpu_table Cpu_table;
+rtems_unsigned32 bsp_isr_level;
+rtems_unsigned32 Heap_size;
+int rtems_argc;
+char **rtems_argv;
+
+/*
+ * May be overridden by RTEMS_WORKSPACE_SIZE and RTEMS_HEAPSPACE_SIZE
+ * environment variables; see below.
+ */
+
+#define DEFAULT_WORKSPACE_SIZE (WORKSPACE_MB * (1024 * 1024))
+#define DEFAULT_HEAPSPACE_SIZE (HEAPSPACE_MB * (1024 * 1024))
+
+/*
+ * Amount to increment itimer by each pass
+ * It is a variable instead of a #define to allow the 'looptest'
+ * script to bump it without recompiling rtems
+ */
+
+rtems_unsigned32 CPU_CLICKS_PER_TICK;
+
+/*
+ * Function: bsp_libc_init
+ * Created: 94/12/6
+ *
+ * Description:
+ * Initialize whatever libc we are using
+ * called from bsp_postdriver_hook
+ *
+ *
+ * Parameters:
+ * none
+ *
+ * Returns:
+ * none.
+ *
+ * Side Effects:
+ *
+ *
+ * Notes:
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+void
+bsp_libc_init(void)
+{
+ void *heap_start;
+
+ if (getenv("RTEMS_HEAPSPACE_SIZE"))
+ Heap_size = strtol(getenv("RTEMS_HEAPSPACE_SIZE"), 0, 0);
+ else
+ Heap_size = DEFAULT_HEAPSPACE_SIZE;
+
+ heap_start = 0;
+
+ RTEMS_Malloc_Initialize((void *)heap_start, Heap_size, 1024 * 1024);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ libc_init(1);
+}
+
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * Parameters:
+ * none
+ *
+ * Returns:
+ * nada
+ *
+ * Side Effects:
+ * installs a few extensions
+ *
+ * Notes:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+
+ /*
+ * Dump malloc stats on exit...
+ */
+#if defined(RTEMS_DEBUG)
+ atexit(malloc_dump);
+#endif
+}
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+#if 0
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+#endif
+}
+
+/*
+ * Function: bsp_start
+ * Created: 94/12/6
+ *
+ * Description:
+ * called by crt0 as our "main" equivalent
+ *
+ *
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+void
+bsp_start(void)
+{
+ unsigned32 workspace_ptr;
+
+ /*
+ * Copy the table
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * If the node number is -1 then the application better provide
+ * it through environment variables RTEMS_NODE.
+ * Ditto for RTEMS_MAXIMUM_NODES
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table) {
+ char *p;
+
+ /* make a copy for possible editing */
+ BSP_Multiprocessing = *BSP_Configuration.User_multiprocessing_table;
+ BSP_Configuration.User_multiprocessing_table = &BSP_Multiprocessing;
+
+ if (BSP_Multiprocessing.node == -1)
+ {
+ p = getenv("RTEMS_NODE");
+ BSP_Multiprocessing.node = p ? atoi(p) : 1;
+ }
+
+ /* If needed provide maximum_nodes also */
+ if (BSP_Multiprocessing.maximum_nodes == -1)
+ {
+ p = getenv("RTEMS_MAXIMUM_NODES");
+ BSP_Multiprocessing.maximum_nodes = p ? atoi(p) : 1;
+ }
+ }
+
+ /*
+ * Set cpu_number to accurately reflect our cpu number
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ cpu_number = BSP_Configuration.User_multiprocessing_table->node - 1;
+ else
+ cpu_number = 0;
+
+ if (getenv("RTEMS_WORKSPACE_SIZE"))
+ BSP_Configuration.work_space_size =
+ strtol(getenv("RTEMS_WORKSPACE_SIZE"), 0, 0);
+ else
+ BSP_Configuration.work_space_size = DEFAULT_WORKSPACE_SIZE;
+
+ /*
+ * Allocate workspace memory, ensuring it is properly aligned
+ */
+
+ workspace_ptr =
+ (unsigned32) sbrk(BSP_Configuration.work_space_size + CPU_ALIGNMENT);
+ workspace_ptr += CPU_ALIGNMENT - 1;
+ workspace_ptr &= ~(CPU_ALIGNMENT - 1);
+
+ BSP_Configuration.work_space_start = (void *) workspace_ptr;
+
+ /*
+ * Set up our hooks
+ * Make sure libc_init is done before drivers init'd so that
+ * they can use atexit()
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ /*
+ * Don't zero out the workspace since it is in the BSS under UNIX.
+ */
+
+ Cpu_table.do_zero_of_workspace = FALSE;
+
+ /*
+ * XXX; interrupt stack not currently used, so this doesn't matter
+ */
+
+ Cpu_table.interrupt_stack_size = (12 * 1024);
+
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+
+ /*
+ * Add 1 region for RTEMS Malloc
+ */
+
+ BSP_Configuration.maximum_regions++;
+
+#ifdef RTEMS_NEWLIB
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Add 1 extension for stack checker
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Add 1 extension for MPCI_fatal
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ BSP_Configuration.maximum_extensions++;
+
+ CPU_CLICKS_PER_TICK = 1;
+
+ /*
+ * Start most of RTEMS
+ * main() will start the rest
+ */
+
+ bsp_isr_level = rtems_initialize_executive_early(
+ &BSP_Configuration,
+ &Cpu_table
+ );
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/exit.c b/c/src/lib/libbsp/unix/posix/startup/exit.c
new file mode 100644
index 0000000000..8e07dc0577
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/exit.c
@@ -0,0 +1,27 @@
+/*
+ * exit
+ *
+ * This routine returns control to "the pre-RTEMS environment".
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <clockdrv.h>
+
+void _exit( void )
+{
+ /* Clock or Timer cleanup is run by at_exit() */
+
+ Io_cleanup();
+
+ bsp_cleanup();
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/no-ctor.c b/c/src/lib/libbsp/unix/posix/startup/no-ctor.c
new file mode 100644
index 0000000000..349ad2b1dd
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/no-ctor.c
@@ -0,0 +1,16 @@
+/*
+ * rtems, floss, libc are always compiled with GNU compilers
+ * application code may be compiled with some other C++ compiler
+ * that has a different global constructor technique.
+ *
+ * For the simple case, where the app has no global constructors or
+ * is compiled by g++, we provide this empty routine
+ * In order to get both g++ constructors (RTEMS::RTEMS, for example)
+ * and application constructors run, we provide this routine.
+ *
+ * $Id$
+ */
+
+void invoke_non_gnu_constructors(void)
+{
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc b/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc
new file mode 100644
index 0000000000..87dba921a7
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc
@@ -0,0 +1,116 @@
+/*
+ * rtems-ctor.cc
+ *
+ * Description:
+ * This file exists solely to (try to) ensure RTEMS is initialized
+ * before any global constructors are run.
+ *
+ * The problem:
+ * Global constructors might reasonably expect that new() will
+ * work, but since new() uses malloc() which uses RTEMS regions,
+ * it can not be called until after initialize_executive().
+ *
+ * Global constructors are called in GNU systems one of 2 ways:
+ *
+ * an "invisible" call to __main() inserted by compiler
+ * This __main() calls __do_global_ctors() which
+ * walks thru the table and calls all global
+ * constructors.
+ *
+ * or -
+ * A special section is put into the linked binary. The
+ * system startup code knows to run the constructors in
+ * this special section before calling main().
+ *
+ * By making RTEMS initialization a constructor, we avoid having
+ * too much about all this. All we have to guarantee is that
+ * this constructor is the first one run.
+ *
+ *
+ * So for the first case above, this is what happens
+ *
+ * host crt0
+ * main()
+ * __main()
+ * __do_global_ctors()
+ * bsp_start()
+ * init_executive_early()
+ * <<any other constructors>>
+ *
+ * init_executive_late()
+ * bsp_cleanup()
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * RTEMS program name
+ * Probably not used by anyone, but it is nice to have it.
+ * Actually the UNIX version of CPU_INVOKE_DEBUGGER will probably
+ * need to use it
+ */
+
+char *rtems_progname;
+
+class RTEMS {
+ public:
+ RTEMS();
+ ~RTEMS();
+};
+
+RTEMS rtems_constructor;
+
+RTEMS::RTEMS()
+{
+ bsp_start();
+}
+
+RTEMS::~RTEMS()
+{
+ bsp_cleanup();
+}
+
+extern "C" {
+ extern void invoke_non_gnu_constructors(void);
+
+ int
+ main(int argc,
+ char **argv,
+ char **environp)
+ {
+ rtems_argc = argc;
+ rtems_argv = argv;
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /*
+ * run any non-gnu constructors we may need
+ */
+
+ invoke_non_gnu_constructors();
+
+ /*
+ * Start multitasking
+ */
+
+ rtems_initialize_executive_late( bsp_isr_level );
+
+ /*
+ * Returns when multitasking is stopped
+ * This allows our destructors to get run normally
+ */
+
+ fflush( stdout );
+ fflush( stderr );
+ return 0;
+ }
+}
diff --git a/c/src/lib/libbsp/unix/posix/startup/setvec.c b/c/src/lib/libbsp/unix/posix/startup/setvec.c
new file mode 100644
index 0000000000..4f65fb57e5
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/startup/setvec.c
@@ -0,0 +1,47 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on UNIX.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+rtems_isr_entry
+set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ rtems_isr_entry rtems_isr_ptr = 0;
+ proc_ptr raw_isr_ptr;
+
+ if ( type ) {
+ rtems_interrupt_catch( handler, vector, &rtems_isr_ptr );
+ return rtems_isr_ptr;
+ } else {
+ _CPU_ISR_install_vector( vector, (proc_ptr) handler, &raw_isr_ptr );
+ return raw_isr_ptr;
+ }
+
+}
+
+
diff --git a/c/src/lib/libbsp/unix/posix/timer/timer.c b/c/src/lib/libbsp/unix/posix/timer/timer.c
new file mode 100644
index 0000000000..abe7e6d6fd
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/timer/timer.c
@@ -0,0 +1,74 @@
+/* timer.c
+ *
+ * This file manages the interval timer on the PA-RISC.
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/* For solaris 2.4 */
+#define __EXTENSIONS__
+
+#include <bsp.h>
+#include <time.h>
+#include <sys/time.h>
+
+struct timeval Timer_start;
+struct timeval Timer_stop;
+struct timezone Time_zone;
+
+rtems_boolean Timer_driver_Find_average_overhead;
+
+void Timer_initialize()
+{
+ gettimeofday( &Timer_start, &Time_zone );
+}
+
+#define AVG_OVERHEAD 0 /* It typically takes xxx microseconds */
+ /* (XX countdowns) to start/stop the timer. */
+#define LEAST_VALID 10 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ int total;
+
+ gettimeofday( &Timer_stop, &Time_zone );
+
+ if ( Timer_stop.tv_sec == Timer_start.tv_sec )
+ total = Timer_stop.tv_usec - Timer_start.tv_usec;
+ else {
+ total = 1000000 - Timer_start.tv_usec;
+ total += (Timer_stop.tv_sec - Timer_start.tv_sec - 1) * 1000000;
+ total += Timer_stop.tv_usec;
+ }
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in countdown units */
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ return total - AVG_OVERHEAD;
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libbsp/unix/posix/times b/c/src/lib/libbsp/unix/posix/times
new file mode 100644
index 0000000000..28811e37ba
--- /dev/null
+++ b/c/src/lib/libbsp/unix/posix/times
@@ -0,0 +1,10 @@
+#
+# Timing Test Suite Results for the UNIX Simulator BSP
+#
+# $Id$
+#
+
+The times when running on the UNIX simulator are irrelevant. They vary based
+on a variety of factors including host OS, host configuration, and system load.
+The intent of the UNIX simulator is to provide a testing and prototyping
+environment not to compete with the "normal" embedded role of RTEMS.
diff --git a/c/src/lib/libc/README b/c/src/lib/libc/README
new file mode 100644
index 0000000000..ee7a90501e
--- /dev/null
+++ b/c/src/lib/libc/README
@@ -0,0 +1,37 @@
+--
+-- $Id$
+--
+
+Overview of newlib support (newlib is from CYGNUS)
+ Each task can have its own libc state including:
+ open stdio files
+ strtok
+ multi precision arithmetic state
+ etc.
+
+ This is implemented by a reentrancy data structure for each task.
+
+ When a task is "started" (in RTEMS sense) the reentrancy structure
+ is allocated. Its address is stored in notepad[NOTEPAD_LAST].
+
+ When task is switched to, the value of global variable _impure_ptr
+ is changed to the value of the new tasks reentrancy structure.
+
+ When a task is deleted
+ atexit() processing (for that task) happens
+ task's stdio buffers are flushed
+
+ When exit(3) is called
+ calling task's atexit processing done
+ global libc state atexit processing done
+ (this will include any atexit routines installed by drivers)
+ executive is shutdown
+ causes a context switch back to bsp land
+
+
+NOTE:
+ libc extension are installed by bsp_libc_init()
+ iff we are using clock interrupts.
+ This hack is necessary to allow the tmtests to avoid
+ timing the extensions.
+
diff --git a/c/src/lib/libc/__brk.c b/c/src/lib/libc/__brk.c
new file mode 100644
index 0000000000..5f256cb072
--- /dev/null
+++ b/c/src/lib/libc/__brk.c
@@ -0,0 +1,44 @@
+#if !defined(RTEMS_UNIX)
+
+/*
+ * RTEMS "Broken" __brk/__sbrk Implementation
+ *
+ * NOTE: sbrk is BSP provided.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <signal.h>
+#include <errno.h>
+#include <sys/types.h>
+#ifdef RTEMS_NEWLIB
+#include <reent.h>
+#endif
+#include <unistd.h>
+
+/* we use RTEMS for memory management. We don't need sbrk */
+
+void * __sbrk(int incr)
+{
+ errno = EINVAL;
+ return (void *)0;
+}
+
+int __brk( const void *endds )
+{
+ errno = EINVAL;
+ return -1;
+}
+
+#endif
diff --git a/c/src/lib/libc/__gettod.c b/c/src/lib/libc/__gettod.c
new file mode 100644
index 0000000000..6c9350d41c
--- /dev/null
+++ b/c/src/lib/libc/__gettod.c
@@ -0,0 +1,103 @@
+#if !defined(RTEMS_UNIX)
+/*
+ * RTEMS gettimeofday Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <time.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <assert.h>
+
+/*
+ * NOTE: The solaris gettimeofday does not have a second parameter.
+ */
+
+int gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ rtems_status_code status;
+ rtems_clock_time_value time;
+
+ if ( !tp ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ tp->tv_sec = time.seconds;
+ tp->tv_usec = time.microseconds;
+
+ /*
+ * newlib does not have timezone and daylight savings time
+ * yet. When it does this needs to be fixed.
+ */
+
+#if 0
+ if ( tzp ) {
+ tzp->tz_minuteswest = 0; /* at UTC */
+ tzp->tz_dsttime = 0; /* no daylight savings */
+ tzp->minuteswest = timezone / 60; /* from seconds to minutes */
+ tzp->dsttime = daylight;
+ }
+#endif
+ return 0;
+}
+
+#if defined(RTEMS_NEWLIB)
+
+#if 0
+/*
+ * "Reentrant" version
+ */
+
+int _gettimeofday_r(
+ struct _reent *ignored_reentrancy_stuff,
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+#endif
+
+/*
+ * "System call" version
+ */
+
+int _gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+
+#endif /* defined(RTEMS_NEWLIB) */
+
+#endif
diff --git a/c/src/lib/libc/__times.c b/c/src/lib/libc/__times.c
new file mode 100644
index 0000000000..12fd9241fe
--- /dev/null
+++ b/c/src/lib/libc/__times.c
@@ -0,0 +1,65 @@
+/*
+ * RTEMS _times Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <sys/times.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <assert.h>
+
+clock_t _times(
+ struct tms *ptms
+)
+{
+ rtems_status_code status;
+ rtems_interval ticks_since_boot;
+
+ if ( !ptms ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get(
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ &ticks_since_boot
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ /*
+ * RTEMS has no notion of system versus user time and does
+ * not (as of 3.2.0) keep track of CPU usage on a per task basis.
+ */
+
+ ptms->tms_utime = ticks_since_boot;
+ ptms->tms_stime = 0;
+ ptms->tms_cutime = 0;
+ ptms->tms_cstime = 0;
+
+ return 0;
+}
+
+clock_t times(
+ struct tms *ptms
+)
+{
+ return _times( ptms );
+}
+
diff --git a/c/src/lib/libc/assoc.c b/c/src/lib/libc/assoc.c
new file mode 100644
index 0000000000..74387a8c5b
--- /dev/null
+++ b/c/src/lib/libc/assoc.c
@@ -0,0 +1,260 @@
+/*
+ * assoc.c
+ * rtems assoc routines
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "assoc.h"
+
+#include <stdio.h> /* sprintf */
+#include <string.h> /* strcat, strcmp */
+
+#define STREQ(a,b) (strcmp((a), (b)) == 0)
+#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (strcmp(ap->name, name) == 0)
+ return ap;
+
+ return default_ap;
+}
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->local_value == local_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->remote_value == remote_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+/*
+ * Get values
+ */
+
+unsigned32
+rtems_assoc_remote_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_remote_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+/*
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+
+const char *
+rtems_assoc_name_bad(
+ unsigned32 bad_value
+)
+{
+#ifdef RTEMS_DEBUG
+ static char bad_buffer[32];
+
+ sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
+#else
+ static char bad_buffer[32] = "<assoc.c: BAD NAME>";
+#endif
+ return bad_buffer;
+}
+
+
+const char *
+rtems_assoc_name_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(local_value);
+}
+
+const char *
+rtems_assoc_name_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(remote_value);
+}
+
+/*
+ * Bitfield functions assume just 1 bit set in each of remote and local
+ * entries; they do not check for this.
+ */
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ unsigned32 b;
+ unsigned32 remote_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & local_value)
+ remote_value |= rtems_assoc_remote_by_local(ap, b);
+
+ return remote_value;
+}
+
+
+unsigned32 rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ unsigned32 b;
+ unsigned32 local_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & remote_value)
+ local_value |= rtems_assoc_local_by_remote(ap, b);
+
+ return local_value;
+}
+
+char *
+rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_remote(ap, b));
+ }
+
+ return buffer;
+}
+
+char *
+rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_local(ap, b));
+ }
+
+ return buffer;
+}
diff --git a/c/src/lib/libc/assoc.h b/c/src/lib/libc/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/c/src/lib/libc/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c
new file mode 100644
index 0000000000..5bd481c3e6
--- /dev/null
+++ b/c/src/lib/libc/error.c
@@ -0,0 +1,209 @@
+/*
+ * report errors and panics to RTEMS' stderr.
+ * Currently just used by RTEMS monitor.
+ *
+ * $Id$
+ */
+
+
+/*
+ * These routines provide general purpose error reporting.
+ * rtems_error reports an error to stderr and allows use of
+ * printf style formatting. A newline is appended to all messages.
+ *
+ * error_flag can be specified as any of the following:
+ *
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * It can also include a rtems_status value which can be OR'd
+ * with the above flags. *
+ *
+ * EXAMPLE
+ * #include <rtems.h>
+ * #include <rtems/error.h>
+ * rtems_error(0, "stray interrupt %d", intr);
+ *
+ * EXAMPLE
+ * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
+ * {
+ * rtems_error(status | RTEMS_ERROR_ABORT,
+ * "could not create task");
+ * }
+ *
+ * EXAMPLE
+ * if ((fd = open(pathname, O_RDNLY)) < 0)
+ * {
+ * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
+ * goto failed;
+ * }
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "error.h"
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h> /* _exit() */
+
+/* bug in hpux <errno.h>: no prototypes unless you are C++ */
+#ifdef hpux9
+char *strerror(int);
+#endif
+
+extern char *rtems_progname;
+int rtems_panic_in_progress;
+
+rtems_assoc_t rtems_status_assoc[] = {
+ { "successful completion", RTEMS_SUCCESSFUL, },
+ { "returned from a thread", RTEMS_TASK_EXITTED, },
+ { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
+ { "invalid object name", RTEMS_INVALID_NAME, },
+ { "invalid object id", RTEMS_INVALID_ID, },
+ { "too many", RTEMS_TOO_MANY, },
+ { "timed out waiting", RTEMS_TIMEOUT, },
+ { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
+ { "specified size was invalid", RTEMS_INVALID_SIZE, },
+ { "address specified is invalid", RTEMS_INVALID_ADDRESS, },
+ { "number was invalid", RTEMS_INVALID_NUMBER, },
+ { "item has not been initialized", RTEMS_NOT_DEFINED, },
+ { "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
+ { "request not satisfied", RTEMS_UNSATISFIED, },
+ { "thread is in wrong state", RTEMS_INCORRECT_STATE, },
+ { "thread already in state", RTEMS_ALREADY_SUSPENDED, },
+ { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
+ { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
+ { "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
+ { "invalid thread priority", RTEMS_INVALID_PRIORITY, },
+ { "invalid date/time", RTEMS_INVALID_CLOCK, },
+ { "invalid node id", RTEMS_INVALID_NODE, },
+ { "directive not configured", RTEMS_NOT_CONFIGURED, },
+ { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
+ { "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
+ { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
+ { "could not get enough memory", RTEMS_NO_MEMORY, },
+ { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
+ { 0, 0, 0 },
+};
+
+
+const char *
+rtems_status_text(
+ rtems_status_code status
+)
+{
+ return rtems_assoc_name_by_local(rtems_status_assoc, status);
+}
+
+
+static int rtems_verror(
+ unsigned32 error_flag,
+ const char *printf_format,
+ va_list arglist
+)
+{
+ int local_errno = 0;
+ int chars_written = 0;
+ rtems_status_code status;
+
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_panic_in_progress++;
+
+ /* disable task switches */
+ _Thread_Disable_dispatch();
+
+ /* don't aggravate things */
+ if (rtems_panic_in_progress > 2)
+ return 0;
+ }
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ status = error_flag & ~RTEMS_ERROR_MASK;
+ if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
+ local_errno = errno;
+
+ if (_System_state_Is_multiprocessing)
+ fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
+
+ if (rtems_progname && *rtems_progname)
+ chars_written += fprintf(stderr, "%s: ", rtems_progname);
+ chars_written += vfprintf(stderr, printf_format, arglist);
+
+ if (status)
+ chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
+
+ if (local_errno)
+ if ((local_errno > 0) && *strerror(local_errno))
+ chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
+ else
+ chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
+
+ chars_written += fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
+ {
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_error(0, "fatal error, exiting");
+ _exit(local_errno);
+ }
+ else
+ {
+ rtems_error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+ return chars_written;
+}
+
+
+/*
+ * Report an error.
+ * error_flag is as above; printf_format is a normal
+ * printf(3) format string, with its concommitant arguments.
+ *
+ * Returns the number of characters written.
+ */
+
+int rtems_error(
+ int error_flag,
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+ int chars_written;
+
+ va_start(arglist, printf_format);
+ chars_written = rtems_verror(error_flag, printf_format, arglist);
+ va_end(arglist);
+
+ return chars_written;
+}
+
+/*
+ * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
+ */
+
+void rtems_panic(
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+
+ va_start(arglist, printf_format);
+ (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
+ va_end(arglist);
+}
diff --git a/c/src/lib/libc/error.h b/c/src/lib/libc/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/c/src/lib/libc/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libc/hosterr.c b/c/src/lib/libc/hosterr.c
new file mode 100644
index 0000000000..7fc2ca966e
--- /dev/null
+++ b/c/src/lib/libc/hosterr.c
@@ -0,0 +1,43 @@
+/*
+ * Routines to access a host errno
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <errno.h>
+
+int host_errno(void);
+
+/*
+ * copy host errno, if any to thread aware errno, if any
+ */
+
+void fix_syscall_errno(void)
+{
+ errno = host_errno();
+}
+
+/*
+ * Get the host system errno, if any
+ * When using newlib (or possibly other libc's) on top of UNIX
+ * the errno returned by system calls may be unavailable due
+ * to trickery of making errno thread aware.
+ * This provides a kludge of getting at it.
+ */
+
+#undef errno
+extern int errno;
+int host_errno(void)
+{
+ return errno;
+}
+
diff --git a/c/src/lib/libc/internal.h b/c/src/lib/libc/internal.h
new file mode 100644
index 0000000000..8ca6c8ed48
--- /dev/null
+++ b/c/src/lib/libc/internal.h
@@ -0,0 +1,41 @@
+/* internal.h
+ *
+ * This include file contains internal information
+ * for the RTEMS C library support which is needed across
+ * files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INTERNAL_LIBC_h
+#define __INTERNAL_LIBC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void MY_task_set_note(
+ rtems_tcb *tcb,
+ rtems_unsigned32 notepad,
+ rtems_unsigned32 note
+);
+
+rtems_unsigned32 MY_task_get_note(
+ rtems_tcb *tcb,
+ rtems_unsigned32 notepad
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libc/libcsupport.h b/c/src/lib/libc/libcsupport.h
new file mode 100644
index 0000000000..f43cd189e1
--- /dev/null
+++ b/c/src/lib/libc/libcsupport.h
@@ -0,0 +1,42 @@
+/* libcsupport.h
+ *
+ * This include file contains the information regarding the
+ * RTEMS specific support for the standard C library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __LIBC_SUPPORT_h
+#define __LIBC_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+);
+
+extern void malloc_dump(void);
+extern void libc_init(int reentrant);
+extern int host_errno(void);
+extern void fix_syscall_errno(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libc/libio.c b/c/src/lib/libc/libio.c
new file mode 100644
index 0000000000..a01dea7b8a
--- /dev/null
+++ b/c/src/lib/libc/libio.c
@@ -0,0 +1,442 @@
+/*
+ * Provide UNIX/POSIX-like io system calls for RTEMS using the
+ * RTEMS IO manager
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
+
+#include <stdio.h> /* O_RDONLY, et.al. */
+#include <fcntl.h> /* O_RDONLY, et.al. */
+
+#if defined(solaris2)
+#define O_NDELAY O_NONBLOCK
+#elif defined(RTEMS_NEWLIB)
+#define O_NDELAY _FNBIO
+#endif
+
+#include <errno.h>
+#include <string.h> /* strcmp */
+#include <unistd.h>
+#include <stdlib.h> /* calloc() */
+
+#include "libio.h" /* libio.h not pulled in by rtems */
+
+/*
+ * Semaphore to protect the io table
+ */
+
+Objects_Id rtems_libio_semaphore;
+
+#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O')
+#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n)
+
+unsigned32 rtems_libio_number_iops;
+rtems_libio_t *rtems_libio_iops;
+rtems_libio_t *rtems_libio_last_iop;
+
+#define rtems_libio_iop(fd) ((((unsigned32)(fd)) < rtems_libio_number_iops) ? \
+ &rtems_libio_iops[fd] : 0)
+
+#define rtems_libio_check_fd(fd) \
+ do { \
+ if ((fd) >= rtems_libio_number_iops) \
+ { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_buffer(buffer) \
+ do { \
+ if ((buffer) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_count(count) \
+ do { \
+ if ((count) == 0) \
+ { \
+ return 0; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_permissions(iop, flag) \
+ do { \
+ if (((iop)->flags & (flag)) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+
+void
+rtems_libio_config(
+ rtems_configuration_table *config,
+ unsigned32 max_fds
+ )
+{
+ rtems_libio_number_iops = max_fds;
+
+ /*
+ * tweak config to reflect # of semaphores we will need
+ */
+
+ config->maximum_semaphores += 1; /* one for iop table */
+ config->maximum_semaphores += max_fds;
+}
+
+/*
+ * Called by bsp startup code to init the libio area.
+ */
+
+void
+rtems_libio_init(void)
+{
+ rtems_status_code rc;
+
+ if (rtems_libio_number_iops > 0)
+ {
+ rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops,
+ sizeof(rtems_libio_t));
+ if (rtems_libio_iops == NULL)
+ rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
+
+ rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
+ }
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_SEM,
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &rtems_libio_semaphore
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+}
+
+/*
+ * Convert RTEMS status to a UNIX errno
+ */
+
+rtems_assoc_t errno_assoc[] = {
+ { "OK", RTEMS_SUCCESSFUL, 0 },
+ { "TIMEOUT", RTEMS_TIMEOUT, ETIME },
+ { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_errno(rtems_status_code code)
+{
+ int rc;
+
+ if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code)))
+ {
+ errno = rc;
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
+ */
+
+rtems_assoc_t access_modes_assoc[] = {
+ { "READ", LIBIO_FLAGS_READ, O_RDONLY },
+ { "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY },
+ { "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR },
+ { 0, 0, 0 },
+};
+
+rtems_assoc_t status_flags_assoc[] = {
+ { "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
+ { "APPEND", LIBIO_FLAGS_APPEND, O_APPEND },
+ { "CREATE", LIBIO_FLAGS_CREATE, O_CREAT },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_fcntl_flags(unsigned32 fcntl_flags)
+{
+ unsigned32 flags = 0;
+ unsigned32 access_modes;
+
+ /*
+ * Access mode is a small integer
+ */
+
+ access_modes = fcntl_flags & O_ACCMODE;
+ fcntl_flags &= ~O_ACCMODE;
+ flags = rtems_assoc_local_by_remote(access_modes_assoc, access_modes);
+
+ /*
+ * Everything else is single bits
+ */
+
+ flags |= rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
+ return flags;
+}
+
+
+static rtems_libio_t *
+rtems_libio_allocate(void)
+{
+ rtems_libio_t *iop;
+ rtems_status_code rc;
+
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ for (iop = rtems_libio_iops; iop <= rtems_libio_last_iop; iop++)
+ if ((iop->flags & LIBIO_FLAGS_OPEN) == 0)
+ {
+ /*
+ * Got one; create a semaphore for it
+ */
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &iop->sem
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ iop->flags = LIBIO_FLAGS_OPEN;
+ goto done;
+ }
+
+failed:
+ iop = 0;
+
+done:
+ rtems_semaphore_release(rtems_libio_semaphore);
+ return iop;
+}
+
+static void
+rtems_libio_free(rtems_libio_t *iop)
+{
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ if (iop->sem)
+ rtems_semaphore_delete(iop->sem);
+ (void) memset(iop, 0, sizeof(*iop));
+
+ rtems_semaphore_release(rtems_libio_semaphore);
+}
+
+int
+__open(
+ const char *pathname,
+ unsigned32 flag,
+ unsigned32 mode)
+{
+ rtems_status_code rc;
+ rtems_libio_t *iop = 0;
+ rtems_driver_name_t *np;
+ rtems_libio_open_close_args_t args;
+
+ if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
+ goto done;
+
+ iop = rtems_libio_allocate();
+ if (iop == 0)
+ {
+ rc = RTEMS_TOO_MANY;
+ goto done;
+ }
+
+ iop->driver = np;
+ iop->pathname = (char *) pathname;
+ iop->flags |= rtems_libio_fcntl_flags(flag);
+
+ args.iop = iop;
+ args.flags = iop->flags;
+ args.mode = mode;
+
+ rc = rtems_io_open(np->major, np->minor, (void *) &args);
+
+done:
+ if (rc != RTEMS_SUCCESSFUL)
+ {
+ if (iop)
+ rtems_libio_free(iop);
+ return rtems_libio_errno(rc);
+ }
+
+ return iop - rtems_libio_iops;
+}
+
+int
+__close(
+ int fd
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_open_close_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.flags = 0;
+ args.mode = 0;
+
+ rc = rtems_io_close(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+ return 0;
+}
+
+int
+__read(
+ int fd,
+ void * buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_read(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__write(
+ int fd,
+ const void *buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_WRITE);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = (void *) buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_write(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__ioctl(
+ int fd,
+ unsigned32 command,
+ void * buffer)
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_ioctl_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.command = command;
+ args.buffer = buffer;
+
+ rc = rtems_io_control(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.ioctl_return;
+}
+
+/*
+ * internal only??
+ */
+
+
+int
+__lseek(
+ int fd,
+ rtems_libio_offset_t offset,
+ int whence
+ )
+{
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+
+ rtems_libio_check_fd(fd);
+
+ switch (whence)
+ {
+ case SEEK_SET:
+ iop->offset = offset;
+ break;
+
+ case SEEK_CUR:
+ iop->offset += offset;
+ break;
+
+ case SEEK_END:
+ iop->offset = iop->size - offset;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
diff --git a/c/src/lib/libc/libio.h b/c/src/lib/libc/libio.h
new file mode 100644
index 0000000000..07d72620b1
--- /dev/null
+++ b/c/src/lib/libc/libio.h
@@ -0,0 +1,98 @@
+/*
+ * General purpose communication channel for RTEMS to allow UNIX/POSIX
+ * system call behavior on top of RTEMS IO devices.
+ *
+ * TODO
+ * stat(2)
+ * unlink(2)
+ * rename(2)
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_LIBIO_H
+#define _RTEMS_LIBIO_H
+
+typedef unsigned32 rtems_libio_offset_t;
+
+/*
+ * An open file data structure, indexed by 'fd'
+ * TODO:
+ * should really have a separate per/file data structure that this
+ * points to (eg: size, offset, driver, pathname should be in that)
+ */
+
+typedef struct {
+ rtems_driver_name_t *driver;
+ rtems_libio_offset_t size; /* size of file */
+ rtems_libio_offset_t offset; /* current offset into the file */
+ unsigned32 flags;
+ char *pathname; /* opened pathname */
+ Objects_Id sem;
+ unsigned32 data0; /* private to "driver" */
+ unsigned32 data1; /* ... */
+} rtems_libio_t;
+
+
+/*
+ * param block for read/write
+ * Note: it must include 'offset' instead of using iop's offset since
+ * we can have multiple outstanding i/o's on a device.
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ rtems_libio_offset_t offset;
+ unsigned8 *buffer;
+ unsigned32 count;
+ unsigned32 flags;
+ unsigned32 bytes_moved;
+} rtems_libio_rw_args_t;
+
+/*
+ * param block for open/close
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 flags;
+ unsigned32 mode;
+} rtems_libio_open_close_args_t;
+
+/*
+ * param block for ioctl
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 command;
+ void *buffer;
+ unsigned32 ioctl_return;
+} rtems_libio_ioctl_args_t;
+
+
+/*
+ * Values for 'flag'
+ */
+
+#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
+#define LIBIO_FLAGS_READ 0x0002 /* reading */
+#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
+#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
+#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
+#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
+#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
+
+#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
+
+void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
+void rtems_libio_init(void);
+
+int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
+int __close(int fd);
+int __read(int fd, void *buffer, unsigned32 count);
+int __write(int fd, const void *buffer, unsigned32 count);
+int __ioctl(int fd, unsigned32 command, void *buffer);
+int __lseek(int fd, rtems_libio_offset_t offset, int whence);
+
+#endif /* _RTEMS_LIBIO_H */
diff --git a/c/src/lib/libc/malloc.c b/c/src/lib/libc/malloc.c
new file mode 100644
index 0000000000..de63df6ea0
--- /dev/null
+++ b/c/src/lib/libc/malloc.c
@@ -0,0 +1,366 @@
+/*
+ * RTEMS Malloc Family Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "libcsupport.h"
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h> /* sbrk(2) */
+
+rtems_id RTEMS_Malloc_Heap;
+size_t RTEMS_Malloc_Sbrk_amount;
+
+#ifdef RTEMS_DEBUG
+#define MALLOC_STATS
+#define MALLOC_DIRTY
+#endif
+
+#ifdef MALLOC_STATS
+#define MSBUMP(f,n) malloc_stats.f += (n)
+
+struct {
+ unsigned32 space_available; /* current size of malloc area */
+ unsigned32 malloc_calls; /* # calls to malloc */
+ unsigned32 free_calls;
+ unsigned32 realloc_calls;
+ unsigned32 calloc_calls;
+ unsigned32 max_depth; /* most ever malloc'd at 1 time */
+ unsigned64 lifetime_allocated;
+ unsigned64 lifetime_freed;
+} malloc_stats;
+
+#else /* No malloc_stats */
+#define MSBUMP(f,n)
+#endif
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+)
+{
+ rtems_status_code status;
+ void *starting_address;
+ rtems_unsigned32 old_address;
+ rtems_unsigned32 u32_address;
+
+ /*
+ * If the starting address is 0 then we are to attempt to
+ * get length worth of memory using sbrk. Make sure we
+ * align the address that we get back.
+ */
+
+ starting_address = start;
+ RTEMS_Malloc_Sbrk_amount = sbrk_amount;
+
+ if (!starting_address) {
+ u32_address = (unsigned int)sbrk(length);
+
+ if (u32_address == -1) {
+ rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
+ /* DOES NOT RETURN!!! */
+ }
+
+ if (u32_address & (CPU_ALIGNMENT-1)) {
+ old_address = u32_address;
+ u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * adjust the length by whatever we aligned by
+ */
+
+ length -= u32_address - old_address;
+ }
+
+ starting_address = (void *)u32_address;
+ }
+
+ /*
+ * Unfortunately we cannot use assert if this fails because if this
+ * has failed we do not have a heap and if we do not have a heap
+ * STDIO cannot work because there will be no buffers.
+ */
+
+ status = rtems_region_create(
+ rtems_build_name( 'H', 'E', 'A', 'P' ),
+ starting_address,
+ length,
+ CPU_ALIGNMENT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &RTEMS_Malloc_Heap
+ );
+ if ( status != RTEMS_SUCCESSFUL )
+ rtems_fatal_error_occurred( status );
+
+#ifdef MALLOC_STATS
+ /* zero all the stats */
+ (void) memset(&malloc_stats, 0, sizeof(malloc_stats));
+#endif
+
+ MSBUMP(space_available, length);
+}
+
+void *malloc(
+ size_t size
+)
+{
+ void *return_this;
+ void *starting_address;
+ rtems_unsigned32 the_size;
+ rtems_unsigned32 sbrk_amount;
+ rtems_status_code status;
+
+ MSBUMP(malloc_calls, 1);
+
+ if ( !size )
+ return (void *) 0;
+
+ /*
+ * Try to give a segment in the current region if there is not
+ * enough space then try to grow the region using rtems_region_extend().
+ * If this fails then return a NULL pointer.
+ */
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+
+ if ( status != RTEMS_SUCCESSFUL ) {
+ /*
+ * Round to the "requested sbrk amount" so hopefully we won't have
+ * to grow again for a while. This effectively does sbrk() calls
+ * in "page" amounts.
+ */
+
+ sbrk_amount = RTEMS_Malloc_Sbrk_amount;
+
+ if ( sbrk_amount == 0 )
+ return (void *) 0;
+
+ the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
+
+ if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
+ return (void *) 0;
+
+ status = rtems_region_extend(
+ RTEMS_Malloc_Heap,
+ starting_address,
+ the_size
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ sbrk(-the_size);
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+
+ MSBUMP(space_available, the_size);
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+ }
+
+#ifdef MALLOC_STATS
+ if (return_this)
+ {
+ unsigned32 actual_size;
+ unsigned32 current_depth;
+ status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size);
+ MSBUMP(lifetime_allocated, actual_size);
+ current_depth = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+ if (current_depth > malloc_stats.max_depth)
+ malloc_stats.max_depth = current_depth;
+ }
+#endif
+
+#ifdef MALLOC_DIRTY
+ (void) memset(return_this, 0xCF, size);
+#endif
+
+ return return_this;
+}
+
+void *calloc(
+ size_t nelem,
+ size_t elsize
+)
+{
+ register char *cptr;
+ int length;
+
+ MSBUMP(calloc_calls, 1);
+
+ length = nelem * elsize;
+ cptr = malloc( length );
+ if ( cptr )
+ memset( cptr, '\0', length );
+
+ MSBUMP(malloc_calls, -1); /* subtract off the malloc */
+
+ return cptr;
+}
+
+void *realloc(
+ void *ptr,
+ size_t size
+)
+{
+ rtems_unsigned32 old_size;
+ rtems_status_code status;
+ char *new_area;
+
+ MSBUMP(realloc_calls, 1);
+
+ if ( !ptr )
+ return malloc( size );
+
+ if ( !size ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ new_area = malloc( size );
+ if ( !new_area ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ return (void *) 0;
+ }
+
+ memcpy( new_area, ptr, (size < old_size) ? size : old_size );
+ free( ptr );
+
+ return new_area;
+
+}
+
+void free(
+ void *ptr
+)
+{
+ rtems_status_code status;
+
+ MSBUMP(free_calls, 1);
+
+ if ( !ptr )
+ return;
+
+#ifdef MALLOC_STATS
+ {
+ unsigned32 size;
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ MSBUMP(lifetime_freed, size);
+ }
+ }
+#endif
+
+ status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ assert( 0 );
+ }
+}
+
+#ifdef MALLOC_STATS
+/*
+ * Dump the malloc statistics
+ * May be called via atexit() (installable by our bsp) or
+ * at any time by user
+ */
+
+void malloc_dump(void)
+{
+ unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+
+ printf("Malloc stats\n");
+ printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
+ (unsigned int) malloc_stats.space_available / 1024,
+ (unsigned int) allocated / 1024,
+ /* avoid float! */
+ (allocated * 100) / malloc_stats.space_available,
+ (unsigned int) malloc_stats.max_depth / 1024,
+ (malloc_stats.max_depth * 100) / malloc_stats.space_available,
+ (unsigned long long) malloc_stats.lifetime_allocated / 1024,
+ (unsigned long long) malloc_stats.lifetime_freed / 1024);
+ printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n",
+ malloc_stats.malloc_calls,
+ malloc_stats.free_calls,
+ malloc_stats.realloc_calls,
+ malloc_stats.calloc_calls);
+}
+#endif
+
+/*
+ * "Reentrant" versions of the above routines implemented above.
+ */
+
+#ifdef RTEMS_NEWLIB
+void *malloc_r(
+ struct _reent *ignored,
+ size_t size
+)
+{
+ return malloc( size );
+}
+
+void *calloc_r(
+ size_t nelem,
+ size_t elsize
+)
+{
+ return calloc( nelem, elsize );
+}
+
+void *realloc_r(
+ void *ptr,
+ size_t size
+)
+{
+ return realloc_r( ptr, size );
+}
+
+void free_r(
+ void *ptr
+)
+{
+ free( ptr );
+}
+#endif
+
diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c
new file mode 100644
index 0000000000..8c9ed2e1a8
--- /dev/null
+++ b/c/src/lib/libc/newlibc.c
@@ -0,0 +1,336 @@
+#if defined(RTEMS_NEWLIB)
+
+/*
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * Description:
+ * Implementation of hooks for the CYGNUS newlib libc
+ * These hooks set things up so that:
+ * '_REENT' is switched at task switch time.
+ *
+ *
+ * TODO:
+ *
+ * NOTE:
+ *
+ * $Id$
+ *
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <libcsupport.h>
+#include <stdlib.h> /* for free() */
+#include <string.h> /* for memset() */
+
+#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
+
+/*
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ * NOTE:
+ * There is some problem with doing this on the hpux version
+ * of the UNIX simulator (symptom is printf core dumps), so
+ * we just don't for now.
+ * Not sure if this is a problem with hpux, newlib, or something else.
+ */
+
+#if defined(RTEMS_UNIX) && !defined(hpux)
+#define NEED_SETVBUF
+#endif
+
+#ifdef NEED_SETVBUF
+#include <stdio.h>
+#endif
+
+#include "internal.h"
+
+#define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST
+
+
+int libc_reentrant; /* do we think we are reentrant? */
+struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);;
+
+/*
+ * CYGNUS newlib routine that does atexit() processing and flushes
+ * stdio streams
+ * undocumented
+ */
+
+extern void _wrapup_reent(struct _reent *);
+extern void _reclaim_reent(struct _reent *);
+
+void
+libc_wrapup(void)
+{
+ _wrapup_reent(0);
+ if (_REENT != &libc_global_reent)
+ {
+ _wrapup_reent(&libc_global_reent);
+#if 0
+ /* don't reclaim this one, just in case we do printfs */
+ /* on our way out to ROM */
+ _reclaim_reent(&libc_global_reent);
+#endif
+ _REENT = &libc_global_reent;
+ }
+}
+
+
+rtems_boolean
+libc_create_hook(rtems_tcb *current_task,
+ rtems_tcb *creating_task)
+{
+ MY_task_set_note(creating_task, LIBC_NOTEPAD, 0);
+ return TRUE;
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ */
+
+rtems_extension
+libc_start_hook(rtems_tcb *current_task,
+ rtems_tcb *starting_task)
+{
+ struct _reent *ptr;
+
+ /* NOTE: our malloc is reentrant without a reent ptr since
+ * it is based on region manager
+ */
+
+ ptr = (struct _reent *) malloc(sizeof(struct _reent));
+
+ /* GCC extension: structure constants */
+ *ptr = (struct _reent) _REENT_INIT((*ptr));
+
+ MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ *
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ */
+
+#ifdef RTEMS_UNIX
+rtems_extension
+libc_begin_hook(rtems_tcb *current_task)
+{
+ setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
+}
+#endif
+
+rtems_extension
+libc_switch_hook(rtems_tcb *current_task,
+ rtems_tcb *heir_task)
+{
+ rtems_unsigned32 impure_value;
+
+ /* XXX We can't use rtems_task_set_note() here since SYSI task has a
+ * tid of 0, which is treated specially (optimized, actually)
+ * by rtems_task_set_note
+ *
+ * NOTE: The above comment is no longer true and we need to use
+ * the extension data areas added about the same time.
+ */
+
+ /*
+ * Don't touch the outgoing task if it has been deleted.
+ */
+
+ if ( !_States_Is_transient( current_task->current_state ) ) {
+ impure_value = (rtems_unsigned32) _REENT;
+ MY_task_set_note(current_task, LIBC_NOTEPAD, impure_value);
+ }
+
+ _REENT = (struct _reent *) MY_task_get_note(heir_task, LIBC_NOTEPAD);
+
+}
+
+/*
+ * Function: libc_delete_hook
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called when a task is deleted.
+ * Must restore the new lib reentrancy state for the new current
+ * task.
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+rtems_extension
+libc_delete_hook(rtems_tcb *current_task,
+ rtems_tcb *deleted_task)
+{
+ struct _reent *ptr;
+
+ /*
+ * The reentrancy structure was allocated by newlib using malloc()
+ */
+
+ if (current_task == deleted_task)
+ {
+ ptr = _REENT;
+ }
+ else
+ {
+ ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
+ }
+
+ /* if (ptr) */
+ if (ptr && ptr != &libc_global_reent)
+ {
+ _wrapup_reent(ptr);
+ _reclaim_reent(ptr);
+ free(ptr);
+ }
+
+ MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
+
+ /*
+ * Require the switch back to another task to install its own
+ */
+
+ if (current_task == deleted_task)
+ {
+ _REENT = 0;
+ }
+}
+
+/*
+ * Function: libc_init
+ * Created: 94/12/10
+ *
+ * Description:
+ * Init libc for CYGNUS newlib
+ * Set up _REENT to use our global libc_global_reent.
+ * (newlib provides a global of its own, but we prefer our
+ * own name for it)
+ *
+ * If reentrancy is desired (which it should be), then
+ * we install the task extension hooks to maintain the
+ * newlib reentrancy global variable _REENT on task
+ * create, delete, switch, exit, etc.
+ *
+ * Parameters:
+ * reentrant non-zero if reentrant library desired.
+ *
+ * Returns:
+ *
+ * Side Effects:
+ * installs libc extensions if reentrant.
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ */
+
+void
+libc_init(int reentrant)
+{
+ rtems_extensions_table libc_extension;
+ rtems_id extension_id;
+ rtems_status_code rc;
+
+ _REENT = &libc_global_reent;
+
+ if (reentrant)
+ {
+ memset(&libc_extension, 0, sizeof(libc_extension));
+
+ libc_extension.thread_create = libc_create_hook;
+ libc_extension.thread_start = libc_start_hook;
+#ifdef RTEMS_UNIX
+ libc_extension.thread_begin = libc_begin_hook;
+#endif
+ libc_extension.thread_switch = libc_switch_hook;
+ libc_extension.thread_delete = libc_delete_hook;
+
+ rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
+ &libc_extension, &extension_id);
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+
+ libc_reentrant = reentrant;
+ }
+}
+
+
+void
+exit(int status)
+{
+ libc_wrapup();
+ rtems_shutdown_executive(status);
+}
+
+
+/*
+ * Function: _exit
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called from exit() after it does atexit() processing and stdio fflush's
+ *
+ * called from bottom of exit() to really delete the task.
+ * If we are using reentrant libc, then let the delete extension
+ * do all the work, otherwise if a shutdown is in progress,
+ * then just do it.
+ *
+ * Parameters:
+ * exit status
+ *
+ * Returns:
+ * does not return
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+#if !defined(RTEMS_UNIX) && !defined(__GO32__)
+void _exit(int status)
+{
+ rtems_shutdown_executive(status);
+}
+#endif
+
+#endif
diff --git a/c/src/lib/libc/no_libc.c b/c/src/lib/libc/no_libc.c
new file mode 100644
index 0000000000..9bb65f4df6
--- /dev/null
+++ b/c/src/lib/libc/no_libc.c
@@ -0,0 +1,45 @@
+#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
+
+/* no_libc.h
+ *
+ * This file contains stubs for the reentrancy hooks when
+ * an unknown C library is used.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+
+#include "libcsupport.h"
+#include "internal.h"
+
+#include <stdlib.h> /* for free() */
+
+void
+libc_init(int reentrant)
+{
+}
+
+void libc_suspend_main(void)
+{
+}
+
+
+void libc_global_exit(rtems_unsigned32 code)
+{
+}
+
+void _exit(int status)
+{
+}
+
+#endif
diff --git a/c/src/lib/libc/support.c b/c/src/lib/libc/support.c
new file mode 100644
index 0000000000..51fe4070e2
--- /dev/null
+++ b/c/src/lib/libc/support.c
@@ -0,0 +1,52 @@
+/*
+ * Routines to Access Internal RTEMS Resources
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+
+void MY_task_set_note(
+ Thread_Control *the_thread,
+ unsigned32 notepad,
+ unsigned32 note
+)
+{
+ RTEMS_API_Control *api;
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ if ( api )
+ api->Notepads[ notepad ] = note;
+}
+
+
+unsigned32 MY_task_get_note(
+ Thread_Control *the_thread,
+ unsigned32 notepad
+)
+{
+ RTEMS_API_Control *api;
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ return api->Notepads[ notepad ];
+}
+
+void *MY_CPU_Context_FP_start(
+ void *base,
+ unsigned32 offset
+)
+{
+ return _CPU_Context_Fp_start( base, offset );
+}
+
diff --git a/c/src/lib/libc/syscalls.c b/c/src/lib/libc/syscalls.c
new file mode 100644
index 0000000000..9c59933769
--- /dev/null
+++ b/c/src/lib/libc/syscalls.c
@@ -0,0 +1,62 @@
+#if !defined(RTEMS_UNIX)
+
+/*
+ * RTEMS Fake System Calls
+ *
+ * This file contains "fake" versions of the system call routines
+ * which are reference by many libc implementations. Once a routine
+ * has been implemented in terms of RTEMS services, it should be
+ * taken out of this file.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+ * fstat, stat, and isatty must lie consistently and report that everything
+ * is a tty or stdout will not be line buffered.
+ */
+
+int __fstat(int _fd, struct stat* _sbuf)
+{
+ _sbuf->st_mode = S_IFCHR;
+#ifdef HAVE_BLKSIZE
+ _sbuf->st_blksize = 0;
+#endif
+ return 0;
+}
+
+int __isatty(int _fd)
+{
+ return 1;
+}
+
+int stat( const char *path, struct stat *buf )
+{
+ return __fstat( 0, buf );
+}
+
+int link( const char *existing, const char *new )
+{
+ /* always fail */
+ return -1;
+}
+
+int unlink( const char *path )
+{
+ /* always fail */
+ return -1;
+}
+
+#endif
diff --git a/c/src/lib/libc/unixlibc.c b/c/src/lib/libc/unixlibc.c
new file mode 100644
index 0000000000..2acd4fba8e
--- /dev/null
+++ b/c/src/lib/libc/unixlibc.c
@@ -0,0 +1,11 @@
+/*
+ * $Id$
+ */
+
+#if defined(RTEMS_UNIXLIB)
+
+void libc_init(int reentrant)
+{
+}
+
+#endif
diff --git a/c/src/lib/libc/utsname.c b/c/src/lib/libc/utsname.c
new file mode 100644
index 0000000000..98b105023e
--- /dev/null
+++ b/c/src/lib/libc/utsname.c
@@ -0,0 +1,61 @@
+/* utsname.c
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/utsname.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+)
+{
+ /* XXX: Here is what Solaris returns...
+ sysname = SunOS
+ nodename = node_name
+ release = 5.3
+ version = Generic_101318-12
+ machine = sun4m
+ */
+
+ strcpy( name->sysname, "RTEMS" );
+
+ sprintf( name->nodename, "Node %d\n", _Objects_Local_node );
+
+ /* XXX release string is in BAD format for this routine!!! */
+ strcpy( name->release, "3.2.0" );
+
+ /* XXX does this have any meaning for RTEMS */
+
+ strcpy( name->release, "" );
+
+ sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME );
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/c/src/lib/libcpu/README b/c/src/lib/libcpu/README
new file mode 100644
index 0000000000..e7e293660c
--- /dev/null
+++ b/c/src/lib/libcpu/README
@@ -0,0 +1,14 @@
+#
+# $Id$
+#
+
+This is the README file for libcpu.
+
+This directory contains reusable libraries which are CPU dependent but not
+target board dependent. For example, the HPPA has an on chip interval timer
+which may be used by all HPPA bsp's.
+
+Another example might be the Intel i960CA has on-chip DMA which could be
+supported in a library and placed in lib/libcpu/i960. This level of support
+will make it easier for others developing embedded applications on a given
+CPU.
diff --git a/c/src/lib/libcpu/hppa1.1/clock/clock.c b/c/src/lib/libcpu/hppa1.1/clock/clock.c
new file mode 100644
index 0000000000..85ecabd263
--- /dev/null
+++ b/c/src/lib/libcpu/hppa1.1/clock/clock.c
@@ -0,0 +1,267 @@
+/* Clock
+ *
+ * This routine initializes the interval timer on the
+ * PA-RISC CPU. The tick frequency is specified by the bsp.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/libio.h>
+
+/* should get this from bsp.h, but it is not installed yet */
+rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
+extern rtems_configuration_table BSP_Configuration;
+
+#include <stdlib.h> /* for atexit() */
+
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+typedef unsigned long long hppa_click_count_t;
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ * CPU_HPPA_CLICKS_PER_TICK is either a #define or an rtems_unsigned32
+ * allocated and set by bsp_start()
+ */
+
+#ifndef CPU_HPPA_CLICKS_PER_TICK
+extern rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK;
+#endif
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
+
+rtems_unsigned32 most_recent_itimer_value;
+
+rtems_unsigned64 Clock_clicks; /* running total of cycles */
+
+rtems_unsigned32 Clock_clicks_interrupt;
+
+void Clock_exit(void);
+
+void
+ReInstall_clock(rtems_isr_entry new_clock_isr)
+{
+ rtems_unsigned32 isrlevel = 0;
+
+ rtems_interrupt_disable(isrlevel);
+ (void) set_vector(
+ new_clock_isr,
+ HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER,
+ 1
+ );
+ rtems_interrupt_enable(isrlevel);
+}
+
+/*
+ * read itimer and update Clock_clicks as appropriate
+ */
+
+rtems_unsigned32
+Clock_read_itimer()
+{
+ rtems_unsigned32 isrlevel;
+ rtems_unsigned32 itimer_value;
+ rtems_unsigned32 wrap_count;
+ rtems_unsigned32 recent_count;
+
+ rtems_interrupt_disable(isrlevel);
+
+ wrap_count = (Clock_clicks & 0xFFFFFFFF00000000ULL) >> 32;
+ recent_count = (rtems_unsigned32) Clock_clicks;
+
+ itimer_value = get_itimer();
+
+ if (itimer_value < recent_count)
+ wrap_count++;
+ Clock_clicks = (((rtems_unsigned64) wrap_count) << 32) + itimer_value;
+
+ rtems_interrupt_enable(isrlevel);
+
+ return itimer_value;
+}
+
+
+void Install_clock(rtems_isr_entry clock_isr)
+{
+ Clock_driver_ticks = 0;
+ Clock_clicks_interrupt = 0;
+ Clock_clicks = 0;
+
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+
+ if (BSP_Configuration.ticks_per_timeslice)
+ {
+ /*
+ * initialize the interval here
+ * First tick is set to right amount of time in the future
+ * Future ticks will be incremented over last value set
+ * in order to provide consistent clicks in the face of
+ * interrupt overhead
+ */
+
+ Clock_clicks_interrupt = Clock_read_itimer() + CPU_HPPA_CLICKS_PER_TICK;
+ set_itimer((rtems_unsigned32) Clock_clicks_interrupt);
+
+ (void) set_vector(clock_isr, HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER, 1);
+ }
+ atexit(Clock_exit);
+}
+
+rtems_isr
+Clock_isr(rtems_vector_number vector)
+{
+ rtems_unsigned32 clicks_til_next_interrupt;
+ rtems_unsigned32 itimer_value;
+
+ /*
+ * setup for next interrupt; making sure the new value is reasonably
+ * in the future.... in case we lost out on an interrupt somehow
+ */
+
+ itimer_value = Clock_read_itimer();
+ Clock_clicks_interrupt += CPU_HPPA_CLICKS_PER_TICK;
+
+ /*
+ * how far away is next interrupt *really*
+ * It may be a long time; this subtraction works even if
+ * Clock_clicks_interrupt < Clock_clicks_low_order via
+ * the miracle of unsigned math.
+ */
+ clicks_til_next_interrupt = Clock_clicks_interrupt - itimer_value;
+
+ /*
+ * If it is too soon then bump it up.
+ * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
+ * But setting it low is useful for debug, so...
+ */
+
+ if (clicks_til_next_interrupt < 400)
+ {
+ Clock_clicks_interrupt = itimer_value + 1000;
+ /* XXX: count these! this should be rare */
+ }
+
+ /*
+ * If it is too late, that means we missed the interrupt somehow.
+ * Rather than wait 35-50s for a wrap, we just fudge it here.
+ */
+
+ if (clicks_til_next_interrupt > CPU_HPPA_CLICKS_PER_TICK)
+ {
+ Clock_clicks_interrupt = itimer_value + 1000;
+ /* XXX: count these! this should never happen :-) */
+ }
+
+ set_itimer((rtems_unsigned32) Clock_clicks_interrupt);
+
+ Clock_driver_ticks++;
+
+ if (Clock_isrs == 1)
+ {
+ rtems_clock_tick();
+ Clock_isrs = BSP_Configuration.microseconds_per_tick / 10000;
+ if (Clock_isrs == 0)
+ Clock_isrs = 1;
+ }
+ else
+ Clock_isrs--;
+}
+
+/*
+ * Called via atexit()
+ * Remove the clock interrupt handler by setting handler to NULL
+ */
+
+void
+Clock_exit(void)
+{
+ if ( BSP_Configuration.ticks_per_timeslice )
+ {
+ (void) set_vector(0, HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER, 1);
+ }
+}
+
+/*
+ * spin delay for specified number of microseconds
+ * used by RTEMS delay macro
+ */
+
+void
+Clock_delay(rtems_unsigned32 microseconds)
+{
+ rtems_unsigned64 future_time;
+
+ (void) Clock_read_itimer();
+ future_time = Clock_clicks +
+ ((rtems_unsigned64) microseconds) *
+ Cpu_table.itimer_clicks_per_microsecond;
+
+ for (;;)
+ {
+ (void) Clock_read_itimer();
+ if (future_time <= Clock_clicks)
+ break;
+ }
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock(Clock_isr);
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ ReInstall_clock(args->buffer);
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libcpu/hppa1.1/runway/runway.h b/c/src/lib/libcpu/hppa1.1/runway/runway.h
new file mode 100644
index 0000000000..41aafe26ef
--- /dev/null
+++ b/c/src/lib/libcpu/hppa1.1/runway/runway.h
@@ -0,0 +1,37 @@
+/*
+ * File: $RCSfile$
+ * Project: PixelFlow
+ * Created: 94/11/29
+ * RespEngr: tony bennett
+ * Revision: $Revision$
+ * Last Mod: $Date$
+ *
+ * Description:
+ * definitions specific to the runway bus
+ *
+ * TODO:
+ * Add lots more.
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_RUNWAY_H
+#define _INCLUDE_RUNWAY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HPPA_RUNWAY_PROC_HPA_BASE ((void *) 0xFFFA0000)
+
+/* given a processor number, where is its HPA? */
+#define HPPA_RUNWAY_HPA(cpu) \
+ ((rtems_unsigned32) (HPPA_RUNWAY_PROC_HPA_BASE + ((cpu) * 0x2000)))
+
+#define HPPA_RUNWAY_REG_IO_EIR_OFFSET 0x000
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_RUNWAY_H */
diff --git a/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.c b/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.c
new file mode 100644
index 0000000000..aa8b768b3a
--- /dev/null
+++ b/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.c
@@ -0,0 +1,308 @@
+/*
+ * File: $RCSfile$
+ * Project: PixelFlow
+ * Created: 94/11/29
+ * RespEngr: tony bennett
+ * Revision: $Revision$
+ * Last Mod: $Date$
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * Description:
+ * HPPA fast spinlock semaphores based on LDCWX instruction.
+ * These semaphores are not known to RTEMS.
+ *
+ * TODO:
+ * Put node number in high 16 bits of flag??
+ * XXX: Need h_s_deallocate
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include "semaphore.h"
+
+/*
+ * Report fatal semaphore error
+ */
+
+#define SEM_FATAL_ERROR(sp) rtems_fatal_error_occurred((rtems_unsigned32) sp)
+
+#define SEM_CHECK(sp) do { \
+ if (((sp) == 0) || (int) (sp) & 0xf) \
+ { \
+ SEM_FATAL_ERROR(sp); \
+ } \
+ } while (0)
+
+/*
+ * Init a semaphore to be free
+ */
+
+#define SEM_FREE_INIT(sp) \
+ do { \
+ (sp)->lock = 1; \
+ (sp)->flags = 0; \
+ (sp)->owner_tcb = 0; \
+ } while (0)
+
+/*
+ * Grab a semaphore recording its owner.
+ */
+
+#define SEM_MARK_GRABBED(sp) \
+ do { \
+ (sp)->owner_tcb = _Thread_Executing; \
+ } while (0)
+
+/*
+ * Mark the semaphore busy
+ */
+
+#define SEM_MARK_BUSY(sp) ((sp)->flags |= HPPA_SEM_IN_USE)
+
+/*
+ * Is a semaphore available?
+ */
+
+#define SEM_IS_AVAILABLE(sp) ((sp)->owner_tcb == 0)
+
+/*
+ * The pool control semaphore is the first in the pool
+ */
+
+#define SEM_CONTROL (&hppa_semaphore_pool[0])
+#define SEM_FIRST (&hppa_semaphore_pool[1])
+
+#define SEM_PRIVATE(cookie) rtems_interrupt_disable(cookie)
+
+#define SEM_PUBLIC(cookie) rtems_interrupt_enable(cookie)
+
+
+/*
+ * Control variables for the pool
+ */
+
+hppa_semaphore_t *hppa_semaphore_pool; /* ptr to first */
+int hppa_semaphores;
+int hppa_semaphores_available;
+
+void
+hppa_semaphore_pool_initialize(void *pool_base,
+ int pool_size)
+{
+ hppa_semaphore_t *sp;
+ int align_factor;
+ rtems_unsigned32 isr_level;
+
+ /*
+ * round pool_base up to be a multiple of SEM_ALIGN
+ */
+
+ align_factor = SEM_ALIGN - (((int) pool_base) & (SEM_ALIGN-1));
+ if (align_factor != SEM_ALIGN)
+ {
+ pool_base += align_factor;
+ pool_size -= align_factor;
+ }
+
+ /*
+ * How many can the pool hold?
+ * Assumes the semaphores are SEM_ALIGN bytes each
+ */
+
+ if (sizeof(hppa_semaphore_t) != SEM_ALIGN)
+ rtems_fatal_error_occurred(RTEMS_INVALID_SIZE);
+
+ pool_size &= ~(SEM_ALIGN - 1);
+
+ SEM_PRIVATE(isr_level);
+
+ hppa_semaphore_pool = pool_base;
+ hppa_semaphores = pool_size / SEM_ALIGN;
+
+ /*
+ * If we are node0, then init all in the pool
+ */
+
+ if (cpu_number == 0)
+ {
+ /*
+ * Tell other cpus we are not done, jic
+ */
+ SEM_CONTROL->user = rtems_build_name('!', 'D', 'N', 'E');
+
+ for (sp=SEM_FIRST; sp < &hppa_semaphore_pool[hppa_semaphores]; sp++)
+ SEM_FREE_INIT(sp);
+ SEM_FREE_INIT(SEM_CONTROL);
+ }
+
+ /*
+ * Tell other cpus we are done, or wait for it to be done if on another cpu
+ */
+
+ if (cpu_number == 0)
+ SEM_CONTROL->user = rtems_build_name('D', 'O', 'N', 'E');
+ else
+ while (SEM_CONTROL->user != rtems_build_name('D', 'O', 'N', 'E'))
+ ;
+
+ hppa_semaphores_available = hppa_semaphores;
+
+ SEM_PUBLIC(isr_level);
+}
+
+/*
+ * Function: hppa_semaphore_acquire
+ * Created: 94/11/29
+ * RespEngr: tony bennett
+ *
+ * Description:
+ * Acquire a semaphore. Will spin on the semaphore unless
+ * 'flag' says not to.
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ * 0 -- if did not acquire
+ * non-zero -- if acquired semaphore
+ * (actually this is the spin count)
+ *
+ * Notes:
+ * There is no requirement that the semaphore be within the pool
+ *
+ * Deficiencies/ToDo:
+ *
+ */
+
+
+rtems_unsigned32
+hppa_semaphore_acquire(hppa_semaphore_t *sp,
+ int flag)
+{
+ rtems_unsigned32 lock_value;
+ rtems_unsigned32 spin_count = 1;
+
+ SEM_CHECK(sp);
+
+ for (;;)
+ {
+ HPPA_ASM_LDCWS(0, 0, sp, lock_value);
+
+ if (lock_value) /* we now own the lock */
+ {
+ SEM_MARK_GRABBED(sp);
+ return spin_count ? spin_count : ~0; /* jic */
+ }
+
+ if (flag & HPPA_SEM_NO_SPIN)
+ return 0;
+
+ spin_count++;
+ }
+}
+
+void
+hppa_semaphore_release(hppa_semaphore_t *sp)
+{
+ SEM_CHECK(sp);
+
+ if (sp->owner_tcb != _Thread_Executing)
+ SEM_FATAL_ERROR("owner mismatch");
+
+ sp->lock = 1;
+}
+
+
+/*
+ * Function: hppa_semaphore_allocate
+ * Created: 94/11/29
+ * RespEngr: tony bennett
+ *
+ * Description:
+ * Get a pointer to a semaphore.
+ *
+ * Parameters:
+ * which -- if 0, then allocate a free semaphore from the pool
+ * if non-zero, then return pointer to that one, even
+ * if it is already busy.
+ *
+ * Returns:
+ * successful -- pointer to semaphore
+ * NULL otherwise
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+hppa_semaphore_t *
+hppa_semaphore_allocate(rtems_unsigned32 which,
+ int flag)
+{
+ hppa_semaphore_t *sp = 0;
+
+ /*
+ * grab the control semaphore
+ */
+
+ if (hppa_semaphore_acquire(SEM_CONTROL, 0) == 0)
+ SEM_FATAL_ERROR("could not grab control semaphore");
+
+ /*
+ * Find a free one and init it
+ */
+
+ if (which)
+ {
+ if (which >= hppa_semaphores)
+ SEM_FATAL_ERROR("requested non-existent semaphore");
+ sp = &hppa_semaphore_pool[which];
+
+ /*
+ * if it is "free", then mark it claimed now.
+ * If it is not free then we are done.
+ */
+
+ if (SEM_IS_AVAILABLE(sp))
+ goto allmine;
+ }
+ else for (sp = SEM_FIRST;
+ sp < &hppa_semaphore_pool[hppa_semaphores];
+ sp++)
+ {
+ if (SEM_IS_AVAILABLE(sp))
+ {
+allmine: SEM_FREE_INIT(sp);
+ SEM_MARK_BUSY(sp);
+ if ( ! (flag & HPPA_SEM_INITIALLY_FREE))
+ SEM_MARK_GRABBED(sp);
+ break;
+ }
+ }
+
+ /*
+ * Free up the control semaphore
+ */
+
+ hppa_semaphore_release(SEM_CONTROL);
+
+ return sp;
+}
+
diff --git a/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.h b/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.h
new file mode 100644
index 0000000000..04f709cf64
--- /dev/null
+++ b/c/src/lib/libcpu/hppa1.1/semaphore/semaphore.h
@@ -0,0 +1,84 @@
+/*
+ * File: $RCSfile$
+ * Project: PixelFlow
+ * Created: 94/11/29
+ * RespEngr: tony e bennett
+ * Revision: $Revision$
+ * Last Mod: $Date$
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * Description:
+ * HPPA fast spinlock semaphores based on LDCWX instruction.
+ * These semaphores are not known to RTEMS.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_SEMAPHORE_H
+#define _INCLUDE_SEMAPHORE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This structure has hardware requirements.
+ * LDCWX opcode requires 16byte alignment for the lock
+ * 'lock' must be first member of structure.
+ */
+
+#define SEM_ALIGN 16
+
+typedef volatile struct {
+
+ rtems_unsigned32 lock __attribute__ ((aligned (SEM_ALIGN)));
+
+ rtems_unsigned32 flags;
+
+ void *owner_tcb; /* for debug/commentary only */
+
+ rtems_unsigned32 user; /* for use by user */
+
+} hppa_semaphore_t;
+
+/*
+ * Values for flags
+ */
+
+#define HPPA_SEM_IN_USE 0x0001 /* semaphore owned by somebody */
+#define HPPA_SEM_NO_SPIN 0x0002 /* don't spin if unavailable */
+#define HPPA_SEM_INITIALLY_FREE 0x0004 /* init it to be free */
+
+/*
+ * Caller specifiable flags
+ */
+
+#define HPPA_SEM_CALLER_FLAGS (HPPA_SEM_NO_SPIN | HPPA_SEM_INITIALLY_FREE)
+
+void hppa_semaphore_pool_initialize(void *pool_base, int pool_size);
+
+rtems_unsigned32 hppa_semaphore_acquire(hppa_semaphore_t *sp, int flag);
+
+void hppa_semaphore_release(hppa_semaphore_t *sp);
+
+hppa_semaphore_t *hppa_semaphore_allocate(rtems_unsigned32 which, int flag);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_SEMAPHORE_H */
diff --git a/c/src/lib/libcpu/hppa1.1/timer/timer.c b/c/src/lib/libcpu/hppa1.1/timer/timer.c
new file mode 100644
index 0000000000..caa04bd282
--- /dev/null
+++ b/c/src/lib/libcpu/hppa1.1/timer/timer.c
@@ -0,0 +1,62 @@
+/* timer.c
+ *
+ * This file manages the interval timer on the PA-RISC.
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+volatile rtems_unsigned32 Timer_starting;
+rtems_boolean Timer_driver_Find_average_overhead;
+
+void Timer_initialize()
+{
+ Timer_starting = get_itimer();
+}
+
+#define AVG_OVERHEAD 0 /* It typically takes 3.0 microseconds */
+ /* (6 countdowns) to start/stop the timer. */
+#define LEAST_VALID 1 /* Don't trust a value lower than this */
+
+int Read_timer()
+{
+ rtems_unsigned32 clicks;
+ rtems_unsigned32 total;
+
+ clicks = get_itimer();
+
+ total = clicks - Timer_starting;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+
+ else {
+ if ( total < LEAST_VALID )
+ return 0; /* below timer resolution */
+ return (total - AVG_OVERHEAD);
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libcpu/powerpc/README b/c/src/lib/libcpu/powerpc/README
new file mode 100644
index 0000000000..32e4aed60c
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/README
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+
+This hierarchy contains support routines for the various
+PowerPC processors.
+
+Since these routines can differ amongst different members
+of the PowerPC family, an entry per CPU type is provided.
+
+Currently only the PPC403 is supported.
+
+Andrew Bray 4/December/1995
diff --git a/c/src/lib/libcpu/powerpc/ppc403/README b/c/src/lib/libcpu/powerpc/ppc403/README
new file mode 100644
index 0000000000..528506d3dd
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/README
@@ -0,0 +1,22 @@
+#
+# $Id$
+#
+
+Various non BSP dependant support routines.
+
+clock - Uses the 403 PIT (Programmable interval timer) to
+ generate RTEMS clock ticks.
+
+console - Uses the 403 Internal serial port to do RTEMS
+ console I/O. Not ALL members of the 403 family
+ have this.
+
+include - Currently empty
+
+timer - Uses the 403 timebase register for timing
+ tests. Other PowerPCs have slightly different
+ timebase register definitions.
+
+vectors - PowerPC 403 specific vector entry points.
+ Includes CPU dependant, application independant
+ handlers: alignment.
diff --git a/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
new file mode 100644
index 0000000000..068cf4f538
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
@@ -0,0 +1,265 @@
+/* clock.c
+ *
+ * This routine initializes the interval timer on the
+ * PowerPC 403 CPU. The tick frequency is specified by the bsp.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <clockdrv.h>
+#include <rtems/libio.h>
+
+#include <stdlib.h> /* for atexit() */
+
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+volatile rtems_unsigned32 Clock_driver_ticks;
+static rtems_unsigned32 pit_value, tick_time;
+static rtems_boolean auto_restart;
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+static INLINE rtems_unsigned32 get_itimer(void)
+{
+ register rtems_unsigned32 rc;
+
+ asm volatile ("mfspr %0, 0x3dd" : "=r" ((rc))); /* TBLO */
+
+ return rc;
+}
+
+/*
+ * ISR Handler
+ */
+
+rtems_isr
+Clock_isr(rtems_vector_number vector)
+{
+ if (!auto_restart)
+ {
+ rtems_unsigned32 clicks_til_next_interrupt;
+ rtems_unsigned32 itimer_value;
+
+ /*
+ * setup for next interrupt; making sure the new value is reasonably
+ * in the future.... in case we lost out on an interrupt somehow
+ */
+
+ itimer_value = get_itimer();
+ tick_time += pit_value;
+
+ /*
+ * how far away is next interrupt *really*
+ * It may be a long time; this subtraction works even if
+ * Clock_clicks_interrupt < Clock_clicks_low_order via
+ * the miracle of unsigned math.
+ */
+ clicks_til_next_interrupt = tick_time - itimer_value;
+
+ /*
+ * If it is too soon then bump it up.
+ * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
+ * But setting it low is useful for debug, so...
+ */
+
+ if (clicks_til_next_interrupt < 400)
+ {
+ tick_time = itimer_value + 1000;
+ clicks_til_next_interrupt = 1000;
+ /* XXX: count these! this should be rare */
+ }
+
+ /*
+ * If it is too late, that means we missed the interrupt somehow.
+ * Rather than wait 35-50s for a wrap, we just fudge it here.
+ */
+
+ if (clicks_til_next_interrupt > pit_value)
+ {
+ tick_time = itimer_value + 1000;
+ clicks_til_next_interrupt = 1000;
+ /* XXX: count these! this should never happen :-) */
+ }
+
+ asm volatile ("mtspr 0x3db, %0" :: "r"
+ (clicks_til_next_interrupt)); /* PIT */
+ }
+
+ asm volatile ( "mtspr 0x3d8, %0" :: "r" (0x08000000)); /* TSR */
+
+ Clock_driver_ticks++;
+
+ rtems_clock_tick();
+}
+
+void Install_clock(rtems_isr_entry clock_isr)
+{
+ rtems_isr_entry previous_isr;
+ rtems_unsigned32 pvr, iocr;
+
+ Clock_driver_ticks = 0;
+
+ asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
+ iocr &= ~4;
+ iocr |= 4; /* Select external timer clock */
+ asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); /* IOCR */
+
+ asm volatile ("mfspr %0, 0x11f" : "=r" ((pvr))); /* PVR */
+
+ if (((pvr & 0xffff0000) >> 16) != 0x0020)
+ return; /* Not a ppc403 */
+
+ if ((pvr & 0xff00) == 0x0000) /* 403GA */
+ auto_restart = (pvr & 0x00f0) > 0x0000 ? 1 : 0;
+ else if ((pvr & 0xff00) == 0x0100) /* 403GB */
+ auto_restart = 1;
+
+ pit_value = BSP_Configuration.microseconds_per_tick *
+ Cpu_table.clicks_per_usec;
+
+ if (BSP_Configuration.ticks_per_timeslice)
+ {
+ register rtems_unsigned32 tcr;
+
+ /*
+ * initialize the interval here
+ * First tick is set to right amount of time in the future
+ * Future ticks will be incremented over last value set
+ * in order to provide consistent clicks in the face of
+ * interrupt overhead
+ */
+
+ rtems_interrupt_catch(clock_isr, PPC_IRQ_PIT, &previous_isr);
+
+ asm volatile ("mtspr 0x3db, %0" : : "r" (pit_value)); /* PIT */
+
+ asm volatile ("mfspr %0, 0x3da" : "=r" ((tcr))); /* TCR */
+
+ tcr &= ~ 0x04400000;
+
+ tcr |= (auto_restart ? 0x04400000 : 0x04000000);
+
+ tick_time = get_itimer() + pit_value;
+
+ asm volatile ("mtspr 0x3da, %0" : "=r" ((tcr)) : "0" ((tcr))); /* TCR */
+ }
+ atexit(Clock_exit);
+}
+
+void
+ReInstall_clock(rtems_isr_entry new_clock_isr)
+{
+ rtems_isr_entry previous_isr;
+ rtems_unsigned32 isrlevel = 0;
+
+ rtems_interrupt_disable(isrlevel);
+
+ rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT, &previous_isr);
+
+ rtems_interrupt_enable(isrlevel);
+}
+
+
+/*
+ * Called via atexit()
+ * Remove the clock interrupt handler by setting handler to NULL
+ */
+
+void
+Clock_exit(void)
+{
+ if ( BSP_Configuration.ticks_per_timeslice )
+ {
+ register rtems_unsigned32 tcr;
+
+ asm volatile ("mfspr %0, 0x3da" : "=r" ((tcr))); /* TCR */
+
+ tcr &= ~ 0x04400000;
+
+ asm volatile ("mtspr 0x3da, %0" : "=r" ((tcr)) : "0" ((tcr))); /* TCR */
+
+ (void) set_vector(0, PPC_IRQ_PIT, 1);
+ }
+
+}
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ Install_clock( Clock_isr );
+
+ /*
+ * make major/minor avail to others such as shared memory driver
+ */
+
+ rtems_clock_major = major;
+ rtems_clock_minor = minor;
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ rtems_libio_ioctl_args_t *args = pargp;
+
+ if (args == 0)
+ goto done;
+
+ /*
+ * This is hokey, but until we get a defined interface
+ * to do this, it will just be this simple...
+ */
+
+ if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+ {
+ Clock_isr(PPC_IRQ_PIT);
+ }
+ else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+ {
+ ReInstall_clock(args->buffer);
+ }
+
+done:
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console.c b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
new file mode 100644
index 0000000000..7a3b1b425a
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
@@ -0,0 +1,387 @@
+/*
+ * This file contains the PowerPC 403GA console IO package.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define NO_BSP_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+struct async {
+/*-----------------------------------------------------------------------------+
+| Line Status Register.
++-----------------------------------------------------------------------------*/
+ unsigned char SPLS;
+ unsigned char SPLSset;
+#define LSRDataReady 0x80
+#define LSRFramingError 0x40
+#define LSROverrunError 0x20
+#define LSRParityError 0x10
+#define LSRBreakInterrupt 0x08
+#define LSRTxHoldEmpty 0x04
+#define LSRTxShiftEmpty 0x02
+
+/*-----------------------------------------------------------------------------+
+| Handshake Status Register.
++-----------------------------------------------------------------------------*/
+ unsigned char SPHS;
+ unsigned char SPHSset;
+#define HSRDsr 0x80
+#define HSRCts 0x40
+
+/*-----------------------------------------------------------------------------+
+| Baud rate divisor registers
++-----------------------------------------------------------------------------*/
+ unsigned char BRDH;
+ unsigned char BRDL;
+
+/*-----------------------------------------------------------------------------+
+| Control Register.
++-----------------------------------------------------------------------------*/
+ unsigned char SPCTL;
+#define CRNormal 0x00
+#define CRLoopback 0x40
+#define CRAutoEcho 0x80
+#define CRDtr 0x20
+#define CRRts 0x10
+#define CRWordLength7 0x00
+#define CRWordLength8 0x08
+#define CRParityDisable 0x00
+#define CRParityEnable 0x04
+#define CREvenParity 0x00
+#define CROddParity 0x02
+#define CRStopBitsOne 0x00
+#define CRStopBitsTwo 0x01
+#define CRDisableDtrRts 0x00
+
+/*-----------------------------------------------------------------------------+
+| Receiver Command Register.
++-----------------------------------------------------------------------------*/
+ unsigned char SPRC;
+#define RCRDisable 0x00
+#define RCREnable 0x80
+#define RCRIntDisable 0x00
+#define RCRIntEnabled 0x20
+#define RCRDMACh2 0x40
+#define RCRDMACh3 0x60
+#define RCRErrorInt 0x10
+#define RCRPauseEnable 0x08
+
+/*-----------------------------------------------------------------------------+
+| Transmitter Command Register.
++-----------------------------------------------------------------------------*/
+ unsigned char SPTC;
+#define TCRDisable 0x00
+#define TCREnable 0x80
+#define TCRIntDisable 0x00
+#define TCRIntEnabled 0x20
+#define TCRDMACh2 0x40
+#define TCRDMACh3 0x60
+#define TCRTxEmpty 0x10
+#define TCRErrorInt 0x08
+#define TCRStopPause 0x04
+#define TCRBreakGen 0x02
+
+/*-----------------------------------------------------------------------------+
+| Miscellanies defines.
++-----------------------------------------------------------------------------*/
+ unsigned char SPTB;
+#define SPRB SPTB
+};
+
+#define XOFFchar 0x13
+#define XONchar 0x11
+
+typedef volatile struct async *pasync;
+static const pasync port = (pasync)0x40000000;
+
+/* console_initialize
+ *
+ * This routine initializes the console IO driver.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+)
+{
+ rtems_status_code status;
+ register unsigned tmp;
+
+ /* Initialise the serial port */
+ asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
+ tmp &= ~3;
+ tmp |= (Cpu_table.serial_external_clock ? 2 : 0) |
+ (Cpu_table.serial_cts_rts ? 1 : 0);
+ asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
+ port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
+ LSRParityError | LSRBreakInterrupt);
+ tmp = Cpu_table.serial_per_sec / Cpu_table.serial_rate;
+ tmp = ((tmp + 8) >> 4) - 1;
+ port->BRDL = tmp & 0x255;
+ port->BRDH = tmp >> 8;
+ port->SPCTL = (CRNormal | CRDtr | CRRts | CRWordLength8 | CRParityDisable |
+ CRStopBitsOne);
+ port->SPRC = (RCREnable | RCRIntDisable | RCRPauseEnable);
+ port->SPTC = (TCREnable | TCRIntDisable);
+ port->SPHS = (HSRDsr | HSRCts);
+
+ status = rtems_io_register_name(
+ "/dev/console",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+
+/* is_character_ready
+ *
+ * This routine returns TRUE if a character is available.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ */
+
+rtems_boolean is_character_ready(
+ char *ch
+)
+{
+ unsigned char status;
+
+ if ((status = port->SPLS) & LSRDataReady)
+ {
+ *ch = port->SPRB;
+ return(TRUE);
+ }
+
+ /* Clean any dodgy status */
+ if ((status & (LSRFramingError | LSROverrunError | LSRParityError |
+ LSRBreakInterrupt)) != 0)
+ {
+ port->SPLS = (LSRFramingError | LSROverrunError | LSRParityError |
+ LSRBreakInterrupt);
+ }
+
+ return FALSE;
+}
+
+/* inbyte
+ *
+ * This routine reads a character from the SOURCE.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values:
+ * character read from SOURCE
+ */
+
+char inbyte( void )
+{
+ unsigned char status;
+
+ while (1)
+ {
+ if ((status = port->SPLS) & LSRDataReady)
+ break;
+
+ /* Clean any dodgy status */
+ if ((status & (LSRFramingError | LSROverrunError | LSRParityError |
+ LSRBreakInterrupt)) != 0)
+ {
+ port->SPLS = (LSRFramingError | LSROverrunError | LSRParityError |
+ LSRBreakInterrupt);
+ }
+ }
+
+ return port->SPRB;
+}
+
+/* outbyte
+ *
+ * This routine transmits a character out the SOURCE. It may support
+ * XON/XOFF flow control.
+ *
+ * Input parameters:
+ * ch - character to be transmitted
+ *
+ * Output parameters: NONE
+ */
+
+void outbyte(
+ char ch
+)
+{
+ unsigned char status;
+
+ while (port->SPHS)
+ port->SPHS = (HSRDsr | HSRCts);
+
+ while (1)
+ {
+ status = port->SPLS;
+
+ if (port->SPHS)
+ port->SPHS = (HSRDsr | HSRCts);
+ else if (status & LSRTxHoldEmpty)
+ break;
+ }
+
+ if (Cpu_table.serial_xon_xoff)
+ while (is_character_ready(&status))
+ {
+ if (status == XOFFchar)
+ do {
+ while (!is_character_ready(&status));
+ } while (status != XONchar);
+ }
+
+ port->SPTB = ch;
+}
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+ int maximum;
+ int count = 0;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ buffer[ count ] = inbyte();
+ if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+ buffer[ count++ ] = '\n';
+ buffer[ count ] = 0;
+ break;
+ }
+ }
+
+ rw_args->bytes_moved = count;
+ return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ int count;
+ int maximum;
+ rtems_libio_rw_args_t *rw_args;
+ char *buffer;
+
+ rw_args = (rtems_libio_rw_args_t *) arg;
+
+ buffer = rw_args->buffer;
+ maximum = rw_args->count;
+
+ for (count = 0; count < maximum; count++) {
+ if ( buffer[ count ] == '\n') {
+ outbyte('\r');
+ }
+ outbyte( buffer[ count ] );
+ }
+ return maximum;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
diff --git a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
new file mode 100644
index 0000000000..4d2f4c0fd4
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
@@ -0,0 +1,98 @@
+/* timer.c
+ *
+ * This file manages the interval timer on the PowerPC 403*.
+ * We shall use the bottom 32 bits of the timebase register,
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems.h>
+
+extern rtems_cpu_table Cpu_table; /* owned by BSP */
+
+static volatile rtems_unsigned32 Timer_starting;
+static rtems_boolean Timer_driver_Find_average_overhead;
+
+/*
+ * This is so small that this code will be reproduced where needed.
+ */
+static INLINE rtems_unsigned32 get_itimer(void)
+{
+ rtems_unsigned32 ret;
+
+ asm volatile ("mfspr %0, 0x3dd" : "=r" ((ret))); /* TBLO */
+
+ return ret;
+}
+
+void Timer_initialize()
+{
+ rtems_unsigned32 iocr;
+
+ asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
+ iocr &= ~4;
+ iocr |= 4; /* Select external timer clock */
+ asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); /* IOCR */
+
+ Timer_starting = get_itimer();
+}
+
+int Read_timer()
+{
+ rtems_unsigned32 clicks;
+ rtems_unsigned32 total;
+
+ clicks = get_itimer();
+
+ total = clicks - Timer_starting;
+
+ if ( Timer_driver_Find_average_overhead == 1 )
+ return total; /* in XXX microsecond units */
+
+ else {
+ if ( total < Cpu_table.timer_least_valid )
+ return 0; /* below timer resolution */
+ return (total - Cpu_table.timer_average_overhead);
+ }
+}
+
+rtems_status_code Empty_function( void )
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+)
+{
+ Timer_driver_Find_average_overhead = find_flag;
+}
diff --git a/c/src/lib/libcpu/powerpc/ppc403/vectors/README b/c/src/lib/libcpu/powerpc/ppc403/vectors/README
new file mode 100644
index 0000000000..4081ae2525
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/vectors/README
@@ -0,0 +1,25 @@
+#
+# $Id$
+#
+
+The location of the vectors file object is critical.
+
+From the comments at the head of vectors.s:
+
+ The issue with this file is getting it loaded at the right place.
+ The first vector MUST be at address 0x????0100.
+ How this is achieved is dependant on the tool chain.
+
+ However the basic mechanism for ELF assemblers is to create a
+ section called ".vectors", which will be loaded to an address
+ between 0x????0000 and 0x????0100 (inclusive) via a link script.
+
+ The basic mechanism for XCOFF assemblers is to place it in the
+ normal text section, and arrange for this file to be located
+ at an appropriate position on the linker command line.
+
+ The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
+ offset from 0x????0000 to the first location in the file. This
+ will usually be 0x0000 or 0x0100.
+
+Andrew Bray 18/8/1995
diff --git a/c/src/lib/libcpu/powerpc/ppc403/vectors/align_h.s b/c/src/lib/libcpu/powerpc/ppc403/vectors/align_h.s
new file mode 100644
index 0000000000..00266b87e9
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/vectors/align_h.s
@@ -0,0 +1,433 @@
+/* align_h.s 1.1 - 95/12/04
+ *
+ * This file contains the assembly code for the PowerPC 403
+ * alignment exception handler for RTEMS.
+ *
+ * Based upon IBM provided code with the following release:
+ *
+ * This source code has been made available to you by IBM on an AS-IS
+ * basis. Anyone receiving this source is licensed under IBM
+ * copyrights to use it in any way he or she deems fit, including
+ * copying it, modifying it, compiling it, and redistributing it either
+ * with or without modifications. No license under IBM patents or
+ * patent applications is to be implied by the copyright license.
+ *
+ * Any user of this software should understand that IBM cannot provide
+ * technical support for this software and will not be responsible for
+ * any consequences resulting from the use of this software.
+ *
+ * Any person who transfers this source code or any derivative work
+ * must include the IBM copyright notice, this paragraph, and the
+ * preceding two paragraphs in the transferred software.
+ *
+ * COPYRIGHT I B M CORPORATION 1995
+ * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
+ *
+ * Modifications:
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+#include "bsp.h"
+
+.set CACHE_SIZE,16 # cache line size of 32 bytes
+.set CACHE_SIZE_L2,4 # cache line size, log 2
+
+.set Open_gpr0,0
+.set Open_gpr1,4
+.set Open_gpr2,8
+.set Open_gpr3,12
+.set Open_gpr4,16
+.set Open_gpr5,20
+.set Open_gpr6,24
+.set Open_gpr7,28
+.set Open_gpr8,32
+.set Open_gpr9,36
+.set Open_gpr10,40
+.set Open_gpr11,44
+.set Open_gpr12,48
+.set Open_gpr13,52
+.set Open_gpr14,56
+.set Open_gpr15,60
+.set Open_gpr16,64
+.set Open_gpr17,68
+.set Open_gpr18,72
+.set Open_gpr19,76
+.set Open_gpr20,80
+.set Open_gpr21,84
+.set Open_gpr22,88
+.set Open_gpr23,92
+.set Open_gpr24,96
+.set Open_gpr25,100
+.set Open_gpr26,104
+.set Open_gpr27,108
+.set Open_gpr28,112
+.set Open_gpr29,116
+.set Open_gpr30,120
+.set Open_gpr31,124
+.set Open_xer,128
+.set Open_lr,132
+.set Open_ctr,136
+.set Open_cr,140
+.set Open_srr2,144
+.set Open_srr3,148
+.set Open_srr0,152
+.set Open_srr1,156
+
+
+/*
+ * This code makes several assumptions for processing efficiency
+ * * General purpose registers are continuous in the image, beginning with
+ * Open_gpr0
+ * * Hash table is highly dependent on opcodes - opcode changes *will*
+ * require rework of the instruction decode mechanism.
+ */
+
+ .text
+ .globl align_h
+
+ .align CACHE_SIZE_L2
+align_h:
+ /*-----------------------------------------------------------------------
+ * Store GPRs in Open Reg save area
+ * Set up r2 as base reg, r1 pointing to Open Reg save area
+ *----------------------------------------------------------------------*/
+ stmw r0,ALIGN_REGS(r0)
+ li r1,ALIGN_REGS
+ /*-----------------------------------------------------------------------
+ * Store special purpose registers in reg save area
+ *----------------------------------------------------------------------*/
+ mfxer r7
+ mflr r8
+ mfcr r9
+ mfctr r10
+ stw r7,Open_xer(r1)
+ stw r8,Open_lr(r1)
+ stw r9,Open_cr(r1)
+ stw r10,Open_ctr(r1)
+ mfspr r7, srr2 /* SRR 2 */
+ mfspr r8, srr3 /* SRR 3 */
+ mfspr r9, srr0 /* SRR 0 */
+ mfspr r10, srr1 /* SRR 1 */
+ stw r7,Open_srr2(r1)
+ stw r8,Open_srr3(r1)
+ stw r9,Open_srr0(r1)
+ stw r10,Open_srr1(r1)
+
+/* Set up common registers */
+ mfspr r5, dear /* DEAR: R5 is data exception address */
+ lwz r9,Open_srr0(r1) /* get faulting instruction */
+ addi r7,r9,4 /* bump instruction */
+ stw r7,Open_srr0(r1) /* restore to image */
+ lwz r9, 0(r9) /* retrieve actual instruction */
+ rlwinm r6,r9,18,25,29 /* r6 is RA * 4 field from instruction */
+ rlwinm r7,r9,6,26,31 /* r7 is primary opcode */
+ bl ref_point /* establish addressibility */
+ref_point:
+ mflr r11 /* r11 is the anchor point for ref_point */
+ addi r10, r7, -31 /* r10 = r7 - 31 */
+ rlwinm r10,r10,2,2,31 /* r10 *= 4 */
+ add r10, r10, r11 /* r10 += anchor point */
+ lwz r10, primary_jt-ref_point(r10)
+ mtlr r10
+ rlwinm r8,r9,13,25,29 /* r8 is RD * 4 */
+ la r7,Open_gpr0(r1) /* r7 is address of GPR 0 in list */
+ blr
+primary_jt:
+ .long xform
+ .long lwz
+ .long lwzu
+ .long 0
+ .long 0
+ .long stw
+ .long stwu
+ .long 0
+ .long 0
+ .long lhz
+ .long lhzu
+ .long lha
+ .long lhau
+ .long sth
+ .long sthu
+ .long lmw
+ .long stmw
+/*
+ * handlers
+ */
+/*
+ * xform instructions require an additional decode. Fortunately, a relatively
+ * simple hash step breaks the instructions out with no collisions
+ */
+xform:
+ rlwinm r7,r9,31,22,31 /* r7 is secondary opcode */
+ rlwinm r10,r7,27,5,31 /* r10 = r7 >> 5 */
+ add r10,r7,r10 /* r10 = r7 + r10 */
+ rlwinm r10,r10,2,25,29 /* r10 = (r10 & 0x1F) * 4 */
+ add r10,r10,r11 /* r10 += anchor point */
+ lwz r10, secondary_ht-ref_point(r10)
+ mtlr r10
+ la r7,Open_gpr0(r1) /* r7 is address of GPR 0 in list */
+ rlwinm r8,r9,13,25,29 /* r8 is RD * 4 */
+ blrl
+
+secondary_ht:
+ .long lhzux /* b 0 0x137 */
+ .long lhax /* b 1 0x157 */
+ .long lhaux /* b 2 0x177 */
+ .long sthx /* b 3 0x197 */
+ .long sthux /* b 4 0x1b7 */
+ .long 0 /* b 5 */
+ .long lwbrx /* b 6 0x216 */
+ .long 0 /* b 7 */
+ .long 0 /* b 8 */
+ .long 0 /* b 9 */
+ .long stwbrx /* b A 0x296 */
+ .long 0 /* b B */
+ .long 0 /* b C */
+ .long 0 /* b D */
+ .long lhbrx /* b E 0x316 */
+ .long 0 /* b F */
+ .long 0 /* b 10 */
+ .long 0 /* b 11 */
+ .long sthbrx /* b 12 0x396 */
+ .long 0 /* b 13 */
+ .long lwarx /* b 14 0x014 */
+ .long dcbz /* b 15 0x3f6 */
+ .long 0 /* b 16 */
+ .long lwzx /* b 17 0x017 */
+ .long lwzux /* b 18 0x037 */
+ .long 0 /* b 19 */
+ .long stwcx /* b 1A 0x096 */
+ .long stwx /* b 1B 0x097 */
+ .long stwux /* b 1C 0x0B7 */
+ .long 0 /* b 1D */
+ .long 0 /* b 1E */
+ .long lhzx /* b 1F 0x117 */
+
+/*
+ * for all handlers
+ * r4 - Addressability to interrupt context
+ * r5 - DEAR address (faulting data address)
+ * r6 - RA field * 4
+ * r7 - Address of GPR 0 in image
+ * r8 - RD field * 4
+ * r9 - Failing instruction
+ */
+
+/* Load halfword algebraic with update */
+lhau:
+/* Load halfword algebraic with update indexed */
+lhaux:
+ stwx r5,r7,r6 /* update RA with effective addr */
+
+/* Load halfword algebraic */
+lha:
+/* Load halfword algebraic indexed */
+lhax:
+ lswi r10,r5,2 /* load two bytes into r10 */
+ srawi r10,r10,16 /* shift right 2 bytes, extending sign */
+ stwx r10,r7,r8 /* update reg image */
+ b align_complete /* return */
+
+/* Load Half Word Byte-Reversed Indexed */
+lhbrx:
+ lswi r10,r5,2 /* load two bytes from DEAR into r10 */
+ rlwinm r10,r10,0,0,15 /* mask off lower 2 bytes */
+ stwbrx r10,r7,r8 /* store reversed in reg image */
+ b align_complete /* return */
+
+/* Load Half Word and Zero with Update */
+lhzu:
+/* Load Half Word and Zero with Update Indexed */
+lhzux:
+ stwx r5,r7,r6 /* update RA with effective addr */
+
+/* Load Half Word and Zero */
+lhz:
+/* Load Half Word and Zero Indexed */
+lhzx:
+ lswi r10,r5,2 /* load two bytes from DEAR into r10 */
+ rlwinm r10,r10,16,16,31 /* shift right 2 bytes, with zero fill */
+ stwx r10,r7,r8 /* update reg image */
+ b align_complete /* return */
+
+/*
+ * Load Multiple Word
+ */
+lmw:
+ lwzx r9,r6,r7 /* R9 contains saved value of RA */
+ addi r10,r7,32*4 /* r10 points to r31 in image + 4 */
+ rlwinm r8,r8,30,2,31 /* r8 >>= 2 (recovers RT) */
+ subfic r8,r8,32 /* r8 is reg count to load */
+ mtctr r8 /* load counter */
+ addi r8,r8,-1 /* r8-- */
+ rlwinm r8,r8,2,2,31 /* r8 *= 4 */
+ add r5,r5,r8 /* update DEAR to point to last reg */
+lwmloop:
+ lswi r11,r5,4 /* load r11 with 4 bytes from DEAR */
+ stwu r11,-4(r10) /* load image and decrement pointer */
+ addi r5,r5,-4 /* decrement effective address */
+ bdnz lwmloop
+ stwx r9,r6,r7 /* restore RA (in case it was trashed) */
+ b align_complete /* return */
+
+/*
+ * Load Word and Reserve Indexed
+ */
+lwarx:
+ lswi r10,r5,4 /* load four bytes from DEAR into r10 */
+ stwx r10,r7,r8 /* update reg image */
+ rlwinm r5,r5,0,0,29 /* Word align address */
+ lwarx r10,0,r5 /* Set reservation */
+ b align_complete /* return */
+
+/*
+ * Load Word Byte-Reversed Indexed
+ */
+lwbrx:
+ lswi r10,r5,4 /* load four bytes from DEAR into r10 */
+ stwbrx r10,r7,r8 /* store reversed in reg image */
+ b align_complete /* return */
+
+/* Load Word and Zero with Update */
+lwzu:
+/* Load Word and Zero with Update Indexed */
+lwzux:
+ stwx r5,r7,r6 /* update RA with effective addr */
+
+/* Load Word and Zero */
+lwz:
+/* Load Word and Zero Indexed */
+lwzx:
+ lswi r10,r5,4 /* load four bytes from DEAR into r10 */
+ stwx r10,r7,r8 /* update reg image */
+ b align_complete /* return */
+
+/* Store instructions */
+
+/* */
+/* Store Half Word and Update */
+sthu:
+/* Store Half Word and Update Indexed */
+sthux:
+ stwx r5,r7,r6 /* Update RA with effective address */
+
+/* Store Half Word */
+sth:
+/* Store Half Word Indexed */
+sthx:
+ lwzx r10,r8,r7 /* retrieve source register value */
+ rlwinm r10,r10,16,0,15 /* move two bytes to high end of reg */
+ stswi r10,r5,2 /* store bytes to DEAR address */
+ b align_complete /* return */
+
+/* */
+/* Store Half Word Byte-Reversed Indexed */
+sthbrx:
+ lwbrx r10,r8,r7 /* retrieve src reg value byte reversed */
+ stswi r10,r5,2 /* move two bytes to DEAR address */
+ b align_complete /* return */
+
+/* */
+/* Store Multiple Word */
+stmw:
+ addi r10,r7,32*4 /* r10 points to r31 in image + 4 */
+ rlwinm r8,r8,30,2,31 /* r8 >>= 2 (recovers RT) */
+ subfic r8,r8,32 /* r8 is reg count to load */
+ mtctr r8 /* load counter */
+ addi r8,r8,-1 /* r8-- */
+ rlwinm r8,r8,2,2,31 /* r8 *= 4 */
+ add r5,r5,r8 /* update DEAR to point to last reg */
+stmloop:
+ lwzu r11,-4(r10) /* get register value */
+ stswi r11,r5,4 /* output to DEAR address */
+ addi r5,r5,-4 /* decrement effective address */
+ bdnz stmloop
+ b align_complete /* return */
+
+/* */
+/* Store Word and Update */
+stwu:
+/* Store Word and Update Indexed */
+stwux:
+ stwx r5,r7,r6 /* Update RA with effective address */
+
+/* Store Word */
+stw:
+/* Store Word Indexed */
+stwx:
+ lwzx r10,r8,r7 /* retrieve source register value */
+ stswi r10,r5,4 /* store bytes to DEAR address */
+ b align_complete /* return */
+
+/* */
+/* Store Word Byte-Reversed Indexed */
+stwbrx:
+ lwbrx r10,r8,r7 /* retrieve src reg value byte reversed */
+ stswi r10,r5,4 /* move two bytes to DEAR address */
+ b align_complete /* return */
+
+/* */
+/* Store Word Conditional Indexed */
+stwcx:
+ rlwinm r10,r5,0,0,29 /* r10 = word aligned DEAR */
+ lwz r11,0(r10) /* save original value of store */
+ stwcx. r11,r0,r10 /* attempt store to address */
+ bne stwcx_moveon /* store failed, move on */
+ stw r11,0(r10) /* repair damage */
+ lwzx r9,r7,r8 /* get register value */
+ stswi r10,r5,4 /* store bytes to DEAR address */
+stwcx_moveon:
+ mfcr r11 /* get condition reg */
+ lwz r9,Open_cr(r1) /* get condition reg image */
+ rlwimi r9,r11,0,0,2 /* insert 3 CR bits into cr image */
+ lwz r11,Open_xer(r1) /* get XER reg */
+ rlwimi r9,r11,29,2,2 /* insert XER SO bit into cr image */
+ stw r9,Open_cr(r1) /* store cr image */
+ b align_complete /* return */
+
+/* */
+/* Data Cache Block Zero */
+dcbz:
+ rlwinm r5,r5,0,0,31-CACHE_SIZE_L2
+ /* get address to nearest Cache line */
+ addi r5,r5,-4 /* adjust by a word */
+ addi r10,r0,CACHE_SIZE/4 /* set counter value */
+ mtctr r10
+ addi r11,r0,0 /* r11 = 0 */
+dcbz_loop:
+ stwu r11,4(r5) /* store a word and update EA */
+ bdnz dcbz_loop
+ b align_complete /* return */
+
+align_complete:
+ /*-----------------------------------------------------------------------
+ * Restore regs and return from the interrupt
+ *----------------------------------------------------------------------*/
+ lmw r24,Open_xer+ALIGN_REGS(r0)
+ mtxer r24
+ mtlr r25
+ mtctr r26
+ mtcrf 0xFF, r27
+ mtspr srr2, r28 /* SRR 2 */
+ mtspr srr3, r29 /* SRR 3 */
+ mtspr srr0, r30 /* SRR 0 */
+ mtspr srr1, r31 /* SRR 1 */
+ lmw r0,Open_gpr0+ALIGN_REGS(r0)
+ rfi
diff --git a/c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.s b/c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.s
new file mode 100644
index 0000000000..b764207648
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.s
@@ -0,0 +1,282 @@
+/* vectors.s 1.1 - 95/12/04
+ *
+ * This file contains the assembly code for the PowerPC 403
+ * interrupt veneers for RTEMS.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ */
+
+/*
+ * The issue with this file is getting it loaded at the right place.
+ * The first vector MUST be at address 0x????0100.
+ * How this is achieved is dependant on the tool chain.
+ *
+ * However the basic mechanism for ELF assemblers is to create a
+ * section called ".vectors", which will be loaded to an address
+ * between 0x????0000 and 0x????0100 (inclusive) via a link script.
+ *
+ * The basic mechanism for XCOFF assemblers is to place it in the
+ * normal text section, and arrange for this file to be located
+ * at an appropriate position on the linker command line.
+ *
+ * The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
+ * offset from 0x????0000 to the first location in the file. This
+ * will usually be 0x0000 or 0x0100.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+#ifndef PPC_VECTOR_FILE_BASE
+#error "PPC_VECTOR_FILE_BASE is not defined."
+#endif
+
+ /* Where this file will be loaded */
+ .set file_base, PPC_VECTOR_FILE_BASE
+
+ /* Offset to store reg 0 */
+
+ .set IP_LINK, 0
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+ .set IP_0, (IP_LINK + 56)
+#else
+ .set IP_0, (IP_LINK + 8)
+#endif
+ .set IP_2, (IP_0 + 4)
+
+ .set IP_3, (IP_2 + 4)
+ .set IP_4, (IP_3 + 4)
+ .set IP_5, (IP_4 + 4)
+ .set IP_6, (IP_5 + 4)
+
+ .set IP_7, (IP_6 + 4)
+ .set IP_8, (IP_7 + 4)
+ .set IP_9, (IP_8 + 4)
+ .set IP_10, (IP_9 + 4)
+
+ .set IP_11, (IP_10 + 4)
+ .set IP_12, (IP_11 + 4)
+ .set IP_13, (IP_12 + 4)
+ .set IP_28, (IP_13 + 4)
+
+ .set IP_29, (IP_28 + 4)
+ .set IP_30, (IP_29 + 4)
+ .set IP_31, (IP_30 + 4)
+ .set IP_CR, (IP_31 + 4)
+
+ .set IP_CTR, (IP_CR + 4)
+ .set IP_XER, (IP_CTR + 4)
+ .set IP_LR, (IP_XER + 4)
+ .set IP_PC, (IP_LR + 4)
+
+ .set IP_MSR, (IP_PC + 4)
+
+ .set IP_END, (IP_MSR + 16)
+
+ /* Vector offsets */
+ .set begin_vector,0x0000
+ .set crit_vector,0x0100
+ .set mach_vector,0x0200
+ .set prot_vector,0x0300
+ .set ext_vector,0x0500
+ .set align_vector,0x0600
+ .set prog_vector,0x0700
+ .set sys_vector,0x0C00
+ .set pit_vector,0x1000
+ .set fit_vector,0x1010
+ .set wadt_vector,0x1020
+ .set debug_vector,0x2000
+
+/* Go to the right section */
+#if PPC_ASM == PPC_ASM_ELF
+ .section .vectors,"awx",@progbits
+#elif PPC_ASM == PPC_ASM_XCOFF
+ .csect .text[PR]
+#endif
+
+ PUBLIC_VAR (__vectors)
+SYM (__vectors):
+
+/* Critical error handling */
+ .org crit_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_CRIT
+ b PROC (_ISR_HandlerC)
+
+/* Machine check exception */
+ .org mach_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_MCHECK
+ b PROC (_ISR_HandlerC)
+
+/* Protection exception */
+ .org prot_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_PROTECT
+ b PROC (_ISR_Handler)
+
+/* External interrupt */
+ .org ext_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_EXTERNAL
+ b PROC (_ISR_Handler)
+
+/* Align exception */
+ .org align_vector - file_base
+ .extern align_h
+ b align_h
+
+/* Program exception */
+ .org prog_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_PROGRAM
+ b PROC (_ISR_Handler)
+
+/* System call */
+ .org sys_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_SCALL
+ b PROC (_ISR_Handler)
+
+/* PIT interrupt */
+ .org pit_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_PIT
+ b PROC (_ISR_Handler)
+
+/* FIT interrupt */
+ .org fit_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_FIT
+ b PROC (_ISR_Handler)
+
+/* Watchdog interrupt */
+ .org wadt_vector - file_base
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_WATCHDOG
+ b PROC (_ISR_HandlerC)
+
+/* Debug exception */
+debug:
+#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
+#if (PPC_HAS_FPU)
+ stwu r1, -(20*4 + 18*8 + IP_END)(r1)
+#else
+ stwu r1, -(20*4 + IP_END)(r1)
+#endif
+#else
+ stwu r1, -(IP_END)(r1)
+#endif
+ stw r0, IP_0(r1)
+
+ li r0, PPC_IRQ_DEBUG
+ b PROC (_ISR_HandlerC)
+
+/* Debug exception */
+ .org debug_vector - file_base
+ b debug
diff --git a/c/src/lib/libcpu/sparc/include/erc32.h b/c/src/lib/libcpu/sparc/include/erc32.h
new file mode 100644
index 0000000000..8dd5162cea
--- /dev/null
+++ b/c/src/lib/libcpu/sparc/include/erc32.h
@@ -0,0 +1,518 @@
+/* erc32.h
+ *
+ * This include file contains information pertaining to the ERC32.
+ * The ERC32 is a custom SPARC V7 implementation based on the Cypress
+ * 601/602 chipset. This CPU has a number of on-board peripherals and
+ * was developed by the European Space Agency to target space applications.
+ *
+ * NOTE: Other than where absolutely required, this version currently
+ * supports only the peripherals and bits used by the basic board
+ * support package. This includes at least significant pieces of
+ * the following items:
+ *
+ * + UART Channels A and B
+ * + General Purpose Timer
+ * + Real Time Clock
+ * + Watchdog Timer (so it can be disabled)
+ * + Control Register (so powerdown mode can be enabled)
+ * + Memory Control Register
+ * + Interrupt Control
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ERC32_h
+#define _INCLUDE_ERC32_h
+
+#include <rtems/score/sparc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Interrupt Sources
+ *
+ * The interrupt source numbers directly map to the trap type and to
+ * the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask,
+ * and the Interrupt Pending Registers.
+ */
+
+#define ERC32_INTERRUPT_MASKED_ERRORS 1
+#define ERC32_INTERRUPT_EXTERNAL_1 2
+#define ERC32_INTERRUPT_EXTERNAL_2 3
+#define ERC32_INTERRUPT_UART_A_RX_TX 4
+#define ERC32_INTERRUPT_UART_B_RX_TX 5
+#define ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR 6
+#define ERC32_INTERRUPT_UART_ERROR 7
+#define ERC32_INTERRUPT_DMA_ACCESS_ERROR 8
+#define ERC32_INTERRUPT_DMA_TIMEOUT 9
+#define ERC32_INTERRUPT_EXTERNAL_3 10
+#define ERC32_INTERRUPT_EXTERNAL_4 11
+#define ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER 12
+#define ERC32_INTERRUPT_REAL_TIME_CLOCK 13
+#define ERC32_INTERRUPT_EXTERNAL_5 14
+#define ERC32_INTERRUPT_WATCHDOG_TIMEOUT 15
+
+#ifndef ASM
+
+/*
+ * Trap Types for on-chip peripherals
+ *
+ * Source: Table 8 - Interrupt Trap Type and Default Priority Assignments
+ *
+ * NOTE: The priority level for each source corresponds to the least
+ * significant nibble of the trap type.
+ */
+
+#define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
+
+#define ERC32_TRAP_SOURCE( _trap ) ((_trap) - 0x10)
+
+#define ERC32_Is_MEC_Trap( _trap ) \
+ ( (_trap) >= ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ) && \
+ (_trap) <= ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ) )
+
+/*
+ * Structure for ERC32 memory mapped registers.
+ *
+ * Source: Section 3.25.2 - Register Address Map
+ *
+ * NOTE: There is only one of these structures per CPU, its base address
+ * is 0x01f80000, and the variable MEC is placed there by the
+ * linkcmds file.
+ */
+
+typedef struct {
+ volatile unsigned32 Control; /* offset 0x00 */
+ volatile unsigned32 Software_Reset; /* offset 0x04 */
+ volatile unsigned32 Power_Down; /* offset 0x08 */
+ volatile unsigned32 Unimplemented_0; /* offset 0x0c */
+ volatile unsigned32 Memory_Configuration; /* offset 0x10 */
+ volatile unsigned32 IO_Configuration; /* offset 0x14 */
+ volatile unsigned32 Wait_State_Configuration; /* offset 0x18 */
+ volatile unsigned32 Unimplemented_1; /* offset 0x1c */
+ volatile unsigned32 Memory_Access_0; /* offset 0x20 */
+ volatile unsigned32 Memory_Access_1; /* offset 0x24 */
+ volatile unsigned32 Unimplemented_2[ 7 ]; /* offset 0x28 */
+ volatile unsigned32 Interrupt_Shape; /* offset 0x44 */
+ volatile unsigned32 Interrupt_Pending; /* offset 0x48 */
+ volatile unsigned32 Interrupt_Mask; /* offset 0x4c */
+ volatile unsigned32 Interrupt_Clear; /* offset 0x50 */
+ volatile unsigned32 Interrupt_Force; /* offset 0x54 */
+ volatile unsigned32 Unimplemented_3[ 2 ]; /* offset 0x58 */
+ /* offset 0x60 */
+ volatile unsigned32 Watchdog_Program_and_Timeout_Acknowledge;
+ volatile unsigned32 Watchdog_Trap_Door_Set; /* offset 0x64 */
+ volatile unsigned32 Unimplemented_4[ 6 ]; /* offset 0x68 */
+ volatile unsigned32 Real_Time_Clock_Counter; /* offset 0x80 */
+ volatile unsigned32 Real_Time_Clock_Scalar; /* offset 0x84 */
+ volatile unsigned32 General_Purpose_Timer_Counter; /* offset 0x88 */
+ volatile unsigned32 General_Purpose_Timer_Scalar; /* offset 0x8c */
+ volatile unsigned32 Unimplemented_5[ 2 ]; /* offset 0x90 */
+ volatile unsigned32 Timer_Control; /* offset 0x98 */
+ volatile unsigned32 Unimplemented_6; /* offset 0x9c */
+ volatile unsigned32 System_Fault_Status; /* offset 0xa0 */
+ volatile unsigned32 First_Failing_Address; /* offset 0xa4 */
+ volatile unsigned32 First_Failing_Data; /* offset 0xa8 */
+ volatile unsigned32 First_Failing_Syndrome_and_Check_Bits;/* offset 0xac */
+ volatile unsigned32 Error_and_Reset_Status; /* offset 0xb0 */
+ volatile unsigned32 Error_Mask; /* offset 0xb4 */
+ volatile unsigned32 Unimplemented_7[ 2 ]; /* offset 0xb8 */
+ volatile unsigned32 Debug_Control; /* offset 0xc0 */
+ volatile unsigned32 Breakpoint; /* offset 0xc4 */
+ volatile unsigned32 Watchpoint; /* offset 0xc8 */
+ volatile unsigned32 Unimplemented_8; /* offset 0xcc */
+ volatile unsigned32 Test_Control; /* offset 0xd0 */
+ volatile unsigned32 Test_Data; /* offset 0xd4 */
+ volatile unsigned32 Unimplemented_9[ 2 ]; /* offset 0xd8 */
+ volatile unsigned32 UART_Channel_A; /* offset 0xe0 */
+ volatile unsigned32 UART_Channel_B; /* offset 0xe4 */
+ volatile unsigned32 UART_Status; /* offset 0xe8 */
+} ERC32_Register_Map;
+
+#endif
+
+/*
+ * The following constants are intended to be used ONLY in assembly
+ * language files.
+ *
+ * NOTE: The intended style of usage is to load the address of MEC
+ * into a register and then use these as displacements from
+ * that register.
+ */
+
+#ifdef ASM
+
+#define ERC32_MEC_CONTROL_OFFSET 0x00
+#define ERC32_MEC_SOFTWARE_RESET_OFFSET 0x04
+#define ERC32_MEC_POWER_DOWN_OFFSET 0x08
+#define ERC32_MEC_UNIMPLEMENTED_0_OFFSET 0x0C
+#define ERC32_MEC_MEMORY_CONFIGURATION_OFFSET 0x10
+#define ERC32_MEC_IO_CONFIGURATION_OFFSET 0x14
+#define ERC32_MEC_WAIT_STATE_CONFIGURATION_OFFSET 0x18
+#define ERC32_MEC_UNIMPLEMENTED_1_OFFSET 0x1C
+#define ERC32_MEC_MEMORY_ACCESS_0_OFFSET 0x20
+#define ERC32_MEC_MEMORY_ACCESS_1_OFFSET 0x24
+#define ERC32_MEC_UNIMPLEMENTED_2_OFFSET 0x28
+#define ERC32_MEC_INTERRUPT_SHAPE_OFFSET 0x44
+#define ERC32_MEC_INTERRUPT_PENDING_OFFSET 0x48
+#define ERC32_MEC_INTERRUPT_MASK_OFFSET 0x4C
+#define ERC32_MEC_INTERRUPT_CLEAR_OFFSET 0x50
+#define ERC32_MEC_INTERRUPT_FORCE_OFFSET 0x54
+#define ERC32_MEC_UNIMPLEMENTED_3_OFFSET 0x58
+#define ERC32_MEC_WATCHDOG_PROGRAM_AND_TIMEOUT_ACKNOWLEDGE_OFFSET 0x60
+#define ERC32_MEC_WATCHDOG_TRAP_DOOR_SET_OFFSET 0x64
+#define ERC32_MEC_UNIMPLEMENTED_4_OFFSET 0x6C
+#define ERC32_MEC_REAL_TIME_CLOCK_COUNTER_OFFSET 0x80
+#define ERC32_MEC_REAL_TIME_CLOCK_SCALAR_OFFSET 0x84
+#define ERC32_MEC_GENERAL_PURPOSE_TIMER_COUNTER_OFFSET 0x88
+#define ERC32_MEC_GENERAL_PURPOSE_TIMER_SCALAR_OFFSET 0x8C
+#define ERC32_MEC_UNIMPLEMENTED_5_OFFSET 0x90
+#define ERC32_MEC_TIMER_CONTROL_OFFSET 0x98
+#define ERC32_MEC_UNIMPLEMENTED_6_OFFSET 0x9C
+#define ERC32_MEC_SYSTEM_FAULT_STATUS_OFFSET 0xA0
+#define ERC32_MEC_FIRST_FAILING_ADDRESS_OFFSET 0xA4
+#define ERC32_MEC_FIRST_FAILING_DATA_OFFSET 0xA8
+#define ERC32_MEC_FIRST_FAILING_SYNDROME_AND_CHECK_BITS_OFFSET 0xAC
+#define ERC32_MEC_ERROR_AND_RESET_STATUS_OFFSET 0xB0
+#define ERC32_MEC_ERROR_MASK_OFFSET 0xB4
+#define ERC32_MEC_UNIMPLEMENTED_7_OFFSET 0xB8
+#define ERC32_MEC_DEBUG_CONTROL_OFFSET 0xC0
+#define ERC32_MEC_BREAKPOINT_OFFSET 0xC4
+#define ERC32_MEC_WATCHPOINT_OFFSET 0xC8
+#define ERC32_MEC_UNIMPLEMENTED_8_OFFSET 0xCC
+#define ERC32_MEC_TEST_CONTROL_OFFSET 0xD0
+#define ERC32_MEC_TEST_DATA_OFFSET 0xD4
+#define ERC32_MEC_UNIMPLEMENTED_9_OFFSET 0xD8
+#define ERC32_MEC_UART_CHANNEL_A_OFFSET 0xE0
+#define ERC32_MEC_UART_CHANNEL_B_OFFSET 0xE4
+#define ERC32_MEC_UART_STATUS_OFFSET 0xE8
+
+#endif
+
+/*
+ * The following defines the bits in the Configuration Register.
+ */
+
+#define ERC32_CONFIGURATION_POWER_DOWN_MASK 0x00000001
+#define ERC32_CONFIGURATION_POWER_DOWN_ALLOWED 0x00000001
+#define ERC32_CONFIGURATION_POWER_DOWN_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_MASK 0x00000002
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_ALLOWED 0x00000002
+#define ERC32_CONFIGURATION_SOFTWARE_RESET_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_MASK 0x00000004
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_ENABLED 0x00000004
+#define ERC32_CONFIGURATION_BUS_TIMEOUT_DISABLED 0x00000000
+
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_MASK 0x00000008
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_ENABLED 0x00000008
+#define ERC32_CONFIGURATION_ACCESS_PROTECTION_DISABLED 0x00000000
+
+
+/*
+ * The following defines the bits in the Memory Configuration Register.
+ */
+
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001C00
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_256K ( 0 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_512K ( 1 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_1MB ( 2 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_2MB ( 3 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_4MB ( 4 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_8MB ( 5 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_16MB ( 6 << 10 )
+#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_32MB ( 7 << 10 )
+
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x001C0000
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_4K ( 0 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_8K ( 1 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_16K ( 2 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_32K ( 3 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_64K ( 4 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_128K ( 5 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_256K ( 6 << 18 )
+#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_512K ( 7 << 18 )
+
+/*
+ * The following defines the bits in the Timer Control Register.
+ */
+
+#define ERC32_MEC_TIMER_CONTROL_GCR 0x00000001 /* 1 = reload at 0 */
+ /* 0 = stop at 0 */
+#define ERC32_MEC_TIMER_CONTROL_GCL 0x00000002 /* 1 = load and start */
+ /* 0 = no function */
+#define ERC32_MEC_TIMER_CONTROL_GSE 0x00000004 /* 1 = enable counting */
+ /* 0 = hold scalar and counter */
+#define ERC32_MEC_TIMER_CONTROL_GSL 0x00000008 /* 1 = load scalar and start */
+ /* 0 = no function */
+
+#define ERC32_MEC_TIMER_CONTROL_RTCCR 0x00000100 /* 1 = reload at 0 */
+ /* 0 = stop at 0 */
+#define ERC32_MEC_TIMER_CONTROL_RTCCL 0x00000200 /* 1 = load and start */
+ /* 0 = no function */
+#define ERC32_MEC_TIMER_CONTROL_RTCSE 0x00000400 /* 1 = enable counting */
+ /* 0 = hold scalar and counter */
+#define ERC32_MEC_TIMER_CONTROL_RTCSL 0x00000800 /* 1 = load scalar and start */
+ /* 0 = no function */
+
+/*
+ * The following defines the bits in the UART Control Registers.
+ *
+ * NOTE: Same bits in UART channels A and B.
+ */
+
+#define ERC32_MEC_UART_CONTROL_RTD 0x000000FF /* RX/TX data */
+#define ERC32_MEC_UART_CONTROL_DR 0x00000100 /* RX Data Ready */
+#define ERC32_MEC_UART_CONTROL_TSE 0x00000200 /* TX Send Empty */
+ /* (i.e. no data to send) */
+#define ERC32_MEC_UART_CONTROL_THE 0x00000400 /* TX Hold Empty */
+ /* (i.e. ready to load) */
+
+/*
+ * The following defines the bits in the MEC UART Control Registers.
+ */
+
+#define ERC32_MEC_UART_STATUS_DR 0x00000001 /* Data Ready */
+#define ERC32_MEC_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */
+#define ERC32_MEC_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */
+#define ERC32_MEC_UART_STATUS_FE 0x00000010 /* RX Framing Error */
+#define ERC32_MEC_UART_STATUS_PE 0x00000020 /* RX Parity Error */
+#define ERC32_MEC_UART_STATUS_OE 0x00000040 /* RX Overrun Error */
+#define ERC32_MEC_UART_STATUS_CU 0x00000080 /* Clear Errors */
+#define ERC32_MEC_UART_STATUS_TXE 0x00000006 /* TX Empty */
+
+#define ERC32_MEC_UART_STATUS_DRA (ERC32_MEC_UART_STATUS_DR << 0)
+#define ERC32_MEC_UART_STATUS_TSEA (ERC32_MEC_UART_STATUS_TSE << 0)
+#define ERC32_MEC_UART_STATUS_THEA (ERC32_MEC_UART_STATUS_THE << 0)
+#define ERC32_MEC_UART_STATUS_FEA (ERC32_MEC_UART_STATUS_FE << 0)
+#define ERC32_MEC_UART_STATUS_PEA (ERC32_MEC_UART_STATUS_PE << 0)
+#define ERC32_MEC_UART_STATUS_OEA (ERC32_MEC_UART_STATUS_OE << 0)
+#define ERC32_MEC_UART_STATUS_CUA (ERC32_MEC_UART_STATUS_CU << 0)
+#define ERC32_MEC_UART_STATUS_TXEA (ERC32_MEC_UART_STATUS_TXE << 0)
+
+#define ERC32_MEC_UART_STATUS_DRB (ERC32_MEC_UART_STATUS_DR << 16)
+#define ERC32_MEC_UART_STATUS_TSEB (ERC32_MEC_UART_STATUS_TSE << 16)
+#define ERC32_MEC_UART_STATUS_THEB (ERC32_MEC_UART_STATUS_THE << 16)
+#define ERC32_MEC_UART_STATUS_FEB (ERC32_MEC_UART_STATUS_FE << 16)
+#define ERC32_MEC_UART_STATUS_PEB (ERC32_MEC_UART_STATUS_PE << 16)
+#define ERC32_MEC_UART_STATUS_OEB (ERC32_MEC_UART_STATUS_OE << 16)
+#define ERC32_MEC_UART_STATUS_CUB (ERC32_MEC_UART_STATUS_CU << 16)
+#define ERC32_MEC_UART_STATUS_TXEB (ERC32_MEC_UART_STATUS_TXE << 16)
+
+#ifndef ASM
+
+/*
+ * This is used to manipulate the on-chip registers.
+ *
+ * The following symbol must be defined in the linkcmds file and point
+ * to the correct location.
+ */
+
+extern ERC32_Register_Map ERC32_MEC;
+
+/*
+ * Macros to manipulate the Interrupt Clear, Interrupt Force, Interrupt Mask,
+ * and the Interrupt Pending Registers.
+ *
+ * NOTE: For operations which are not atomic, this code disables interrupts
+ * to guarantee there are no intervening accesses to the same register.
+ * The operations which read the register, modify the value and then
+ * store the result back are vulnerable.
+ */
+
+#define ERC32_Clear_interrupt( _source ) \
+ do { \
+ ERC32_MEC.Interrupt_Clear = (1 << (_source)); \
+ } while (0)
+
+#define ERC32_Force_interrupt( _source ) \
+ do { \
+ ERC32_MEC.Interrupt_Force = (1 << (_source)); \
+ } while (0)
+
+#define ERC32_Is_interrupt_pending( _source ) \
+ (ERC32_MEC.Interrupt_Pending & (1 << (_source)))
+
+#define ERC32_Is_interrupt_masked( _source ) \
+ (ERC32_MEC.Interrupt_Masked & (1 << (_source)))
+
+#define ERC32_Mask_interrupt( _source ) \
+ do { \
+ unsigned32 _level; \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask |= (1 << (_source)); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+#define ERC32_Unmask_interrupt( _source ) \
+ do { \
+ unsigned32 _level; \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask &= ~(1 << (_source)); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+#define ERC32_Disable_interrupt( _source, _previous ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _mask = 1 << (_source); \
+ \
+ sparc_disable_interrupts( _level ); \
+ (_previous) = ERC32_MEC.Interrupt_Mask; \
+ ERC32_MEC.Interrupt_Mask = _previous | _mask; \
+ sparc_enable_interrupts( _level ); \
+ (_previous) &= ~_mask; \
+ } while (0)
+
+#define ERC32_Restore_interrupt( _source, _previous ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _mask = 1 << (_source); \
+ \
+ sparc_disable_interrupts( _level ); \
+ ERC32_MEC.Interrupt_Mask = \
+ (ERC32_MEC.Interrupt_Mask & ~_mask) | (_previous); \
+ sparc_enable_interrupts( _level ); \
+ } while (0)
+
+/*
+ * The following macros attempt to hide the fact that the General Purpose
+ * Timer and Real Time Clock Timer share the Timer Control Register. Because
+ * the Timer Control Register is write only, we must mirror it in software
+ * and insure that writes to one timer do not alter the current settings
+ * and status of the other timer.
+ *
+ * This code promotes the view that the two timers are completely independent.
+ * By exclusively using the routines below to access the Timer Control
+ * Register, the application can view the system as having a General Purpose
+ * Timer Control Register and a Real Time Clock Timer Control Register
+ * rather than the single shared value.
+ *
+ * Each logical timer control register is organized as follows:
+ *
+ * D0 - Counter Reload
+ * 1 = reload counter at zero and restart
+ * 0 = stop counter at zero
+ *
+ * D1 - Counter Load
+ * 1 = load counter with preset value and restart
+ * 0 = no function
+ *
+ * D2 - Enable
+ * 1 = enable counting
+ * 0 = hold scaler and counter
+ *
+ * D2 - Scaler Load
+ * 1 = load scalar with preset value and restart
+ * 0 = no function
+ *
+ * To insure the management of the mirror is atomic, we disable interrupts
+ * around updates.
+ */
+
+#define ERC32_MEC_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000001
+#define ERC32_MEC_TIMER_COUNTER_STOP_AT_ZERO 0x00000000
+
+#define ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER 0x00000002
+
+#define ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING 0x00000004
+#define ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING 0x00000000
+
+#define ERC32_MEC_TIMER_COUNTER_LOAD_SCALER 0x00000008
+
+#define ERC32_MEC_TIMER_COUNTER_RELOAD_MASK 0x00000001
+#define ERC32_MEC_TIMER_COUNTER_ENABLE_MASK 0x00000004
+
+#define ERC32_MEC_TIMER_COUNTER_DEFINED_MASK 0x0000000F
+#define ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000005
+
+extern unsigned32 _ERC32_MEC_Timer_Control_Mirror;
+
+/*
+ * This macros manipulate the General Purpose Timer portion of the
+ * Timer Control register and promote the view that there are actually
+ * two independent Timer Control Registers.
+ */
+
+#define ERC32_MEC_Set_General_Purpose_Timer_Control( _value ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _control; \
+ unsigned32 __value; \
+ \
+ __value = ((_value) & 0x0f); \
+ sparc_disable_interrupts( _level ); \
+ _control = _ERC32_MEC_Timer_Control_Mirror; \
+ _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK << 8; \
+ _ERC32_MEC_Timer_Control_Mirror = _control | _value; \
+ _control &= (ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK << 8); \
+ _control |= __value; \
+ /* printf( "GPT 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \
+ ERC32_MEC.Timer_Control = _control; \
+ sparc_enable_interrupts( _level ); \
+ } while ( 0 )
+
+#define ERC32_MEC_Get_General_Purpose_Timer_Control( _value ) \
+ do { \
+ (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \
+ } while ( 0 )
+
+/*
+ * This macros manipulate the Real Timer Clock Timer portion of the
+ * Timer Control register and promote the view that there are actually
+ * two independent Timer Control Registers.
+ */
+
+#define ERC32_MEC_Set_Real_Time_Clock_Timer_Control( _value ) \
+ do { \
+ unsigned32 _level; \
+ unsigned32 _control; \
+ unsigned32 __value; \
+ \
+ __value = ((_value) & 0x0f) << 8; \
+ sparc_disable_interrupts( _level ); \
+ _control = _ERC32_MEC_Timer_Control_Mirror; \
+ _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK; \
+ _ERC32_MEC_Timer_Control_Mirror = _control | _value; \
+ _control &= ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK; \
+ _control |= __value; \
+ /* printf( "RTC 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \
+ ERC32_MEC.Timer_Control = _control; \
+ sparc_enable_interrupts( _level ); \
+ } while ( 0 )
+
+#define ERC32_MEC_Get_Real_Time_Clock_Timer_Control( _value ) \
+ do { \
+ (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \
+ } while ( 0 )
+
+
+#endif /* !ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_INCLUDE_ERC32_h */
+/* end of include file */
+
diff --git a/c/src/lib/libcpu/sparc/reg_win/window.s b/c/src/lib/libcpu/sparc/reg_win/window.s
new file mode 100644
index 0000000000..c21e73ebb4
--- /dev/null
+++ b/c/src/lib/libcpu/sparc/reg_win/window.s
@@ -0,0 +1,257 @@
+/*
+ * window.s
+ *
+ * This file contains the register window management routines for the
+ * SPARC architecture. Trap handlers for the following capabilities
+ * are included in this file:
+ *
+ * + Window Overflow
+ * + Window Underflow
+ * + Flushing All Windows
+ *
+ * COPYRIGHT:
+ *
+ * This file includes the window overflow and underflow handlers from
+ * the file srt0.s provided with the binary distribution of the SPARC
+ * Instruction Simulator (SIS) found at
+ * ftp://ftp.estec.esa.nl/pub/ws/wsd/erc32.
+ *
+ * COPYRIGHT (c) 1995. European Space Agency.
+ *
+ * This terms of the RTEMS license apply to this file.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+
+ .seg "text"
+ /*
+ * Window overflow trap handler.
+ *
+ * On entry:
+ *
+ * l0 = psr (from trap table)
+ * l1 = pc
+ * l2 = npc
+ */
+
+ PUBLIC(window_overflow_trap_handler)
+
+SYM(window_overflow_trap_handler):
+
+ /*
+ * Calculate new WIM by "rotating" the valid bits in the WIM right
+ * by one position. The following shows how the bits move for a SPARC
+ * cpu implementation where SPARC_NUMBER_OF_REGISTER_WINDOWS is 8.
+ *
+ * OLD WIM = 76543210
+ * NEW WIM = 07654321
+ *
+ * NOTE: New WIM must be stored in a global register since the
+ * "save" instruction just prior to the load of the wim
+ * register will result in the local register set changing.
+ */
+
+ mov %wim, %l3 ! l3 = WIM
+ mov %g1, %l7 ! save g1
+ srl %l3, 1, %g1 ! g1 = WIM >> 1
+ sll %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1 , %l4
+ ! l4 = WIM << (Number Windows - 1)
+ or %l4, %g1, %g1 ! g1 = (WIM >> 1) |
+ ! (WIM << (Number Windows - 1))
+
+ save ! Get into window to be saved.
+ mov %g1, %wim ! load new WIM
+ nop; nop; nop ! 3 slot delay
+ std %l0, [%sp + 0x00] ! save local register set
+ std %l2, [%sp + 0x08]
+ std %l4, [%sp + 0x10]
+ std %l6, [%sp + 0x18]
+ std %i0, [%sp + 0x20] ! save input register set
+ std %i2, [%sp + 0x28]
+ std %i4, [%sp + 0x30]
+ std %i6, [%sp + 0x38]
+ restore ! Go back to trap window.
+ mov %l7, %g1 ! restore g1
+ jmp %l1 ! Re-execute save.
+ rett %l2
+
+ /*
+ * Window underflow trap handler.
+ *
+ * On entry:
+ *
+ * l0 = psr (from trap table)
+ * l1 = pc
+ * l2 = npc
+ */
+
+ PUBLIC(window_underflow_trap_handler)
+
+SYM(window_underflow_trap_handler):
+
+ /*
+ * Calculate new WIM by "rotating" the valid bits in the WIM left
+ * by one position. The following shows how the bits move for a SPARC
+ * cpu implementation where SPARC_NUMBER_OF_REGISTER_WINDOWS is 8.
+ *
+ * OLD WIM = 76543210
+ * NEW WIM = 07654321
+ *
+ * NOTE: New WIM must be stored in a global register since the
+ * "save" instruction just prior to the load of the wim
+ * register will result in the local register set changing.
+ */
+
+ mov %wim, %l3 ! Calculate new WIM
+ sll %l3, 1, %l4 ! l4 = WIM << 1
+ srl %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1, %l5
+ ! l5 = WIM >> (Number Windows-1)
+ or %l5, %l4, %l5 ! l5 = (WIM << 1) |
+ ! (WIM >> (Number Windows-1))
+ mov %l5, %wim ! load the new WIM
+ nop; nop; nop
+ restore ! Two restores to get into the
+ restore ! window to restore
+ ldd [%sp + 0x00], %l0 ! First the local register set
+ ldd [%sp + 0x08], %l2
+ ldd [%sp + 0x10], %l4
+ ldd [%sp + 0x18], %l6
+ ldd [%sp + 0x20], %i0 ! Then the input registers
+ ldd [%sp + 0x28], %i2
+ ldd [%sp + 0x30], %i4
+ ldd [%sp + 0x38], %i6
+ save ! Get back to the trap window.
+ save
+ jmp %l1 ! Re-execute restore.
+ rett %l2
+
+ /*
+ * Flush All Windows trap handler.
+ *
+ * Flush all windows with valid contents except the current one
+ * and the one we will be returning to.
+ *
+ * In examining the set register windows, one may logically divide
+ * the windows into sets (some of which may be empty) based on their
+ * current status:
+ *
+ * + current (i.e. in use),
+ * + used (i.e. a restore would not trap)
+ * + invalid (i.e. 1 in corresponding bit in WIM)
+ * + unused
+ *
+ * Either the used or unused set of windows may be empty.
+ *
+ * NOTE: We assume only one bit is set in the WIM at a time.
+ *
+ * Given a CWP of 5 and a WIM of 0x1, the registers are divided
+ * into sets as follows:
+ *
+ * + 0 - invalid
+ * + 1-4 - unused
+ * + 5 - current
+ * + 6-7 - used
+ *
+ * In this case, we only would save the used windows which we
+ * will not be returning to -- 6.
+ *
+ * Register Usage while saving the windows:
+ * g1 = current PSR
+ * g2 = current wim
+ * g3 = CWP
+ * g4 = wim scratch
+ * g5 = scratch
+ *
+ * On entry:
+ *
+ * l0 = psr (from trap table)
+ * l1 = pc
+ * l2 = npc
+ */
+
+ PUBLIC(window_flush_trap_handler)
+
+SYM(window_flush_trap_handler):
+ /*
+ * Save the global registers we will be using
+ */
+
+ mov %g1, %l3
+ mov %g2, %l4
+ mov %g3, %l5
+ mov %g4, %l6
+ mov %g5, %l7
+
+ mov %l0, %g1 ! g1 = psr
+ mov %wim, %g2 ! g2 = wim
+ and %l0, SPARC_PSR_CWP_MASK, %g3 ! g3 = CWP
+
+ add %g3, 1, %g5 ! g5 = CWP + 1
+ and %g5, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g5
+
+ mov 1, %g4
+ sll %g4, %g5, %g4 ! g4 = WIM mask for CWP+1 invalid
+
+ restore ! go back one register window
+
+save_frame_loop:
+ sll %g4, 1, %g5 ! rotate the "wim" left 1
+ srl %g4, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g4
+ or %g4, %g5, %g4 ! g4 = wim if we do one restore
+
+ /*
+ * If a restore would not underflow, then continue.
+ */
+
+ andcc %g4, %g2, %g0 ! Any windows to flush?
+ bnz done_flushing ! No, then continue
+ nop
+
+ restore ! back one window
+
+ /*
+ * Now save the window just as if we overflowed to it.
+ */
+
+ std %l0, [%sp + CPU_STACK_FRAME_L0_OFFSET]
+ std %l2, [%sp + CPU_STACK_FRAME_L2_OFFSET]
+ std %l4, [%sp + CPU_STACK_FRAME_L4_OFFSET]
+ std %l6, [%sp + CPU_STACK_FRAME_L6_OFFSET]
+
+ std %i0, [%sp + CPU_STACK_FRAME_I0_OFFSET]
+ std %i2, [%sp + CPU_STACK_FRAME_I2_OFFSET]
+ std %i4, [%sp + CPU_STACK_FRAME_I4_OFFSET]
+ std %i6, [%sp + CPU_STACK_FRAME_I6_FP_OFFSET]
+
+ ba save_frame_loop
+ nop
+
+done_flushing:
+
+ add %g3, 2, %g3 ! calculate desired WIM
+ and %g3, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g3
+ mov 1, %g4
+ sll %g4, %g3, %g4 ! g4 = new WIM
+ mov %g4, %wim
+
+ mov %g1, %psr ! restore PSR
+ nop
+ nop
+ nop
+
+ /*
+ * Restore the global registers we used
+ */
+
+ mov %l3, %g1
+ mov %l4, %g2
+ mov %l5, %g3
+ mov %l6, %g4
+ mov %l7, %g5
+
+ jmpl %l2, %g0
+ rett %l2 + 4
+
+/* end of file */
diff --git a/c/src/lib/libmisc/README b/c/src/lib/libmisc/README
new file mode 100644
index 0000000000..6825898121
--- /dev/null
+++ b/c/src/lib/libmisc/README
@@ -0,0 +1,16 @@
+#
+# $Id$
+#
+
+This directory contains for the "miscellaneous" library. Currently
+the only item in this library is a user extension set which checks
+for a task "blowing" it's stack.
+
+The following ideas have been mentioned for items which could go
+in this library, but this list is not all inclusive:
+
+ + Workspace Consistency Checker
+ + Task Execution Time Monitor
+
+The intent of this library is to provide a home for useful utility routines
+which are dependent upon RTEMS.
diff --git a/c/src/lib/libmisc/assoc/assoc.c b/c/src/lib/libmisc/assoc/assoc.c
new file mode 100644
index 0000000000..74387a8c5b
--- /dev/null
+++ b/c/src/lib/libmisc/assoc/assoc.c
@@ -0,0 +1,260 @@
+/*
+ * assoc.c
+ * rtems assoc routines
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "assoc.h"
+
+#include <stdio.h> /* sprintf */
+#include <string.h> /* strcat, strcmp */
+
+#define STREQ(a,b) (strcmp((a), (b)) == 0)
+#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (strcmp(ap->name, name) == 0)
+ return ap;
+
+ return default_ap;
+}
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->local_value == local_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->remote_value == remote_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+/*
+ * Get values
+ */
+
+unsigned32
+rtems_assoc_remote_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_remote_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+/*
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+
+const char *
+rtems_assoc_name_bad(
+ unsigned32 bad_value
+)
+{
+#ifdef RTEMS_DEBUG
+ static char bad_buffer[32];
+
+ sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
+#else
+ static char bad_buffer[32] = "<assoc.c: BAD NAME>";
+#endif
+ return bad_buffer;
+}
+
+
+const char *
+rtems_assoc_name_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(local_value);
+}
+
+const char *
+rtems_assoc_name_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(remote_value);
+}
+
+/*
+ * Bitfield functions assume just 1 bit set in each of remote and local
+ * entries; they do not check for this.
+ */
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ unsigned32 b;
+ unsigned32 remote_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & local_value)
+ remote_value |= rtems_assoc_remote_by_local(ap, b);
+
+ return remote_value;
+}
+
+
+unsigned32 rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ unsigned32 b;
+ unsigned32 local_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & remote_value)
+ local_value |= rtems_assoc_local_by_remote(ap, b);
+
+ return local_value;
+}
+
+char *
+rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_remote(ap, b));
+ }
+
+ return buffer;
+}
+
+char *
+rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_local(ap, b));
+ }
+
+ return buffer;
+}
diff --git a/c/src/lib/libmisc/assoc/assoc.h b/c/src/lib/libmisc/assoc/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/c/src/lib/libmisc/assoc/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/c/src/lib/libmisc/error/error.c b/c/src/lib/libmisc/error/error.c
new file mode 100644
index 0000000000..5bd481c3e6
--- /dev/null
+++ b/c/src/lib/libmisc/error/error.c
@@ -0,0 +1,209 @@
+/*
+ * report errors and panics to RTEMS' stderr.
+ * Currently just used by RTEMS monitor.
+ *
+ * $Id$
+ */
+
+
+/*
+ * These routines provide general purpose error reporting.
+ * rtems_error reports an error to stderr and allows use of
+ * printf style formatting. A newline is appended to all messages.
+ *
+ * error_flag can be specified as any of the following:
+ *
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * It can also include a rtems_status value which can be OR'd
+ * with the above flags. *
+ *
+ * EXAMPLE
+ * #include <rtems.h>
+ * #include <rtems/error.h>
+ * rtems_error(0, "stray interrupt %d", intr);
+ *
+ * EXAMPLE
+ * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
+ * {
+ * rtems_error(status | RTEMS_ERROR_ABORT,
+ * "could not create task");
+ * }
+ *
+ * EXAMPLE
+ * if ((fd = open(pathname, O_RDNLY)) < 0)
+ * {
+ * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
+ * goto failed;
+ * }
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "error.h"
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h> /* _exit() */
+
+/* bug in hpux <errno.h>: no prototypes unless you are C++ */
+#ifdef hpux9
+char *strerror(int);
+#endif
+
+extern char *rtems_progname;
+int rtems_panic_in_progress;
+
+rtems_assoc_t rtems_status_assoc[] = {
+ { "successful completion", RTEMS_SUCCESSFUL, },
+ { "returned from a thread", RTEMS_TASK_EXITTED, },
+ { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
+ { "invalid object name", RTEMS_INVALID_NAME, },
+ { "invalid object id", RTEMS_INVALID_ID, },
+ { "too many", RTEMS_TOO_MANY, },
+ { "timed out waiting", RTEMS_TIMEOUT, },
+ { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
+ { "specified size was invalid", RTEMS_INVALID_SIZE, },
+ { "address specified is invalid", RTEMS_INVALID_ADDRESS, },
+ { "number was invalid", RTEMS_INVALID_NUMBER, },
+ { "item has not been initialized", RTEMS_NOT_DEFINED, },
+ { "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
+ { "request not satisfied", RTEMS_UNSATISFIED, },
+ { "thread is in wrong state", RTEMS_INCORRECT_STATE, },
+ { "thread already in state", RTEMS_ALREADY_SUSPENDED, },
+ { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
+ { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
+ { "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
+ { "invalid thread priority", RTEMS_INVALID_PRIORITY, },
+ { "invalid date/time", RTEMS_INVALID_CLOCK, },
+ { "invalid node id", RTEMS_INVALID_NODE, },
+ { "directive not configured", RTEMS_NOT_CONFIGURED, },
+ { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
+ { "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
+ { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
+ { "could not get enough memory", RTEMS_NO_MEMORY, },
+ { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
+ { 0, 0, 0 },
+};
+
+
+const char *
+rtems_status_text(
+ rtems_status_code status
+)
+{
+ return rtems_assoc_name_by_local(rtems_status_assoc, status);
+}
+
+
+static int rtems_verror(
+ unsigned32 error_flag,
+ const char *printf_format,
+ va_list arglist
+)
+{
+ int local_errno = 0;
+ int chars_written = 0;
+ rtems_status_code status;
+
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_panic_in_progress++;
+
+ /* disable task switches */
+ _Thread_Disable_dispatch();
+
+ /* don't aggravate things */
+ if (rtems_panic_in_progress > 2)
+ return 0;
+ }
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ status = error_flag & ~RTEMS_ERROR_MASK;
+ if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
+ local_errno = errno;
+
+ if (_System_state_Is_multiprocessing)
+ fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
+
+ if (rtems_progname && *rtems_progname)
+ chars_written += fprintf(stderr, "%s: ", rtems_progname);
+ chars_written += vfprintf(stderr, printf_format, arglist);
+
+ if (status)
+ chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
+
+ if (local_errno)
+ if ((local_errno > 0) && *strerror(local_errno))
+ chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
+ else
+ chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
+
+ chars_written += fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
+ {
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_error(0, "fatal error, exiting");
+ _exit(local_errno);
+ }
+ else
+ {
+ rtems_error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+ return chars_written;
+}
+
+
+/*
+ * Report an error.
+ * error_flag is as above; printf_format is a normal
+ * printf(3) format string, with its concommitant arguments.
+ *
+ * Returns the number of characters written.
+ */
+
+int rtems_error(
+ int error_flag,
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+ int chars_written;
+
+ va_start(arglist, printf_format);
+ chars_written = rtems_verror(error_flag, printf_format, arglist);
+ va_end(arglist);
+
+ return chars_written;
+}
+
+/*
+ * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
+ */
+
+void rtems_panic(
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+
+ va_start(arglist, printf_format);
+ (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
+ va_end(arglist);
+}
diff --git a/c/src/lib/libmisc/error/error.h b/c/src/lib/libmisc/error/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/c/src/lib/libmisc/error/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libmisc/monitor/README b/c/src/lib/libmisc/monitor/README
new file mode 100644
index 0000000000..d5a73da140
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/README
@@ -0,0 +1,97 @@
+#
+# $Id$
+#
+
+monitor task
+
+The monitor task is an optional task that knows about RTEMS
+data structures and can print out information about them.
+It is a work-in-progress and needs many more commands, but
+is useful now.
+
+The monitor works best when it is the highest priority task,
+so all your other tasks should ideally be at some priority
+greater than 1.
+
+To use the monitor:
+-------------------
+
+ #include <rtems/monitor.h>
+
+ ...
+
+ rtems_monitor_init(0);
+
+ The parameter to rtems_monitor_init() tells the monitor whether
+ to suspend itself on startup. A value of 0 causes the monitor
+ to immediately enter command mode; a non-zero value causes the
+ monitor to suspend itself after creation and wait for explicit
+ wakeup.
+
+
+ rtems_monitor_wakeup();
+
+ wakes up a suspended monitor and causes it to reenter command mode.
+
+Monitor commands
+----------------
+
+ The monitor prompt is 'rtems> '.
+ Can abbreviate commands to "uniquity"
+ There is a 'help' command. Here is the output from various
+ help commands:
+
+ Commands (may be abbreviated)
+
+ help -- get this message or command specific help
+ task -- show task information
+ queue -- show message queue information
+ symbol -- show entries from symbol table
+ pause -- pause monitor for a specified number of ticks
+ fatal -- invoke a fatal RTEMS error
+
+ task [id [id ...] ]
+ display information about the specified tasks.
+ Default is to display information about all tasks on this node
+
+ queue [id [id ... ] ]
+ display information about the specified message queues
+ Default is to display information about all queues on this node
+
+ symbol [ symbolname [symbolname ... ] ]
+ display value associated with specified symbol.
+ Defaults to displaying all known symbols.
+
+ pause [ticks]
+ monitor goes to "sleep" for specified ticks (default is 1)
+ monitor will resume at end of period or if explicitly awakened
+
+ fatal [status]
+ Invoke 'rtems_fatal_error_occurred' with 'status'
+ (default is RTEMS_INTERNAL_ERROR)
+
+ continue
+ put the monitor to sleep waiting for an explicit wakeup from the
+ program running.
+
+
+Sample output from 'task' command
+---------------------------------
+
+ rtems> task
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES
+ ------------------------------------------------------------------------
+ 00010001 UI1 2 READY P:T:nA NONE15: 0x40606348
+ 00010002 RMON 1 READY nP NONE15: 0x40604110
+
+ 'RMON' is the monitor itself, so we have 1 "user" task.
+ Its modes are P:T:nA which translate to:
+
+ preemptable
+ timesliced
+ no ASRS
+
+ It has no events.
+ It has a notepad value for notepad 15 which is 0x40606348
+ (this is the libc thread state)
+
diff --git a/c/src/lib/libmisc/monitor/mon-command.c b/c/src/lib/libmisc/monitor/mon-command.c
new file mode 100644
index 0000000000..87d31dfa2a
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-command.c
@@ -0,0 +1,187 @@
+/*
+ * Command parsing routines for RTEMS monitor
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * make_argv(cp): token-count
+ * Break up the command line in 'cp' into global argv[] and argc (return
+ * value).
+ */
+
+int
+rtems_monitor_make_argv(
+ char *cp,
+ int *argc_p,
+ char **argv)
+{
+ int argc = 0;
+
+ while ((cp = strtok(cp, " \t\n\r")))
+ {
+ argv[argc++] = cp;
+ cp = (char *) NULL;
+ }
+ argv[argc] = (char *) NULL; /* end of argv */
+
+ return *argc_p = argc;
+}
+
+
+/*
+ * Read and break up a monitor command
+ *
+ * We have to loop on the gets call, since it will return NULL under UNIX
+ * RTEMS when we get a signal (eg: SIGALRM).
+ */
+
+int
+rtems_monitor_command_read(char *command,
+ int *argc,
+ char **argv)
+{
+ extern rtems_configuration_table BSP_Configuration;
+ static char monitor_prompt[32];
+
+ /*
+ * put node number in the prompt if we are multiprocessing
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table == 0)
+ sprintf(monitor_prompt, "%s", MONITOR_PROMPT);
+ else if (rtems_monitor_default_node != rtems_monitor_node)
+ sprintf(monitor_prompt, "%d-%s-%d", rtems_monitor_node, MONITOR_PROMPT, rtems_monitor_default_node);
+ else
+ sprintf(monitor_prompt, "%d-%s", rtems_monitor_node, MONITOR_PROMPT);
+
+#ifdef RTEMS_UNIX
+ /* RTEMS on unix gets so many interrupt system calls this is hosed */
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ while (gets(command) == (char *) 0)
+ ;
+#else
+ do
+ {
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ } while (gets(command) == (char *) 0);
+#endif
+
+ return rtems_monitor_make_argv(command, argc, argv);
+}
+
+/*
+ * Look up a command in a command table
+ *
+ */
+
+rtems_monitor_command_entry_t *
+rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t *table,
+ int argc,
+ char **argv
+)
+{
+ rtems_monitor_command_entry_t *p;
+ rtems_monitor_command_entry_t *abbreviated_match = 0;
+ int abbreviated_matches = 0;
+ char *command;
+ int command_length;
+
+ command = argv[0];
+
+ if ((table == 0) || (command == 0))
+ goto failed;
+
+ command_length = strlen(command);
+
+ for (p = table; p->command; p++)
+ if (STREQ(command, p->command)) /* exact match */
+ goto done;
+ else if (STRNEQ(command, p->command, command_length))
+ {
+ abbreviated_matches++;
+ abbreviated_match = p;
+ }
+
+ /* no perfect match; is there a non-ambigous abbreviated match? */
+ if ( ! abbreviated_match)
+ {
+ printf("Unrecognized command '%s'; try 'help'\n", command);
+ goto failed;
+ }
+
+ if (abbreviated_matches > 1)
+ {
+ printf("Command '%s' is ambiguous; try 'help'\n", command);
+ goto failed;
+ }
+
+ p = abbreviated_match;
+
+done:
+ if (p->command_function == 0)
+ goto failed;
+ return p;
+
+failed:
+ return 0;
+}
+
+void
+rtems_monitor_command_usage(rtems_monitor_command_entry_t *table,
+ char *command_string)
+{
+ rtems_monitor_command_entry_t *help = 0;
+ char *help_command_argv[2];
+
+ /* if first entry in table is a usage, then print it out */
+ if (command_string == 0)
+ {
+ if (STREQ(table->command, "--usage--") && table->usage)
+ help = table;
+ }
+ else
+ {
+ help_command_argv[0] = command_string;
+ help_command_argv[1] = 0;
+ help = rtems_monitor_command_lookup(table, 1, help_command_argv);
+ }
+
+ if (help)
+ printf("%s\n", help->usage);
+}
+
+
+void
+rtems_monitor_help_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_command_entry_t *command;
+
+ command = (rtems_monitor_command_entry_t *) command_arg;
+
+ if (argc == 1)
+ rtems_monitor_command_usage(command, 0);
+ else
+ {
+ for (arg=1; argv[arg]; arg++)
+ rtems_monitor_command_usage(command, argv[arg]);
+ }
+}
diff --git a/c/src/lib/libmisc/monitor/mon-config.c b/c/src/lib/libmisc/monitor/mon-config.c
new file mode 100644
index 0000000000..f5c9f6f093
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-config.c
@@ -0,0 +1,130 @@
+/*
+ * RTEMS Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_config_canonical(
+ rtems_monitor_config_t *canonical_config,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = (rtems_configuration_table *) config_void;
+
+ canonical_config->work_space_start = c->work_space_start;
+ canonical_config->work_space_size = c->work_space_size;
+ canonical_config->maximum_tasks = c->maximum_tasks;
+ canonical_config->maximum_timers = c->maximum_timers;
+ canonical_config->maximum_semaphores = c->maximum_semaphores;
+ canonical_config->maximum_message_queues = c->maximum_message_queues;
+ canonical_config->maximum_partitions = c->maximum_partitions;
+ canonical_config->maximum_regions = c->maximum_regions;
+ canonical_config->maximum_ports = c->maximum_ports;
+ canonical_config->maximum_periods = c->maximum_periods;
+ canonical_config->maximum_extensions = c->maximum_extensions;
+ canonical_config->microseconds_per_tick = c->microseconds_per_tick;
+ canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
+ canonical_config->number_of_initialization_tasks = c->number_of_initialization_tasks;
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_config_next(
+ void *object_info,
+ rtems_monitor_config_t *canonical_config,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_config_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+INITIAL (startup) Configuration Info\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_config_dump(
+ rtems_monitor_config_t *monitor_config,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length = 0;
+ length += printf("WORKSPACE");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("start: 0x%x; size: 0x%x\n",
+ (unsigned32) monitor_config->work_space_start,
+ monitor_config->work_space_size);
+
+ length = 0;
+ length += printf("TIME");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n",
+ monitor_config->microseconds_per_tick,
+ monitor_config->ticks_per_timeslice,
+ 1000000 / monitor_config->microseconds_per_tick);
+
+ length = 0;
+ length += printf("MAXIMUMS");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n",
+ monitor_config->maximum_tasks,
+ monitor_config->maximum_timers,
+ monitor_config->maximum_semaphores,
+ monitor_config->maximum_message_queues,
+ monitor_config->maximum_extensions);
+ length = 0;
+ length += rtems_monitor_pad(CONTCOL, length);
+ length += printf("partitions: %d; regions: %d; ports: %d; periods: %d\n",
+ monitor_config->maximum_partitions,
+ monitor_config->maximum_regions,
+ monitor_config->maximum_ports,
+ monitor_config->maximum_periods);
+}
diff --git a/c/src/lib/libmisc/monitor/mon-dname.c b/c/src/lib/libmisc/monitor/mon-dname.c
new file mode 100644
index 0000000000..e6993e18f7
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-dname.c
@@ -0,0 +1,112 @@
+/*
+ * RTEMS monitor driver names support.
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'dname' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+#include <string.h> /* strncpy() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+void
+rtems_monitor_dname_canonical(
+ rtems_monitor_dname_t *canonical_dname,
+ void *dname_void
+)
+{
+ rtems_driver_name_t *np = (rtems_driver_name_t *) dname_void;
+
+ (void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
+ canonical_dname->major = np->major;
+ canonical_dname->minor = np->minor;
+}
+
+void *
+rtems_monitor_dname_next(
+ void *object_information,
+ rtems_monitor_dname_t *canonical_dname,
+ rtems_id *next_id
+)
+{
+ int n = rtems_get_index(*next_id);
+ rtems_driver_name_t *table = _IO_Driver_name_table;
+ rtems_driver_name_t *np = 0;
+
+/* XXX should we be using _IO_Number_of_devices */
+ for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
+ if (np->device_name)
+ goto done;
+
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+
+done:
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_dname->id = n;
+ canonical_dname->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return np;
+}
+
+void
+rtems_monitor_dname_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major:Minor Name\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_dname_dump(
+ rtems_monitor_dname_t *monitor_dname,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(6, length);
+ length += rtems_monitor_dump_hex(monitor_dname->major);
+ length += printf(":");
+ length += rtems_monitor_dump_hex(monitor_dname->minor);
+
+ length += rtems_monitor_pad(16, length);
+ length += printf("%.*s",
+ (int) sizeof(monitor_dname->name_string),
+ (char *) monitor_dname->name_string);
+
+ length += printf("\n");
+ length = 0;
+}
diff --git a/c/src/lib/libmisc/monitor/mon-driver.c b/c/src/lib/libmisc/monitor/mon-driver.c
new file mode 100644
index 0000000000..d5cff24a19
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-driver.c
@@ -0,0 +1,136 @@
+/*
+ * RTEMS monitor IO (device drivers) support
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'name' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+
+void
+rtems_monitor_driver_canonical(
+ rtems_monitor_driver_t *canonical_driver,
+ void *driver_void
+)
+{
+ rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
+ d->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
+ d->open);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
+ d->close);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
+ d->read);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
+ d->write);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
+ d->control);
+}
+
+
+void *
+rtems_monitor_driver_next(
+ void *object_info,
+ rtems_monitor_driver_t *canonical_driver,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_device_drivers)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_driver->id = n;
+ canonical_driver->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return (void *) (c->Device_driver_table + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_driver_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major Entry points\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_driver_dump(
+ rtems_monitor_driver_t *monitor_driver,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += printf(" %d", monitor_driver->id);
+
+ length += rtems_monitor_pad(13, length);
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
+ length += printf("; control: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("open: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
+ length += printf("; close: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("read: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
+ length += printf("; write: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
+ length += printf("\n");
+ length = 0;
+}
diff --git a/c/src/lib/libmisc/monitor/mon-extension.c b/c/src/lib/libmisc/monitor/mon-extension.c
new file mode 100644
index 0000000000..4afecaa617
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-extension.c
@@ -0,0 +1,98 @@
+/*
+ * RTEMS Monitor extension support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_extension_canonical(
+ rtems_monitor_extension_t *canonical_extension,
+ void *extension_void
+)
+{
+ Extension_Control *rtems_extension = (Extension_Control *) extension_void;
+ rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
+ e->thread_create);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_start,
+ e->thread_start);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_restart,
+ e->thread_restart);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_delete,
+ e->thread_delete);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_tswitch,
+ e->thread_switch);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_begin,
+ e->thread_begin);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_exitted,
+ e->thread_exitted);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_fatal,
+ e->fatal);
+}
+
+void
+rtems_monitor_extension_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the canonical form
+ */
+
+void
+rtems_monitor_extension_dump(
+ rtems_monitor_extension_t *monitor_extension,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_extension->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_extension->name);
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("create: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
+ length += printf("; start: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
+ length += printf("; restart: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("delete: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
+ length += printf("; switch: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
+ length += printf("; begin: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("exitted: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
+ length += printf("; fatal: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
+ length += printf("\n");
+ length = 0;
+ printf("\n");
+}
diff --git a/c/src/lib/libmisc/monitor/mon-itask.c b/c/src/lib/libmisc/monitor/mon-itask.c
new file mode 100644
index 0000000000..5ce4b55270
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-itask.c
@@ -0,0 +1,115 @@
+/*
+ * RTEMS Monitor init task support
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+/*
+ * As above, but just for init tasks
+ */
+void
+rtems_monitor_init_task_canonical(
+ rtems_monitor_init_task_t *canonical_itask,
+ void *itask_void
+)
+{
+ rtems_initialization_tasks_table *rtems_itask = itask_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
+ rtems_itask->entry_point);
+
+ canonical_itask->argument = rtems_itask->argument;
+ canonical_itask->stack_size = rtems_itask->stack_size;
+ canonical_itask->priority = rtems_itask->initial_priority;
+ canonical_itask->modes = rtems_itask->mode_set;
+ canonical_itask->attributes = rtems_itask->attribute_set;
+}
+
+void *
+rtems_monitor_init_task_next(
+ void *object_info,
+ rtems_monitor_init_task_t *canonical_init_task,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_initialization_tasks_table *itask;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_initialization_tasks)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ itask = c->User_initialization_tasks_table + n;
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_init_task->id = n;
+ canonical_init_task->name = itask->name;
+
+ *next_id += 1;
+ return (void *) itask;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_init_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ # NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_init_task_dump(
+ rtems_monitor_init_task_t *monitor_itask,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_decimal(monitor_itask->id);
+
+ length += rtems_monitor_pad(7, length);
+ length += rtems_monitor_dump_name(monitor_itask->name);
+
+ length += rtems_monitor_pad(14, length);
+ length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
+
+ length += rtems_monitor_pad(25, length);
+ length += printf("%d [0x%x]", monitor_itask->argument, monitor_itask->argument);
+
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_priority(monitor_itask->priority);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_modes(monitor_itask->modes);
+
+ length += rtems_monitor_pad(54, length);
+ length += rtems_monitor_dump_attributes(monitor_itask->attributes);
+
+ length += rtems_monitor_pad(66, length);
+ length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);
+
+ printf("\n");
+}
diff --git a/c/src/lib/libmisc/monitor/mon-manager.c b/c/src/lib/libmisc/monitor/mon-manager.c
new file mode 100644
index 0000000000..af8d530d3b
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-manager.c
@@ -0,0 +1,50 @@
+/*
+ * RTEMS Monitor "manager" support.
+ * Used to traverse object (chain) lists and print them out.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+#include <monitor.h>
+
+/*
+ * "next" routine for all objects that are RTEMS manager objects
+ */
+
+void *
+rtems_monitor_manager_next(
+ void *table_void,
+ void *canonical,
+ rtems_id *next_id
+)
+{
+ Objects_Information *table = table_void;
+ rtems_monitor_generic_t *copy;
+ Objects_Control *object = 0;
+ unsigned32 location;
+
+ /*
+ * When we are called, it must be local
+ */
+
+ if ( ! _Objects_Is_local_id(*next_id))
+ goto done;
+
+ object = _Objects_Get_next(table, *next_id, &location, next_id);
+
+ if (object)
+ {
+ copy = (rtems_monitor_generic_t *) canonical;
+ copy->id = object->id;
+ _Objects_Copy_name_raw(object->name, &copy->name, sizeof(copy->name));
+ }
+
+done:
+ return object;
+}
+
diff --git a/c/src/lib/libmisc/monitor/mon-monitor.c b/c/src/lib/libmisc/monitor/mon-monitor.c
new file mode 100644
index 0000000000..a5a3fab131
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-monitor.c
@@ -0,0 +1,517 @@
+/*
+ * RTEMS monitor main body
+ *
+ * TODO:
+ * add stuff to RTEMS api
+ * rtems_get_name(id)
+ * rtems_get_type(id)
+ * rtems_build_id(node, type, num)
+ * Add a command to dump out info about an arbitrary id when
+ * types are added to id's
+ * rtems> id idnum
+ * idnum: node n, object: whatever, id: whatever
+ * allow id's to be specified as n:t:id, where 'n:t' is optional
+ * should have a separate monitor FILE stream (ala the debugger)
+ * remote request/response stuff should be cleaned up
+ * maybe we can use real rpc??
+ * 'info' command to print out:
+ * interrupt stack location, direction and size
+ * floating point config stuff
+ * interrupt config stuff
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/* set by trap handler */
+extern rtems_tcb *debugger_interrupted_task;
+extern rtems_context *debugger_interrupted_task_context;
+extern rtems_unsigned32 debugger_trap;
+
+/*
+ * Various id's for the monitor
+ * They need to be public variables for access by other agencies
+ * such as debugger and remote servers'
+ */
+
+rtems_id rtems_monitor_task_id;
+
+unsigned32 rtems_monitor_node; /* our node number */
+unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * The rtems symbol table
+ */
+
+rtems_symbol_table_t *rtems_monitor_symbols;
+
+/*
+ * The top-level commands
+ */
+
+rtems_monitor_command_entry_t rtems_monitor_commands[] = {
+ { "--usage--",
+ "\n"
+ "RTEMS monitor\n"
+ "\n"
+ "Commands (may be abbreviated)\n"
+ "\n"
+ " help -- get this message or command specific help\n"
+ " pause -- pause monitor for a specified number of ticks\n"
+ " exit -- invoke a fatal RTEMS error\n"
+ " symbol -- show entries from symbol table\n"
+ " continue -- put monitor to sleep waiting for explicit wakeup\n"
+ " config -- show system configuration\n"
+ " itask -- list init tasks\n"
+ " mpci -- list mpci config\n"
+ " task -- show task information\n"
+ " queue -- show message queue information\n"
+ " extension -- user extensions\n"
+ " driver -- show information about named drivers\n"
+ " dname -- show information about named drivers\n"
+ " object -- generic object information\n"
+ " node -- specify default node for commands that take id's\n"
+#ifdef CPU_INVOKE_DEBUGGER
+ " debugger -- invoke system debugger\n"
+#endif
+ ,
+ 0,
+ 0,
+ (unsigned32) rtems_monitor_commands,
+ },
+ { "config",
+ "config\n"
+ " Show the system configuration.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ },
+ { "itask",
+ "itask\n"
+ " List init tasks for the system\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ },
+ { "mpci",
+ "mpci\n"
+ " Show the MPCI system configuration, if configured.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ },
+ { "pause",
+ "pause [ticks]\n"
+ " monitor goes to \"sleep\" for specified ticks (default is 1)\n"
+ " monitor will resume at end of period or if explicitly awakened\n",
+ 0,
+ rtems_monitor_pause_cmd,
+ 0,
+ },
+ { "continue",
+ "continue\n"
+ " put the monitor to sleep waiting for an explicit wakeup from the\n"
+ " program running.\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "go",
+ "go\n"
+ " Alias for 'continue'\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "node",
+ "node [ node number ]\n"
+ " Specify default node number for commands that take id's\n",
+ 0,
+ rtems_monitor_node_cmd,
+ 0,
+ },
+ { "symbol",
+ "symbol [ symbolname [symbolname ... ] ]\n"
+ " display value associated with specified symbol.\n"
+ " Defaults to displaying all known symbols.\n",
+ 0,
+ rtems_monitor_symbol_cmd,
+ (unsigned32) &rtems_monitor_symbols,
+ },
+ { "extension",
+ "extension [id [id ...] ]\n"
+ " display information about specified extensions.\n"
+ " Default is to display information about all extensions on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_EXTENSION,
+ },
+ { "task",
+ "task [id [id ...] ]\n"
+ " display information about the specified tasks.\n"
+ " Default is to display information about all tasks on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_TASK,
+ },
+ { "queue",
+ "queue [id [id ... ] ]\n"
+ " display information about the specified message queues\n"
+ " Default is to display information about all queues on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_QUEUE,
+ },
+ { "object",
+ "object [id [id ...] ]\n"
+ " display information about specified RTEMS objects.\n"
+ " Object id's must include 'type' information.\n"
+ " (which may normally be defaulted)\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INVALID,
+ },
+ { "driver",
+ "driver [ major [ major ... ] ]\n"
+ " Display the RTEMS device driver table.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DRIVER,
+ },
+ { "dname",
+ "dname\n"
+ " Displays information about named drivers.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ },
+ { "exit",
+ "exit [status]\n"
+ " Invoke 'rtems_fatal_error_occurred' with 'status'\n"
+ " (default is RTEMS_SUCCESSFUL)\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL,
+ },
+ { "fatal",
+ "fatal [status]\n"
+ " 'exit' with fatal error; default error is RTEMS_TASK_EXITTED\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_TASK_EXITTED, /* exit value */
+ },
+ { "quit",
+ "quit [status]\n"
+ " Alias for 'exit'\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL, /* exit value */
+ },
+ { "help",
+ "help [ command [ command ] ]\n"
+ " provide information about commands\n"
+ " Default is show basic command summary.\n",
+ 0,
+ rtems_monitor_help_cmd,
+ (unsigned32) rtems_monitor_commands,
+ },
+#ifdef CPU_INVOKE_DEBUGGER
+ { "debugger",
+ "debugger\n"
+ " Enter the debugger, if possible.\n"
+ " A continue from the debugger will return to the monitor.\n",
+ 0,
+ rtems_monitor_debugger_cmd,
+ 0,
+ },
+#endif
+ { 0, 0, 0, 0, 0 },
+};
+
+
+rtems_status_code
+rtems_monitor_suspend(rtems_interval timeout)
+{
+ rtems_event_set event_set;
+ rtems_status_code status;
+
+ status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &event_set);
+ return status;
+}
+
+void
+rtems_monitor_wakeup(void)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT);
+}
+
+void
+rtems_monitor_debugger_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+#ifdef CPU_INVOKE_DEBUGGER
+ CPU_INVOKE_DEBUGGER;
+#endif
+}
+
+void
+rtems_monitor_pause_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_monitor_suspend(1);
+ else
+ rtems_monitor_suspend(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_fatal_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_fatal_error_occurred(command_arg);
+ else
+ rtems_fatal_error_occurred(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_continue_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+}
+
+void
+rtems_monitor_node_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ unsigned32 new_node = rtems_monitor_default_node;
+
+ switch (argc)
+ {
+ case 1: /* no node, just set back to ours */
+ new_node = rtems_monitor_node;
+ break;
+
+ case 2:
+ new_node = strtoul(argv[1], 0, 0);
+ break;
+
+ default:
+ printf("invalid syntax, try 'help node'\n");
+ break;
+ }
+
+ if ((new_node >= 1) &&
+ _Configuration_MP_table &&
+ (new_node <= _Configuration_MP_table->maximum_nodes))
+ rtems_monitor_default_node = new_node;
+}
+
+
+/*
+ * Function: rtems_monitor_symbols_loadup
+ *
+ * Description:
+ * Create and load the monitor's symbol table.
+ * We are reading the output format of 'gnm' which looks like this:
+ *
+ * 400a7068 ? _Rate_monotonic_Information
+ * 400a708c ? _Thread_Dispatch_disable_level
+ * 400a7090 ? _Configuration_Table
+ *
+ * We ignore the type field.
+ *
+ * Side Effects:
+ * Creates and fills in 'rtems_monitor_symbols' table
+ *
+ * TODO
+ * there should be a BSP #define or something like that
+ * to do this; Assuming stdio is crazy.
+ * Someday this should know BFD
+ * Maybe we could get objcopy to just copy the symbol areas
+ * and copy that down.
+ *
+ */
+
+void
+rtems_monitor_symbols_loadup(void)
+{
+ FILE *fp;
+ char buffer[128];
+
+ if (rtems_monitor_symbols)
+ rtems_symbol_table_destroy(rtems_monitor_symbols);
+
+ rtems_monitor_symbols = rtems_symbol_table_create(10);
+ if (rtems_monitor_symbols == 0)
+ return;
+
+ fp = fopen("symbols", "r");
+
+ if (fp == 0)
+ return;
+
+ while (fgets(buffer, sizeof(buffer) - 1, fp))
+ {
+ char *symbol;
+ char *value;
+ char *ignored_type;
+
+ value = strtok(buffer, " \t\n");
+ ignored_type = strtok(0, " \t\n");
+ symbol = strtok(0, " \t\n");
+
+ if (symbol && ignored_type && value)
+ {
+ rtems_symbol_t *sp;
+ sp = rtems_symbol_create(rtems_monitor_symbols,
+ symbol,
+ (rtems_unsigned32) strtoul(value, 0, 16));
+ if (sp == 0)
+ {
+ printf("could not define symbol '%s'\n", symbol);
+ goto done;
+ }
+ }
+ else
+ {
+ printf("parsing error on '%s'\n", buffer);
+ goto done;
+ }
+ }
+
+done:
+}
+
+
+/*
+ * Main monitor command loop
+ */
+
+void
+rtems_monitor_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_tcb *debugee = 0;
+ rtems_context *rp;
+ rtems_context_fp *fp;
+ char command_buffer[513];
+ int argc;
+ char *argv[64];
+ boolean verbose = FALSE;
+
+ if (monitor_flags & RTEMS_MONITOR_SUSPEND)
+ (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+
+ for (;;)
+ {
+ extern rtems_tcb * _Thread_Executing;
+ rtems_monitor_command_entry_t *command;
+
+ debugee = _Thread_Executing;
+ rp = &debugee->Registers;
+ fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */
+
+ if (0 == rtems_monitor_command_read(command_buffer, &argc, argv))
+ continue;
+ if ((command = rtems_monitor_command_lookup(rtems_monitor_commands,
+ argc,
+ argv)) == 0)
+ continue;
+
+ command->command_function(argc, argv, command->command_arg, verbose);
+
+ fflush(stdout);
+ }
+}
+
+
+void
+rtems_monitor_kill(void)
+{
+ if (rtems_monitor_task_id)
+ rtems_task_delete(rtems_monitor_task_id);
+ rtems_monitor_task_id = 0;
+
+ rtems_monitor_server_kill();
+}
+
+void
+rtems_monitor_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ rtems_monitor_kill();
+
+ status = rtems_task_create(RTEMS_MONITOR_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor task");
+ goto done;
+ }
+
+ rtems_monitor_node = rtems_get_node(rtems_monitor_task_id);
+ rtems_monitor_default_node = rtems_monitor_node;
+
+ rtems_monitor_symbols_loadup();
+
+ if (monitor_flags & RTEMS_MONITOR_GLOBAL)
+ rtems_monitor_server_init(monitor_flags);
+
+ /*
+ * Start the monitor task itself
+ */
+
+ status = rtems_task_start(rtems_monitor_task_id,
+ rtems_monitor_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor");
+ goto done;
+ }
+
+done:
+}
diff --git a/c/src/lib/libmisc/monitor/mon-mpci.c b/c/src/lib/libmisc/monitor/mon-mpci.c
new file mode 100644
index 0000000000..5c4d2c2cb3
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-mpci.c
@@ -0,0 +1,159 @@
+/*
+ * RTEMS MPCI Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_mpci_canonical(
+ rtems_monitor_mpci_t *canonical_mpci,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_multiprocessing_table *m;
+ rtems_mpci_table *mt;
+
+ m = c->User_multiprocessing_table;
+ if (m == 0)
+ return;
+ mt = m->User_mpci_table;
+
+ canonical_mpci->node = m->node;
+ canonical_mpci->maximum_nodes = m->maximum_nodes;
+ canonical_mpci->maximum_global_objects = m->maximum_global_objects;
+ canonical_mpci->maximum_proxies = m->maximum_proxies;
+
+ canonical_mpci->default_timeout = mt->default_timeout;
+ canonical_mpci->maximum_packet_size = mt->maximum_packet_size;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->initialization,
+ mt->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->get_packet,
+ mt->get_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->return_packet,
+ mt->return_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->send_packet,
+ mt->send_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet,
+ mt->receive_packet);
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_mpci_next(
+ void *object_info,
+ rtems_monitor_mpci_t *canonical_mpci,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ if ( ! c->User_multiprocessing_table)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_mpci_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ max max max default max\n\
+ node nodes globals proxies timeout pktsize\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_mpci_dump(
+ rtems_monitor_mpci_t *monitor_mpci,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(2, length);
+ length += printf(" %d", monitor_mpci->node);
+ length += rtems_monitor_pad(11, length);
+ length += printf("%d", monitor_mpci->maximum_nodes);
+
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
+
+ length += rtems_monitor_pad(28, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies);
+
+ length += rtems_monitor_pad(37, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->default_timeout);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("get: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose);
+ length += printf("; return: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("send: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose);
+ length += printf("; receive: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose);
+
+ printf("\n");
+ length = 0;
+}
diff --git a/c/src/lib/libmisc/monitor/mon-object.c b/c/src/lib/libmisc/monitor/mon-object.c
new file mode 100644
index 0000000000..0dfc6513d2
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-object.c
@@ -0,0 +1,374 @@
+/*
+ * RTEMS Monitor "object" support.
+ *
+ * Used to traverse object lists and print them out.
+ * An object can be an RTEMS object (chain based stuff) or
+ * a "misc" object such as a device driver.
+ *
+ * Each object has its own file in this directory (eg: extension.c)
+ * That file provides routines to convert a "native" structure
+ * to its canonical form, print a canonical structure, etc.
+ *
+ * TODO:
+ * should allow for non-numeric id's???
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#include <monitor.h>
+
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * add:
+ * next
+ */
+
+rtems_monitor_object_info_t rtems_monitor_object_info[] =
+{
+ { RTEMS_MONITOR_OBJECT_CONFIG,
+ (void *) 0,
+ sizeof(rtems_monitor_config_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_config_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_config_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_config_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_config_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_MPCI,
+ (void *) 0,
+ sizeof(rtems_monitor_mpci_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_mpci_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_mpci_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_mpci_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_mpci_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_INIT_TASK,
+ (void *) 0,
+ sizeof(rtems_monitor_init_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_init_task_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_init_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_init_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_init_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_TASK,
+ (void *) &_RTEMS_tasks_Information,
+ sizeof(rtems_monitor_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_QUEUE,
+ (void *) &_Message_queue_Information,
+ sizeof(rtems_monitor_queue_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_queue_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_queue_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_queue_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_EXTENSION,
+ (void *) &_Extension_Information,
+ sizeof(rtems_monitor_extension_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_extension_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_extension_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_extension_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DRIVER,
+ (void *) 0,
+ sizeof(rtems_monitor_driver_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_driver_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_driver_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_driver_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_driver_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DNAME,
+ /* XXX now that the driver name table is allocated from the */
+ /* XXX Workspace, this does not work */
+ (void *) 0,
+ /* (void *) _IO_Driver_name_table, */
+ sizeof(rtems_monitor_dname_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_dname_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_dname_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_dname_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_dname_dump,
+ },
+};
+
+/*
+ * Allow id's to be specified without the node number or
+ * type for convenience.
+ */
+
+rtems_id
+rtems_monitor_id_fixup(
+ rtems_id id,
+ unsigned32 default_node,
+ rtems_monitor_object_type_t type
+)
+{
+ unsigned32 node;
+
+ node = rtems_get_node(id);
+ if (node == 0)
+ {
+ if (rtems_get_class(id) != OBJECTS_NO_CLASS)
+ type = rtems_get_class(id);
+
+ id = _Objects_Build_id(type, default_node, rtems_get_index(id));
+ }
+ return id;
+}
+
+
+rtems_monitor_object_info_t *
+rtems_monitor_object_lookup(
+ rtems_monitor_object_type_t type
+)
+{
+ rtems_monitor_object_info_t *p;
+ for (p = &rtems_monitor_object_info[0];
+ p < &rtems_monitor_object_info[NUMELEMS(rtems_monitor_object_info)];
+ p++)
+ {
+ if (p->type == type)
+ return p;
+ }
+ return 0;
+}
+
+rtems_id
+rtems_monitor_object_canonical_next_remote(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ rtems_status_code status;
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+
+ /*
+ * Send request
+ */
+
+ request.command = RTEMS_MONITOR_SERVER_CANONICAL;
+ request.argument0 = (unsigned32) type;
+ request.argument1 = (unsigned32) id;
+
+ status = rtems_monitor_server_request(rtems_get_node(id), &request, &response);
+ if (status != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ /*
+ * process response
+ */
+
+ next_id = (rtems_id) response.result0;
+ if (next_id != RTEMS_OBJECT_ID_FINAL)
+ (void) memcpy(canonical, &response.payload, response.result1);
+
+ return next_id;
+
+failed:
+ return RTEMS_OBJECT_ID_FINAL;
+
+}
+
+
+rtems_id
+rtems_monitor_object_canonical_next(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ void *raw_item;
+
+ if ( ! _Objects_Is_local_id(id))
+ next_id = rtems_monitor_object_canonical_next_remote(info->type,
+ id,
+ canonical);
+ else
+ {
+ next_id = id;
+
+ raw_item = (void *) info->next(info->object_information,
+ canonical,
+ &next_id);
+
+ if (raw_item)
+ {
+ info->canonical(canonical, raw_item);
+ _Thread_Enable_dispatch();
+ }
+ }
+ return next_id;
+}
+
+
+/*
+ * this is routine server invokes locally to get the type
+ */
+
+rtems_id
+rtems_monitor_object_canonical_get(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical,
+ unsigned32 *size_p
+)
+{
+ rtems_monitor_object_info_t *info;
+ rtems_id next_id;
+
+ *size_p = 0;
+
+ info = rtems_monitor_object_lookup(type);
+
+ if (info == 0)
+ return RTEMS_OBJECT_ID_FINAL;
+
+ next_id = rtems_monitor_object_canonical_next(info, id, canonical);
+ *size_p = info->size;
+
+ return next_id;
+}
+
+
+void
+rtems_monitor_object_dump_1(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ if ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ /*
+ * If the one we actually got is the one we wanted, then
+ * print it out.
+ * For ones that have an id field, this works fine,
+ * for all others, always dump it out.
+ *
+ * HACK: the way we determine whether there is an id is a hack.
+ *
+ * by the way: the reason we try to not have an id, is that some
+ * of the canonical structures are almost too big for shared
+ * memory driver (eg: mpci)
+ */
+
+ if ((info->next != rtems_monitor_manager_next) ||
+ (id == canonical.generic.id))
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_dump_all(
+ rtems_monitor_object_info_t *info,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ next_id = RTEMS_OBJECT_ID_INITIAL(info->type, rtems_monitor_default_node);
+
+ while ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ next_id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_object_info_t *info = 0;
+ rtems_monitor_object_type_t type = (rtems_monitor_object_type_t) command_arg;
+
+ /* what is the default type? */
+ type = (rtems_monitor_object_type_t) command_arg;
+
+ if (argc == 1)
+ {
+ if (type == RTEMS_MONITOR_OBJECT_INVALID)
+ {
+ printf("A type must be specified to \"dump all\"\n");
+ goto done;
+ }
+
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ rtems_monitor_object_dump_all(info, verbose);
+ }
+ else
+ {
+ unsigned32 default_node = rtems_monitor_default_node;
+ rtems_monitor_object_type_t last_type = RTEMS_MONITOR_OBJECT_INVALID;
+ rtems_id id;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ id = (rtems_id) strtoul(argv[arg], 0, 16);
+ id = rtems_monitor_id_fixup(id, default_node, type);
+ type = (rtems_monitor_object_type_t) rtems_get_class(id);
+
+ /*
+ * Allow the item type to change in the middle
+ * of the command. If the type changes, then
+ * just dump out a new header and keep on going.
+ */
+ if (type != last_type)
+ {
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ }
+
+ if (info == 0)
+ {
+not_found: printf("Invalid or unsupported type %d\n", type);
+ goto done;
+ }
+
+ rtems_monitor_object_dump_1(info, id, verbose);
+
+ default_node = rtems_get_node(id);
+
+ last_type = type;
+ }
+ }
+done:
+}
diff --git a/c/src/lib/libmisc/monitor/mon-prmisc.c b/c/src/lib/libmisc/monitor/mon-prmisc.c
new file mode 100644
index 0000000000..030bd020da
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-prmisc.c
@@ -0,0 +1,254 @@
+/*
+ * Print misc stuff for the monitor dump routines
+ * Each routine returns the number of characters it output.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <ctype.h>
+
+void
+rtems_monitor_separator(void)
+{
+ printf("------------------------------------------------------------------------------\n");
+}
+
+unsigned32
+rtems_monitor_pad(
+ unsigned32 destination_column,
+ unsigned32 current_column
+)
+{
+ int pad_length;
+
+ if (destination_column <= current_column)
+ pad_length = 1;
+ else
+ pad_length = destination_column - current_column;
+
+ return printf("%*s", pad_length, "");
+}
+
+unsigned32
+rtems_monitor_dump_char(rtems_unsigned8 ch)
+{
+ if (isprint(ch))
+ return printf("%c", ch);
+ else
+ return printf("%02x", ch);
+}
+
+unsigned32
+rtems_monitor_dump_decimal(unsigned32 num)
+{
+ return printf("%4d", num);
+}
+
+unsigned32
+rtems_monitor_dump_hex(unsigned32 num)
+{
+ return printf("0x%x", num);
+}
+
+unsigned32
+rtems_monitor_dump_assoc_bitfield(
+ rtems_assoc_t *ap,
+ char *separator,
+ unsigned32 value
+ )
+{
+ unsigned32 b;
+ unsigned32 length = 0;
+ const char *name;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (length)
+ length += printf("%s", separator);
+
+ name = rtems_assoc_name_by_local(ap, b);
+
+ if (name)
+ length += printf("%s", name);
+ else
+ length += printf("0x%x", b);
+ }
+
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_id(rtems_id id)
+{
+ return printf("%08x", id);
+}
+
+unsigned32
+rtems_monitor_dump_name(rtems_name name)
+{
+ int i;
+ unsigned32 length = 0;
+ union {
+ unsigned32 ui;
+ char c[4];
+ } u;
+
+ u.ui = (rtems_unsigned32) name;
+
+ for (i=0; i<sizeof(u.c); i++)
+ length += rtems_monitor_dump_char(u.c[i]);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_priority(rtems_task_priority priority)
+{
+ return printf("%3d", priority);
+}
+
+
+rtems_assoc_t rtems_monitor_state_assoc[] = {
+ { "DORM", STATES_DORMANT },
+ { "SUSP", STATES_SUSPENDED },
+ { "TRANS", STATES_TRANSIENT },
+ { "DELAY", STATES_DELAYING },
+ { "Wbuf", STATES_WAITING_FOR_BUFFER },
+ { "Wseg", STATES_WAITING_FOR_SEGMENT },
+ { "Wmsg" , STATES_WAITING_FOR_MESSAGE },
+ { "Wevnt", STATES_WAITING_FOR_EVENT },
+ { "Wsem", STATES_WAITING_FOR_SEMAPHORE },
+ { "Wtime", STATES_WAITING_FOR_TIME },
+ { "Wrpc", STATES_WAITING_FOR_RPC_REPLY },
+ { "WRATE", STATES_WAITING_FOR_PERIOD },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_state(States_Control state)
+{
+ unsigned32 length = 0;
+
+ if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */
+ length += printf("READY");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
+ ":",
+ state);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_attribute_assoc[] = {
+ { "FL", RTEMS_FLOATING_POINT },
+ { "GL", RTEMS_GLOBAL },
+ { "PR", RTEMS_PRIORITY },
+ { "BI", RTEMS_BINARY_SEMAPHORE },
+ { "IN", RTEMS_INHERIT_PRIORITY },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_attributes(rtems_attribute attributes)
+{
+ unsigned32 length = 0;
+
+ if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */
+ length += printf("DEFAULT");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
+ ":",
+ attributes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_modes_assoc[] = {
+ { "nP", RTEMS_NO_PREEMPT },
+ { "T", RTEMS_TIMESLICE },
+ { "nA", RTEMS_NO_ASR },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_modes(rtems_mode modes)
+{
+ unsigned32 length = 0;
+
+ if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */
+ length += printf("P:T:nA");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
+ ":",
+ modes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_events_assoc[] = {
+ { "0", RTEMS_EVENT_0 },
+ { "1", RTEMS_EVENT_1 },
+ { "2", RTEMS_EVENT_2 },
+ { "3", RTEMS_EVENT_3 },
+ { "4", RTEMS_EVENT_4 },
+ { "5", RTEMS_EVENT_5 },
+ { "6", RTEMS_EVENT_6 },
+ { "7", RTEMS_EVENT_7 },
+ { "8", RTEMS_EVENT_8 },
+ { "9", RTEMS_EVENT_9 },
+ { "10", RTEMS_EVENT_10 },
+ { "11", RTEMS_EVENT_11 },
+ { "12", RTEMS_EVENT_12 },
+ { "13", RTEMS_EVENT_13 },
+ { "14", RTEMS_EVENT_14 },
+ { "15", RTEMS_EVENT_15 },
+ { "16", RTEMS_EVENT_16 },
+ { "17", RTEMS_EVENT_17 },
+ { "18", RTEMS_EVENT_18 },
+ { "19", RTEMS_EVENT_19 },
+ { "20", RTEMS_EVENT_20 },
+ { "21", RTEMS_EVENT_21 },
+ { "22", RTEMS_EVENT_22 },
+ { "23", RTEMS_EVENT_23 },
+ { "24", RTEMS_EVENT_24 },
+ { "25", RTEMS_EVENT_25 },
+ { "26", RTEMS_EVENT_26 },
+ { "27", RTEMS_EVENT_27 },
+ { "28", RTEMS_EVENT_28 },
+ { "29", RTEMS_EVENT_29 },
+ { "30", RTEMS_EVENT_30 },
+ { "31", RTEMS_EVENT_31 },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_events(rtems_event_set events)
+{
+ unsigned32 length = 0;
+
+ if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */
+ length += printf("NONE");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
+ ":",
+ events);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_notepad(unsigned32 *notepad)
+{
+ unsigned32 length = 0;
+ int i;
+
+ for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++)
+ if (notepad[i])
+ length += printf("%d: 0x%x ", i, notepad[i]);
+
+ return length;
+}
diff --git a/c/src/lib/libmisc/monitor/mon-queue.c b/c/src/lib/libmisc/monitor/mon-queue.c
new file mode 100644
index 0000000000..08c1d9474e
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-queue.c
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_queue_canonical(
+ rtems_monitor_queue_t *canonical_queue,
+ void *queue_void
+)
+{
+ Message_queue_Control *rtems_queue = (Message_queue_Control *) queue_void;
+
+ canonical_queue->attributes = rtems_queue->attribute_set;
+ canonical_queue->maximum_message_size = rtems_queue->message_queue.maximum_message_size;
+ canonical_queue->maximum_pending_messages = rtems_queue->message_queue.maximum_pending_messages;
+ canonical_queue->number_of_pending_messages = rtems_queue->message_queue.number_of_pending_messages;
+}
+
+void
+rtems_monitor_queue_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME ATTRIBUTES PEND MAXPEND MAXSIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the "next" queue indicated by 'id'.
+ * Returns next one to check.
+ * Returns RTEMS_OBJECT_ID_FINAL when all done
+ */
+
+void
+rtems_monitor_queue_dump(
+ rtems_monitor_queue_t *monitor_queue,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_queue->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_queue->name);
+ length += rtems_monitor_pad(19, length);
+ length += rtems_monitor_dump_attributes(monitor_queue->attributes);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->number_of_pending_messages);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_pending_messages);
+ length += rtems_monitor_pad(48, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size);
+
+ printf("\n");
+}
diff --git a/c/src/lib/libmisc/monitor/mon-server.c b/c/src/lib/libmisc/monitor/mon-server.c
new file mode 100644
index 0000000000..cc26718c27
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-server.c
@@ -0,0 +1,302 @@
+/*
+ * RTEMS monitor server (handles requests for info from RTEMS monitors
+ * running on other nodes)
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/*
+ * Various id's for the server
+ */
+
+rtems_id rtems_monitor_server_task_id;
+rtems_id rtems_monitor_server_request_queue_id; /* our server */
+rtems_id *rtems_monitor_server_request_queue_ids; /* all servers */
+rtems_id rtems_monitor_server_response_queue_id; /* our server */
+
+
+/*
+ * Send a request to a server task
+ */
+
+rtems_status_code
+rtems_monitor_server_request(
+ unsigned32 server_node,
+ rtems_monitor_server_request_t *request,
+ rtems_monitor_server_response_t *response
+)
+{
+ rtems_id server_id;
+ rtems_status_code status;
+ unsigned32 size;
+
+ /*
+ * What is id of monitor on target node?
+ * Look it up if we don't know it yet.
+ */
+
+ server_id = rtems_monitor_server_request_queue_ids[server_node];
+ if (server_id == 0)
+ {
+ status = rtems_message_queue_ident(RTEMS_MONITOR_QUEUE_NAME,
+ server_node,
+ &server_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "ident of remote server failed");
+ goto done;
+ }
+
+ rtems_monitor_server_request_queue_ids[server_node] = server_id;
+ }
+
+ request->return_id = rtems_monitor_server_response_queue_id;
+
+ status = rtems_message_queue_send(server_id, request, sizeof(*request));
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server request send failed");
+ goto done;
+ }
+
+ /*
+ * Await response, if requested
+ */
+
+ if (response)
+ {
+ status = rtems_message_queue_receive(rtems_monitor_server_response_queue_id,
+ response,
+ &size,
+ RTEMS_WAIT,
+ 100);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "server did not respond");
+
+ /* maybe server task was restarted; look it up again next time */
+ rtems_monitor_server_request_queue_ids[server_node] = 0;
+
+ goto done;
+ }
+
+ if (response->command != RTEMS_MONITOR_SERVER_RESPONSE)
+ {
+ status = RTEMS_INCORRECT_STATE;
+ goto done;
+ }
+ }
+
+done:
+ return status;
+}
+
+
+
+/*
+ * monitor server task
+ */
+
+void
+rtems_monitor_server_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+ rtems_status_code status;
+ unsigned32 size;
+
+ for (;;)
+ {
+ status = rtems_message_queue_receive(
+ rtems_monitor_server_request_queue_id,
+ &request,
+ &size,
+ RTEMS_WAIT,
+ (rtems_interval) 0);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server msg queue receive error");
+ goto failed;
+ }
+
+ if (size != sizeof(request))
+ {
+ rtems_error(0, "monitor server bad size on receive");
+ goto failed;
+ }
+
+ switch (request.command)
+ {
+ case RTEMS_MONITOR_SERVER_CANONICAL:
+ {
+ rtems_monitor_object_type_t object_type;
+ rtems_id id;
+ rtems_id next_id;
+
+ object_type = (rtems_monitor_object_type_t) request.argument0;
+ id = (rtems_id) request.argument1;
+ next_id = rtems_monitor_object_canonical_get(object_type,
+ id,
+ &response.payload,
+ &size);
+
+ response.command = RTEMS_MONITOR_SERVER_RESPONSE;
+ response.result0 = next_id;
+ response.result1 = size;
+
+#define SERVER_OVERHEAD (RTEMS_offsetof(rtems_monitor_server_response_t, \
+ payload))
+
+ status = rtems_message_queue_send(request.return_id,
+ &response,
+ size + SERVER_OVERHEAD);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "response send failed");
+ goto failed;
+ }
+ break;
+ }
+
+ default:
+ {
+ rtems_error(0, "invalid command to monitor server: %d", request.command);
+ goto failed;
+ }
+ }
+ }
+
+failed:
+ rtems_task_delete(RTEMS_SELF);
+}
+
+
+/*
+ * Kill off any old server
+ * Not sure if this is useful, but it doesn't help
+ */
+
+void
+rtems_monitor_server_kill(void)
+{
+ if (rtems_monitor_server_task_id)
+ rtems_task_delete(rtems_monitor_server_task_id);
+ rtems_monitor_task_id = 0;
+
+ if (rtems_monitor_server_request_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_request_queue_id);
+ rtems_monitor_server_response_queue_id = 0;
+
+ if (rtems_monitor_server_response_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_response_queue_id);
+ rtems_monitor_server_request_queue_ids = 0;
+
+ if (rtems_monitor_server_request_queue_ids)
+ free(rtems_monitor_server_request_queue_ids);
+ rtems_monitor_server_request_queue_ids = 0;
+}
+
+
+void
+rtems_monitor_server_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ if (_System_state_Is_multiprocessing &&
+ (_Configuration_MP_table->maximum_nodes > 1))
+ {
+ unsigned32 maximum_nodes = _Configuration_MP_table->maximum_nodes;
+
+ /*
+ * create the msg que our server will listen
+ * Since we only get msgs from other RTEMS monitors, we just
+ * need reserve space for 1 msg from each node.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_QUEUE_NAME,
+ maximum_nodes,
+ sizeof(rtems_monitor_server_request_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_request_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server message queue");
+ goto done;
+ }
+
+ /*
+ * create the msg que our responses will come on
+ * Since monitor just does one thing at a time, we only need 1 item
+ * message queue.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_RESPONSE_QUEUE_NAME,
+ 1, /* depth */
+ sizeof(rtems_monitor_server_response_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_response_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor response message queue");
+ goto done;
+ }
+
+ /* need an id for queue of each other server we might talk to */
+ /* indexed by node, so add 1 to maximum_nodes */
+ rtems_monitor_server_request_queue_ids =
+ (rtems_id *) malloc((maximum_nodes + 1) * sizeof(rtems_id));
+ (void) memset(rtems_monitor_server_request_queue_ids,
+ 0,
+ (maximum_nodes + 1) * sizeof(rtems_id));
+
+ rtems_monitor_server_request_queue_ids[rtems_monitor_node] =
+ rtems_monitor_server_request_queue_id;
+
+ /*
+ * create the server task
+ */
+ status = rtems_task_create(RTEMS_MONITOR_SERVER_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_server_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server task");
+ goto done;
+ }
+
+ /*
+ * Start the server task
+ */
+ status = rtems_task_start(rtems_monitor_server_task_id,
+ rtems_monitor_server_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor server");
+ goto done;
+ }
+ }
+
+done:
+}
diff --git a/c/src/lib/libmisc/monitor/mon-symbols.c b/c/src/lib/libmisc/monitor/mon-symbols.c
new file mode 100644
index 0000000000..6c6589d38f
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-symbols.c
@@ -0,0 +1,481 @@
+/*
+ * File: symbols.c
+ *
+ * Description:
+ * Symbol table manager for the RTEMS monitor.
+ * These routines may be used by other system resources also.
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "monitor.h"
+#include "symbols.h"
+
+
+rtems_symbol_table_t *
+rtems_symbol_table_create()
+{
+ rtems_symbol_table_t *table;
+
+ table = (rtems_symbol_table_t *) malloc(sizeof(rtems_symbol_table_t));
+ memset((void *) table, 0, sizeof(*table));
+
+ table->growth_factor = 30; /* 30 percent */
+
+ return table;
+}
+
+void
+rtems_symbol_table_destroy(rtems_symbol_table_t *table)
+{
+ rtems_symbol_string_block_t *p, *pnext;
+
+ if (table)
+ {
+ if (table->addresses)
+ (void) free(table->addresses);
+ table->addresses = 0;
+ p = table->string_buffer_head;
+ while (p)
+ {
+ pnext = p->next;
+ free(p);
+ p = pnext;
+ }
+ table->string_buffer_head = 0;
+ table->string_buffer_current = 0;
+
+ free(table);
+ }
+}
+
+rtems_symbol_t *
+rtems_symbol_create(
+ rtems_symbol_table_t *table,
+ char *name,
+ rtems_unsigned32 value
+ )
+{
+ int symbol_length;
+ size_t newsize;
+ rtems_symbol_t *sp;
+
+ symbol_length = strlen(name) + 1; /* include '\000' in length */
+
+ /* need to grow the table? */
+ if (table->next >= table->size)
+ {
+ if (table->size == 0)
+ newsize = 100;
+ else
+ newsize = table->size + (table->size / (100 / table->growth_factor));
+
+ table->addresses = (rtems_symbol_t *) realloc((void *) table->addresses, newsize * sizeof(rtems_symbol_t));
+ if (table->addresses == 0) /* blew it; lost orig */
+ goto failed;
+ table->size = newsize;
+ }
+
+ sp = &table->addresses[table->next];
+ sp->value = value;
+
+ /* Have to add it to string pool */
+ /* need to grow pool? */
+
+ if ((table->string_buffer_head == 0) ||
+ (table->strings_next + symbol_length) >= SYMBOL_STRING_BLOCK_SIZE)
+ {
+ rtems_symbol_string_block_t *p;
+
+ p = (rtems_symbol_string_block_t *) malloc(sizeof(rtems_symbol_string_block_t));
+ if (p == 0)
+ goto failed;
+ p->next = 0;
+ if (table->string_buffer_head == 0)
+ table->string_buffer_head = p;
+ else
+ table->string_buffer_current->next = p;
+ table->string_buffer_current = p;
+
+ table->strings_next = 0;
+ }
+
+ sp->name = table->string_buffer_current->buffer + table->strings_next;
+ (void) strcpy(sp->name, name);
+
+ table->strings_next += symbol_length;
+ table->sorted = 0;
+ table->next++;
+
+ return sp;
+
+/* XXX Not sure what to do here. We've possibly destroyed the initial
+ symbol table due to realloc failure */
+failed:
+ return 0;
+}
+
+/*
+ * Qsort entry point for compare by address
+ */
+
+static int
+rtems_symbol_compare(const void *e1,
+ const void *e2)
+{
+ rtems_symbol_t *s1, *s2;
+ s1 = (rtems_symbol_t *) e1;
+ s2 = (rtems_symbol_t *) e2;
+
+ if (s1->value < s2->value)
+ return -1;
+ if (s1->value > s2->value)
+ return 1;
+ return 0;
+}
+
+
+/*
+ * Sort the symbol table using qsort
+ */
+
+static void
+rtems_symbol_sort(rtems_symbol_table_t *table)
+{
+ qsort((void *) table->addresses, (size_t) table->next,
+ sizeof(rtems_symbol_t), rtems_symbol_compare);
+ table->sorted = 1;
+}
+
+
+/*
+ * Search the symbol table by address
+ * This code based on CYGNUS newlib bsearch, but changed
+ * to allow for finding closest symbol <= key
+ */
+
+rtems_symbol_t *
+rtems_symbol_value_lookup(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ rtems_symbol_t *sp;
+ rtems_symbol_t *base;
+ rtems_symbol_t *best = 0;
+ rtems_unsigned32 distance;
+ rtems_unsigned32 best_distance = ~0;
+ rtems_unsigned32 elements;
+
+ if (table == 0)
+ table = rtems_monitor_symbols;
+
+ if ((table == 0) || (table->size == 0))
+ return 0;
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ base = table->addresses;
+ elements = table->next;
+
+ while (elements)
+ {
+ sp = base + (elements / 2);
+ if (value < sp->value)
+ elements /= 2;
+ else if (value > sp->value)
+ {
+ distance = value - sp->value;
+ if (distance < best_distance)
+ {
+ best_distance = distance;
+ best = sp;
+ }
+ base = sp + 1;
+ elements = (elements / 2) - (elements % 2 ? 0 : 1);
+ }
+ else
+ return sp;
+ }
+
+ if (value == base->value)
+ return base;
+
+ return best;
+}
+
+/*
+ * Search the symbol table for the exact matching address.
+ * If the symbol table has already been sorted, then
+ * call the regular symbol value lookup, however, it it
+ * has not yet been sorted, search it sequentially.
+ * This routine is primarily used for low level symbol
+ * lookups (eg. from exception handler and interrupt routines)
+ * where the penality of sorted is not wanted and where
+ * an exact match is needed such that symbol table order
+ * is not important.
+ */
+const rtems_symbol_t *
+rtems_symbol_value_lookup_exact(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ if (table->sorted)
+ {
+ sp = rtems_symbol_value_lookup(table, value);
+ if ( rtems_symbol_value(sp) == value )
+ return sp;
+ else
+ return NULL; /* not an exact match */
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( sp->value == value )
+ return sp;
+ }
+
+ return NULL;
+
+}
+
+
+/*
+ * Search the symbol table by string name (case independent)
+ */
+
+rtems_symbol_t *
+rtems_symbol_name_lookup(
+ rtems_symbol_table_t *table,
+ char *name
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( strcasecmp(sp->name, name) == 0 )
+ return sp;
+ }
+
+ return NULL;
+}
+
+void *
+rtems_monitor_symbol_next(
+ void *object_info,
+ rtems_monitor_symbol_t *canonical,
+ rtems_id *next_id
+)
+{
+ rtems_symbol_table_t *table;
+ int n = rtems_get_index(*next_id);
+
+ table = *(rtems_symbol_table_t **) object_info;
+ if (table == 0)
+ goto failed;
+
+ if (n >= table->next)
+ goto failed;
+
+ /* NOTE: symbols do not have id and name fields */
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) (table->addresses + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+void
+rtems_monitor_symbol_canonical(
+ rtems_monitor_symbol_t *canonical_symbol,
+ rtems_symbol_t *sp
+)
+{
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = 0;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+}
+
+
+void
+rtems_monitor_symbol_canonical_by_name(
+ rtems_monitor_symbol_t *canonical_symbol,
+ char *name
+)
+{
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_name_lookup(0, name);
+
+ canonical_symbol->value = sp ? sp->value : 0;
+
+ strncpy(canonical_symbol->name, name, sizeof(canonical_symbol->name));
+ canonical_symbol->offset = 0;
+}
+
+void
+rtems_monitor_symbol_canonical_by_value(
+ rtems_monitor_symbol_t *canonical_symbol,
+ void *value_void_p
+)
+{
+ unsigned32 value = (unsigned32) value_void_p;
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_value_lookup(0, value);
+ if (sp)
+ {
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = value - sp->value;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+ }
+ else
+ {
+ canonical_symbol->value = value;
+ canonical_symbol->offset = 0;
+ canonical_symbol->name[0] = '\0';
+ }
+}
+
+
+unsigned32
+rtems_monitor_symbol_dump(
+ rtems_monitor_symbol_t *canonical_symbol,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ /*
+ * print the name if it exists AND if value is non-zero
+ * Ie: don't print some garbage symbol for address 0
+ */
+
+ if (canonical_symbol->name[0] && (canonical_symbol->value != 0))
+ {
+ if (canonical_symbol->offset == 0)
+ length += printf("%.*s",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name);
+ else
+ length += printf("<%.*s+0x%x>",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name,
+ canonical_symbol->offset);
+ if (verbose)
+ length += printf(" [0x%x]", canonical_symbol->value);
+ }
+ else
+ length += printf("[0x%x]", canonical_symbol->value);
+
+ return length;
+}
+
+
+void
+rtems_monitor_symbol_dump_all(
+ rtems_symbol_table_t *table,
+ boolean verbose
+)
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ rtems_monitor_symbol_canonical(&canonical_symbol, sp);
+ rtems_monitor_symbol_dump(&canonical_symbol, TRUE);
+ printf("\n");
+ }
+}
+
+
+/*
+ * 'symbol' command
+ */
+
+void
+rtems_monitor_symbol_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_symbol_table_t *table;
+
+ table = *(rtems_symbol_table_t **) command_arg;
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ /*
+ * Use object command to dump out whole symbol table
+ */
+ if (argc == 1)
+ rtems_monitor_symbol_dump_all(table, verbose);
+ else
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]);
+ rtems_monitor_symbol_dump(&canonical_symbol, verbose);
+ printf("\n");
+ }
+ }
+}
diff --git a/c/src/lib/libmisc/monitor/mon-task.c b/c/src/lib/libmisc/monitor/mon-task.c
new file mode 100644
index 0000000000..b1a7938eb5
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/mon-task.c
@@ -0,0 +1,92 @@
+/*
+ * RTEMS Monitor task support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_task_canonical(
+ rtems_monitor_task_t *canonical_task,
+ void *thread_void
+)
+{
+ Thread_Control *rtems_thread = (Thread_Control *) thread_void;
+ RTEMS_API_Control *api;
+
+ api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ canonical_task->entry = rtems_thread->Start.entry_point;
+ canonical_task->argument = rtems_thread->Start.numeric_argument;
+ canonical_task->stack = rtems_thread->Start.Initial_stack.area;
+ canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
+ canonical_task->priority = rtems_thread->current_priority;
+ canonical_task->state = rtems_thread->current_state;
+ canonical_task->wait_id = rtems_thread->Wait.id;
+ canonical_task->events = api->pending_events;
+
+/* XXX modes and attributes only exist in the RTEMS API .. */
+/* XXX not directly in the core thread.. they will have to be derived */
+/* XXX if they are important enough to include anymore. */
+ canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
+ canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
+ (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
+/* XXX more to fix */
+/*
+ (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
+*/
+}
+
+
+void
+rtems_monitor_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_task_dump(
+ rtems_monitor_task_t *monitor_task,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_id(monitor_task->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_task->name);
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_priority(monitor_task->priority);
+ length += rtems_monitor_pad(24, length);
+ length += rtems_monitor_dump_state(monitor_task->state);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_modes(monitor_task->modes);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_events(monitor_task->events);
+ if (monitor_task->wait_id)
+ {
+ length += rtems_monitor_pad(47, length);
+ length += rtems_monitor_dump_id(monitor_task->wait_id);
+ length += rtems_monitor_pad(57, length);
+ length += rtems_monitor_dump_hex(monitor_task->wait_args);
+ }
+
+ length += rtems_monitor_pad(65, length);
+ length += rtems_monitor_dump_notepad(monitor_task->notepad);
+ printf("\n");
+}
+
diff --git a/c/src/lib/libmisc/monitor/monitor.h b/c/src/lib/libmisc/monitor/monitor.h
new file mode 100644
index 0000000000..8a86b2c7d0
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/monitor.h
@@ -0,0 +1,443 @@
+/*
+ * File: monitor.h
+ *
+ * Description:
+ * The RTEMS monitor task include file.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef __MONITOR_H
+#define __MONITOR_H
+
+#include "symbols.h"
+#include <rtems/error.h> /* rtems_error() */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Monitor types are derived from rtems object classes
+ */
+
+typedef enum {
+ RTEMS_MONITOR_OBJECT_INVALID = OBJECTS_NO_CLASS,
+ RTEMS_MONITOR_OBJECT_TASK = OBJECTS_RTEMS_TASKS,
+ RTEMS_MONITOR_OBJECT_EXTENSION = OBJECTS_RTEMS_EXTENSIONS,
+ RTEMS_MONITOR_OBJECT_QUEUE = OBJECTS_RTEMS_MESSAGE_QUEUES,
+ RTEMS_MONITOR_OBJECT_SEMAPHORE = OBJECTS_RTEMS_SEMAPHORES,
+ RTEMS_MONITOR_OBJECT_PARTITION = OBJECTS_RTEMS_PARTITIONS,
+ RTEMS_MONITOR_OBJECT_REGION = OBJECTS_RTEMS_REGIONS,
+ RTEMS_MONITOR_OBJECT_PORT = OBJECTS_RTEMS_PORTS,
+
+ /* following monitor objects are not known to RTEMS, but
+ * we like to have "types" for them anyway */
+
+ RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_CLASSES_LAST+1,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ RTEMS_MONITOR_OBJECT_SYMBOL,
+} rtems_monitor_object_type_t;
+
+/*
+ * rtems_monitor_init() flags
+ */
+
+#define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */
+#define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */
+
+
+/*
+ * Public interfaces for RTEMS data structures monitor is aware of.
+ * These are only used by the monitor.
+ *
+ * NOTE:
+ * All the canonical objects that correspond to RTEMS managed "objects"
+ * must have an identical first portion with 'id' and 'name' fields.
+ *
+ * Others do not have that restriction, even tho we would like them to.
+ * This is because some of the canonical structures are almost too big
+ * for shared memory driver (eg: mpci) and we are nickel and diming it.
+ */
+
+/*
+ * Type of a pointer that may be a symbol
+ */
+
+#define MONITOR_SYMBOL_LEN 20
+typedef struct {
+ char name[MONITOR_SYMBOL_LEN];
+ unsigned32 value;
+ unsigned32 offset;
+} rtems_monitor_symbol_t;
+
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+} rtems_monitor_generic_t;
+
+/*
+ * Task
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ Thread_Entry entry;
+ unsigned32 argument;
+ void *stack;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ States_Control state;
+ rtems_event_set events;
+ rtems_mode modes;
+ rtems_attribute attributes;
+ unsigned32 notepad[RTEMS_NUMBER_NOTEPADS];
+ rtems_id wait_id;
+ unsigned32 wait_args;
+} rtems_monitor_task_t;
+
+/*
+ * Init task
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id */
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t entry;
+ unsigned32 argument;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ rtems_mode modes;
+ rtems_attribute attributes;
+} rtems_monitor_init_task_t;
+
+
+/*
+ * Message queue
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_attribute attributes;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_pending_messages;
+ unsigned32 maximum_message_size;
+} rtems_monitor_queue_t;
+
+/*
+ * Extension
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t e_create;
+ rtems_monitor_symbol_t e_start;
+ rtems_monitor_symbol_t e_restart;
+ rtems_monitor_symbol_t e_delete;
+ rtems_monitor_symbol_t e_tswitch;
+ rtems_monitor_symbol_t e_begin;
+ rtems_monitor_symbol_t e_exitted;
+ rtems_monitor_symbol_t e_fatal;
+} rtems_monitor_extension_t;
+
+/*
+ * Device driver
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id (should be tho) */
+ rtems_name name; /* ditto */
+ /* end of common portion */
+ rtems_monitor_symbol_t initialization; /* initialization procedure */
+ rtems_monitor_symbol_t open; /* open request procedure */
+ rtems_monitor_symbol_t close; /* close request procedure */
+ rtems_monitor_symbol_t read; /* read request procedure */
+ rtems_monitor_symbol_t write; /* write request procedure */
+ rtems_monitor_symbol_t control; /* special functions procedure */
+} rtems_monitor_driver_t;
+
+typedef struct {
+ rtems_id id; /* not used for drivers (yet) */
+ rtems_name name; /* not used for drivers (yet) */
+ /* end of common portion */
+ unsigned32 major;
+ unsigned32 minor;
+ char name_string[64];
+} rtems_monitor_dname_t;
+
+/*
+ * System config
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+} rtems_monitor_config_t;
+
+/*
+ * MPCI config
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ rtems_monitor_symbol_t initialization;
+ rtems_monitor_symbol_t get_packet;
+ rtems_monitor_symbol_t return_packet;
+ rtems_monitor_symbol_t send_packet;
+ rtems_monitor_symbol_t receive_packet;
+} rtems_monitor_mpci_t;
+
+/*
+ * The generic canonical information union
+ */
+
+typedef union {
+ rtems_monitor_generic_t generic;
+ rtems_monitor_task_t task;
+ rtems_monitor_queue_t queue;
+ rtems_monitor_extension_t extension;
+ rtems_monitor_driver_t driver;
+ rtems_monitor_dname_t dname;
+ rtems_monitor_config_t config;
+ rtems_monitor_mpci_t mpci;
+ rtems_monitor_init_task_t itask;
+} rtems_monitor_union_t;
+
+/*
+ * Support for talking to other monitors
+ */
+
+/*
+ * Names of other monitors
+ */
+
+#define RTEMS_MONITOR_NAME (rtems_build_name('R', 'M', 'O', 'N'))
+#define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V'))
+#define RTEMS_MONITOR_QUEUE_NAME (rtems_build_name('R', 'M', 'S', 'Q'))
+#define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q'))
+
+#define RTEMS_MONITOR_SERVER_RESPONSE 0x0001
+#define RTEMS_MONITOR_SERVER_CANONICAL 0x0002
+
+typedef struct
+{
+ unsigned32 command;
+ rtems_id return_id;
+ unsigned32 argument0;
+ unsigned32 argument1;
+ unsigned32 argument2;
+ unsigned32 argument3;
+ unsigned32 argument4;
+ unsigned32 argument5;
+} rtems_monitor_server_request_t;
+
+typedef struct
+{
+ unsigned32 command;
+ unsigned32 result0;
+ unsigned32 result1;
+ rtems_monitor_union_t payload;
+} rtems_monitor_server_response_t;
+
+extern rtems_id rtems_monitor_task_id;
+
+extern unsigned32 rtems_monitor_node; /* our node number */
+extern unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * Monitor command function and table entry
+ */
+
+typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t;
+
+typedef void ( *rtems_monitor_command_function_t )(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+ );
+
+struct rtems_monitor_command_entry_s {
+ char *command; /* command name */
+ char *usage; /* usage string for the command */
+ unsigned32 arguments_required; /* # of required args */
+ rtems_monitor_command_function_t command_function;
+
+ /* Some argument for the command */
+ unsigned32 command_arg;
+};
+
+typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
+typedef void (*rtems_monitor_object_canonical_fn)(void *, void *);
+typedef void (*rtems_monitor_object_dump_header_fn)(boolean);
+typedef void (*rtems_monitor_object_dump_fn)(void *, boolean);
+
+typedef struct {
+ rtems_monitor_object_type_t type;
+ void *object_information;
+ int size; /* of canonical object */
+ rtems_monitor_object_next_fn next;
+ rtems_monitor_object_canonical_fn canonical;
+ rtems_monitor_object_dump_header_fn dump_header;
+ rtems_monitor_object_dump_fn dump;
+} rtems_monitor_object_info_t;
+
+
+/* monitor.c */
+void rtems_monitor_kill(void);
+void rtems_monitor_init(rtems_boolean);
+void rtems_monitor_wakeup(void);
+void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_debugger_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_node_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_symbols_loadup(void);
+void rtems_monitor_task(rtems_task_argument);
+
+/* server.c */
+void rtems_monitor_server_kill(void);
+rtems_status_code rtems_monitor_server_request(unsigned32, rtems_monitor_server_request_t *, rtems_monitor_server_response_t *);
+void rtems_monitor_server_task(rtems_task_argument);
+void rtems_monitor_server_init(unsigned32);
+
+/* command.c */
+int rtems_monitor_make_argv(char *, int *, char **);
+int rtems_monitor_command_read(char *, int *, char **);
+rtems_monitor_command_entry_t *rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t * table, int argc, char **argv);
+void rtems_monitor_command_usage(rtems_monitor_command_entry_t *, char *);
+void rtems_monitor_help_cmd(int, char **, unsigned32, boolean);
+
+/* prmisc.c */
+void rtems_monitor_separator(void);
+unsigned32 rtems_monitor_pad(unsigned32 dest_col, unsigned32 curr_col);
+unsigned32 rtems_monitor_dump_char(unsigned8 ch);
+unsigned32 rtems_monitor_dump_decimal(unsigned32 num);
+unsigned32 rtems_monitor_dump_hex(unsigned32 num);
+unsigned32 rtems_monitor_dump_id(rtems_id id);
+unsigned32 rtems_monitor_dump_name(rtems_name name);
+unsigned32 rtems_monitor_dump_priority(rtems_task_priority priority);
+unsigned32 rtems_monitor_dump_state(States_Control state);
+unsigned32 rtems_monitor_dump_modes(rtems_mode modes);
+unsigned32 rtems_monitor_dump_attributes(rtems_attribute attributes);
+unsigned32 rtems_monitor_dump_events(rtems_event_set events);
+unsigned32 rtems_monitor_dump_notepad(unsigned32 *notepad);
+
+/* object.c */
+rtems_id rtems_monitor_id_fixup(rtems_id, unsigned32, rtems_monitor_object_type_t);
+rtems_id rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, unsigned32 *size_p);
+rtems_id rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *);
+void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
+rtems_id rtems_monitor_object_canonical(rtems_id, void *);
+void rtems_monitor_object_cmd(int, char **, unsigned32, boolean);
+
+/* manager.c */
+void *rtems_monitor_manager_next(void *, void *, rtems_id *);
+
+/* config.c */
+void rtems_monitor_config_canonical(rtems_monitor_config_t *, void *);
+void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
+void rtems_monitor_config_dump_header(boolean);
+void rtems_monitor_config_dump(rtems_monitor_config_t *, boolean verbose);
+
+/* mpci.c */
+void rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *);
+void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
+void rtems_monitor_mpci_dump_header(boolean);
+void rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, boolean verbose);
+
+/* itask.c */
+void rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *);
+void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
+void rtems_monitor_init_task_dump_header(boolean);
+void rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, boolean verbose);
+
+/* extension.c */
+void rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *);
+void rtems_monitor_extension_dump_header(boolean verbose);
+void rtems_monitor_extension_dump(rtems_monitor_extension_t *, boolean);
+
+/* task.c */
+void rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
+void rtems_monitor_task_dump_header(boolean verbose);
+void rtems_monitor_task_dump(rtems_monitor_task_t *, boolean);
+
+/* queue.c */
+void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
+void rtems_monitor_queue_dump_header(boolean verbose);
+void rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean);
+
+/* driver.c */
+void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
+void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);
+void rtems_monitor_driver_dump_header(boolean);
+void rtems_monitor_driver_dump(rtems_monitor_driver_t *, boolean);
+
+/* dname.c */
+void *rtems_monitor_dname_next(void *, rtems_monitor_dname_t *, rtems_id *);
+void rtems_monitor_dname_canonical(rtems_monitor_dname_t *, void *);
+void rtems_monitor_dname_dump_header(boolean);
+void rtems_monitor_dname_dump(rtems_monitor_dname_t *, boolean);
+
+/* symbols.c */
+rtems_symbol_table_t *rtems_symbol_table_create();
+void rtems_symbol_table_destroy(rtems_symbol_table_t *table);
+
+rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, unsigned32);
+rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, unsigned32);
+const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, unsigned32);
+rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *);
+void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
+void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *);
+void rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, char *);
+void rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *);
+unsigned32 rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, boolean);
+void rtems_monitor_symbol_cmd(int, char **, unsigned32, boolean);
+
+
+extern rtems_symbol_table_t *rtems_monitor_symbols;
+
+#ifndef MONITOR_PROMPT
+#define MONITOR_PROMPT "rtems" /* will have '> ' appended */
+#endif
+
+#define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0
+
+
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define STRNEQ(a,b,n) (strncmp(a,b,n) == 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __MONITOR_H */
diff --git a/c/src/lib/libmisc/monitor/symbols.h b/c/src/lib/libmisc/monitor/symbols.h
new file mode 100644
index 0000000000..061ccdd952
--- /dev/null
+++ b/c/src/lib/libmisc/monitor/symbols.h
@@ -0,0 +1,64 @@
+/*
+ * RTEMS monitor symbol table functions
+ *
+ * Description:
+ * Entry points for symbol table routines.
+ *
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_SYMBOLS_H
+#define _INCLUDE_SYMBOLS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ rtems_unsigned32 value;
+ char *name;
+} rtems_symbol_t;
+
+#define SYMBOL_STRING_BLOCK_SIZE 4080
+typedef struct rtems_symbol_string_block_s {
+ struct rtems_symbol_string_block_s *next;
+ char buffer[SYMBOL_STRING_BLOCK_SIZE];
+} rtems_symbol_string_block_t;
+
+typedef struct {
+
+ rtems_unsigned32 sorted; /* are symbols sorted right now? */
+
+ rtems_unsigned32 growth_factor; /* % to grow by when needed */
+
+ rtems_unsigned32 next; /* next symbol slot to use when adding */
+ rtems_unsigned32 size; /* max # of symbols */
+
+ /*
+ * Symbol list -- sorted by address (when we do a lookup)
+ */
+
+ rtems_symbol_t *addresses; /* symbol array by address */
+
+ /*
+ * String pool, unsorted, a list of blocks of string data
+ */
+
+ rtems_symbol_string_block_t *string_buffer_head;
+ rtems_symbol_string_block_t *string_buffer_current;
+ rtems_unsigned32 strings_next; /* next byte to use in this block */
+
+} rtems_symbol_table_t;
+
+#define rtems_symbol_name(sp) ((sp)->name)
+#define rtems_symbol_value(sp) ((sp)->value)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_SYMBOLS_H */
diff --git a/c/src/lib/libmisc/stackchk/README b/c/src/lib/libmisc/stackchk/README
new file mode 100644
index 0000000000..20e76f07bc
--- /dev/null
+++ b/c/src/lib/libmisc/stackchk/README
@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+
+This directory contains a stack bounds checker. It provides two
+primary features:
+
+ + check for stack overflow at each context switch
+ + provides an educated guess at each task's stack usage
+
+The stack overflow check at context switch works by looking for
+a 16 byte pattern at the logical end of the stack to be corrupted.
+The "guesser" assumes that the entire stack was prefilled with a known
+pattern and assumes that the pattern is still in place if the memory
+has not been used as a stack.
+
+Both of these can be fooled by pushing large holes onto the stack
+and not writing to them... or (much more unlikely) writing the
+magic patterns into memory.
+
+This code has not been extensively tested. It is provided as a tool
+for RTEMS users to catch the most common mistake in multitasking
+systems ... too little stack space. Suggestions and comments are appreciated.
+
+NOTES:
+
+1. Stack usage information is questionable on CPUs which push
+ large holes on stack.
+
+2. The stack checker has a tendency to generate a fault when
+ trying to print the helpful diagnostic message. If it comes
+ out, congratulations. If not, then the variable Stack_check_Blown_task
+ contains a pointer to the TCB of the offending task. This
+ is usually enough to go on.
+
+FUTURE:
+
+1. Determine how/if gcc will generate stack probe calls and support that.
+
+2. Get accurate stack usage numbers on i960.. it pushes very large
+ holes on the stack.
diff --git a/c/src/lib/libmisc/stackchk/check.c b/c/src/lib/libmisc/stackchk/check.c
new file mode 100644
index 0000000000..3d06d1dd12
--- /dev/null
+++ b/c/src/lib/libmisc/stackchk/check.c
@@ -0,0 +1,512 @@
+/*
+ * Stack Overflow Check User Extension Set
+ *
+ * NOTE: This extension set automatically determines at
+ * initialization time whether the stack for this
+ * CPU grows up or down and installs the correct
+ * extension routines for that direction.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+
+/*
+ * HACK
+ * the stack dump information should be printed by a "fatal" extension.
+ * Fatal extensions only get called via rtems_fatal_error_occurred()
+ * and not when rtems_shutdown_executive() is called.
+ * I hope/think this is changing so that fatal extensions are renamed
+ * to "shutdown" extensions.
+ * When that happens, this #define should be deleted and all the code
+ * it marks.
+ */
+#define DONT_USE_FATAL_EXTENSION
+
+
+extern rtems_configuration_table BSP_Configuration;
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stackchk.h"
+#include "internal.h"
+
+/*
+ * This variable contains the name of the task which "blew" the stack.
+ * It is NULL if the system is all right.
+ */
+
+Thread_Control *Stack_check_Blown_task;
+
+/*
+ * The extension table for the stack checker.
+ */
+
+rtems_extensions_table Stack_check_Extension_table = {
+ Stack_check_Create_extension, /* rtems_task_create */
+ 0, /* rtems_task_start */
+ 0, /* rtems_task_restart */
+ 0, /* rtems_task_delete */
+ Stack_check_Switch_extension, /* task_switch */
+ Stack_check_Begin_extension, /* task_begin */
+ 0, /* task_exitted */
+#ifdef DONT_USE_FATAL_EXTENSION
+ 0, /* fatal */
+#else
+ Stack_check_Fatal_extension, /* fatal */
+#endif
+};
+
+/*
+ * The "magic pattern" used to mark the end of the stack.
+ */
+
+Stack_check_Control Stack_check_Pattern;
+
+/*
+ * Where the pattern goes in the stack area is dependent upon
+ * whether the stack grow to the high or low area of the memory.
+ *
+ */
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) \
+ ((_the_stack)->area + (_the_stack)->size - sizeof( Stack_check_Control ) ))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water ) \
+ ((_high_water) - (_low))
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area)
+
+#else
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) ((_the_stack)->area + HEAP_OVERHEAD))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water) \
+ ( ((_low) + (_size)) - (_high_water) )
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area + sizeof(Stack_check_Control))
+
+#endif
+
+#define Stack_check_usable_stack_size(_the_stack) \
+ ((_the_stack)->size - sizeof(Stack_check_Control))
+
+
+/*
+ * Do we have an interrupt stack?
+ * XXX it would sure be nice if the interrupt stack were also
+ * stored in a "stack" structure!
+ */
+
+
+Stack_Control stack_check_interrupt_stack;
+
+/*
+ * Prototypes necessary for forward references
+ */
+
+void Stack_check_Dump_usage( void );
+
+/*
+ * Fill an entire stack area with BYTE_PATTERN.
+ * This will be used by a Fatal extension to check for
+ * amount of actual stack used
+ */
+
+void
+stack_check_dope_stack(Stack_Control *stack)
+{
+ memset(stack->area, BYTE_PATTERN, stack->size);
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Initialize
+ */
+
+unsigned32 stack_check_initialized = 0;
+
+void Stack_check_Initialize( void )
+{
+ rtems_status_code status;
+ Objects_Id id_ignored;
+ unsigned32 *p;
+#if 0
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ Objects_Information *information;
+#endif
+
+ if (stack_check_initialized)
+ return;
+
+ /*
+ * Dope the pattern and fill areas
+ */
+
+ for ( p = Stack_check_Pattern.pattern;
+ p < &Stack_check_Pattern.pattern[PATTERN_SIZE_WORDS];
+ p += 4
+ )
+ {
+ p[0] = 0xFEEDF00D; /* FEED FOOD to BAD DOG */
+ p[1] = 0x0BAD0D06;
+ p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
+ p[3] = 0x600D0D06;
+ };
+
+ status = rtems_extension_create(
+ rtems_build_name( 'S', 'T', 'C', 'K' ),
+ &Stack_check_Extension_table,
+ &id_ignored
+ );
+ assert ( status == RTEMS_SUCCESSFUL );
+
+ Stack_check_Blown_task = 0;
+
+ /*
+ * If installed by a task, that task will not get setup properly
+ * since it missed out on the create hook. This will cause a
+ * failure on first switch out of that task.
+ * So pretend here that we actually ran create and begin extensions.
+ */
+
+ /* XXX
+ *
+ * Technically this has not been done for any task created before this
+ * happened. So just run through them and fix the situation.
+ */
+#if 0
+ if (_Thread_Executing)
+ {
+ Stack_check_Create_extension(_Thread_Executing, _Thread_Executing);
+ }
+#endif
+
+#if 0
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Create_extension( the_thread, the_thread );
+ }
+ }
+ }
+#endif
+
+ /*
+ * If appropriate, setup the interrupt stack for high water testing
+ * also.
+ */
+ if (_CPU_Interrupt_stack_low && _CPU_Interrupt_stack_high)
+ {
+ stack_check_interrupt_stack.area = _CPU_Interrupt_stack_low;
+ stack_check_interrupt_stack.size = _CPU_Interrupt_stack_high -
+ _CPU_Interrupt_stack_low;
+
+ stack_check_dope_stack(&stack_check_interrupt_stack);
+ }
+
+#ifdef DONT_USE_FATAL_EXTENSION
+#ifdef RTEMS_DEBUG
+ /*
+ * this would normally be called by a fatal extension
+ * handler, but we don't run fatal extensions unless
+ * we fatal error.
+ */
+ atexit(Stack_check_Dump_usage);
+#endif
+#endif
+
+ stack_check_initialized = 1;
+}
+
+/*PAGE
+ *
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+)
+{
+ if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
+ stack_check_dope_stack(&the_thread->Start.Initial_stack);
+
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+)
+{
+ Stack_check_Control *the_pattern;
+
+ if ( the_thread->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ the_pattern = Stack_check_Get_pattern_area(&the_thread->Start.Initial_stack);
+
+ *the_pattern = Stack_check_Pattern;
+}
+
+/*PAGE
+ *
+ * Stack_check_report_blown_task
+ * Report a blown stack. Needs to be a separate routine
+ * so that interrupt handlers can use this too.
+ *
+ * Caller must have set the Stack_check_Blown_task.
+ *
+ * NOTE: The system is in a questionable state... we may not get
+ * the following message out.
+ */
+
+void Stack_check_report_blown_task(void)
+{
+ Stack_Control *stack;
+ Thread_Control *running;
+
+ running = Stack_check_Blown_task;
+ stack = &running->Start.Initial_stack;
+
+ fprintf(
+ stderr,
+ "BLOWN STACK!!! Offending task(%p): id=0x%08x; name=0x%08x",
+ running,
+ running->Object.id,
+ *(unsigned32 *)running->Object.name
+ );
+ fflush(stderr);
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ fprintf(
+ stderr,
+ "; node=%d\n",
+ BSP_Configuration.User_multiprocessing_table->node
+ );
+ else
+ fprintf(stderr, "\n");
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " stack covers range 0x%08x - 0x%08x (%d bytes)\n",
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + stack->size - 1,
+ (unsigned32) stack->size);
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " Damaged pattern begins at 0x%08x and is %d bytes long\n",
+ (unsigned32) Stack_check_Get_pattern_area(stack), PATTERN_SIZE_BYTES);
+ fflush(stderr);
+
+ rtems_fatal_error_occurred( (unsigned32) "STACK BLOWN" );
+}
+
+/*PAGE
+ *
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+)
+{
+ if ( running->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ if (0 != memcmp( (void *) Stack_check_Get_pattern_area( &running->Start.Initial_stack)->pattern,
+ (void *) Stack_check_Pattern.pattern,
+ PATTERN_SIZE_BYTES))
+ {
+ Stack_check_Blown_task = running;
+ Stack_check_report_blown_task();
+ }
+}
+
+void *Stack_check_find_high_water_mark(
+ const void *s,
+ size_t n
+)
+{
+ const unsigned32 *base, *ebase;
+ unsigned32 length;
+
+ base = s;
+ length = n/4;
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+ /*
+ * start at higher memory and find first word that does not
+ * match pattern
+ */
+
+ base += length - 1;
+ for (ebase = s; base > ebase; base--)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#else
+ /*
+ * start at lower memory and find first word that does not
+ * match pattern
+ */
+
+ base += PATTERN_SIZE_WORDS;
+ for (ebase = base + length; base < ebase; base++)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#endif
+
+ return (void *)0;
+}
+
+/*PAGE
+ *
+ * Stack_check_Dump_threads_usage
+ * Try to print out how much stack was actually used by the task.
+ *
+ */
+
+void Stack_check_Dump_threads_usage(
+ Thread_Control *the_thread
+)
+{
+ unsigned32 size, used;
+ void *low;
+ void *high_water_mark;
+ Stack_Control *stack;
+
+ if ( !the_thread )
+ return;
+
+ /*
+ * XXX HACK to get to interrupt stack
+ */
+
+ if (the_thread == (Thread_Control *) -1)
+ {
+ if (stack_check_interrupt_stack.area)
+ {
+ stack = &stack_check_interrupt_stack;
+ the_thread = 0;
+ }
+ else
+ return;
+ }
+ else
+ stack = &the_thread->Start.Initial_stack;
+
+ low = Stack_check_usable_stack_start(stack);
+ size = Stack_check_usable_stack_size(stack);
+
+ high_water_mark = Stack_check_find_high_water_mark(low, size);
+
+ if ( high_water_mark )
+ used = Stack_check_Calculate_used( low, size, high_water_mark );
+ else
+ used = 0;
+
+ printf( "0x%08x 0x%08x 0x%08x 0x%08x %8d %8d\n",
+ the_thread ? the_thread->Object.id : ~0,
+ the_thread ? *(unsigned32 *)the_thread->Object.name :
+ rtems_build_name('I', 'N', 'T', 'R'),
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + (unsigned32) stack->size - 1,
+ size,
+ used
+ );
+}
+
+/*PAGE
+ *
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+)
+{
+#ifndef DONT_USE_FATAL_EXTENSION
+ if (status == 0)
+ Stack_check_Dump_usage();
+#endif
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void )
+{
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ unsigned32 hit_running = 0;
+ Objects_Information *information;
+
+ if (stack_check_initialized == 0)
+ return;
+
+ printf("Stack usage by thread\n");
+ printf(
+ " ID NAME LOW HIGH AVAILABLE USED\n"
+ );
+
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Dump_threads_usage( the_thread );
+ if ( the_thread == _Thread_Executing )
+ hit_running = 1;
+ }
+ }
+ }
+
+ if ( !hit_running )
+ Stack_check_Dump_threads_usage( _Thread_Executing );
+
+ /* dump interrupt stack info if any */
+ Stack_check_Dump_threads_usage((Thread_Control *) -1);
+}
+
diff --git a/c/src/lib/libmisc/stackchk/internal.h b/c/src/lib/libmisc/stackchk/internal.h
new file mode 100644
index 0000000000..e98ec7e92e
--- /dev/null
+++ b/c/src/lib/libmisc/stackchk/internal.h
@@ -0,0 +1,96 @@
+/* internal.h
+ *
+ * This include file contains internal information
+ * for the RTEMS stack checker.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INTERNAL_STACK_CHECK_h
+#define __INTERNAL_STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This structure is used to fill in and compare the "end of stack"
+ * marker pattern.
+ * pattern area must be a multiple of 4 words.
+ */
+
+#ifdef CPU_STACK_CHECK_SIZE
+#define PATTERN_SIZE_WORDS (((CPU_STACK_CHECK_SIZE / 4) + 3) & ~0x3)
+#else
+#define PATTERN_SIZE_WORDS 4
+#endif
+
+#define PATTERN_SIZE_BYTES (PATTERN_SIZE_WORDS * 4)
+
+typedef struct {
+ unsigned32 pattern[ PATTERN_SIZE_WORDS ];
+} Stack_check_Control;
+
+/*
+ * The pattern used to fill the entire stack.
+ */
+
+#define BYTE_PATTERN 0xA5
+#define U32_PATTERN 0xA5A5A5A5
+
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+);
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libmisc/stackchk/stackchk.h b/c/src/lib/libmisc/stackchk/stackchk.h
new file mode 100644
index 0000000000..f3281c63fe
--- /dev/null
+++ b/c/src/lib/libmisc/stackchk/stackchk.h
@@ -0,0 +1,41 @@
+/* stackchk.h
+ *
+ * This include file contains information necessary to utilize
+ * and install the stack checker mechanism.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_CHECK_h
+#define __STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Stack_check_Initialize
+ */
+
+void Stack_check_Initialize( void );
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/start/README b/c/src/lib/start/README
new file mode 100644
index 0000000000..bec0349374
--- /dev/null
+++ b/c/src/lib/start/README
@@ -0,0 +1,10 @@
+$Id$
+
+For each processor there may be some start up code
+(like crt.o) in the appropriate entry subdirectory. This
+entry code transfers control to target board specific
+code).
+
+For some processors this code exists in some external (to RTEMS)
+library such as libgloss or the host system (for example the hppa1_1
+and UNIX cpu's)
diff --git a/c/src/lib/start/i960/start.s b/c/src/lib/start/i960/start.s
new file mode 100644
index 0000000000..f9287d2641
--- /dev/null
+++ b/c/src/lib/start/i960/start.s
@@ -0,0 +1,106 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+ BEGIN_CODE
+ PUBLIC(start) # GNU960 default entry point
+
+start:
+ mov 3, r12
+ modpc r12, r12, r12 # enable tracing/trace faults
+ mov g5, g5 # NOP
+ mov 0, g14 # initialize constant for C
+
+ /*
+ * zero out uninitialized data area
+ */
+zerobss:
+ lda _end, r4 /* find end of .bss */
+ lda _bss_start, r5 /* find beginning of .bss */
+ ldconst 0, r6
+
+loop: st r6, (r5) /* to zero out uninitialized */
+ addo 4, r5, r5 /* data area */
+ cmpobl r5, r4, loop /* loop until _end reached */
+
+/* set up stack pointer:
+ * The heap will begin at '_end'; its length is 'heap_size'
+ * bytes. The stack will begin at the first 64-byte-aligned
+ * block after the heap.
+ *
+ * A default value of 'heap_size' is set by linking with libnindy.a
+ * The default can be overridden by redefining this symbol at link
+ * time (with a line of the form 'heap_size=XXXX;' in the lnk960
+ * linker specification file; or one of the form
+ * "-defsym heap_size=XXXX" on the gld960 invocation line).
+ */
+
+ ldconst _end, sp /* set sp = address of end of heap */
+ lda heap_size(sp),sp
+ lda 64(sp), sp /* Now round up to 64-byte boundary */
+ ldconst 0xffffffc0, r12
+ and r12, sp, sp
+ st sp, _stack_start /* Save for brk() routine */
+
+ call init_frames
+ ret /* return to monitor */
+
+init_frames:
+ mov 0, g14 /* initialize constant for C */
+ ldconst 0x3b001000, g0
+ ldconst 0x00009107, g1
+ modac g1, g0, g0 /* set AC controls */
+
+ /*
+ * remember the frame, so that we can set it up if necessary
+ */
+
+ st fp, _start_frame
+
+ /*
+ * Call application mainline.
+ * Someday, real values of argc and argv will be set up.
+ * For now, they are set to 0.
+ */
+ ldconst 0,g0
+ ldconst 0,g1
+ ldconst 0,g2
+ call _main
+ ret
+
+END_CODE
+
+ BEGIN_DATA
+
+ PUBLIC(_start_frame)
+SYM (_start_frame):
+ .word 0 # addr of first user frame: for gdb960
+
+SYM (_stack_start):
+ PUBLIC(_stack_start)
+ .word 0 # addr of first user frame: for gdb960
+
+END_DATA
+
+BEGIN_BSS
+ PUBLIC(heap_size)
+ .set heap_size,0x2000
+END_BSS
+
+END
diff --git a/c/src/lib/start/m68k/start.s b/c/src/lib/start/m68k/start.s
new file mode 100644
index 0000000000..2784b09901
--- /dev/null
+++ b/c/src/lib/start/m68k/start.s
@@ -0,0 +1,167 @@
+/* entry.s
+ *
+ * This file contains the entry point for the application.
+ * The name of this entry point is compiler dependent.
+ * It jumps to the BSP which is responsible for performing
+ * all initialization.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "asm.h"
+
+BEGIN_CODE
+ | Default entry points for:
+ PUBLIC (start) | GNU
+ PUBLIC (M68Kvec) | Vector Table
+
+SYM (start):
+SYM (M68Kvec): | standard location for vectors
+ nop | for linkers with problem
+ | location zero
+ jmp SYM (start_around)
+
+ /*
+ * We can use the following space as our vector table
+ * if the CPU has a VBR or we can save vector table in it
+ * if the CPU does not.
+ */
+
+ .space 4088 | to avoid initial intr stack
+ | from 135BUG on MVME13?
+ | and start code at 0x4000
+SYM (vectors):
+ .space 1016 | reserve space for rest of vectors
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+SYM (lowintstack):
+ .space 4092 | reserve for interrupt stack
+SYM (hiintstack):
+ .space 4 | end of interrupt stack
+#endif
+
+ PUBLIC (start_around)
+SYM (start_around):
+ move.w sr, SYM (initial_sr)
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ movec isp,a0
+ move.l a0, SYM (initial_isp)
+ movec usp,a0
+ move.l a0, SYM (initial_usp)
+ movec msp,a0
+ move.l a0, SYM (initial_msp)
+#else
+ move.l a7, SYM (initial_msp)
+#endif
+ oriw #0x0700,sr | INTERRUPTS OFF!!!
+
+
+
+ |
+ | zero out uninitialized data area
+ |
+zerobss:
+ moveal # SYM (end),a0 | find end of .bss
+ moveal # SYM (bss_start),a1 | find beginning of .bss
+ movel #0,d0
+
+loop: movel #0,a1@+ | to zero out uninitialized
+ cmpal a0,a1
+ jlt loop | loop until _end reached
+
+ movel # SYM (end),d0 | d0 = end of bss/start of heap
+ addl # SYM (heap_size),d0 | d0 = end of heap
+ movel d0, SYM (stack_start) | Save for brk() routine
+ addl # SYM (stack_size),d0 | make room for stack
+ andl #0xffffffc0,d0 | align it on 16 byte boundary
+ movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!!
+ movel d0,a7 | set master stack pointer
+ movel d0,a6 | set base pointer
+
+ /*
+ * RTEMS should maintiain a separate interrupt stack on CPUs
+ * without one in hardware. This is currently not supported
+ * on versions of the m68k without a HW intr stack.
+ */
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ lea SYM (hiintstack),a0 | a0 = high end of intr stack
+ movec a0,isp | set interrupt stack
+#endif
+
+
+ movel #0,a7@- | push environp
+ movel #0,a7@- | push argv
+ movel #0,a7@- | push argc
+
+ jsr SYM (main)
+ addl #12,a7
+
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ move.l SYM (initial_isp),a0
+ movec a0,isp
+ move.l SYM (initial_usp),a0
+ movec a0,usp
+ move.l SYM (initial_msp),a0
+ movec a0,msp
+#else
+ movea.l SYM (initial_msp),a7
+#endif
+ move.w SYM (initial_sr),sr
+ rts
+
+END_CODE
+
+BEGIN_DATA
+
+ PUBLIC (start_frame)
+SYM (start_frame):
+ .space 4,0
+
+ PUBLIC (stack_start)
+SYM (stack_start):
+ .space 4,0
+END_DATA
+
+BEGIN_BSS
+
+ PUBLIC (environ)
+ .align 2
+SYM (environ):
+ .long 0
+
+ PUBLIC (initial_isp)
+SYM (initial_isp):
+ .space 4
+
+ PUBLIC (initial_msp)
+SYM (initial_msp):
+ .space 4
+
+ PUBLIC (initial_usp)
+SYM (initial_usp):
+ .space 4
+
+ PUBLIC (initial_sr)
+SYM (initial_sr):
+ .space 2
+
+ PUBLIC (heap_size)
+ .set SYM (heap_size),0x2000
+
+ PUBLIC (stack_size)
+ .set SYM (stack_size),0x1000
+
+
+END_DATA
+END
+
+
diff --git a/c/src/libchip/shmdr/README b/c/src/libchip/shmdr/README
new file mode 100644
index 0000000000..5ed9e861b0
--- /dev/null
+++ b/c/src/libchip/shmdr/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+The mpci.h file provided in here is too simple for an MPCI with
+multiple ways to get to a node.
+
+This version of the shm driver needs to be reorganized to follow
+the better model of the Ada version.
diff --git a/c/src/libchip/shmdr/addlq.c b/c/src/libchip/shmdr/addlq.c
new file mode 100644
index 0000000000..2c2529c834
--- /dev/null
+++ b/c/src/libchip/shmdr/addlq.c
@@ -0,0 +1,43 @@
+/* void Shm_Locked_queue_Add( lq_cb, ecb )
+ *
+ * This routine adds an envelope control block to a shared memory queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to a locked queue control block
+ * ecb - pointer to an envelope control block
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Locked_queue_Add(
+ Shm_Locked_queue_Control *lq_cb,
+ Shm_Envelope_control *ecb
+)
+{
+ rtems_unsigned32 index;
+
+ ecb->next = Shm_Locked_queue_End_of_list;
+ ecb->queue = lq_cb->owner;
+ index = ecb->index;
+
+ Shm_Lock( lq_cb );
+ if ( Shm_Convert(lq_cb->front) != Shm_Locked_queue_End_of_list )
+ Shm_Envelopes[ Shm_Convert(lq_cb->rear) ].next = index;
+ else
+ lq_cb->front = index;
+ lq_cb->rear = index;
+ Shm_Unlock( lq_cb );
+}
diff --git a/c/src/libchip/shmdr/cnvpkt.c b/c/src/libchip/shmdr/cnvpkt.c
new file mode 100644
index 0000000000..2c3a144167
--- /dev/null
+++ b/c/src/libchip/shmdr/cnvpkt.c
@@ -0,0 +1,42 @@
+/* void Shm_Convert_packet( &packet )
+ *
+ * This routine is the shared memory locked queue MPCI driver routine
+ * used to convert the RTEMS's information in a packet from non-native
+ * format to processor native format.
+ *
+ * Input parameters:
+ * packet - pointer to a packet
+ *
+ * Output parameters:
+ * *packet - packet in native format
+ *
+ * NOTE: Message buffers are not manipulated.
+ * Endian conversion is currently the only conversion.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Convert_packet(
+ rtems_packet_prefix *packet
+)
+{
+ rtems_unsigned32 *pkt, i;
+
+ pkt = (rtems_unsigned32 *) packet;
+ for ( i=RTEMS_MINIMUN_HETERO_CONVERSION ; i ; i--, pkt++ )
+ *pkt = CPU_swap_u32( *pkt );
+
+ for ( i=packet->to_convert ; i ; i--, pkt++ )
+ *pkt = CPU_swap_u32( *pkt );
+}
diff --git a/c/src/libchip/shmdr/dump.c b/c/src/libchip/shmdr/dump.c
new file mode 100644
index 0000000000..dc02961138
--- /dev/null
+++ b/c/src/libchip/shmdr/dump.c
@@ -0,0 +1,49 @@
+/*
+ * This routine is invoked following a reset to report the statistics
+ * gathered during the previous execution.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+
+#include "shm.h"
+
+void
+Shm_Print_statistics(void)
+{
+ rtems_unsigned32 ticks;
+ rtems_unsigned32 ticks_per_second;
+ rtems_unsigned32 seconds;
+ int packets_per_second;
+
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks );
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
+
+ seconds = ticks / ticks_per_second;
+
+ packets_per_second = Shm_Receive_message_count / seconds;
+ if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) )
+ packets_per_second++;
+
+ printf( "\n\nSHMDR STATISTICS (NODE %d)\n", Shm_Local_node );
+ printf( "TICKS SINCE BOOT = %d\n", ticks );
+ printf( "TICKS PER SECOND = %d\n", ticks_per_second );
+ printf( "ISRs=%d\n", Shm_Interrupt_count );
+ printf( "RECV=%d\n", Shm_Receive_message_count );
+ printf( "NULL=%d\n", Shm_Null_message_count );
+ printf( "PKTS/SEC=%d\n", packets_per_second );
+}
diff --git a/c/src/libchip/shmdr/fatal.c b/c/src/libchip/shmdr/fatal.c
new file mode 100644
index 0000000000..b36ff8da41
--- /dev/null
+++ b/c/src/libchip/shmdr/fatal.c
@@ -0,0 +1,39 @@
+/* void MPCI_Fatal( error )
+ *
+ * This routine is the shared memory driver fatal error handler.
+ *
+ * Input parameters:
+ * error - fatal error code
+ *
+ * Output parameters: NEVER RETURNS
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void MPCI_Fatal(
+ Internal_errors_Source source,
+ boolean is_internal,
+ rtems_unsigned32 error
+)
+{
+ /* Eventually need to attempt to broadcast a K_FATAL message
+ * without checking for all possible errors (do not want to
+ * recurse).
+ *
+ * Also need to avoid using Shm_Node_statuses if the driver has not been
+ * initialized.
+ */
+
+ Shm_Local_node_status->error = Shm_Convert(error);
+}
diff --git a/c/src/libchip/shmdr/getlq.c b/c/src/libchip/shmdr/getlq.c
new file mode 100644
index 0000000000..efc7b0996c
--- /dev/null
+++ b/c/src/libchip/shmdr/getlq.c
@@ -0,0 +1,48 @@
+/* Shm_Envelope_control *Shm_Locked_queue_Get( lq_cb )
+ *
+ * This routine returns an envelope control block from a shared
+ * memory queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to a locked queue control block
+ *
+ * Output parameters:
+ * returns - pointer to an envelope control block
+ * - NULL if no envelopes on specified queue
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <shm.h>
+
+Shm_Envelope_control *Shm_Locked_queue_Get(
+ Shm_Locked_queue_Control *lq_cb
+)
+{
+ Shm_Envelope_control *tmp_ecb;
+ rtems_unsigned32 tmpfront;
+
+ tmp_ecb = NULL;
+ Shm_Lock( lq_cb );
+
+ tmpfront = Shm_Convert(lq_cb->front);
+ if ( tmpfront != Shm_Locked_queue_End_of_list ) {
+ tmp_ecb = &Shm_Envelopes[ tmpfront ];
+ lq_cb->front = tmp_ecb->next;
+ if ( tmp_ecb->next == Shm_Locked_queue_End_of_list )
+ lq_cb->rear = Shm_Locked_queue_End_of_list;
+ tmp_ecb->next = Shm_Locked_queue_Not_on_list;
+ }
+
+ Shm_Unlock( lq_cb );
+ return( tmp_ecb );
+}
diff --git a/c/src/libchip/shmdr/getpkt.c b/c/src/libchip/shmdr/getpkt.c
new file mode 100644
index 0000000000..c80b3ed282
--- /dev/null
+++ b/c/src/libchip/shmdr/getpkt.c
@@ -0,0 +1,36 @@
+/* Shm_Get_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver
+ * routine used to obtain an empty message packet.
+ *
+ * Input parameters:
+ * packet - address of pointer to packet
+ *
+ * Output parameters:
+ * *(cpb->get_packet) - address of allocated packet
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **packet
+)
+{
+ Shm_Envelope_control *ecb;
+
+ ecb = Shm_Allocate_envelope();
+ if ( !ecb )
+ rtems_fatal_error_occurred ( SHM_NO_FREE_PKTS );
+ *packet = Shm_Envelope_control_to_packet_prefix_pointer( ecb );
+}
diff --git a/c/src/libchip/shmdr/init.c b/c/src/libchip/shmdr/init.c
new file mode 100644
index 0000000000..a553e4ff9b
--- /dev/null
+++ b/c/src/libchip/shmdr/init.c
@@ -0,0 +1,254 @@
+/* Shm_Initialization
+ *
+ * This routine is the shared memory communications initerface
+ * driver initialization routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define _SHM_INIT
+
+#include <rtems.h>
+#include <shm.h>
+
+#include <string.h> /* memset() */
+#include <stdlib.h> /* malloc() */
+#include <assert.h>
+
+/*
+ * User extension to install MPCI_Fatal as a fatal error
+ * handler extension
+ */
+
+rtems_extensions_table MPCI_Shm_extensions;
+
+rtems_mpci_entry Shm_Initialization( void )
+
+{
+ rtems_unsigned32 i, all_initialized;
+ rtems_unsigned32 interrupt_cause, interrupt_value;
+ void *interrupt_address;
+ Shm_Node_status_control *nscb;
+ rtems_unsigned32 extension_id; /* for installation of MPCI_Fatal */
+ rtems_unsigned32 remaining_memory;
+/* XXX these should use "public" methods to set their values.... */
+ rtems_configuration_table *configuration = _Configuration_Table;
+ rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table;
+
+ Shm_RTEMS_Configuration = configuration;
+ Shm_RTEMS_MP_Configuration = mp_configuration;
+
+ Shm_Local_node = Shm_RTEMS_MP_Configuration->node;
+ Shm_Maximum_nodes = Shm_RTEMS_MP_Configuration->maximum_nodes;
+
+ Shm_Get_configuration( Shm_Local_node, &Shm_Configuration );
+
+ Shm_Interrupt_table = (Shm_Interrupt_information *) malloc(
+ sizeof(Shm_Interrupt_information) * (Shm_Maximum_nodes + 1)
+ );
+
+ assert( Shm_Interrupt_table );
+
+
+ Shm_Receive_message_count = 0;
+ Shm_Null_message_count = 0;
+ Shm_Interrupt_count = 0;
+
+ /*
+ * Set the Node Status indicators
+ */
+
+ Shm_Pending_initialization =
+ Shm_Convert(rtems_build_name( 'P', 'E', 'N', 'D' ));
+ Shm_Initialization_complete =
+ Shm_Convert(rtems_build_name( 'C', 'O', 'M', 'P' ));
+ Shm_Active_node =
+ Shm_Convert(rtems_build_name( 'A', 'C', 'T', 'V' ));
+
+ /*
+ * Initialize the constants used by the Locked Queue code.
+ */
+
+ Shm_Locked_queue_End_of_list = Shm_Convert( 0xffffffff );
+ Shm_Locked_queue_Not_on_list = Shm_Convert( 0xfffffffe );
+
+ /*
+ * Set the base addresses for the:
+ * + Node Status Table
+ * + Free Pool and Receive Queues
+ * + Envelopes
+ */
+
+ Shm_Node_statuses = (Shm_Node_status_control *) START_NS_CBS;
+ Shm_Locked_queues = (Shm_Locked_queue_Control *) START_LQ_CBS;
+ Shm_Envelopes = (Shm_Envelope_control *) START_ENVELOPES;
+
+ /*
+ * Calculate the maximum number of envelopes which can be
+ * placed the remaining shared memory.
+ */
+
+ remaining_memory =
+ ((void *)Shm_Configuration->base + Shm_Configuration->length) -
+ ((void *)Shm_Envelopes);
+
+ Shm_Maximum_envelopes = remaining_memory / sizeof( Shm_Envelope_control );
+ Shm_Maximum_envelopes -= 1;
+
+ /*
+ * Set the pointer to the receive queue for the local node.
+ * When we receive a node, we will get it from here before
+ * processing it.
+ */
+
+ Shm_Local_receive_queue = &Shm_Locked_queues[ Shm_Local_node ];
+ Shm_Local_node_status = &Shm_Node_statuses[ Shm_Local_node ];
+
+ /*
+ * Convert local interrupt cause information into the
+ * neutral format so other nodes will be able to
+ * understand it.
+ */
+
+ interrupt_address =
+ (void *) Shm_Convert( (rtems_unsigned32)Shm_Configuration->Intr.address );
+ interrupt_value = Shm_Convert( Shm_Configuration->Intr.value );
+ interrupt_cause = Shm_Convert( Shm_Configuration->Intr.length );
+
+ if ( Shm_Configuration->poll_intr == POLLED_MODE ) Shm_setclockvec();
+ else Shm_setvec();
+
+ if ( Shm_Is_master_node() ) {
+
+ /*
+ * Zero out the shared memory area.
+ */
+
+ (void) memset(
+ (void *) Shm_Configuration->base,
+ 0,
+ Shm_Configuration->length
+ );
+
+ /*
+ * Initialize all of the locked queues (the free envelope
+ * pool and a receive queue per node) and set all of the
+ * node's status so they will be waiting to initialization
+ * to complete.
+ */
+
+ Shm_Locked_queue_Initialize( FREE_ENV_CB, FREE_ENV_POOL );
+
+ for ( i=SHM_FIRST_NODE ; i<=Shm_Maximum_nodes ; i++ ) {
+ Shm_Initialize_receive_queue( i );
+
+ Shm_Node_statuses[ i ].status = Shm_Pending_initialization;
+ Shm_Node_statuses[ i ].error = 0;
+ }
+
+ /*
+ * Initialize all of the envelopes and place them in the
+ * free pool.
+ */
+
+ for ( i=0 ; i<Shm_Maximum_envelopes ; i++ ) {
+ Shm_Envelopes[ i ].index = Shm_Convert(i);
+ Shm_Free_envelope( &Shm_Envelopes[ i ] );
+ }
+
+ /*
+ * Initialize this node's interrupt information in the
+ * shared area so other nodes can interrupt us.
+ */
+
+ Shm_Local_node_status->int_address = (rtems_unsigned32) interrupt_address;
+ Shm_Local_node_status->int_value = interrupt_value;
+ Shm_Local_node_status->int_length = interrupt_cause;
+
+ Shm_Local_node_status->status = Shm_Initialization_complete;
+
+ /*
+ * Loop until all nodes have completed initialization.
+ */
+
+ do {
+ all_initialized = 1;
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ )
+ if ( Shm_Node_statuses[ i ].status != Shm_Initialization_complete )
+ all_initialized = 0;
+
+ } while ( all_initialized == 0 );
+
+ /*
+ * Tell the other nodes we think that the system is up.
+ */
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ )
+ Shm_Node_statuses[ i ].status = Shm_Active_node;
+
+ } else { /* is not MASTER node */
+
+ /*
+ * Initialize the node status for the non-master nodes.
+ * Because the master node zeroes out memory, it is
+ * necessary for them to keep putting their values in
+ * the node status area until the master says they
+ * should become active.
+ */
+
+ Shm_Local_node_status->status = Shm_Pending_initialization;
+
+ do {
+
+ if ( Shm_Local_node_status->status == Shm_Pending_initialization ) {
+
+ /*
+ * Initialize this node's interrupt information in the
+ * shared area so other nodes can interrupt us.
+ */
+
+ Shm_Local_node_status->int_address =
+ (rtems_unsigned32) interrupt_address;
+ Shm_Local_node_status->int_value = interrupt_value;
+ Shm_Local_node_status->int_length = interrupt_cause;
+
+ Shm_Local_node_status->status = Shm_Initialization_complete;
+ }
+ } while ( Shm_Local_node_status->status != Shm_Active_node ) ;
+ }
+
+ /*
+ * Initialize the Interrupt Information Table
+ */
+
+ for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ ) {
+ nscb = &Shm_Node_statuses[ i ];
+
+ Shm_Interrupt_table[i].address = Shm_Convert_address(
+ (void *)Shm_Convert(((vol_u32) nscb->int_address))
+ );
+ Shm_Interrupt_table[i].value = Shm_Convert( nscb->int_value );
+ Shm_Interrupt_table[i].length = Shm_Convert( nscb->int_length );
+ }
+
+ MPCI_Shm_extensions.fatal = MPCI_Fatal;
+
+ (void) rtems_extension_create(
+ rtems_build_name( 'M', 'P', 'E', 'X' ),
+ &MPCI_Shm_extensions,
+ &extension_id
+ );
+}
diff --git a/c/src/libchip/shmdr/initlq.c b/c/src/libchip/shmdr/initlq.c
new file mode 100644
index 0000000000..3f44cf577d
--- /dev/null
+++ b/c/src/libchip/shmdr/initlq.c
@@ -0,0 +1,35 @@
+/* void Shm_Locked_queue_Initialize( lq_cb, owner )
+ *
+ * This routine initializes a shared memory locked queue.
+ *
+ * Input parameters:
+ * lq_cb - pointer to the control block of the queue
+ * to be initialized
+ * owner - unique idenitifier of who owns this queue.
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Locked_queue_Initialize(
+ Shm_Locked_queue_Control *lq_cb,
+ rtems_unsigned32 owner
+)
+{
+ Shm_Initialize_lock( lq_cb );
+ lq_cb->front = Shm_Locked_queue_End_of_list;
+ lq_cb->rear = Shm_Locked_queue_End_of_list;
+ lq_cb->owner = Shm_Convert(owner);
+}
diff --git a/c/src/libchip/shmdr/intr.c b/c/src/libchip/shmdr/intr.c
new file mode 100644
index 0000000000..8982103227
--- /dev/null
+++ b/c/src/libchip/shmdr/intr.c
@@ -0,0 +1,58 @@
+/* void Shm_Cause_interrupt( node )
+ *
+ * This routine is the shared memory driver routine which
+ * generates interrupts to other CPUs.
+ *
+ * It uses the information placed in the node status control
+ * block by each node. For example, when used with the Motorola
+ * MVME136 board, the MPCSR is used.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+void Shm_Cause_interrupt(
+ rtems_unsigned32 node
+)
+{
+ Shm_Interrupt_information *intr;
+ rtems_unsigned8 *u8;
+ rtems_unsigned16 *u16;
+ rtems_unsigned32 *u32;
+ rtems_unsigned32 value;
+
+ intr = &Shm_Interrupt_table[node];
+ value = intr->value;
+
+ switch ( intr->length ) {
+ case NO_INTERRUPT:
+ break;
+ case BYTE:
+ u8 = (rtems_unsigned8 *)intr->address;
+ *u8 = (rtems_unsigned8) value;
+ break;
+ case WORD:
+ u16 = (rtems_unsigned16 *)intr->address;
+ *u16 = (rtems_unsigned16) value;
+ break;
+ case LONG:
+ u32 = (rtems_unsigned32 *)intr->address;
+ *u32 = (rtems_unsigned32) value;
+ break;
+ }
+}
diff --git a/c/src/libchip/shmdr/mpci.h b/c/src/libchip/shmdr/mpci.h
new file mode 100644
index 0000000000..c5646a61d7
--- /dev/null
+++ b/c/src/libchip/shmdr/mpci.h
@@ -0,0 +1,59 @@
+/* mpci.h
+ *
+ * This include file contains all the renaming necessary to
+ * have an application use the Shared Memory Driver as its
+ * sole mechanism for MPCI.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SHM_MPCI_h
+#define __SHM_MPCI_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <shm.h>
+
+#define MPCI_Initialization( _configuration ) \
+ Shm_Initialization( _configuration )
+
+#define MPCI_Get_packet( _the_packet ) \
+ Shm_Get_packet( _the_packet )
+
+#define MPCI_Return_packet( _the_packet ) \
+ Shm_Return_packet( _the_packet )
+
+#define MPCI_Receive_packet( _the_packet ) \
+ Shm_Receive_packet( _the_packet )
+
+#define MPCI_Send_packet( _destination, _the_packet ) \
+ Shm_Send_packet( _destination, _the_packet )
+
+/* Unnecessary... mapped in shm.h
+#define MPCI_Fatal( _the_error ) \
+ Shm_Fatal( _the_error )
+*/
+
+#define MPCI_Enable_statistics()
+
+#define MPCI_Print_statistics() \
+ Shm_Print_statistics()
+
+/* no need to rename the MPCI_Table either */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/libchip/shmdr/mpisr.c b/c/src/libchip/shmdr/mpisr.c
new file mode 100644
index 0000000000..93ced3d351
--- /dev/null
+++ b/c/src/libchip/shmdr/mpisr.c
@@ -0,0 +1,23 @@
+/* _Shm_isr()
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_isr Shm_isr(
+ rtems_vector_number vector
+)
+{
+ Shm_Interrupt_count += 1;
+ rtems_multiprocessing_announce();
+}
diff --git a/c/src/libchip/shmdr/poll.c b/c/src/libchip/shmdr/poll.c
new file mode 100644
index 0000000000..27361f08eb
--- /dev/null
+++ b/c/src/libchip/shmdr/poll.c
@@ -0,0 +1,53 @@
+/* void Shm_Poll()
+ *
+ * This routine polls to see if a packet has arrived. If one
+ * has it informs the executive. It is typically called from
+ * the clock tick interrupt service routine.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/libio.h>
+
+#include "shm.h"
+
+void Shm_Poll()
+{
+ rtems_unsigned32 tmpfront;
+ rtems_libio_ioctl_args_t args;
+
+ /* invoke clock isr */
+ args.iop = 0;
+ args.command = rtems_build_name('I', 'S', 'R', ' ');
+ (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
+
+ /*
+ * Check for msgs only if we are "up"
+ * This avoids a race condition where we may get a clock
+ * interrupt before MPCI has completed its init
+ */
+
+ if (_System_state_Is_up(_System_state_Get()))
+ {
+ tmpfront = Shm_Local_receive_queue->front;
+ if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list )
+ {
+ rtems_multiprocessing_announce();
+ Shm_Interrupt_count++;
+ }
+ }
+}
diff --git a/c/src/libchip/shmdr/receive.c b/c/src/libchip/shmdr/receive.c
new file mode 100644
index 0000000000..e094a2df6b
--- /dev/null
+++ b/c/src/libchip/shmdr/receive.c
@@ -0,0 +1,44 @@
+/* Shm_Receive_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver routine
+ * used to obtain a packet containing a message from this node's
+ * receive queue.
+ *
+ * Input parameters:
+ * packet - address of a pointer to a packet
+ *
+ * Output parameters:
+ * *(rpb->packet) - pointer to packet
+ * NULL if no packet currently available
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **packet
+)
+{
+ Shm_Envelope_control *ecb;
+
+ ecb = Shm_Locked_queue_Get( Shm_Local_receive_queue );
+ if ( ecb ) {
+ *(packet) = Shm_Envelope_control_to_packet_prefix_pointer( ecb );
+ if ( ecb->Preamble.endian != Shm_Configuration->format )
+ Shm_Convert_packet( *packet );
+ Shm_Receive_message_count++;
+ } else {
+ *(packet) = NULL;
+ Shm_Null_message_count++;
+ }
+}
diff --git a/c/src/libchip/shmdr/retpkt.c b/c/src/libchip/shmdr/retpkt.c
new file mode 100644
index 0000000000..973b84ab0d
--- /dev/null
+++ b/c/src/libchip/shmdr/retpkt.c
@@ -0,0 +1,32 @@
+/* Shm_Return_packet
+ *
+ * This routine is the shared memory locked queue MPCI driver
+ * routine used to return a message packet to a free envelope
+ * pool accessible by this node.
+ *
+ * Input parameters:
+ * packet - address of pointer to packet
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *packet
+)
+{
+ Shm_Free_envelope( Shm_Packet_prefix_to_envelope_control_pointer(packet) );
+}
+
diff --git a/c/src/libchip/shmdr/send.c b/c/src/libchip/shmdr/send.c
new file mode 100644
index 0000000000..58a5bb93b9
--- /dev/null
+++ b/c/src/libchip/shmdr/send.c
@@ -0,0 +1,61 @@
+/* Shm_Send_packet
+ *
+ * This routine is the shared memory driver locked queue write
+ * MPCI driver routine. This routine sends the specified packet
+ * to the destination specified by "node". A "node" value of
+ * zero designates that this packet is to be broadcasted.
+ *
+ * Input parameters:
+ * node - destination of this packet (0 = broadcast)
+ * packet - address of packet
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "shm.h"
+
+struct pkt_cpy {
+ rtems_unsigned32 packet[MAX_PACKET_SIZE/4];
+};
+
+rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32 node,
+ rtems_packet_prefix *packet
+)
+{
+ Shm_Envelope_control *ecb, *tmp_ecb;
+ rtems_unsigned32 nnum;
+
+ ecb = Shm_Packet_prefix_to_envelope_control_pointer( packet );
+ if ( node ) {
+ Shm_Build_preamble( ecb, node );
+ Shm_Build_postamble( ecb );
+ Shm_Append_to_receive_queue( node, ecb );
+ (*Shm_Configuration->cause_intr)( node );
+ }
+ else {
+ for( nnum = SHM_FIRST_NODE ; nnum <= Shm_Maximum_nodes ; nnum++ )
+ if ( Shm_Local_node != nnum ) {
+ tmp_ecb = Shm_Allocate_envelope();
+ if ( !tmp_ecb )
+ rtems_fatal_error_occurred( SHM_NO_FREE_PKTS );
+ Shm_Build_preamble( tmp_ecb, nnum );
+ *((struct pkt_cpy *)tmp_ecb->packet) = *((struct pkt_cpy *)packet);
+ Shm_Build_postamble( tmp_ecb );
+ Shm_Append_to_receive_queue( nnum, tmp_ecb );
+ (*Shm_Configuration->cause_intr)( nnum );
+ }
+ Shm_Free_envelope( ecb );
+ }
+}
diff --git a/c/src/libchip/shmdr/setckvec.c b/c/src/libchip/shmdr/setckvec.c
new file mode 100644
index 0000000000..bb3a19e1c8
--- /dev/null
+++ b/c/src/libchip/shmdr/setckvec.c
@@ -0,0 +1,34 @@
+/* Shm_setclockvec
+ *
+ * This routines installs the shared memory clock interrupt handler
+ * used when the driver is used in polling mode.
+ *
+ * INPUT PARAMETERS: NONE
+ *
+ * OUTPUT PARAMETERS: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/libio.h>
+
+#include "shm.h"
+
+rtems_isr Shm_setclockvec()
+{
+ rtems_libio_ioctl_args_t args;
+ args.iop = 0;
+ args.command = rtems_build_name('N', 'E', 'W', ' ');
+ args.buffer = (void *) Shm_Poll;
+
+ (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
+}
diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h
new file mode 100644
index 0000000000..e7a8ae0496
--- /dev/null
+++ b/c/src/libchip/shmdr/shm_driver.h
@@ -0,0 +1,534 @@
+/* shm.h
+ *
+ * This include file contains all the constants, structures,
+ * and global variables for this RTEMS based shared memory
+ * communications interface driver.
+ *
+ * Processor board dependencies are in other files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SHM_h
+#define __SHM_h
+
+#include <clockdrv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The information contained in the Node Status, Locked Queue, and
+ * Envelope Control Blocks must be maintained in a NEUTRAL format.
+ * Currently the neutral format may be selected as big or little
+ * endian by simply defining either NEUTRAL_BIG or NEUTRAL_LITTLE.
+ *
+ * It is CRITICAL to note that the neutral format can ONLY be
+ * changed by modifying this file and recompiling the ENTIRE
+ * SHM driver including ALL target specific support files.
+ *
+ * The following table details the memory contents for the endian
+ * field of the Node Status Control Block in the various
+ * data format configurations (data is in hexadecimal):
+ *
+ * NEUTRAL NATIVE BYTE 0 BYTE 1 BYTE 2 BYTE 3
+ * ======= ====== ====== ====== ====== ======
+ * BIG BIG 00 00 00 01
+ * BIG LITTLE 10 00 00 00
+ * LITTLE BIG 01 00 00 00
+ * LITTLE LITTLE 00 00 00 10
+ *
+ *
+ * NOTE: XXX
+ * PORTABILITY OF LOCKING INSTRUCTIONS
+ * ===================================
+ * The locking mechanism described below is not
+ * general enough. Where the hardware supports
+ * it we should use "atomic swap" instructions
+ * so the values in the lock can be tailored to
+ * support a CPU with only weak atomic memory
+ * instructions. There are combinations of
+ * CPUs with inflexible atomic memory instructions
+ * which appear to be incompatible. For example,
+ * the SPARClite instruction uses a byte which is
+ * 0xFF when locked. The PA-RISC uses 1 to indicate
+ * locked and 0 when unlocked. These CPUs appear to
+ * have incompatible lock instructions. But
+ * they could be used in a heterogenous system
+ * with does not mix SPARCs and PA-RISCs. For
+ * example, the i386 and SPARC or i386 and SPARC
+ * could work together. The bottom line is that
+ * not every CPU will work together using this
+ * locking scheme. There are supposed to be
+ * algorithms to do this without hardware assist
+ * and one of these should be incorporated into
+ * the shared memory driver.
+ *
+ * The most flexible scheme using the instructions
+ * of the various CPUs for efficiency would be to use
+ * "atomic swaps" wherever possible. Make the lock
+ * and unlock configurable much like BIG vs LITTLE
+ * endian use of shared memory is now. The values
+ * of the lock could then reflect the "worst"
+ * CPU in a system. This still results in mixes
+ * of CPUs which are incompatible.
+ *
+ * The current locking mechanism is based upon the MC68020
+ * "tas" instruction which is atomic. All ports to other CPUs
+ * comply with the restrictive placement of lock bit by this
+ * instruction. The lock bit is the most significant bit in a
+ * big-endian rtems_unsigned32. On other processors, the lock is
+ * typically implemented via an atomic swap or atomic modify
+ * bits type instruction.
+ */
+
+#define NEUTRAL_BIG
+
+#ifdef NEUTRAL_BIG
+#define SHM_BIG 0x00000001
+#define SHM_LITTLE 0x10000000
+#endif
+
+#ifdef NEUTRAL_LITTLE
+#define SHM_BIG 0x01000000
+#define SHM_LITTLE 0x00000010
+#endif
+
+/*
+ * The following are the values used to fill in the lock field. Some CPUs
+ * are able to write only a single value into field. By making the
+ * lock and unlock values configurable, CPUs which support "atomic swap"
+ * instructions can generally be made to work in any heterogeneous
+ * configuration. However, it is possible for two CPUs to be incompatible
+ * in regards to the lock field values. This occurs when two CPUs
+ * which write only a single value to the field are used in a system
+ * but the two CPUs write different incompatible values.
+ *
+ * NOTE: The following is a first attempt at defining values which
+ * have a chance at working together. The m68k should use
+ * chk2 instead of tas to be less restrictive. Target endian
+ * problems (like the Force CPU386 which has (broken) big endian
+ * view of the VMEbus address space) are not addressed yet.
+ */
+
+#if defined(i960)
+#define SHM_LOCK_VALUE 0x00000080
+#define SHM_UNLOCK_VALUE 0
+#elif defined(m68k)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(i386)
+#define SHM_LOCK_VALUE 0x80000000
+#define SHM_UNLOCK_VALUE 0
+#elif defined(hppa1_1)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(unix)
+#define SHM_LOCK_VALUE 0
+#define SHM_UNLOCK_VALUE 1
+#elif defined(no_cpu) /* for this values are irrelevant */
+#define SHM_LOCK_VALUE 1
+#define SHM_UNLOCK_VALUE 0
+#endif
+
+#define Shm_Convert( value ) \
+ ((Shm_Configuration->convert) ? \
+ (*Shm_Configuration->convert)(value) : (value))
+
+/* constants */
+
+#define SHM_MASTER 1 /* master initialization node */
+#define SHM_FIRST_NODE 1
+
+/* size constants */
+
+#define KILOBYTE (1024)
+#define MEGABYTE (1024*1024)
+
+/* inter-node interrupt values */
+
+#define NO_INTERRUPT 0 /* used for polled nodes */
+#define BYTE 1
+#define WORD 2
+#define LONG 4
+
+/* operational mode constants -- used in SHM Configuration Table */
+#define POLLED_MODE 0
+#define INTR_MODE 1
+
+/* error codes */
+
+#define NO_ERROR 0
+#define SHM_NO_FREE_PKTS 0xf0000
+
+/* null pointers of different types */
+
+#define NULL_ENV_CB ((Shm_Envelope_control *) 0)
+#define NULL_CONVERT 0
+
+/*
+ * size of stuff before preamble in envelope.
+ * It must be a constant since we will use it to generate MAX_PACKET_SIZE
+ */
+
+#define SHM_ENVELOPE_PREFIX_OVERHEAD (4 * sizeof(vol_u32))
+
+/*
+ * The following is adjusted so envelopes are MAX_ENVELOPE_SIZE bytes long.
+ * It must be >= RTEMS_MINIMUM_PACKET_SIZE in mppkt.h.
+ */
+
+#ifndef MAX_ENVELOPE_SIZE
+#define MAX_ENVELOPE_SIZE 0x180
+#endif
+
+#define MAX_PACKET_SIZE (MAX_ENVELOPE_SIZE - \
+ SHM_ENVELOPE_PREFIX_OVERHEAD + \
+ sizeof(Shm_Envelope_preamble) + \
+ sizeof(Shm_Envelope_postamble))
+
+
+/* constants pertinent to Locked Queue routines */
+
+#define LQ_UNLOCKED SHM_UNLOCK_VALUE
+#define LQ_LOCKED SHM_LOCK_VALUE
+
+/* constants related to the Free Envelope Pool */
+
+#define FREE_ENV_POOL 0
+#define FREE_ENV_CB (&Shm_Locked_queues[ FREE_ENV_POOL ])
+
+/* The following are important when dealing with
+ * the shared memory communications interface area.
+ *
+ * NOTE: The starting address and length of the shared memory
+ * is defined in a system dependent file.
+ */
+
+#define START_NS_CBS ((void *)Shm_Configuration->base)
+#define START_LQ_CBS ((START_NS_CBS) + \
+ ( (sizeof (Shm_Node_status_control)) * (Shm_Maximum_nodes + 1) ) )
+#define START_ENVELOPES ( ((void *) START_LQ_CBS) + \
+ ( (sizeof (Shm_Locked_queue_Control)) * (Shm_Maximum_nodes + 1) ) )
+#define END_SHMCI_AREA ( (void *) START_ENVELOPES + \
+ ( (sizeof (Shm_Envelope_control)) * Shm_Maximum_envelopes ) )
+#define END_SHARED_MEM (START_NS_CBS+Shm_Configuration->length)
+
+/* macros */
+
+#define Shm_Is_master_node() \
+ ( SHM_MASTER == Shm_Local_node )
+
+#define Shm_Free_envelope( ecb ) \
+ Shm_Locked_queue_Add( FREE_ENV_CB, (ecb) )
+#define Shm_Allocate_envelope() \
+ Shm_Locked_queue_Get(FREE_ENV_CB)
+
+#define Shm_Initialize_receive_queue(node) \
+ Shm_Locked_queue_Initialize( &Shm_Locked_queues[node], node )
+
+#define Shm_Append_to_receive_queue(node, ecb) \
+ Shm_Locked_queue_Add( &Shm_Locked_queues[node], (ecb) )
+
+#define Shm_Envelope_control_to_packet_prefix_pointer(ecb) \
+ ((void *)(ecb)->packet)
+
+#define Shm_Packet_prefix_to_envelope_control_pointer( pkt ) \
+ ((Shm_Envelope_control *)((rtems_unsigned8 *)(pkt) - \
+ (sizeof(Shm_Envelope_preamble) + SHM_ENVELOPE_PREFIX_OVERHEAD)))
+
+#define Shm_Build_preamble(ecb, node) \
+ (ecb)->Preamble.endian = Shm_Configuration->format
+
+#define Shm_Build_postamble( ecb )
+
+/* volatile types */
+
+typedef volatile rtems_unsigned8 vol_u8;
+typedef volatile rtems_unsigned32 vol_u32;
+
+/* shm control information */
+
+struct shm_info {
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+ vol_u32 not_currently_used_3;
+};
+
+typedef struct {
+ /*byte start_of_text;*/
+ vol_u32 endian;
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Envelope_preamble;
+
+typedef struct {
+} Shm_Envelope_postamble;
+
+/* WARNING! If you change this structure, don't forget to change
+ * SHM_ENVELOPE_PREFIX_OVERHEAD and
+ * Shm_Packet_prefix_to_envelope_control_pointer() above.
+ */
+
+/* This comment block describes the contents of each field
+ * of the Envelope Control Block:
+ *
+ * next - The index of the next envelope on this queue.
+ * queue - The index of the queue this envelope is on.
+ * index - The index of this envelope.
+ * Preamble - Generic packet preamble. One day this structure
+ * could be enhanced to contain routing information.
+ * packet - RTEMS MPCI packet. Untouched by SHM Driver
+ * other than copying and format conversion as
+ * documented in the RTEMS User's Guide.
+ * Postamble - Generic packet postamble. One day this structure
+ * could be enhanced to contain checksum information.
+ */
+
+typedef struct {
+ vol_u32 next; /* next envelope on queue */
+ vol_u32 queue; /* queue on which this resides */
+ vol_u32 index; /* index into array of envelopes*/
+ vol_u32 pad0; /* insure the next one is aligned */
+ Shm_Envelope_preamble Preamble; /* header information */
+ vol_u8 packet[MAX_PACKET_SIZE]; /* RTEMS INFO */
+ Shm_Envelope_postamble Postamble;/* trailer information */
+} Shm_Envelope_control;
+
+/* This comment block describes the contents of each field
+ * of the Locked Queue Control Block:
+ *
+ * lock - Lock used to insure mutually exclusive access.
+ * front - Index of first envelope on queue. This field
+ * is used to remove head of queue (receive).
+ * rear - Index of last envelope on queue. This field
+ * is used to add evelope to queue (send).
+ * owner - The node number of the recipient (owning) node.
+ * RTEMS does not use the node number zero (0).
+ * The zero node is used by the SHM Driver for the
+ * Free Envelope Queue shared by all nodes.
+ */
+
+typedef struct {
+ vol_u32 lock; /* lock field for this queue */
+ vol_u32 front; /* first envelope on queue */
+ vol_u32 rear; /* last envelope on queue */
+ vol_u32 owner; /* receiving (i.e. owning) node */
+} Shm_Locked_queue_Control;
+
+/* This comment block describes the contents of each field
+ * of the Node Status Control Block:
+ *
+ * status - Node status. Current values are Pending Initialization,
+ * Initialization Complete, and Active Node. Other values
+ * could be added to enhance fault tolerance.
+ * error - Zero if the node has not failed. Otherwise,
+ * this field contains a status indicating the
+ * failure reason.
+ * int_address, int_value, and int_length
+ * - These field are the Interrupt Information table
+ * for this node in neutral format. This is how
+ * each node knows how to generate interrupts.
+ */
+
+typedef struct {
+ vol_u32 status; /* node status information */
+ vol_u32 error; /* fatal error code */
+ vol_u32 int_address; /* write here for interrupt */
+ vol_u32 int_value; /* this value causes interrupt */
+ vol_u32 int_length; /* for this length (0,1,2,4) */
+ vol_u32 not_currently_used_0;
+ vol_u32 not_currently_used_1;
+ vol_u32 not_currently_used_2;
+} Shm_Node_status_control;
+
+/* This comment block describes the contents of each field
+ * of the Interrupt Information Table. This table describes
+ * how another node can generate an interrupt to this node.
+ * This information is target board dependent. If the
+ * SHM Driver is in POLLED_MODE, then all fields should
+ * be initialized to NO_INTERRUPT.
+ *
+ * address - The address to which another node should
+ * write to cause an interrupt.
+ * value - The value which must be written
+ * length - The size of the value to write. Valid
+ * values are BYTE, WORD, and LONG.
+ *
+ * NOTE: The Node Status Control Block contains this
+ * information in neutral format and not in a
+ * structure to avoid potential alignment problems.
+ */
+
+typedef struct {
+ vol_u32 *address; /* write here for interrupt */
+ vol_u32 value; /* this value causes interrupt */
+ vol_u32 length; /* for this length (0,1,2,4) */
+} Shm_Interrupt_information;
+
+/* SHM Configuration Table
+ *
+ * This comment block describes the contents of each field
+ * of the SHM Configuration Table.
+ *
+ * base - The base address of the shared memory. This
+ * address may be specific to this node.
+ * length - The length of the shared memory in bytes.
+ * format - The natural format for rtems_unsigned32's in the
+ * shared memory. Valid values are currently
+ * only SHM_LITTLE and SHM_BIG.
+ * convert - The address of the routine which converts
+ * between neutral and local format.
+ * poll_intr - The operational mode of the driver. Some
+ * target boards may not provide hardware for
+ * an interprocessor interrupt. If POLLED_MODE
+ * is selected, the SHM driver will install a
+ * wrapper around the Clock_isr() to poll for
+ * incoming packets. Throughput is dependent
+ * on the time between clock interrupts.
+ * Valid values are POLLED_MODE and INTR_MODE.
+ * cause_intr - This is the address of the routine used to
+ * write to a particular address and cause an
+ * interrupt on another node. This routine
+ * may need to be target dependent if something
+ * other than a normal write from C does not work.
+ * Intr - This structure describes the operation required
+ * to cause an interrupt to this node. The actual
+ * contents of this structure are described above.
+ */
+
+struct shm_config_info {
+ vol_u32 *base; /* base address of SHM */
+ vol_u32 length; /* length (in bytes) of SHM */
+ vol_u32 format; /* SHM is big or little endian */
+ vol_u32 (*convert)();/* neutral conversion routine */
+ vol_u32 poll_intr;/* POLLED or INTR driven mode */
+ void (*cause_intr)( rtems_unsigned32 );
+ Shm_Interrupt_information Intr; /* cause intr information */
+};
+
+typedef struct shm_config_info shm_config_table;
+
+/* global variables */
+
+#ifdef _SHM_INIT
+#define SHM_EXTERN
+#else
+#define SHM_EXTERN extern
+#endif
+
+SHM_EXTERN shm_config_table *Shm_Configuration;
+SHM_EXTERN Shm_Interrupt_information *Shm_Interrupt_table;
+SHM_EXTERN Shm_Node_status_control *Shm_Node_statuses;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Locked_queues;
+SHM_EXTERN Shm_Envelope_control *Shm_Envelopes;
+SHM_EXTERN rtems_configuration_table *Shm_RTEMS_Configuration;
+SHM_EXTERN rtems_multiprocessing_table *Shm_RTEMS_MP_Configuration;
+SHM_EXTERN rtems_unsigned32 Shm_Receive_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Null_message_count;
+SHM_EXTERN rtems_unsigned32 Shm_Interrupt_count;
+SHM_EXTERN rtems_unsigned32 Shm_Local_node;
+SHM_EXTERN Shm_Locked_queue_Control *Shm_Local_receive_queue;
+SHM_EXTERN Shm_Node_status_control *Shm_Local_node_status;
+SHM_EXTERN rtems_unsigned32 Shm_isrstat;
+ /* reported by shmdr */
+
+SHM_EXTERN rtems_unsigned32 Shm_Pending_initialization;
+SHM_EXTERN rtems_unsigned32 Shm_Initialization_complete;
+SHM_EXTERN rtems_unsigned32 Shm_Active_node;
+
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_nodes;
+SHM_EXTERN rtems_unsigned32 Shm_Maximum_envelopes;
+
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_End_of_list;
+SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_Not_on_list;
+
+/* functions */
+
+/* locked queue routines */
+void Shm_Locked_queue_Add(
+ Shm_Locked_queue_Control *, Shm_Envelope_control * );
+Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control * );
+void Shm_Locked_queue_Initialize(
+ Shm_Locked_queue_Control *, rtems_unsigned32 );
+ /* Shm_Initialize_lock is CPU dependent */
+ /* Shm_Lock is CPU dependent */
+ /* Shm_Unlock is CPU dependent */
+
+/* portable routines */
+void Init_env_pool();
+void Shm_Print_statistics( void );
+void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 );
+rtems_task Shm_Cause_interrupt( rtems_unsigned32 );
+void Shm_Poll();
+void Shm_setclockvec();
+void Shm_Convert_packet( rtems_packet_prefix * );
+
+/* CPU specific routines are inlined in shmcpu.h */
+
+/* target specific routines */
+void *Shm_Convert_address( void * );
+void Shm_Get_configuration( rtems_unsigned32, shm_config_table ** );
+void Shm_isr();
+void Shm_setvec( void );
+
+void Shm_Initialize_lock( Shm_Locked_queue_Control * );
+void Shm_Lock( Shm_Locked_queue_Control * );
+void Shm_Unlock( Shm_Locked_queue_Control * );
+
+/* MPCI entry points */
+rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Initialization( void );
+
+rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *
+);
+
+rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32,
+ rtems_packet_prefix *
+);
+
+extern rtems_mpci_table MPCI_table;
+
+#ifdef _SHM_INIT
+
+/* multiprocessor communications interface (MPCI) table */
+
+rtems_mpci_table MPCI_table = {
+ 100000, /* default timeout value in ticks */
+ MAX_PACKET_SIZE, /* maximum packet size */
+ Shm_Initialization, /* initialization procedure */
+ Shm_Get_packet, /* get packet procedure */
+ Shm_Return_packet, /* return packet procedure */
+ Shm_Send_packet, /* packet send procedure */
+ Shm_Receive_packet /* packet receive procedure */
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/libmisc/README b/c/src/libmisc/README
new file mode 100644
index 0000000000..6825898121
--- /dev/null
+++ b/c/src/libmisc/README
@@ -0,0 +1,16 @@
+#
+# $Id$
+#
+
+This directory contains for the "miscellaneous" library. Currently
+the only item in this library is a user extension set which checks
+for a task "blowing" it's stack.
+
+The following ideas have been mentioned for items which could go
+in this library, but this list is not all inclusive:
+
+ + Workspace Consistency Checker
+ + Task Execution Time Monitor
+
+The intent of this library is to provide a home for useful utility routines
+which are dependent upon RTEMS.
diff --git a/c/src/libmisc/assoc/assoc.c b/c/src/libmisc/assoc/assoc.c
new file mode 100644
index 0000000000..74387a8c5b
--- /dev/null
+++ b/c/src/libmisc/assoc/assoc.c
@@ -0,0 +1,260 @@
+/*
+ * assoc.c
+ * rtems assoc routines
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "assoc.h"
+
+#include <stdio.h> /* sprintf */
+#include <string.h> /* strcat, strcmp */
+
+#define STREQ(a,b) (strcmp((a), (b)) == 0)
+#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (strcmp(ap->name, name) == 0)
+ return ap;
+
+ return default_ap;
+}
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->local_value == local_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->remote_value == remote_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+/*
+ * Get values
+ */
+
+unsigned32
+rtems_assoc_remote_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_remote_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+/*
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+
+const char *
+rtems_assoc_name_bad(
+ unsigned32 bad_value
+)
+{
+#ifdef RTEMS_DEBUG
+ static char bad_buffer[32];
+
+ sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
+#else
+ static char bad_buffer[32] = "<assoc.c: BAD NAME>";
+#endif
+ return bad_buffer;
+}
+
+
+const char *
+rtems_assoc_name_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(local_value);
+}
+
+const char *
+rtems_assoc_name_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(remote_value);
+}
+
+/*
+ * Bitfield functions assume just 1 bit set in each of remote and local
+ * entries; they do not check for this.
+ */
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ unsigned32 b;
+ unsigned32 remote_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & local_value)
+ remote_value |= rtems_assoc_remote_by_local(ap, b);
+
+ return remote_value;
+}
+
+
+unsigned32 rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ unsigned32 b;
+ unsigned32 local_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & remote_value)
+ local_value |= rtems_assoc_local_by_remote(ap, b);
+
+ return local_value;
+}
+
+char *
+rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_remote(ap, b));
+ }
+
+ return buffer;
+}
+
+char *
+rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_local(ap, b));
+ }
+
+ return buffer;
+}
diff --git a/c/src/libmisc/assoc/assoc.h b/c/src/libmisc/assoc/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/c/src/libmisc/assoc/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/c/src/libmisc/error/error.c b/c/src/libmisc/error/error.c
new file mode 100644
index 0000000000..5bd481c3e6
--- /dev/null
+++ b/c/src/libmisc/error/error.c
@@ -0,0 +1,209 @@
+/*
+ * report errors and panics to RTEMS' stderr.
+ * Currently just used by RTEMS monitor.
+ *
+ * $Id$
+ */
+
+
+/*
+ * These routines provide general purpose error reporting.
+ * rtems_error reports an error to stderr and allows use of
+ * printf style formatting. A newline is appended to all messages.
+ *
+ * error_flag can be specified as any of the following:
+ *
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * It can also include a rtems_status value which can be OR'd
+ * with the above flags. *
+ *
+ * EXAMPLE
+ * #include <rtems.h>
+ * #include <rtems/error.h>
+ * rtems_error(0, "stray interrupt %d", intr);
+ *
+ * EXAMPLE
+ * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
+ * {
+ * rtems_error(status | RTEMS_ERROR_ABORT,
+ * "could not create task");
+ * }
+ *
+ * EXAMPLE
+ * if ((fd = open(pathname, O_RDNLY)) < 0)
+ * {
+ * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
+ * goto failed;
+ * }
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "error.h"
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h> /* _exit() */
+
+/* bug in hpux <errno.h>: no prototypes unless you are C++ */
+#ifdef hpux9
+char *strerror(int);
+#endif
+
+extern char *rtems_progname;
+int rtems_panic_in_progress;
+
+rtems_assoc_t rtems_status_assoc[] = {
+ { "successful completion", RTEMS_SUCCESSFUL, },
+ { "returned from a thread", RTEMS_TASK_EXITTED, },
+ { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
+ { "invalid object name", RTEMS_INVALID_NAME, },
+ { "invalid object id", RTEMS_INVALID_ID, },
+ { "too many", RTEMS_TOO_MANY, },
+ { "timed out waiting", RTEMS_TIMEOUT, },
+ { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
+ { "specified size was invalid", RTEMS_INVALID_SIZE, },
+ { "address specified is invalid", RTEMS_INVALID_ADDRESS, },
+ { "number was invalid", RTEMS_INVALID_NUMBER, },
+ { "item has not been initialized", RTEMS_NOT_DEFINED, },
+ { "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
+ { "request not satisfied", RTEMS_UNSATISFIED, },
+ { "thread is in wrong state", RTEMS_INCORRECT_STATE, },
+ { "thread already in state", RTEMS_ALREADY_SUSPENDED, },
+ { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
+ { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
+ { "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
+ { "invalid thread priority", RTEMS_INVALID_PRIORITY, },
+ { "invalid date/time", RTEMS_INVALID_CLOCK, },
+ { "invalid node id", RTEMS_INVALID_NODE, },
+ { "directive not configured", RTEMS_NOT_CONFIGURED, },
+ { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
+ { "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
+ { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
+ { "could not get enough memory", RTEMS_NO_MEMORY, },
+ { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
+ { 0, 0, 0 },
+};
+
+
+const char *
+rtems_status_text(
+ rtems_status_code status
+)
+{
+ return rtems_assoc_name_by_local(rtems_status_assoc, status);
+}
+
+
+static int rtems_verror(
+ unsigned32 error_flag,
+ const char *printf_format,
+ va_list arglist
+)
+{
+ int local_errno = 0;
+ int chars_written = 0;
+ rtems_status_code status;
+
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_panic_in_progress++;
+
+ /* disable task switches */
+ _Thread_Disable_dispatch();
+
+ /* don't aggravate things */
+ if (rtems_panic_in_progress > 2)
+ return 0;
+ }
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ status = error_flag & ~RTEMS_ERROR_MASK;
+ if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
+ local_errno = errno;
+
+ if (_System_state_Is_multiprocessing)
+ fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
+
+ if (rtems_progname && *rtems_progname)
+ chars_written += fprintf(stderr, "%s: ", rtems_progname);
+ chars_written += vfprintf(stderr, printf_format, arglist);
+
+ if (status)
+ chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
+
+ if (local_errno)
+ if ((local_errno > 0) && *strerror(local_errno))
+ chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
+ else
+ chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
+
+ chars_written += fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
+ {
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_error(0, "fatal error, exiting");
+ _exit(local_errno);
+ }
+ else
+ {
+ rtems_error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+ return chars_written;
+}
+
+
+/*
+ * Report an error.
+ * error_flag is as above; printf_format is a normal
+ * printf(3) format string, with its concommitant arguments.
+ *
+ * Returns the number of characters written.
+ */
+
+int rtems_error(
+ int error_flag,
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+ int chars_written;
+
+ va_start(arglist, printf_format);
+ chars_written = rtems_verror(error_flag, printf_format, arglist);
+ va_end(arglist);
+
+ return chars_written;
+}
+
+/*
+ * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
+ */
+
+void rtems_panic(
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+
+ va_start(arglist, printf_format);
+ (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
+ va_end(arglist);
+}
diff --git a/c/src/libmisc/error/error.h b/c/src/libmisc/error/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/c/src/libmisc/error/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/c/src/libmisc/monitor/README b/c/src/libmisc/monitor/README
new file mode 100644
index 0000000000..d5a73da140
--- /dev/null
+++ b/c/src/libmisc/monitor/README
@@ -0,0 +1,97 @@
+#
+# $Id$
+#
+
+monitor task
+
+The monitor task is an optional task that knows about RTEMS
+data structures and can print out information about them.
+It is a work-in-progress and needs many more commands, but
+is useful now.
+
+The monitor works best when it is the highest priority task,
+so all your other tasks should ideally be at some priority
+greater than 1.
+
+To use the monitor:
+-------------------
+
+ #include <rtems/monitor.h>
+
+ ...
+
+ rtems_monitor_init(0);
+
+ The parameter to rtems_monitor_init() tells the monitor whether
+ to suspend itself on startup. A value of 0 causes the monitor
+ to immediately enter command mode; a non-zero value causes the
+ monitor to suspend itself after creation and wait for explicit
+ wakeup.
+
+
+ rtems_monitor_wakeup();
+
+ wakes up a suspended monitor and causes it to reenter command mode.
+
+Monitor commands
+----------------
+
+ The monitor prompt is 'rtems> '.
+ Can abbreviate commands to "uniquity"
+ There is a 'help' command. Here is the output from various
+ help commands:
+
+ Commands (may be abbreviated)
+
+ help -- get this message or command specific help
+ task -- show task information
+ queue -- show message queue information
+ symbol -- show entries from symbol table
+ pause -- pause monitor for a specified number of ticks
+ fatal -- invoke a fatal RTEMS error
+
+ task [id [id ...] ]
+ display information about the specified tasks.
+ Default is to display information about all tasks on this node
+
+ queue [id [id ... ] ]
+ display information about the specified message queues
+ Default is to display information about all queues on this node
+
+ symbol [ symbolname [symbolname ... ] ]
+ display value associated with specified symbol.
+ Defaults to displaying all known symbols.
+
+ pause [ticks]
+ monitor goes to "sleep" for specified ticks (default is 1)
+ monitor will resume at end of period or if explicitly awakened
+
+ fatal [status]
+ Invoke 'rtems_fatal_error_occurred' with 'status'
+ (default is RTEMS_INTERNAL_ERROR)
+
+ continue
+ put the monitor to sleep waiting for an explicit wakeup from the
+ program running.
+
+
+Sample output from 'task' command
+---------------------------------
+
+ rtems> task
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES
+ ------------------------------------------------------------------------
+ 00010001 UI1 2 READY P:T:nA NONE15: 0x40606348
+ 00010002 RMON 1 READY nP NONE15: 0x40604110
+
+ 'RMON' is the monitor itself, so we have 1 "user" task.
+ Its modes are P:T:nA which translate to:
+
+ preemptable
+ timesliced
+ no ASRS
+
+ It has no events.
+ It has a notepad value for notepad 15 which is 0x40606348
+ (this is the libc thread state)
+
diff --git a/c/src/libmisc/monitor/mon-command.c b/c/src/libmisc/monitor/mon-command.c
new file mode 100644
index 0000000000..87d31dfa2a
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-command.c
@@ -0,0 +1,187 @@
+/*
+ * Command parsing routines for RTEMS monitor
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * make_argv(cp): token-count
+ * Break up the command line in 'cp' into global argv[] and argc (return
+ * value).
+ */
+
+int
+rtems_monitor_make_argv(
+ char *cp,
+ int *argc_p,
+ char **argv)
+{
+ int argc = 0;
+
+ while ((cp = strtok(cp, " \t\n\r")))
+ {
+ argv[argc++] = cp;
+ cp = (char *) NULL;
+ }
+ argv[argc] = (char *) NULL; /* end of argv */
+
+ return *argc_p = argc;
+}
+
+
+/*
+ * Read and break up a monitor command
+ *
+ * We have to loop on the gets call, since it will return NULL under UNIX
+ * RTEMS when we get a signal (eg: SIGALRM).
+ */
+
+int
+rtems_monitor_command_read(char *command,
+ int *argc,
+ char **argv)
+{
+ extern rtems_configuration_table BSP_Configuration;
+ static char monitor_prompt[32];
+
+ /*
+ * put node number in the prompt if we are multiprocessing
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table == 0)
+ sprintf(monitor_prompt, "%s", MONITOR_PROMPT);
+ else if (rtems_monitor_default_node != rtems_monitor_node)
+ sprintf(monitor_prompt, "%d-%s-%d", rtems_monitor_node, MONITOR_PROMPT, rtems_monitor_default_node);
+ else
+ sprintf(monitor_prompt, "%d-%s", rtems_monitor_node, MONITOR_PROMPT);
+
+#ifdef RTEMS_UNIX
+ /* RTEMS on unix gets so many interrupt system calls this is hosed */
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ while (gets(command) == (char *) 0)
+ ;
+#else
+ do
+ {
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ } while (gets(command) == (char *) 0);
+#endif
+
+ return rtems_monitor_make_argv(command, argc, argv);
+}
+
+/*
+ * Look up a command in a command table
+ *
+ */
+
+rtems_monitor_command_entry_t *
+rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t *table,
+ int argc,
+ char **argv
+)
+{
+ rtems_monitor_command_entry_t *p;
+ rtems_monitor_command_entry_t *abbreviated_match = 0;
+ int abbreviated_matches = 0;
+ char *command;
+ int command_length;
+
+ command = argv[0];
+
+ if ((table == 0) || (command == 0))
+ goto failed;
+
+ command_length = strlen(command);
+
+ for (p = table; p->command; p++)
+ if (STREQ(command, p->command)) /* exact match */
+ goto done;
+ else if (STRNEQ(command, p->command, command_length))
+ {
+ abbreviated_matches++;
+ abbreviated_match = p;
+ }
+
+ /* no perfect match; is there a non-ambigous abbreviated match? */
+ if ( ! abbreviated_match)
+ {
+ printf("Unrecognized command '%s'; try 'help'\n", command);
+ goto failed;
+ }
+
+ if (abbreviated_matches > 1)
+ {
+ printf("Command '%s' is ambiguous; try 'help'\n", command);
+ goto failed;
+ }
+
+ p = abbreviated_match;
+
+done:
+ if (p->command_function == 0)
+ goto failed;
+ return p;
+
+failed:
+ return 0;
+}
+
+void
+rtems_monitor_command_usage(rtems_monitor_command_entry_t *table,
+ char *command_string)
+{
+ rtems_monitor_command_entry_t *help = 0;
+ char *help_command_argv[2];
+
+ /* if first entry in table is a usage, then print it out */
+ if (command_string == 0)
+ {
+ if (STREQ(table->command, "--usage--") && table->usage)
+ help = table;
+ }
+ else
+ {
+ help_command_argv[0] = command_string;
+ help_command_argv[1] = 0;
+ help = rtems_monitor_command_lookup(table, 1, help_command_argv);
+ }
+
+ if (help)
+ printf("%s\n", help->usage);
+}
+
+
+void
+rtems_monitor_help_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_command_entry_t *command;
+
+ command = (rtems_monitor_command_entry_t *) command_arg;
+
+ if (argc == 1)
+ rtems_monitor_command_usage(command, 0);
+ else
+ {
+ for (arg=1; argv[arg]; arg++)
+ rtems_monitor_command_usage(command, argv[arg]);
+ }
+}
diff --git a/c/src/libmisc/monitor/mon-config.c b/c/src/libmisc/monitor/mon-config.c
new file mode 100644
index 0000000000..f5c9f6f093
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-config.c
@@ -0,0 +1,130 @@
+/*
+ * RTEMS Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_config_canonical(
+ rtems_monitor_config_t *canonical_config,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = (rtems_configuration_table *) config_void;
+
+ canonical_config->work_space_start = c->work_space_start;
+ canonical_config->work_space_size = c->work_space_size;
+ canonical_config->maximum_tasks = c->maximum_tasks;
+ canonical_config->maximum_timers = c->maximum_timers;
+ canonical_config->maximum_semaphores = c->maximum_semaphores;
+ canonical_config->maximum_message_queues = c->maximum_message_queues;
+ canonical_config->maximum_partitions = c->maximum_partitions;
+ canonical_config->maximum_regions = c->maximum_regions;
+ canonical_config->maximum_ports = c->maximum_ports;
+ canonical_config->maximum_periods = c->maximum_periods;
+ canonical_config->maximum_extensions = c->maximum_extensions;
+ canonical_config->microseconds_per_tick = c->microseconds_per_tick;
+ canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
+ canonical_config->number_of_initialization_tasks = c->number_of_initialization_tasks;
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_config_next(
+ void *object_info,
+ rtems_monitor_config_t *canonical_config,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_config_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+INITIAL (startup) Configuration Info\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_config_dump(
+ rtems_monitor_config_t *monitor_config,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length = 0;
+ length += printf("WORKSPACE");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("start: 0x%x; size: 0x%x\n",
+ (unsigned32) monitor_config->work_space_start,
+ monitor_config->work_space_size);
+
+ length = 0;
+ length += printf("TIME");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n",
+ monitor_config->microseconds_per_tick,
+ monitor_config->ticks_per_timeslice,
+ 1000000 / monitor_config->microseconds_per_tick);
+
+ length = 0;
+ length += printf("MAXIMUMS");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n",
+ monitor_config->maximum_tasks,
+ monitor_config->maximum_timers,
+ monitor_config->maximum_semaphores,
+ monitor_config->maximum_message_queues,
+ monitor_config->maximum_extensions);
+ length = 0;
+ length += rtems_monitor_pad(CONTCOL, length);
+ length += printf("partitions: %d; regions: %d; ports: %d; periods: %d\n",
+ monitor_config->maximum_partitions,
+ monitor_config->maximum_regions,
+ monitor_config->maximum_ports,
+ monitor_config->maximum_periods);
+}
diff --git a/c/src/libmisc/monitor/mon-dname.c b/c/src/libmisc/monitor/mon-dname.c
new file mode 100644
index 0000000000..e6993e18f7
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-dname.c
@@ -0,0 +1,112 @@
+/*
+ * RTEMS monitor driver names support.
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'dname' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+#include <string.h> /* strncpy() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+void
+rtems_monitor_dname_canonical(
+ rtems_monitor_dname_t *canonical_dname,
+ void *dname_void
+)
+{
+ rtems_driver_name_t *np = (rtems_driver_name_t *) dname_void;
+
+ (void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
+ canonical_dname->major = np->major;
+ canonical_dname->minor = np->minor;
+}
+
+void *
+rtems_monitor_dname_next(
+ void *object_information,
+ rtems_monitor_dname_t *canonical_dname,
+ rtems_id *next_id
+)
+{
+ int n = rtems_get_index(*next_id);
+ rtems_driver_name_t *table = _IO_Driver_name_table;
+ rtems_driver_name_t *np = 0;
+
+/* XXX should we be using _IO_Number_of_devices */
+ for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
+ if (np->device_name)
+ goto done;
+
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+
+done:
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_dname->id = n;
+ canonical_dname->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return np;
+}
+
+void
+rtems_monitor_dname_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major:Minor Name\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_dname_dump(
+ rtems_monitor_dname_t *monitor_dname,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(6, length);
+ length += rtems_monitor_dump_hex(monitor_dname->major);
+ length += printf(":");
+ length += rtems_monitor_dump_hex(monitor_dname->minor);
+
+ length += rtems_monitor_pad(16, length);
+ length += printf("%.*s",
+ (int) sizeof(monitor_dname->name_string),
+ (char *) monitor_dname->name_string);
+
+ length += printf("\n");
+ length = 0;
+}
diff --git a/c/src/libmisc/monitor/mon-driver.c b/c/src/libmisc/monitor/mon-driver.c
new file mode 100644
index 0000000000..d5cff24a19
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-driver.c
@@ -0,0 +1,136 @@
+/*
+ * RTEMS monitor IO (device drivers) support
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'name' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+
+void
+rtems_monitor_driver_canonical(
+ rtems_monitor_driver_t *canonical_driver,
+ void *driver_void
+)
+{
+ rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
+ d->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
+ d->open);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
+ d->close);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
+ d->read);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
+ d->write);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
+ d->control);
+}
+
+
+void *
+rtems_monitor_driver_next(
+ void *object_info,
+ rtems_monitor_driver_t *canonical_driver,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_device_drivers)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_driver->id = n;
+ canonical_driver->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return (void *) (c->Device_driver_table + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_driver_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major Entry points\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_driver_dump(
+ rtems_monitor_driver_t *monitor_driver,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += printf(" %d", monitor_driver->id);
+
+ length += rtems_monitor_pad(13, length);
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
+ length += printf("; control: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("open: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
+ length += printf("; close: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("read: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
+ length += printf("; write: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
+ length += printf("\n");
+ length = 0;
+}
diff --git a/c/src/libmisc/monitor/mon-extension.c b/c/src/libmisc/monitor/mon-extension.c
new file mode 100644
index 0000000000..4afecaa617
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-extension.c
@@ -0,0 +1,98 @@
+/*
+ * RTEMS Monitor extension support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_extension_canonical(
+ rtems_monitor_extension_t *canonical_extension,
+ void *extension_void
+)
+{
+ Extension_Control *rtems_extension = (Extension_Control *) extension_void;
+ rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
+ e->thread_create);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_start,
+ e->thread_start);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_restart,
+ e->thread_restart);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_delete,
+ e->thread_delete);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_tswitch,
+ e->thread_switch);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_begin,
+ e->thread_begin);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_exitted,
+ e->thread_exitted);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_fatal,
+ e->fatal);
+}
+
+void
+rtems_monitor_extension_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the canonical form
+ */
+
+void
+rtems_monitor_extension_dump(
+ rtems_monitor_extension_t *monitor_extension,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_extension->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_extension->name);
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("create: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
+ length += printf("; start: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
+ length += printf("; restart: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("delete: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
+ length += printf("; switch: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
+ length += printf("; begin: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("exitted: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
+ length += printf("; fatal: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
+ length += printf("\n");
+ length = 0;
+ printf("\n");
+}
diff --git a/c/src/libmisc/monitor/mon-itask.c b/c/src/libmisc/monitor/mon-itask.c
new file mode 100644
index 0000000000..5ce4b55270
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-itask.c
@@ -0,0 +1,115 @@
+/*
+ * RTEMS Monitor init task support
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+/*
+ * As above, but just for init tasks
+ */
+void
+rtems_monitor_init_task_canonical(
+ rtems_monitor_init_task_t *canonical_itask,
+ void *itask_void
+)
+{
+ rtems_initialization_tasks_table *rtems_itask = itask_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
+ rtems_itask->entry_point);
+
+ canonical_itask->argument = rtems_itask->argument;
+ canonical_itask->stack_size = rtems_itask->stack_size;
+ canonical_itask->priority = rtems_itask->initial_priority;
+ canonical_itask->modes = rtems_itask->mode_set;
+ canonical_itask->attributes = rtems_itask->attribute_set;
+}
+
+void *
+rtems_monitor_init_task_next(
+ void *object_info,
+ rtems_monitor_init_task_t *canonical_init_task,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_initialization_tasks_table *itask;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_initialization_tasks)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ itask = c->User_initialization_tasks_table + n;
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_init_task->id = n;
+ canonical_init_task->name = itask->name;
+
+ *next_id += 1;
+ return (void *) itask;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_init_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ # NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_init_task_dump(
+ rtems_monitor_init_task_t *monitor_itask,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_decimal(monitor_itask->id);
+
+ length += rtems_monitor_pad(7, length);
+ length += rtems_monitor_dump_name(monitor_itask->name);
+
+ length += rtems_monitor_pad(14, length);
+ length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
+
+ length += rtems_monitor_pad(25, length);
+ length += printf("%d [0x%x]", monitor_itask->argument, monitor_itask->argument);
+
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_priority(monitor_itask->priority);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_modes(monitor_itask->modes);
+
+ length += rtems_monitor_pad(54, length);
+ length += rtems_monitor_dump_attributes(monitor_itask->attributes);
+
+ length += rtems_monitor_pad(66, length);
+ length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);
+
+ printf("\n");
+}
diff --git a/c/src/libmisc/monitor/mon-manager.c b/c/src/libmisc/monitor/mon-manager.c
new file mode 100644
index 0000000000..af8d530d3b
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-manager.c
@@ -0,0 +1,50 @@
+/*
+ * RTEMS Monitor "manager" support.
+ * Used to traverse object (chain) lists and print them out.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+#include <monitor.h>
+
+/*
+ * "next" routine for all objects that are RTEMS manager objects
+ */
+
+void *
+rtems_monitor_manager_next(
+ void *table_void,
+ void *canonical,
+ rtems_id *next_id
+)
+{
+ Objects_Information *table = table_void;
+ rtems_monitor_generic_t *copy;
+ Objects_Control *object = 0;
+ unsigned32 location;
+
+ /*
+ * When we are called, it must be local
+ */
+
+ if ( ! _Objects_Is_local_id(*next_id))
+ goto done;
+
+ object = _Objects_Get_next(table, *next_id, &location, next_id);
+
+ if (object)
+ {
+ copy = (rtems_monitor_generic_t *) canonical;
+ copy->id = object->id;
+ _Objects_Copy_name_raw(object->name, &copy->name, sizeof(copy->name));
+ }
+
+done:
+ return object;
+}
+
diff --git a/c/src/libmisc/monitor/mon-monitor.c b/c/src/libmisc/monitor/mon-monitor.c
new file mode 100644
index 0000000000..a5a3fab131
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-monitor.c
@@ -0,0 +1,517 @@
+/*
+ * RTEMS monitor main body
+ *
+ * TODO:
+ * add stuff to RTEMS api
+ * rtems_get_name(id)
+ * rtems_get_type(id)
+ * rtems_build_id(node, type, num)
+ * Add a command to dump out info about an arbitrary id when
+ * types are added to id's
+ * rtems> id idnum
+ * idnum: node n, object: whatever, id: whatever
+ * allow id's to be specified as n:t:id, where 'n:t' is optional
+ * should have a separate monitor FILE stream (ala the debugger)
+ * remote request/response stuff should be cleaned up
+ * maybe we can use real rpc??
+ * 'info' command to print out:
+ * interrupt stack location, direction and size
+ * floating point config stuff
+ * interrupt config stuff
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/* set by trap handler */
+extern rtems_tcb *debugger_interrupted_task;
+extern rtems_context *debugger_interrupted_task_context;
+extern rtems_unsigned32 debugger_trap;
+
+/*
+ * Various id's for the monitor
+ * They need to be public variables for access by other agencies
+ * such as debugger and remote servers'
+ */
+
+rtems_id rtems_monitor_task_id;
+
+unsigned32 rtems_monitor_node; /* our node number */
+unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * The rtems symbol table
+ */
+
+rtems_symbol_table_t *rtems_monitor_symbols;
+
+/*
+ * The top-level commands
+ */
+
+rtems_monitor_command_entry_t rtems_monitor_commands[] = {
+ { "--usage--",
+ "\n"
+ "RTEMS monitor\n"
+ "\n"
+ "Commands (may be abbreviated)\n"
+ "\n"
+ " help -- get this message or command specific help\n"
+ " pause -- pause monitor for a specified number of ticks\n"
+ " exit -- invoke a fatal RTEMS error\n"
+ " symbol -- show entries from symbol table\n"
+ " continue -- put monitor to sleep waiting for explicit wakeup\n"
+ " config -- show system configuration\n"
+ " itask -- list init tasks\n"
+ " mpci -- list mpci config\n"
+ " task -- show task information\n"
+ " queue -- show message queue information\n"
+ " extension -- user extensions\n"
+ " driver -- show information about named drivers\n"
+ " dname -- show information about named drivers\n"
+ " object -- generic object information\n"
+ " node -- specify default node for commands that take id's\n"
+#ifdef CPU_INVOKE_DEBUGGER
+ " debugger -- invoke system debugger\n"
+#endif
+ ,
+ 0,
+ 0,
+ (unsigned32) rtems_monitor_commands,
+ },
+ { "config",
+ "config\n"
+ " Show the system configuration.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ },
+ { "itask",
+ "itask\n"
+ " List init tasks for the system\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ },
+ { "mpci",
+ "mpci\n"
+ " Show the MPCI system configuration, if configured.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ },
+ { "pause",
+ "pause [ticks]\n"
+ " monitor goes to \"sleep\" for specified ticks (default is 1)\n"
+ " monitor will resume at end of period or if explicitly awakened\n",
+ 0,
+ rtems_monitor_pause_cmd,
+ 0,
+ },
+ { "continue",
+ "continue\n"
+ " put the monitor to sleep waiting for an explicit wakeup from the\n"
+ " program running.\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "go",
+ "go\n"
+ " Alias for 'continue'\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "node",
+ "node [ node number ]\n"
+ " Specify default node number for commands that take id's\n",
+ 0,
+ rtems_monitor_node_cmd,
+ 0,
+ },
+ { "symbol",
+ "symbol [ symbolname [symbolname ... ] ]\n"
+ " display value associated with specified symbol.\n"
+ " Defaults to displaying all known symbols.\n",
+ 0,
+ rtems_monitor_symbol_cmd,
+ (unsigned32) &rtems_monitor_symbols,
+ },
+ { "extension",
+ "extension [id [id ...] ]\n"
+ " display information about specified extensions.\n"
+ " Default is to display information about all extensions on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_EXTENSION,
+ },
+ { "task",
+ "task [id [id ...] ]\n"
+ " display information about the specified tasks.\n"
+ " Default is to display information about all tasks on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_TASK,
+ },
+ { "queue",
+ "queue [id [id ... ] ]\n"
+ " display information about the specified message queues\n"
+ " Default is to display information about all queues on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_QUEUE,
+ },
+ { "object",
+ "object [id [id ...] ]\n"
+ " display information about specified RTEMS objects.\n"
+ " Object id's must include 'type' information.\n"
+ " (which may normally be defaulted)\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INVALID,
+ },
+ { "driver",
+ "driver [ major [ major ... ] ]\n"
+ " Display the RTEMS device driver table.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DRIVER,
+ },
+ { "dname",
+ "dname\n"
+ " Displays information about named drivers.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ },
+ { "exit",
+ "exit [status]\n"
+ " Invoke 'rtems_fatal_error_occurred' with 'status'\n"
+ " (default is RTEMS_SUCCESSFUL)\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL,
+ },
+ { "fatal",
+ "fatal [status]\n"
+ " 'exit' with fatal error; default error is RTEMS_TASK_EXITTED\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_TASK_EXITTED, /* exit value */
+ },
+ { "quit",
+ "quit [status]\n"
+ " Alias for 'exit'\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL, /* exit value */
+ },
+ { "help",
+ "help [ command [ command ] ]\n"
+ " provide information about commands\n"
+ " Default is show basic command summary.\n",
+ 0,
+ rtems_monitor_help_cmd,
+ (unsigned32) rtems_monitor_commands,
+ },
+#ifdef CPU_INVOKE_DEBUGGER
+ { "debugger",
+ "debugger\n"
+ " Enter the debugger, if possible.\n"
+ " A continue from the debugger will return to the monitor.\n",
+ 0,
+ rtems_monitor_debugger_cmd,
+ 0,
+ },
+#endif
+ { 0, 0, 0, 0, 0 },
+};
+
+
+rtems_status_code
+rtems_monitor_suspend(rtems_interval timeout)
+{
+ rtems_event_set event_set;
+ rtems_status_code status;
+
+ status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &event_set);
+ return status;
+}
+
+void
+rtems_monitor_wakeup(void)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT);
+}
+
+void
+rtems_monitor_debugger_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+#ifdef CPU_INVOKE_DEBUGGER
+ CPU_INVOKE_DEBUGGER;
+#endif
+}
+
+void
+rtems_monitor_pause_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_monitor_suspend(1);
+ else
+ rtems_monitor_suspend(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_fatal_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_fatal_error_occurred(command_arg);
+ else
+ rtems_fatal_error_occurred(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_continue_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+}
+
+void
+rtems_monitor_node_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ unsigned32 new_node = rtems_monitor_default_node;
+
+ switch (argc)
+ {
+ case 1: /* no node, just set back to ours */
+ new_node = rtems_monitor_node;
+ break;
+
+ case 2:
+ new_node = strtoul(argv[1], 0, 0);
+ break;
+
+ default:
+ printf("invalid syntax, try 'help node'\n");
+ break;
+ }
+
+ if ((new_node >= 1) &&
+ _Configuration_MP_table &&
+ (new_node <= _Configuration_MP_table->maximum_nodes))
+ rtems_monitor_default_node = new_node;
+}
+
+
+/*
+ * Function: rtems_monitor_symbols_loadup
+ *
+ * Description:
+ * Create and load the monitor's symbol table.
+ * We are reading the output format of 'gnm' which looks like this:
+ *
+ * 400a7068 ? _Rate_monotonic_Information
+ * 400a708c ? _Thread_Dispatch_disable_level
+ * 400a7090 ? _Configuration_Table
+ *
+ * We ignore the type field.
+ *
+ * Side Effects:
+ * Creates and fills in 'rtems_monitor_symbols' table
+ *
+ * TODO
+ * there should be a BSP #define or something like that
+ * to do this; Assuming stdio is crazy.
+ * Someday this should know BFD
+ * Maybe we could get objcopy to just copy the symbol areas
+ * and copy that down.
+ *
+ */
+
+void
+rtems_monitor_symbols_loadup(void)
+{
+ FILE *fp;
+ char buffer[128];
+
+ if (rtems_monitor_symbols)
+ rtems_symbol_table_destroy(rtems_monitor_symbols);
+
+ rtems_monitor_symbols = rtems_symbol_table_create(10);
+ if (rtems_monitor_symbols == 0)
+ return;
+
+ fp = fopen("symbols", "r");
+
+ if (fp == 0)
+ return;
+
+ while (fgets(buffer, sizeof(buffer) - 1, fp))
+ {
+ char *symbol;
+ char *value;
+ char *ignored_type;
+
+ value = strtok(buffer, " \t\n");
+ ignored_type = strtok(0, " \t\n");
+ symbol = strtok(0, " \t\n");
+
+ if (symbol && ignored_type && value)
+ {
+ rtems_symbol_t *sp;
+ sp = rtems_symbol_create(rtems_monitor_symbols,
+ symbol,
+ (rtems_unsigned32) strtoul(value, 0, 16));
+ if (sp == 0)
+ {
+ printf("could not define symbol '%s'\n", symbol);
+ goto done;
+ }
+ }
+ else
+ {
+ printf("parsing error on '%s'\n", buffer);
+ goto done;
+ }
+ }
+
+done:
+}
+
+
+/*
+ * Main monitor command loop
+ */
+
+void
+rtems_monitor_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_tcb *debugee = 0;
+ rtems_context *rp;
+ rtems_context_fp *fp;
+ char command_buffer[513];
+ int argc;
+ char *argv[64];
+ boolean verbose = FALSE;
+
+ if (monitor_flags & RTEMS_MONITOR_SUSPEND)
+ (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+
+ for (;;)
+ {
+ extern rtems_tcb * _Thread_Executing;
+ rtems_monitor_command_entry_t *command;
+
+ debugee = _Thread_Executing;
+ rp = &debugee->Registers;
+ fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */
+
+ if (0 == rtems_monitor_command_read(command_buffer, &argc, argv))
+ continue;
+ if ((command = rtems_monitor_command_lookup(rtems_monitor_commands,
+ argc,
+ argv)) == 0)
+ continue;
+
+ command->command_function(argc, argv, command->command_arg, verbose);
+
+ fflush(stdout);
+ }
+}
+
+
+void
+rtems_monitor_kill(void)
+{
+ if (rtems_monitor_task_id)
+ rtems_task_delete(rtems_monitor_task_id);
+ rtems_monitor_task_id = 0;
+
+ rtems_monitor_server_kill();
+}
+
+void
+rtems_monitor_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ rtems_monitor_kill();
+
+ status = rtems_task_create(RTEMS_MONITOR_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor task");
+ goto done;
+ }
+
+ rtems_monitor_node = rtems_get_node(rtems_monitor_task_id);
+ rtems_monitor_default_node = rtems_monitor_node;
+
+ rtems_monitor_symbols_loadup();
+
+ if (monitor_flags & RTEMS_MONITOR_GLOBAL)
+ rtems_monitor_server_init(monitor_flags);
+
+ /*
+ * Start the monitor task itself
+ */
+
+ status = rtems_task_start(rtems_monitor_task_id,
+ rtems_monitor_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor");
+ goto done;
+ }
+
+done:
+}
diff --git a/c/src/libmisc/monitor/mon-mpci.c b/c/src/libmisc/monitor/mon-mpci.c
new file mode 100644
index 0000000000..5c4d2c2cb3
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-mpci.c
@@ -0,0 +1,159 @@
+/*
+ * RTEMS MPCI Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_mpci_canonical(
+ rtems_monitor_mpci_t *canonical_mpci,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_multiprocessing_table *m;
+ rtems_mpci_table *mt;
+
+ m = c->User_multiprocessing_table;
+ if (m == 0)
+ return;
+ mt = m->User_mpci_table;
+
+ canonical_mpci->node = m->node;
+ canonical_mpci->maximum_nodes = m->maximum_nodes;
+ canonical_mpci->maximum_global_objects = m->maximum_global_objects;
+ canonical_mpci->maximum_proxies = m->maximum_proxies;
+
+ canonical_mpci->default_timeout = mt->default_timeout;
+ canonical_mpci->maximum_packet_size = mt->maximum_packet_size;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->initialization,
+ mt->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->get_packet,
+ mt->get_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->return_packet,
+ mt->return_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->send_packet,
+ mt->send_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet,
+ mt->receive_packet);
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_mpci_next(
+ void *object_info,
+ rtems_monitor_mpci_t *canonical_mpci,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ if ( ! c->User_multiprocessing_table)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_mpci_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ max max max default max\n\
+ node nodes globals proxies timeout pktsize\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_mpci_dump(
+ rtems_monitor_mpci_t *monitor_mpci,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(2, length);
+ length += printf(" %d", monitor_mpci->node);
+ length += rtems_monitor_pad(11, length);
+ length += printf("%d", monitor_mpci->maximum_nodes);
+
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
+
+ length += rtems_monitor_pad(28, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies);
+
+ length += rtems_monitor_pad(37, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->default_timeout);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("get: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose);
+ length += printf("; return: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("send: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose);
+ length += printf("; receive: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose);
+
+ printf("\n");
+ length = 0;
+}
diff --git a/c/src/libmisc/monitor/mon-object.c b/c/src/libmisc/monitor/mon-object.c
new file mode 100644
index 0000000000..0dfc6513d2
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-object.c
@@ -0,0 +1,374 @@
+/*
+ * RTEMS Monitor "object" support.
+ *
+ * Used to traverse object lists and print them out.
+ * An object can be an RTEMS object (chain based stuff) or
+ * a "misc" object such as a device driver.
+ *
+ * Each object has its own file in this directory (eg: extension.c)
+ * That file provides routines to convert a "native" structure
+ * to its canonical form, print a canonical structure, etc.
+ *
+ * TODO:
+ * should allow for non-numeric id's???
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#include <monitor.h>
+
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * add:
+ * next
+ */
+
+rtems_monitor_object_info_t rtems_monitor_object_info[] =
+{
+ { RTEMS_MONITOR_OBJECT_CONFIG,
+ (void *) 0,
+ sizeof(rtems_monitor_config_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_config_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_config_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_config_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_config_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_MPCI,
+ (void *) 0,
+ sizeof(rtems_monitor_mpci_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_mpci_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_mpci_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_mpci_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_mpci_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_INIT_TASK,
+ (void *) 0,
+ sizeof(rtems_monitor_init_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_init_task_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_init_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_init_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_init_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_TASK,
+ (void *) &_RTEMS_tasks_Information,
+ sizeof(rtems_monitor_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_QUEUE,
+ (void *) &_Message_queue_Information,
+ sizeof(rtems_monitor_queue_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_queue_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_queue_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_queue_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_EXTENSION,
+ (void *) &_Extension_Information,
+ sizeof(rtems_monitor_extension_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_extension_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_extension_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_extension_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DRIVER,
+ (void *) 0,
+ sizeof(rtems_monitor_driver_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_driver_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_driver_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_driver_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_driver_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DNAME,
+ /* XXX now that the driver name table is allocated from the */
+ /* XXX Workspace, this does not work */
+ (void *) 0,
+ /* (void *) _IO_Driver_name_table, */
+ sizeof(rtems_monitor_dname_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_dname_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_dname_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_dname_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_dname_dump,
+ },
+};
+
+/*
+ * Allow id's to be specified without the node number or
+ * type for convenience.
+ */
+
+rtems_id
+rtems_monitor_id_fixup(
+ rtems_id id,
+ unsigned32 default_node,
+ rtems_monitor_object_type_t type
+)
+{
+ unsigned32 node;
+
+ node = rtems_get_node(id);
+ if (node == 0)
+ {
+ if (rtems_get_class(id) != OBJECTS_NO_CLASS)
+ type = rtems_get_class(id);
+
+ id = _Objects_Build_id(type, default_node, rtems_get_index(id));
+ }
+ return id;
+}
+
+
+rtems_monitor_object_info_t *
+rtems_monitor_object_lookup(
+ rtems_monitor_object_type_t type
+)
+{
+ rtems_monitor_object_info_t *p;
+ for (p = &rtems_monitor_object_info[0];
+ p < &rtems_monitor_object_info[NUMELEMS(rtems_monitor_object_info)];
+ p++)
+ {
+ if (p->type == type)
+ return p;
+ }
+ return 0;
+}
+
+rtems_id
+rtems_monitor_object_canonical_next_remote(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ rtems_status_code status;
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+
+ /*
+ * Send request
+ */
+
+ request.command = RTEMS_MONITOR_SERVER_CANONICAL;
+ request.argument0 = (unsigned32) type;
+ request.argument1 = (unsigned32) id;
+
+ status = rtems_monitor_server_request(rtems_get_node(id), &request, &response);
+ if (status != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ /*
+ * process response
+ */
+
+ next_id = (rtems_id) response.result0;
+ if (next_id != RTEMS_OBJECT_ID_FINAL)
+ (void) memcpy(canonical, &response.payload, response.result1);
+
+ return next_id;
+
+failed:
+ return RTEMS_OBJECT_ID_FINAL;
+
+}
+
+
+rtems_id
+rtems_monitor_object_canonical_next(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ void *raw_item;
+
+ if ( ! _Objects_Is_local_id(id))
+ next_id = rtems_monitor_object_canonical_next_remote(info->type,
+ id,
+ canonical);
+ else
+ {
+ next_id = id;
+
+ raw_item = (void *) info->next(info->object_information,
+ canonical,
+ &next_id);
+
+ if (raw_item)
+ {
+ info->canonical(canonical, raw_item);
+ _Thread_Enable_dispatch();
+ }
+ }
+ return next_id;
+}
+
+
+/*
+ * this is routine server invokes locally to get the type
+ */
+
+rtems_id
+rtems_monitor_object_canonical_get(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical,
+ unsigned32 *size_p
+)
+{
+ rtems_monitor_object_info_t *info;
+ rtems_id next_id;
+
+ *size_p = 0;
+
+ info = rtems_monitor_object_lookup(type);
+
+ if (info == 0)
+ return RTEMS_OBJECT_ID_FINAL;
+
+ next_id = rtems_monitor_object_canonical_next(info, id, canonical);
+ *size_p = info->size;
+
+ return next_id;
+}
+
+
+void
+rtems_monitor_object_dump_1(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ if ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ /*
+ * If the one we actually got is the one we wanted, then
+ * print it out.
+ * For ones that have an id field, this works fine,
+ * for all others, always dump it out.
+ *
+ * HACK: the way we determine whether there is an id is a hack.
+ *
+ * by the way: the reason we try to not have an id, is that some
+ * of the canonical structures are almost too big for shared
+ * memory driver (eg: mpci)
+ */
+
+ if ((info->next != rtems_monitor_manager_next) ||
+ (id == canonical.generic.id))
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_dump_all(
+ rtems_monitor_object_info_t *info,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ next_id = RTEMS_OBJECT_ID_INITIAL(info->type, rtems_monitor_default_node);
+
+ while ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ next_id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_object_info_t *info = 0;
+ rtems_monitor_object_type_t type = (rtems_monitor_object_type_t) command_arg;
+
+ /* what is the default type? */
+ type = (rtems_monitor_object_type_t) command_arg;
+
+ if (argc == 1)
+ {
+ if (type == RTEMS_MONITOR_OBJECT_INVALID)
+ {
+ printf("A type must be specified to \"dump all\"\n");
+ goto done;
+ }
+
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ rtems_monitor_object_dump_all(info, verbose);
+ }
+ else
+ {
+ unsigned32 default_node = rtems_monitor_default_node;
+ rtems_monitor_object_type_t last_type = RTEMS_MONITOR_OBJECT_INVALID;
+ rtems_id id;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ id = (rtems_id) strtoul(argv[arg], 0, 16);
+ id = rtems_monitor_id_fixup(id, default_node, type);
+ type = (rtems_monitor_object_type_t) rtems_get_class(id);
+
+ /*
+ * Allow the item type to change in the middle
+ * of the command. If the type changes, then
+ * just dump out a new header and keep on going.
+ */
+ if (type != last_type)
+ {
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ }
+
+ if (info == 0)
+ {
+not_found: printf("Invalid or unsupported type %d\n", type);
+ goto done;
+ }
+
+ rtems_monitor_object_dump_1(info, id, verbose);
+
+ default_node = rtems_get_node(id);
+
+ last_type = type;
+ }
+ }
+done:
+}
diff --git a/c/src/libmisc/monitor/mon-prmisc.c b/c/src/libmisc/monitor/mon-prmisc.c
new file mode 100644
index 0000000000..030bd020da
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-prmisc.c
@@ -0,0 +1,254 @@
+/*
+ * Print misc stuff for the monitor dump routines
+ * Each routine returns the number of characters it output.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <ctype.h>
+
+void
+rtems_monitor_separator(void)
+{
+ printf("------------------------------------------------------------------------------\n");
+}
+
+unsigned32
+rtems_monitor_pad(
+ unsigned32 destination_column,
+ unsigned32 current_column
+)
+{
+ int pad_length;
+
+ if (destination_column <= current_column)
+ pad_length = 1;
+ else
+ pad_length = destination_column - current_column;
+
+ return printf("%*s", pad_length, "");
+}
+
+unsigned32
+rtems_monitor_dump_char(rtems_unsigned8 ch)
+{
+ if (isprint(ch))
+ return printf("%c", ch);
+ else
+ return printf("%02x", ch);
+}
+
+unsigned32
+rtems_monitor_dump_decimal(unsigned32 num)
+{
+ return printf("%4d", num);
+}
+
+unsigned32
+rtems_monitor_dump_hex(unsigned32 num)
+{
+ return printf("0x%x", num);
+}
+
+unsigned32
+rtems_monitor_dump_assoc_bitfield(
+ rtems_assoc_t *ap,
+ char *separator,
+ unsigned32 value
+ )
+{
+ unsigned32 b;
+ unsigned32 length = 0;
+ const char *name;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (length)
+ length += printf("%s", separator);
+
+ name = rtems_assoc_name_by_local(ap, b);
+
+ if (name)
+ length += printf("%s", name);
+ else
+ length += printf("0x%x", b);
+ }
+
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_id(rtems_id id)
+{
+ return printf("%08x", id);
+}
+
+unsigned32
+rtems_monitor_dump_name(rtems_name name)
+{
+ int i;
+ unsigned32 length = 0;
+ union {
+ unsigned32 ui;
+ char c[4];
+ } u;
+
+ u.ui = (rtems_unsigned32) name;
+
+ for (i=0; i<sizeof(u.c); i++)
+ length += rtems_monitor_dump_char(u.c[i]);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_priority(rtems_task_priority priority)
+{
+ return printf("%3d", priority);
+}
+
+
+rtems_assoc_t rtems_monitor_state_assoc[] = {
+ { "DORM", STATES_DORMANT },
+ { "SUSP", STATES_SUSPENDED },
+ { "TRANS", STATES_TRANSIENT },
+ { "DELAY", STATES_DELAYING },
+ { "Wbuf", STATES_WAITING_FOR_BUFFER },
+ { "Wseg", STATES_WAITING_FOR_SEGMENT },
+ { "Wmsg" , STATES_WAITING_FOR_MESSAGE },
+ { "Wevnt", STATES_WAITING_FOR_EVENT },
+ { "Wsem", STATES_WAITING_FOR_SEMAPHORE },
+ { "Wtime", STATES_WAITING_FOR_TIME },
+ { "Wrpc", STATES_WAITING_FOR_RPC_REPLY },
+ { "WRATE", STATES_WAITING_FOR_PERIOD },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_state(States_Control state)
+{
+ unsigned32 length = 0;
+
+ if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */
+ length += printf("READY");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
+ ":",
+ state);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_attribute_assoc[] = {
+ { "FL", RTEMS_FLOATING_POINT },
+ { "GL", RTEMS_GLOBAL },
+ { "PR", RTEMS_PRIORITY },
+ { "BI", RTEMS_BINARY_SEMAPHORE },
+ { "IN", RTEMS_INHERIT_PRIORITY },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_attributes(rtems_attribute attributes)
+{
+ unsigned32 length = 0;
+
+ if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */
+ length += printf("DEFAULT");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
+ ":",
+ attributes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_modes_assoc[] = {
+ { "nP", RTEMS_NO_PREEMPT },
+ { "T", RTEMS_TIMESLICE },
+ { "nA", RTEMS_NO_ASR },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_modes(rtems_mode modes)
+{
+ unsigned32 length = 0;
+
+ if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */
+ length += printf("P:T:nA");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
+ ":",
+ modes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_events_assoc[] = {
+ { "0", RTEMS_EVENT_0 },
+ { "1", RTEMS_EVENT_1 },
+ { "2", RTEMS_EVENT_2 },
+ { "3", RTEMS_EVENT_3 },
+ { "4", RTEMS_EVENT_4 },
+ { "5", RTEMS_EVENT_5 },
+ { "6", RTEMS_EVENT_6 },
+ { "7", RTEMS_EVENT_7 },
+ { "8", RTEMS_EVENT_8 },
+ { "9", RTEMS_EVENT_9 },
+ { "10", RTEMS_EVENT_10 },
+ { "11", RTEMS_EVENT_11 },
+ { "12", RTEMS_EVENT_12 },
+ { "13", RTEMS_EVENT_13 },
+ { "14", RTEMS_EVENT_14 },
+ { "15", RTEMS_EVENT_15 },
+ { "16", RTEMS_EVENT_16 },
+ { "17", RTEMS_EVENT_17 },
+ { "18", RTEMS_EVENT_18 },
+ { "19", RTEMS_EVENT_19 },
+ { "20", RTEMS_EVENT_20 },
+ { "21", RTEMS_EVENT_21 },
+ { "22", RTEMS_EVENT_22 },
+ { "23", RTEMS_EVENT_23 },
+ { "24", RTEMS_EVENT_24 },
+ { "25", RTEMS_EVENT_25 },
+ { "26", RTEMS_EVENT_26 },
+ { "27", RTEMS_EVENT_27 },
+ { "28", RTEMS_EVENT_28 },
+ { "29", RTEMS_EVENT_29 },
+ { "30", RTEMS_EVENT_30 },
+ { "31", RTEMS_EVENT_31 },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_events(rtems_event_set events)
+{
+ unsigned32 length = 0;
+
+ if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */
+ length += printf("NONE");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
+ ":",
+ events);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_notepad(unsigned32 *notepad)
+{
+ unsigned32 length = 0;
+ int i;
+
+ for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++)
+ if (notepad[i])
+ length += printf("%d: 0x%x ", i, notepad[i]);
+
+ return length;
+}
diff --git a/c/src/libmisc/monitor/mon-queue.c b/c/src/libmisc/monitor/mon-queue.c
new file mode 100644
index 0000000000..08c1d9474e
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-queue.c
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_queue_canonical(
+ rtems_monitor_queue_t *canonical_queue,
+ void *queue_void
+)
+{
+ Message_queue_Control *rtems_queue = (Message_queue_Control *) queue_void;
+
+ canonical_queue->attributes = rtems_queue->attribute_set;
+ canonical_queue->maximum_message_size = rtems_queue->message_queue.maximum_message_size;
+ canonical_queue->maximum_pending_messages = rtems_queue->message_queue.maximum_pending_messages;
+ canonical_queue->number_of_pending_messages = rtems_queue->message_queue.number_of_pending_messages;
+}
+
+void
+rtems_monitor_queue_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME ATTRIBUTES PEND MAXPEND MAXSIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the "next" queue indicated by 'id'.
+ * Returns next one to check.
+ * Returns RTEMS_OBJECT_ID_FINAL when all done
+ */
+
+void
+rtems_monitor_queue_dump(
+ rtems_monitor_queue_t *monitor_queue,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_queue->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_queue->name);
+ length += rtems_monitor_pad(19, length);
+ length += rtems_monitor_dump_attributes(monitor_queue->attributes);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->number_of_pending_messages);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_pending_messages);
+ length += rtems_monitor_pad(48, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size);
+
+ printf("\n");
+}
diff --git a/c/src/libmisc/monitor/mon-server.c b/c/src/libmisc/monitor/mon-server.c
new file mode 100644
index 0000000000..cc26718c27
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-server.c
@@ -0,0 +1,302 @@
+/*
+ * RTEMS monitor server (handles requests for info from RTEMS monitors
+ * running on other nodes)
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/*
+ * Various id's for the server
+ */
+
+rtems_id rtems_monitor_server_task_id;
+rtems_id rtems_monitor_server_request_queue_id; /* our server */
+rtems_id *rtems_monitor_server_request_queue_ids; /* all servers */
+rtems_id rtems_monitor_server_response_queue_id; /* our server */
+
+
+/*
+ * Send a request to a server task
+ */
+
+rtems_status_code
+rtems_monitor_server_request(
+ unsigned32 server_node,
+ rtems_monitor_server_request_t *request,
+ rtems_monitor_server_response_t *response
+)
+{
+ rtems_id server_id;
+ rtems_status_code status;
+ unsigned32 size;
+
+ /*
+ * What is id of monitor on target node?
+ * Look it up if we don't know it yet.
+ */
+
+ server_id = rtems_monitor_server_request_queue_ids[server_node];
+ if (server_id == 0)
+ {
+ status = rtems_message_queue_ident(RTEMS_MONITOR_QUEUE_NAME,
+ server_node,
+ &server_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "ident of remote server failed");
+ goto done;
+ }
+
+ rtems_monitor_server_request_queue_ids[server_node] = server_id;
+ }
+
+ request->return_id = rtems_monitor_server_response_queue_id;
+
+ status = rtems_message_queue_send(server_id, request, sizeof(*request));
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server request send failed");
+ goto done;
+ }
+
+ /*
+ * Await response, if requested
+ */
+
+ if (response)
+ {
+ status = rtems_message_queue_receive(rtems_monitor_server_response_queue_id,
+ response,
+ &size,
+ RTEMS_WAIT,
+ 100);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "server did not respond");
+
+ /* maybe server task was restarted; look it up again next time */
+ rtems_monitor_server_request_queue_ids[server_node] = 0;
+
+ goto done;
+ }
+
+ if (response->command != RTEMS_MONITOR_SERVER_RESPONSE)
+ {
+ status = RTEMS_INCORRECT_STATE;
+ goto done;
+ }
+ }
+
+done:
+ return status;
+}
+
+
+
+/*
+ * monitor server task
+ */
+
+void
+rtems_monitor_server_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+ rtems_status_code status;
+ unsigned32 size;
+
+ for (;;)
+ {
+ status = rtems_message_queue_receive(
+ rtems_monitor_server_request_queue_id,
+ &request,
+ &size,
+ RTEMS_WAIT,
+ (rtems_interval) 0);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server msg queue receive error");
+ goto failed;
+ }
+
+ if (size != sizeof(request))
+ {
+ rtems_error(0, "monitor server bad size on receive");
+ goto failed;
+ }
+
+ switch (request.command)
+ {
+ case RTEMS_MONITOR_SERVER_CANONICAL:
+ {
+ rtems_monitor_object_type_t object_type;
+ rtems_id id;
+ rtems_id next_id;
+
+ object_type = (rtems_monitor_object_type_t) request.argument0;
+ id = (rtems_id) request.argument1;
+ next_id = rtems_monitor_object_canonical_get(object_type,
+ id,
+ &response.payload,
+ &size);
+
+ response.command = RTEMS_MONITOR_SERVER_RESPONSE;
+ response.result0 = next_id;
+ response.result1 = size;
+
+#define SERVER_OVERHEAD (RTEMS_offsetof(rtems_monitor_server_response_t, \
+ payload))
+
+ status = rtems_message_queue_send(request.return_id,
+ &response,
+ size + SERVER_OVERHEAD);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "response send failed");
+ goto failed;
+ }
+ break;
+ }
+
+ default:
+ {
+ rtems_error(0, "invalid command to monitor server: %d", request.command);
+ goto failed;
+ }
+ }
+ }
+
+failed:
+ rtems_task_delete(RTEMS_SELF);
+}
+
+
+/*
+ * Kill off any old server
+ * Not sure if this is useful, but it doesn't help
+ */
+
+void
+rtems_monitor_server_kill(void)
+{
+ if (rtems_monitor_server_task_id)
+ rtems_task_delete(rtems_monitor_server_task_id);
+ rtems_monitor_task_id = 0;
+
+ if (rtems_monitor_server_request_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_request_queue_id);
+ rtems_monitor_server_response_queue_id = 0;
+
+ if (rtems_monitor_server_response_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_response_queue_id);
+ rtems_monitor_server_request_queue_ids = 0;
+
+ if (rtems_monitor_server_request_queue_ids)
+ free(rtems_monitor_server_request_queue_ids);
+ rtems_monitor_server_request_queue_ids = 0;
+}
+
+
+void
+rtems_monitor_server_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ if (_System_state_Is_multiprocessing &&
+ (_Configuration_MP_table->maximum_nodes > 1))
+ {
+ unsigned32 maximum_nodes = _Configuration_MP_table->maximum_nodes;
+
+ /*
+ * create the msg que our server will listen
+ * Since we only get msgs from other RTEMS monitors, we just
+ * need reserve space for 1 msg from each node.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_QUEUE_NAME,
+ maximum_nodes,
+ sizeof(rtems_monitor_server_request_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_request_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server message queue");
+ goto done;
+ }
+
+ /*
+ * create the msg que our responses will come on
+ * Since monitor just does one thing at a time, we only need 1 item
+ * message queue.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_RESPONSE_QUEUE_NAME,
+ 1, /* depth */
+ sizeof(rtems_monitor_server_response_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_response_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor response message queue");
+ goto done;
+ }
+
+ /* need an id for queue of each other server we might talk to */
+ /* indexed by node, so add 1 to maximum_nodes */
+ rtems_monitor_server_request_queue_ids =
+ (rtems_id *) malloc((maximum_nodes + 1) * sizeof(rtems_id));
+ (void) memset(rtems_monitor_server_request_queue_ids,
+ 0,
+ (maximum_nodes + 1) * sizeof(rtems_id));
+
+ rtems_monitor_server_request_queue_ids[rtems_monitor_node] =
+ rtems_monitor_server_request_queue_id;
+
+ /*
+ * create the server task
+ */
+ status = rtems_task_create(RTEMS_MONITOR_SERVER_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_server_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server task");
+ goto done;
+ }
+
+ /*
+ * Start the server task
+ */
+ status = rtems_task_start(rtems_monitor_server_task_id,
+ rtems_monitor_server_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor server");
+ goto done;
+ }
+ }
+
+done:
+}
diff --git a/c/src/libmisc/monitor/mon-symbols.c b/c/src/libmisc/monitor/mon-symbols.c
new file mode 100644
index 0000000000..6c6589d38f
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-symbols.c
@@ -0,0 +1,481 @@
+/*
+ * File: symbols.c
+ *
+ * Description:
+ * Symbol table manager for the RTEMS monitor.
+ * These routines may be used by other system resources also.
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "monitor.h"
+#include "symbols.h"
+
+
+rtems_symbol_table_t *
+rtems_symbol_table_create()
+{
+ rtems_symbol_table_t *table;
+
+ table = (rtems_symbol_table_t *) malloc(sizeof(rtems_symbol_table_t));
+ memset((void *) table, 0, sizeof(*table));
+
+ table->growth_factor = 30; /* 30 percent */
+
+ return table;
+}
+
+void
+rtems_symbol_table_destroy(rtems_symbol_table_t *table)
+{
+ rtems_symbol_string_block_t *p, *pnext;
+
+ if (table)
+ {
+ if (table->addresses)
+ (void) free(table->addresses);
+ table->addresses = 0;
+ p = table->string_buffer_head;
+ while (p)
+ {
+ pnext = p->next;
+ free(p);
+ p = pnext;
+ }
+ table->string_buffer_head = 0;
+ table->string_buffer_current = 0;
+
+ free(table);
+ }
+}
+
+rtems_symbol_t *
+rtems_symbol_create(
+ rtems_symbol_table_t *table,
+ char *name,
+ rtems_unsigned32 value
+ )
+{
+ int symbol_length;
+ size_t newsize;
+ rtems_symbol_t *sp;
+
+ symbol_length = strlen(name) + 1; /* include '\000' in length */
+
+ /* need to grow the table? */
+ if (table->next >= table->size)
+ {
+ if (table->size == 0)
+ newsize = 100;
+ else
+ newsize = table->size + (table->size / (100 / table->growth_factor));
+
+ table->addresses = (rtems_symbol_t *) realloc((void *) table->addresses, newsize * sizeof(rtems_symbol_t));
+ if (table->addresses == 0) /* blew it; lost orig */
+ goto failed;
+ table->size = newsize;
+ }
+
+ sp = &table->addresses[table->next];
+ sp->value = value;
+
+ /* Have to add it to string pool */
+ /* need to grow pool? */
+
+ if ((table->string_buffer_head == 0) ||
+ (table->strings_next + symbol_length) >= SYMBOL_STRING_BLOCK_SIZE)
+ {
+ rtems_symbol_string_block_t *p;
+
+ p = (rtems_symbol_string_block_t *) malloc(sizeof(rtems_symbol_string_block_t));
+ if (p == 0)
+ goto failed;
+ p->next = 0;
+ if (table->string_buffer_head == 0)
+ table->string_buffer_head = p;
+ else
+ table->string_buffer_current->next = p;
+ table->string_buffer_current = p;
+
+ table->strings_next = 0;
+ }
+
+ sp->name = table->string_buffer_current->buffer + table->strings_next;
+ (void) strcpy(sp->name, name);
+
+ table->strings_next += symbol_length;
+ table->sorted = 0;
+ table->next++;
+
+ return sp;
+
+/* XXX Not sure what to do here. We've possibly destroyed the initial
+ symbol table due to realloc failure */
+failed:
+ return 0;
+}
+
+/*
+ * Qsort entry point for compare by address
+ */
+
+static int
+rtems_symbol_compare(const void *e1,
+ const void *e2)
+{
+ rtems_symbol_t *s1, *s2;
+ s1 = (rtems_symbol_t *) e1;
+ s2 = (rtems_symbol_t *) e2;
+
+ if (s1->value < s2->value)
+ return -1;
+ if (s1->value > s2->value)
+ return 1;
+ return 0;
+}
+
+
+/*
+ * Sort the symbol table using qsort
+ */
+
+static void
+rtems_symbol_sort(rtems_symbol_table_t *table)
+{
+ qsort((void *) table->addresses, (size_t) table->next,
+ sizeof(rtems_symbol_t), rtems_symbol_compare);
+ table->sorted = 1;
+}
+
+
+/*
+ * Search the symbol table by address
+ * This code based on CYGNUS newlib bsearch, but changed
+ * to allow for finding closest symbol <= key
+ */
+
+rtems_symbol_t *
+rtems_symbol_value_lookup(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ rtems_symbol_t *sp;
+ rtems_symbol_t *base;
+ rtems_symbol_t *best = 0;
+ rtems_unsigned32 distance;
+ rtems_unsigned32 best_distance = ~0;
+ rtems_unsigned32 elements;
+
+ if (table == 0)
+ table = rtems_monitor_symbols;
+
+ if ((table == 0) || (table->size == 0))
+ return 0;
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ base = table->addresses;
+ elements = table->next;
+
+ while (elements)
+ {
+ sp = base + (elements / 2);
+ if (value < sp->value)
+ elements /= 2;
+ else if (value > sp->value)
+ {
+ distance = value - sp->value;
+ if (distance < best_distance)
+ {
+ best_distance = distance;
+ best = sp;
+ }
+ base = sp + 1;
+ elements = (elements / 2) - (elements % 2 ? 0 : 1);
+ }
+ else
+ return sp;
+ }
+
+ if (value == base->value)
+ return base;
+
+ return best;
+}
+
+/*
+ * Search the symbol table for the exact matching address.
+ * If the symbol table has already been sorted, then
+ * call the regular symbol value lookup, however, it it
+ * has not yet been sorted, search it sequentially.
+ * This routine is primarily used for low level symbol
+ * lookups (eg. from exception handler and interrupt routines)
+ * where the penality of sorted is not wanted and where
+ * an exact match is needed such that symbol table order
+ * is not important.
+ */
+const rtems_symbol_t *
+rtems_symbol_value_lookup_exact(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ if (table->sorted)
+ {
+ sp = rtems_symbol_value_lookup(table, value);
+ if ( rtems_symbol_value(sp) == value )
+ return sp;
+ else
+ return NULL; /* not an exact match */
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( sp->value == value )
+ return sp;
+ }
+
+ return NULL;
+
+}
+
+
+/*
+ * Search the symbol table by string name (case independent)
+ */
+
+rtems_symbol_t *
+rtems_symbol_name_lookup(
+ rtems_symbol_table_t *table,
+ char *name
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( strcasecmp(sp->name, name) == 0 )
+ return sp;
+ }
+
+ return NULL;
+}
+
+void *
+rtems_monitor_symbol_next(
+ void *object_info,
+ rtems_monitor_symbol_t *canonical,
+ rtems_id *next_id
+)
+{
+ rtems_symbol_table_t *table;
+ int n = rtems_get_index(*next_id);
+
+ table = *(rtems_symbol_table_t **) object_info;
+ if (table == 0)
+ goto failed;
+
+ if (n >= table->next)
+ goto failed;
+
+ /* NOTE: symbols do not have id and name fields */
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) (table->addresses + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+void
+rtems_monitor_symbol_canonical(
+ rtems_monitor_symbol_t *canonical_symbol,
+ rtems_symbol_t *sp
+)
+{
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = 0;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+}
+
+
+void
+rtems_monitor_symbol_canonical_by_name(
+ rtems_monitor_symbol_t *canonical_symbol,
+ char *name
+)
+{
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_name_lookup(0, name);
+
+ canonical_symbol->value = sp ? sp->value : 0;
+
+ strncpy(canonical_symbol->name, name, sizeof(canonical_symbol->name));
+ canonical_symbol->offset = 0;
+}
+
+void
+rtems_monitor_symbol_canonical_by_value(
+ rtems_monitor_symbol_t *canonical_symbol,
+ void *value_void_p
+)
+{
+ unsigned32 value = (unsigned32) value_void_p;
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_value_lookup(0, value);
+ if (sp)
+ {
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = value - sp->value;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+ }
+ else
+ {
+ canonical_symbol->value = value;
+ canonical_symbol->offset = 0;
+ canonical_symbol->name[0] = '\0';
+ }
+}
+
+
+unsigned32
+rtems_monitor_symbol_dump(
+ rtems_monitor_symbol_t *canonical_symbol,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ /*
+ * print the name if it exists AND if value is non-zero
+ * Ie: don't print some garbage symbol for address 0
+ */
+
+ if (canonical_symbol->name[0] && (canonical_symbol->value != 0))
+ {
+ if (canonical_symbol->offset == 0)
+ length += printf("%.*s",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name);
+ else
+ length += printf("<%.*s+0x%x>",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name,
+ canonical_symbol->offset);
+ if (verbose)
+ length += printf(" [0x%x]", canonical_symbol->value);
+ }
+ else
+ length += printf("[0x%x]", canonical_symbol->value);
+
+ return length;
+}
+
+
+void
+rtems_monitor_symbol_dump_all(
+ rtems_symbol_table_t *table,
+ boolean verbose
+)
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ rtems_monitor_symbol_canonical(&canonical_symbol, sp);
+ rtems_monitor_symbol_dump(&canonical_symbol, TRUE);
+ printf("\n");
+ }
+}
+
+
+/*
+ * 'symbol' command
+ */
+
+void
+rtems_monitor_symbol_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_symbol_table_t *table;
+
+ table = *(rtems_symbol_table_t **) command_arg;
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ /*
+ * Use object command to dump out whole symbol table
+ */
+ if (argc == 1)
+ rtems_monitor_symbol_dump_all(table, verbose);
+ else
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]);
+ rtems_monitor_symbol_dump(&canonical_symbol, verbose);
+ printf("\n");
+ }
+ }
+}
diff --git a/c/src/libmisc/monitor/mon-task.c b/c/src/libmisc/monitor/mon-task.c
new file mode 100644
index 0000000000..b1a7938eb5
--- /dev/null
+++ b/c/src/libmisc/monitor/mon-task.c
@@ -0,0 +1,92 @@
+/*
+ * RTEMS Monitor task support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_task_canonical(
+ rtems_monitor_task_t *canonical_task,
+ void *thread_void
+)
+{
+ Thread_Control *rtems_thread = (Thread_Control *) thread_void;
+ RTEMS_API_Control *api;
+
+ api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ canonical_task->entry = rtems_thread->Start.entry_point;
+ canonical_task->argument = rtems_thread->Start.numeric_argument;
+ canonical_task->stack = rtems_thread->Start.Initial_stack.area;
+ canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
+ canonical_task->priority = rtems_thread->current_priority;
+ canonical_task->state = rtems_thread->current_state;
+ canonical_task->wait_id = rtems_thread->Wait.id;
+ canonical_task->events = api->pending_events;
+
+/* XXX modes and attributes only exist in the RTEMS API .. */
+/* XXX not directly in the core thread.. they will have to be derived */
+/* XXX if they are important enough to include anymore. */
+ canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
+ canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
+ (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
+/* XXX more to fix */
+/*
+ (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
+*/
+}
+
+
+void
+rtems_monitor_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_task_dump(
+ rtems_monitor_task_t *monitor_task,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_id(monitor_task->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_task->name);
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_priority(monitor_task->priority);
+ length += rtems_monitor_pad(24, length);
+ length += rtems_monitor_dump_state(monitor_task->state);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_modes(monitor_task->modes);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_events(monitor_task->events);
+ if (monitor_task->wait_id)
+ {
+ length += rtems_monitor_pad(47, length);
+ length += rtems_monitor_dump_id(monitor_task->wait_id);
+ length += rtems_monitor_pad(57, length);
+ length += rtems_monitor_dump_hex(monitor_task->wait_args);
+ }
+
+ length += rtems_monitor_pad(65, length);
+ length += rtems_monitor_dump_notepad(monitor_task->notepad);
+ printf("\n");
+}
+
diff --git a/c/src/libmisc/monitor/monitor.h b/c/src/libmisc/monitor/monitor.h
new file mode 100644
index 0000000000..8a86b2c7d0
--- /dev/null
+++ b/c/src/libmisc/monitor/monitor.h
@@ -0,0 +1,443 @@
+/*
+ * File: monitor.h
+ *
+ * Description:
+ * The RTEMS monitor task include file.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef __MONITOR_H
+#define __MONITOR_H
+
+#include "symbols.h"
+#include <rtems/error.h> /* rtems_error() */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Monitor types are derived from rtems object classes
+ */
+
+typedef enum {
+ RTEMS_MONITOR_OBJECT_INVALID = OBJECTS_NO_CLASS,
+ RTEMS_MONITOR_OBJECT_TASK = OBJECTS_RTEMS_TASKS,
+ RTEMS_MONITOR_OBJECT_EXTENSION = OBJECTS_RTEMS_EXTENSIONS,
+ RTEMS_MONITOR_OBJECT_QUEUE = OBJECTS_RTEMS_MESSAGE_QUEUES,
+ RTEMS_MONITOR_OBJECT_SEMAPHORE = OBJECTS_RTEMS_SEMAPHORES,
+ RTEMS_MONITOR_OBJECT_PARTITION = OBJECTS_RTEMS_PARTITIONS,
+ RTEMS_MONITOR_OBJECT_REGION = OBJECTS_RTEMS_REGIONS,
+ RTEMS_MONITOR_OBJECT_PORT = OBJECTS_RTEMS_PORTS,
+
+ /* following monitor objects are not known to RTEMS, but
+ * we like to have "types" for them anyway */
+
+ RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_CLASSES_LAST+1,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ RTEMS_MONITOR_OBJECT_SYMBOL,
+} rtems_monitor_object_type_t;
+
+/*
+ * rtems_monitor_init() flags
+ */
+
+#define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */
+#define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */
+
+
+/*
+ * Public interfaces for RTEMS data structures monitor is aware of.
+ * These are only used by the monitor.
+ *
+ * NOTE:
+ * All the canonical objects that correspond to RTEMS managed "objects"
+ * must have an identical first portion with 'id' and 'name' fields.
+ *
+ * Others do not have that restriction, even tho we would like them to.
+ * This is because some of the canonical structures are almost too big
+ * for shared memory driver (eg: mpci) and we are nickel and diming it.
+ */
+
+/*
+ * Type of a pointer that may be a symbol
+ */
+
+#define MONITOR_SYMBOL_LEN 20
+typedef struct {
+ char name[MONITOR_SYMBOL_LEN];
+ unsigned32 value;
+ unsigned32 offset;
+} rtems_monitor_symbol_t;
+
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+} rtems_monitor_generic_t;
+
+/*
+ * Task
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ Thread_Entry entry;
+ unsigned32 argument;
+ void *stack;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ States_Control state;
+ rtems_event_set events;
+ rtems_mode modes;
+ rtems_attribute attributes;
+ unsigned32 notepad[RTEMS_NUMBER_NOTEPADS];
+ rtems_id wait_id;
+ unsigned32 wait_args;
+} rtems_monitor_task_t;
+
+/*
+ * Init task
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id */
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t entry;
+ unsigned32 argument;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ rtems_mode modes;
+ rtems_attribute attributes;
+} rtems_monitor_init_task_t;
+
+
+/*
+ * Message queue
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_attribute attributes;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_pending_messages;
+ unsigned32 maximum_message_size;
+} rtems_monitor_queue_t;
+
+/*
+ * Extension
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t e_create;
+ rtems_monitor_symbol_t e_start;
+ rtems_monitor_symbol_t e_restart;
+ rtems_monitor_symbol_t e_delete;
+ rtems_monitor_symbol_t e_tswitch;
+ rtems_monitor_symbol_t e_begin;
+ rtems_monitor_symbol_t e_exitted;
+ rtems_monitor_symbol_t e_fatal;
+} rtems_monitor_extension_t;
+
+/*
+ * Device driver
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id (should be tho) */
+ rtems_name name; /* ditto */
+ /* end of common portion */
+ rtems_monitor_symbol_t initialization; /* initialization procedure */
+ rtems_monitor_symbol_t open; /* open request procedure */
+ rtems_monitor_symbol_t close; /* close request procedure */
+ rtems_monitor_symbol_t read; /* read request procedure */
+ rtems_monitor_symbol_t write; /* write request procedure */
+ rtems_monitor_symbol_t control; /* special functions procedure */
+} rtems_monitor_driver_t;
+
+typedef struct {
+ rtems_id id; /* not used for drivers (yet) */
+ rtems_name name; /* not used for drivers (yet) */
+ /* end of common portion */
+ unsigned32 major;
+ unsigned32 minor;
+ char name_string[64];
+} rtems_monitor_dname_t;
+
+/*
+ * System config
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+} rtems_monitor_config_t;
+
+/*
+ * MPCI config
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ rtems_monitor_symbol_t initialization;
+ rtems_monitor_symbol_t get_packet;
+ rtems_monitor_symbol_t return_packet;
+ rtems_monitor_symbol_t send_packet;
+ rtems_monitor_symbol_t receive_packet;
+} rtems_monitor_mpci_t;
+
+/*
+ * The generic canonical information union
+ */
+
+typedef union {
+ rtems_monitor_generic_t generic;
+ rtems_monitor_task_t task;
+ rtems_monitor_queue_t queue;
+ rtems_monitor_extension_t extension;
+ rtems_monitor_driver_t driver;
+ rtems_monitor_dname_t dname;
+ rtems_monitor_config_t config;
+ rtems_monitor_mpci_t mpci;
+ rtems_monitor_init_task_t itask;
+} rtems_monitor_union_t;
+
+/*
+ * Support for talking to other monitors
+ */
+
+/*
+ * Names of other monitors
+ */
+
+#define RTEMS_MONITOR_NAME (rtems_build_name('R', 'M', 'O', 'N'))
+#define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V'))
+#define RTEMS_MONITOR_QUEUE_NAME (rtems_build_name('R', 'M', 'S', 'Q'))
+#define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q'))
+
+#define RTEMS_MONITOR_SERVER_RESPONSE 0x0001
+#define RTEMS_MONITOR_SERVER_CANONICAL 0x0002
+
+typedef struct
+{
+ unsigned32 command;
+ rtems_id return_id;
+ unsigned32 argument0;
+ unsigned32 argument1;
+ unsigned32 argument2;
+ unsigned32 argument3;
+ unsigned32 argument4;
+ unsigned32 argument5;
+} rtems_monitor_server_request_t;
+
+typedef struct
+{
+ unsigned32 command;
+ unsigned32 result0;
+ unsigned32 result1;
+ rtems_monitor_union_t payload;
+} rtems_monitor_server_response_t;
+
+extern rtems_id rtems_monitor_task_id;
+
+extern unsigned32 rtems_monitor_node; /* our node number */
+extern unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * Monitor command function and table entry
+ */
+
+typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t;
+
+typedef void ( *rtems_monitor_command_function_t )(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+ );
+
+struct rtems_monitor_command_entry_s {
+ char *command; /* command name */
+ char *usage; /* usage string for the command */
+ unsigned32 arguments_required; /* # of required args */
+ rtems_monitor_command_function_t command_function;
+
+ /* Some argument for the command */
+ unsigned32 command_arg;
+};
+
+typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
+typedef void (*rtems_monitor_object_canonical_fn)(void *, void *);
+typedef void (*rtems_monitor_object_dump_header_fn)(boolean);
+typedef void (*rtems_monitor_object_dump_fn)(void *, boolean);
+
+typedef struct {
+ rtems_monitor_object_type_t type;
+ void *object_information;
+ int size; /* of canonical object */
+ rtems_monitor_object_next_fn next;
+ rtems_monitor_object_canonical_fn canonical;
+ rtems_monitor_object_dump_header_fn dump_header;
+ rtems_monitor_object_dump_fn dump;
+} rtems_monitor_object_info_t;
+
+
+/* monitor.c */
+void rtems_monitor_kill(void);
+void rtems_monitor_init(rtems_boolean);
+void rtems_monitor_wakeup(void);
+void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_debugger_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_node_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_symbols_loadup(void);
+void rtems_monitor_task(rtems_task_argument);
+
+/* server.c */
+void rtems_monitor_server_kill(void);
+rtems_status_code rtems_monitor_server_request(unsigned32, rtems_monitor_server_request_t *, rtems_monitor_server_response_t *);
+void rtems_monitor_server_task(rtems_task_argument);
+void rtems_monitor_server_init(unsigned32);
+
+/* command.c */
+int rtems_monitor_make_argv(char *, int *, char **);
+int rtems_monitor_command_read(char *, int *, char **);
+rtems_monitor_command_entry_t *rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t * table, int argc, char **argv);
+void rtems_monitor_command_usage(rtems_monitor_command_entry_t *, char *);
+void rtems_monitor_help_cmd(int, char **, unsigned32, boolean);
+
+/* prmisc.c */
+void rtems_monitor_separator(void);
+unsigned32 rtems_monitor_pad(unsigned32 dest_col, unsigned32 curr_col);
+unsigned32 rtems_monitor_dump_char(unsigned8 ch);
+unsigned32 rtems_monitor_dump_decimal(unsigned32 num);
+unsigned32 rtems_monitor_dump_hex(unsigned32 num);
+unsigned32 rtems_monitor_dump_id(rtems_id id);
+unsigned32 rtems_monitor_dump_name(rtems_name name);
+unsigned32 rtems_monitor_dump_priority(rtems_task_priority priority);
+unsigned32 rtems_monitor_dump_state(States_Control state);
+unsigned32 rtems_monitor_dump_modes(rtems_mode modes);
+unsigned32 rtems_monitor_dump_attributes(rtems_attribute attributes);
+unsigned32 rtems_monitor_dump_events(rtems_event_set events);
+unsigned32 rtems_monitor_dump_notepad(unsigned32 *notepad);
+
+/* object.c */
+rtems_id rtems_monitor_id_fixup(rtems_id, unsigned32, rtems_monitor_object_type_t);
+rtems_id rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, unsigned32 *size_p);
+rtems_id rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *);
+void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
+rtems_id rtems_monitor_object_canonical(rtems_id, void *);
+void rtems_monitor_object_cmd(int, char **, unsigned32, boolean);
+
+/* manager.c */
+void *rtems_monitor_manager_next(void *, void *, rtems_id *);
+
+/* config.c */
+void rtems_monitor_config_canonical(rtems_monitor_config_t *, void *);
+void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
+void rtems_monitor_config_dump_header(boolean);
+void rtems_monitor_config_dump(rtems_monitor_config_t *, boolean verbose);
+
+/* mpci.c */
+void rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *);
+void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
+void rtems_monitor_mpci_dump_header(boolean);
+void rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, boolean verbose);
+
+/* itask.c */
+void rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *);
+void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
+void rtems_monitor_init_task_dump_header(boolean);
+void rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, boolean verbose);
+
+/* extension.c */
+void rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *);
+void rtems_monitor_extension_dump_header(boolean verbose);
+void rtems_monitor_extension_dump(rtems_monitor_extension_t *, boolean);
+
+/* task.c */
+void rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
+void rtems_monitor_task_dump_header(boolean verbose);
+void rtems_monitor_task_dump(rtems_monitor_task_t *, boolean);
+
+/* queue.c */
+void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
+void rtems_monitor_queue_dump_header(boolean verbose);
+void rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean);
+
+/* driver.c */
+void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
+void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);
+void rtems_monitor_driver_dump_header(boolean);
+void rtems_monitor_driver_dump(rtems_monitor_driver_t *, boolean);
+
+/* dname.c */
+void *rtems_monitor_dname_next(void *, rtems_monitor_dname_t *, rtems_id *);
+void rtems_monitor_dname_canonical(rtems_monitor_dname_t *, void *);
+void rtems_monitor_dname_dump_header(boolean);
+void rtems_monitor_dname_dump(rtems_monitor_dname_t *, boolean);
+
+/* symbols.c */
+rtems_symbol_table_t *rtems_symbol_table_create();
+void rtems_symbol_table_destroy(rtems_symbol_table_t *table);
+
+rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, unsigned32);
+rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, unsigned32);
+const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, unsigned32);
+rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *);
+void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
+void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *);
+void rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, char *);
+void rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *);
+unsigned32 rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, boolean);
+void rtems_monitor_symbol_cmd(int, char **, unsigned32, boolean);
+
+
+extern rtems_symbol_table_t *rtems_monitor_symbols;
+
+#ifndef MONITOR_PROMPT
+#define MONITOR_PROMPT "rtems" /* will have '> ' appended */
+#endif
+
+#define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0
+
+
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define STRNEQ(a,b,n) (strncmp(a,b,n) == 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __MONITOR_H */
diff --git a/c/src/libmisc/monitor/symbols.h b/c/src/libmisc/monitor/symbols.h
new file mode 100644
index 0000000000..061ccdd952
--- /dev/null
+++ b/c/src/libmisc/monitor/symbols.h
@@ -0,0 +1,64 @@
+/*
+ * RTEMS monitor symbol table functions
+ *
+ * Description:
+ * Entry points for symbol table routines.
+ *
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_SYMBOLS_H
+#define _INCLUDE_SYMBOLS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ rtems_unsigned32 value;
+ char *name;
+} rtems_symbol_t;
+
+#define SYMBOL_STRING_BLOCK_SIZE 4080
+typedef struct rtems_symbol_string_block_s {
+ struct rtems_symbol_string_block_s *next;
+ char buffer[SYMBOL_STRING_BLOCK_SIZE];
+} rtems_symbol_string_block_t;
+
+typedef struct {
+
+ rtems_unsigned32 sorted; /* are symbols sorted right now? */
+
+ rtems_unsigned32 growth_factor; /* % to grow by when needed */
+
+ rtems_unsigned32 next; /* next symbol slot to use when adding */
+ rtems_unsigned32 size; /* max # of symbols */
+
+ /*
+ * Symbol list -- sorted by address (when we do a lookup)
+ */
+
+ rtems_symbol_t *addresses; /* symbol array by address */
+
+ /*
+ * String pool, unsorted, a list of blocks of string data
+ */
+
+ rtems_symbol_string_block_t *string_buffer_head;
+ rtems_symbol_string_block_t *string_buffer_current;
+ rtems_unsigned32 strings_next; /* next byte to use in this block */
+
+} rtems_symbol_table_t;
+
+#define rtems_symbol_name(sp) ((sp)->name)
+#define rtems_symbol_value(sp) ((sp)->value)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_SYMBOLS_H */
diff --git a/c/src/libmisc/stackchk/README b/c/src/libmisc/stackchk/README
new file mode 100644
index 0000000000..20e76f07bc
--- /dev/null
+++ b/c/src/libmisc/stackchk/README
@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+
+This directory contains a stack bounds checker. It provides two
+primary features:
+
+ + check for stack overflow at each context switch
+ + provides an educated guess at each task's stack usage
+
+The stack overflow check at context switch works by looking for
+a 16 byte pattern at the logical end of the stack to be corrupted.
+The "guesser" assumes that the entire stack was prefilled with a known
+pattern and assumes that the pattern is still in place if the memory
+has not been used as a stack.
+
+Both of these can be fooled by pushing large holes onto the stack
+and not writing to them... or (much more unlikely) writing the
+magic patterns into memory.
+
+This code has not been extensively tested. It is provided as a tool
+for RTEMS users to catch the most common mistake in multitasking
+systems ... too little stack space. Suggestions and comments are appreciated.
+
+NOTES:
+
+1. Stack usage information is questionable on CPUs which push
+ large holes on stack.
+
+2. The stack checker has a tendency to generate a fault when
+ trying to print the helpful diagnostic message. If it comes
+ out, congratulations. If not, then the variable Stack_check_Blown_task
+ contains a pointer to the TCB of the offending task. This
+ is usually enough to go on.
+
+FUTURE:
+
+1. Determine how/if gcc will generate stack probe calls and support that.
+
+2. Get accurate stack usage numbers on i960.. it pushes very large
+ holes on the stack.
diff --git a/c/src/libmisc/stackchk/check.c b/c/src/libmisc/stackchk/check.c
new file mode 100644
index 0000000000..3d06d1dd12
--- /dev/null
+++ b/c/src/libmisc/stackchk/check.c
@@ -0,0 +1,512 @@
+/*
+ * Stack Overflow Check User Extension Set
+ *
+ * NOTE: This extension set automatically determines at
+ * initialization time whether the stack for this
+ * CPU grows up or down and installs the correct
+ * extension routines for that direction.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+
+/*
+ * HACK
+ * the stack dump information should be printed by a "fatal" extension.
+ * Fatal extensions only get called via rtems_fatal_error_occurred()
+ * and not when rtems_shutdown_executive() is called.
+ * I hope/think this is changing so that fatal extensions are renamed
+ * to "shutdown" extensions.
+ * When that happens, this #define should be deleted and all the code
+ * it marks.
+ */
+#define DONT_USE_FATAL_EXTENSION
+
+
+extern rtems_configuration_table BSP_Configuration;
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stackchk.h"
+#include "internal.h"
+
+/*
+ * This variable contains the name of the task which "blew" the stack.
+ * It is NULL if the system is all right.
+ */
+
+Thread_Control *Stack_check_Blown_task;
+
+/*
+ * The extension table for the stack checker.
+ */
+
+rtems_extensions_table Stack_check_Extension_table = {
+ Stack_check_Create_extension, /* rtems_task_create */
+ 0, /* rtems_task_start */
+ 0, /* rtems_task_restart */
+ 0, /* rtems_task_delete */
+ Stack_check_Switch_extension, /* task_switch */
+ Stack_check_Begin_extension, /* task_begin */
+ 0, /* task_exitted */
+#ifdef DONT_USE_FATAL_EXTENSION
+ 0, /* fatal */
+#else
+ Stack_check_Fatal_extension, /* fatal */
+#endif
+};
+
+/*
+ * The "magic pattern" used to mark the end of the stack.
+ */
+
+Stack_check_Control Stack_check_Pattern;
+
+/*
+ * Where the pattern goes in the stack area is dependent upon
+ * whether the stack grow to the high or low area of the memory.
+ *
+ */
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) \
+ ((_the_stack)->area + (_the_stack)->size - sizeof( Stack_check_Control ) ))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water ) \
+ ((_high_water) - (_low))
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area)
+
+#else
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) ((_the_stack)->area + HEAP_OVERHEAD))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water) \
+ ( ((_low) + (_size)) - (_high_water) )
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area + sizeof(Stack_check_Control))
+
+#endif
+
+#define Stack_check_usable_stack_size(_the_stack) \
+ ((_the_stack)->size - sizeof(Stack_check_Control))
+
+
+/*
+ * Do we have an interrupt stack?
+ * XXX it would sure be nice if the interrupt stack were also
+ * stored in a "stack" structure!
+ */
+
+
+Stack_Control stack_check_interrupt_stack;
+
+/*
+ * Prototypes necessary for forward references
+ */
+
+void Stack_check_Dump_usage( void );
+
+/*
+ * Fill an entire stack area with BYTE_PATTERN.
+ * This will be used by a Fatal extension to check for
+ * amount of actual stack used
+ */
+
+void
+stack_check_dope_stack(Stack_Control *stack)
+{
+ memset(stack->area, BYTE_PATTERN, stack->size);
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Initialize
+ */
+
+unsigned32 stack_check_initialized = 0;
+
+void Stack_check_Initialize( void )
+{
+ rtems_status_code status;
+ Objects_Id id_ignored;
+ unsigned32 *p;
+#if 0
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ Objects_Information *information;
+#endif
+
+ if (stack_check_initialized)
+ return;
+
+ /*
+ * Dope the pattern and fill areas
+ */
+
+ for ( p = Stack_check_Pattern.pattern;
+ p < &Stack_check_Pattern.pattern[PATTERN_SIZE_WORDS];
+ p += 4
+ )
+ {
+ p[0] = 0xFEEDF00D; /* FEED FOOD to BAD DOG */
+ p[1] = 0x0BAD0D06;
+ p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
+ p[3] = 0x600D0D06;
+ };
+
+ status = rtems_extension_create(
+ rtems_build_name( 'S', 'T', 'C', 'K' ),
+ &Stack_check_Extension_table,
+ &id_ignored
+ );
+ assert ( status == RTEMS_SUCCESSFUL );
+
+ Stack_check_Blown_task = 0;
+
+ /*
+ * If installed by a task, that task will not get setup properly
+ * since it missed out on the create hook. This will cause a
+ * failure on first switch out of that task.
+ * So pretend here that we actually ran create and begin extensions.
+ */
+
+ /* XXX
+ *
+ * Technically this has not been done for any task created before this
+ * happened. So just run through them and fix the situation.
+ */
+#if 0
+ if (_Thread_Executing)
+ {
+ Stack_check_Create_extension(_Thread_Executing, _Thread_Executing);
+ }
+#endif
+
+#if 0
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Create_extension( the_thread, the_thread );
+ }
+ }
+ }
+#endif
+
+ /*
+ * If appropriate, setup the interrupt stack for high water testing
+ * also.
+ */
+ if (_CPU_Interrupt_stack_low && _CPU_Interrupt_stack_high)
+ {
+ stack_check_interrupt_stack.area = _CPU_Interrupt_stack_low;
+ stack_check_interrupt_stack.size = _CPU_Interrupt_stack_high -
+ _CPU_Interrupt_stack_low;
+
+ stack_check_dope_stack(&stack_check_interrupt_stack);
+ }
+
+#ifdef DONT_USE_FATAL_EXTENSION
+#ifdef RTEMS_DEBUG
+ /*
+ * this would normally be called by a fatal extension
+ * handler, but we don't run fatal extensions unless
+ * we fatal error.
+ */
+ atexit(Stack_check_Dump_usage);
+#endif
+#endif
+
+ stack_check_initialized = 1;
+}
+
+/*PAGE
+ *
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+)
+{
+ if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
+ stack_check_dope_stack(&the_thread->Start.Initial_stack);
+
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+)
+{
+ Stack_check_Control *the_pattern;
+
+ if ( the_thread->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ the_pattern = Stack_check_Get_pattern_area(&the_thread->Start.Initial_stack);
+
+ *the_pattern = Stack_check_Pattern;
+}
+
+/*PAGE
+ *
+ * Stack_check_report_blown_task
+ * Report a blown stack. Needs to be a separate routine
+ * so that interrupt handlers can use this too.
+ *
+ * Caller must have set the Stack_check_Blown_task.
+ *
+ * NOTE: The system is in a questionable state... we may not get
+ * the following message out.
+ */
+
+void Stack_check_report_blown_task(void)
+{
+ Stack_Control *stack;
+ Thread_Control *running;
+
+ running = Stack_check_Blown_task;
+ stack = &running->Start.Initial_stack;
+
+ fprintf(
+ stderr,
+ "BLOWN STACK!!! Offending task(%p): id=0x%08x; name=0x%08x",
+ running,
+ running->Object.id,
+ *(unsigned32 *)running->Object.name
+ );
+ fflush(stderr);
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ fprintf(
+ stderr,
+ "; node=%d\n",
+ BSP_Configuration.User_multiprocessing_table->node
+ );
+ else
+ fprintf(stderr, "\n");
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " stack covers range 0x%08x - 0x%08x (%d bytes)\n",
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + stack->size - 1,
+ (unsigned32) stack->size);
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " Damaged pattern begins at 0x%08x and is %d bytes long\n",
+ (unsigned32) Stack_check_Get_pattern_area(stack), PATTERN_SIZE_BYTES);
+ fflush(stderr);
+
+ rtems_fatal_error_occurred( (unsigned32) "STACK BLOWN" );
+}
+
+/*PAGE
+ *
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+)
+{
+ if ( running->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ if (0 != memcmp( (void *) Stack_check_Get_pattern_area( &running->Start.Initial_stack)->pattern,
+ (void *) Stack_check_Pattern.pattern,
+ PATTERN_SIZE_BYTES))
+ {
+ Stack_check_Blown_task = running;
+ Stack_check_report_blown_task();
+ }
+}
+
+void *Stack_check_find_high_water_mark(
+ const void *s,
+ size_t n
+)
+{
+ const unsigned32 *base, *ebase;
+ unsigned32 length;
+
+ base = s;
+ length = n/4;
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+ /*
+ * start at higher memory and find first word that does not
+ * match pattern
+ */
+
+ base += length - 1;
+ for (ebase = s; base > ebase; base--)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#else
+ /*
+ * start at lower memory and find first word that does not
+ * match pattern
+ */
+
+ base += PATTERN_SIZE_WORDS;
+ for (ebase = base + length; base < ebase; base++)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#endif
+
+ return (void *)0;
+}
+
+/*PAGE
+ *
+ * Stack_check_Dump_threads_usage
+ * Try to print out how much stack was actually used by the task.
+ *
+ */
+
+void Stack_check_Dump_threads_usage(
+ Thread_Control *the_thread
+)
+{
+ unsigned32 size, used;
+ void *low;
+ void *high_water_mark;
+ Stack_Control *stack;
+
+ if ( !the_thread )
+ return;
+
+ /*
+ * XXX HACK to get to interrupt stack
+ */
+
+ if (the_thread == (Thread_Control *) -1)
+ {
+ if (stack_check_interrupt_stack.area)
+ {
+ stack = &stack_check_interrupt_stack;
+ the_thread = 0;
+ }
+ else
+ return;
+ }
+ else
+ stack = &the_thread->Start.Initial_stack;
+
+ low = Stack_check_usable_stack_start(stack);
+ size = Stack_check_usable_stack_size(stack);
+
+ high_water_mark = Stack_check_find_high_water_mark(low, size);
+
+ if ( high_water_mark )
+ used = Stack_check_Calculate_used( low, size, high_water_mark );
+ else
+ used = 0;
+
+ printf( "0x%08x 0x%08x 0x%08x 0x%08x %8d %8d\n",
+ the_thread ? the_thread->Object.id : ~0,
+ the_thread ? *(unsigned32 *)the_thread->Object.name :
+ rtems_build_name('I', 'N', 'T', 'R'),
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + (unsigned32) stack->size - 1,
+ size,
+ used
+ );
+}
+
+/*PAGE
+ *
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+)
+{
+#ifndef DONT_USE_FATAL_EXTENSION
+ if (status == 0)
+ Stack_check_Dump_usage();
+#endif
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void )
+{
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ unsigned32 hit_running = 0;
+ Objects_Information *information;
+
+ if (stack_check_initialized == 0)
+ return;
+
+ printf("Stack usage by thread\n");
+ printf(
+ " ID NAME LOW HIGH AVAILABLE USED\n"
+ );
+
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Dump_threads_usage( the_thread );
+ if ( the_thread == _Thread_Executing )
+ hit_running = 1;
+ }
+ }
+ }
+
+ if ( !hit_running )
+ Stack_check_Dump_threads_usage( _Thread_Executing );
+
+ /* dump interrupt stack info if any */
+ Stack_check_Dump_threads_usage((Thread_Control *) -1);
+}
+
diff --git a/c/src/libmisc/stackchk/internal.h b/c/src/libmisc/stackchk/internal.h
new file mode 100644
index 0000000000..e98ec7e92e
--- /dev/null
+++ b/c/src/libmisc/stackchk/internal.h
@@ -0,0 +1,96 @@
+/* internal.h
+ *
+ * This include file contains internal information
+ * for the RTEMS stack checker.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INTERNAL_STACK_CHECK_h
+#define __INTERNAL_STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This structure is used to fill in and compare the "end of stack"
+ * marker pattern.
+ * pattern area must be a multiple of 4 words.
+ */
+
+#ifdef CPU_STACK_CHECK_SIZE
+#define PATTERN_SIZE_WORDS (((CPU_STACK_CHECK_SIZE / 4) + 3) & ~0x3)
+#else
+#define PATTERN_SIZE_WORDS 4
+#endif
+
+#define PATTERN_SIZE_BYTES (PATTERN_SIZE_WORDS * 4)
+
+typedef struct {
+ unsigned32 pattern[ PATTERN_SIZE_WORDS ];
+} Stack_check_Control;
+
+/*
+ * The pattern used to fill the entire stack.
+ */
+
+#define BYTE_PATTERN 0xA5
+#define U32_PATTERN 0xA5A5A5A5
+
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+);
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/libmisc/stackchk/stackchk.h b/c/src/libmisc/stackchk/stackchk.h
new file mode 100644
index 0000000000..f3281c63fe
--- /dev/null
+++ b/c/src/libmisc/stackchk/stackchk.h
@@ -0,0 +1,41 @@
+/* stackchk.h
+ *
+ * This include file contains information necessary to utilize
+ * and install the stack checker mechanism.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_CHECK_h
+#define __STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Stack_check_Initialize
+ */
+
+void Stack_check_Initialize( void );
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/optman/rtems/no-dpmem.c b/c/src/optman/rtems/no-dpmem.c
new file mode 100644
index 0000000000..11f2641feb
--- /dev/null
+++ b/c/src/optman/rtems/no-dpmem.c
@@ -0,0 +1,98 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/dpmem.h>
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+)
+{
+}
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/rtems/no-event.c b/c/src/optman/rtems/no-event.c
new file mode 100644
index 0000000000..4eb984c011
--- /dev/null
+++ b/c/src/optman/rtems/no-event.c
@@ -0,0 +1,56 @@
+/*
+ * Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Event_Manager_initialization( void )
+{
+}
+
+rtems_status_code rtems_event_send(
+ Objects_Id id,
+ rtems_event_set event_in
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_event_receive(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
diff --git a/c/src/optman/rtems/no-mp.c b/c/src/optman/rtems/no-mp.c
new file mode 100644
index 0000000000..f6adc53c76
--- /dev/null
+++ b/c/src/optman/rtems/no-mp.c
@@ -0,0 +1,201 @@
+/*
+ * Multiprocessing Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/interr.h>
+
+void _Multiprocessing_Manager_initialization ( void )
+{
+}
+
+void rtems_multiprocessing_announce ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table,
+ unsigned32 timeout_status
+)
+{
+}
+
+void _MPCI_Create_server( void )
+{
+}
+
+void _MPCI_Initialization ( void )
+{
+}
+
+void _MPCI_Register_packet_processor(
+ Objects_Classes the_class,
+ MPCI_Packet_processor the_packet_processor
+
+)
+{
+}
+
+MP_packet_Prefix *_MPCI_Get_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+void _MPCI_Return_packet (
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Send_process_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+unsigned32 _MPCI_Send_request_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet,
+ States_Control extra_state
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return 0;
+}
+
+void _MPCI_Send_response_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+MP_packet_Prefix *_MPCI_Receive_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+Thread_Control *_MPCI_Process_response (
+ MP_packet_Prefix *the_packet
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+Thread _MPCI_Receive_server(
+ unsigned32 ignore
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Announce ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+
+void _MPCI_Internal_packets_Send_process_packet (
+ MPCI_Internal_Remote_operations operation
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+void _MPCI_Internal_packets_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void )
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return NULL;
+}
+
+/* end of file */
diff --git a/c/src/optman/rtems/no-msg.c b/c/src/optman/rtems/no-msg.c
new file mode 100644
index 0000000000..6a5b84652a
--- /dev/null
+++ b/c/src/optman/rtems/no-msg.c
@@ -0,0 +1,192 @@
+/*
+ * Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/interr.h>
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+}
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size_p,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+unsigned32 _Message_queue_Flush_support(
+ Message_queue_Control *the_message_queue
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+ return 0;
+}
+
+boolean _Message_queue_Seize(
+ Message_queue_Control *the_message_queue,
+ rtems_option option_set,
+ void *buffer,
+ unsigned32 *size_p
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+ _Thread_Executing->Wait.return_code = RTEMS_UNSATISFIED;
+ return TRUE;
+}
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/rtems/no-part.c b/c/src/optman/rtems/no-part.c
new file mode 100644
index 0000000000..36eb4aee12
--- /dev/null
+++ b/c/src/optman/rtems/no-part.c
@@ -0,0 +1,97 @@
+/*
+ * Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+)
+{
+}
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/rtems/no-region.c b/c/src/optman/rtems/no-region.c
new file mode 100644
index 0000000000..6a779fb785
--- /dev/null
+++ b/c/src/optman/rtems/no-region.c
@@ -0,0 +1,114 @@
+/*
+ * Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+)
+{
+}
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/rtems/no-rtmon.c b/c/src/optman/rtems/no-rtmon.c
new file mode 100644
index 0000000000..fb064dafc5
--- /dev/null
+++ b/c/src/optman/rtems/no-rtmon.c
@@ -0,0 +1,117 @@
+/*
+ * Rate Monotonic Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/ratemon.h>
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+)
+{
+}
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+void _Rate_monotonic_Timeout(
+ Objects_Id id,
+ void *ignored
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+}
+
+boolean _Rate_monotonic_Set_state(
+Rate_monotonic_Control *the_period
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return FALSE;
+}
diff --git a/c/src/optman/rtems/no-sem.c b/c/src/optman/rtems/no-sem.c
new file mode 100644
index 0000000000..3f79491075
--- /dev/null
+++ b/c/src/optman/rtems/no-sem.c
@@ -0,0 +1,114 @@
+/*
+ * Semaphore Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/interr.h>
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+}
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_obtain(
+ Objects_Id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_semaphore_release(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+boolean _Semaphore_Seize(
+ Semaphore_Control *the_semaphore,
+ rtems_option option_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ _Thread_Executing->Wait.return_code = RTEMS_UNSATISFIED;
+ return TRUE;
+}
diff --git a/c/src/optman/rtems/no-signal.c b/c/src/optman/rtems/no-signal.c
new file mode 100644
index 0000000000..fdd90efb38
--- /dev/null
+++ b/c/src/optman/rtems/no-signal.c
@@ -0,0 +1,56 @@
+/*
+ * Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/rtems/signal.h>
+
+void _Signal_Manager_initialization( void )
+{
+}
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry handler,
+ rtems_mode mode_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_signal_send(
+ rtems_id id,
+ rtems_signal_set signal_set
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+/* end of file */
diff --git a/c/src/optman/rtems/no-timer.c b/c/src/optman/rtems/no-timer.c
new file mode 100644
index 0000000000..c133a48328
--- /dev/null
+++ b/c/src/optman/rtems/no-timer.c
@@ -0,0 +1,123 @@
+/*
+ * Timer Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/interr.h>
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/timer.h>
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+)
+{
+}
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/sapi/no-ext.c b/c/src/optman/sapi/no-ext.c
new file mode 100644
index 0000000000..bd7b91039b
--- /dev/null
+++ b/c/src/optman/sapi/no-ext.c
@@ -0,0 +1,67 @@
+/*
+ * Extension Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+#include <rtems/score/interr.h>
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+)
+{
+}
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/optman/sapi/no-io.c b/c/src/optman/sapi/no-io.c
new file mode 100644
index 0000000000..ed75a3df87
--- /dev/null
+++ b/c/src/optman/sapi/no-io.c
@@ -0,0 +1,145 @@
+/*
+ * Input/Output Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/config.h>
+#include <rtems/io.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+)
+{
+}
+
+void _IO_Initialize_all_drivers( void )
+{
+}
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_lookup_name(
+ const char *pathname,
+ rtems_driver_name_t **rnp
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_RTEMS_API,
+ FALSE,
+ RTEMS_NOT_CONFIGURED
+ );
+ return RTEMS_NOT_CONFIGURED;
+}
diff --git a/c/src/tests/README b/c/src/tests/README
new file mode 100644
index 0000000000..f799370569
--- /dev/null
+++ b/c/src/tests/README
@@ -0,0 +1,44 @@
+#
+# $Id$
+#
+
+This is the directory under which the RTEMS
+test programs provided with the release are located. The
+following is a description of the contents of each file and
+subdirectory directly in this directory:
+
+NOTE: Other than the 'samples' directory these tests are intended
+ only to exercise RTEMS features and are *not* good examples
+ of programming for RTEMS.
+
+ samples
+
+ This directory contains a set of simple sample applications
+ which can be used either to test a board support package
+ or as the starting point for a custom application.
+
+ mptests
+
+ This directory contains the RTEMS Multiprocessor Test Suite.
+ The tests in this directory provide near complete (98%+) test
+ coverage of the multiprocessor specific code in RTEMS.
+
+ psxtests
+
+ This directory contains the RTEMS POSIX API Test Suite.
+ The tests in this directory test the POSIX API support in RTEMS.
+
+ sptests
+
+ This directory contains the RTEMS Single Processor Test Suite.
+ The tests in this directory provide near complete (98%+) test
+ coverage of the non-multiprocessor code in RTEMS.
+
+ tmtests
+
+ This directory contains the RTEMS Timing Test Suite.
+ The tests in this directory are used to measure the execution
+ time of RTEMS directive and some critical internal functions.
+ The results of these test are reported in the Fact Sheets
+ and Supplental Manuals.
+
diff --git a/c/src/tests/libtests/README b/c/src/tests/libtests/README
new file mode 100644
index 0000000000..bc4b217832
--- /dev/null
+++ b/c/src/tests/libtests/README
@@ -0,0 +1,10 @@
+#
+# $Id$
+#
+
+This directory contains tests for some of the items in
+the lib directories. The intent is to be able to
+verify the basic functionality of a library. For example,
+it is important to know that the stack checker successfully
+detects tasks which both stay within and exceed their
+stack limits.
diff --git a/c/src/tests/libtests/stackchk/blow.c b/c/src/tests/libtests/stackchk/blow.c
new file mode 100644
index 0000000000..107461b135
--- /dev/null
+++ b/c/src/tests/libtests/stackchk/blow.c
@@ -0,0 +1,45 @@
+/* task1.c
+ *
+ * This set of three tasks do some simple task switching for about
+ * 15 seconds and then call a routine to "blow the stack".
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+void b() {}
+
+void blow_stack( void )
+{
+ volatile unsigned32 *low, *high;
+
+b();
+ /*
+ * Destroy the first and last 16 bytes of our stack... Hope it
+ * does not cause problems :)
+ */
+
+ low = _Thread_Executing->Start.Initial_stack.area + HEAP_OVERHEAD;
+ high = _Thread_Executing->Start.Initial_stack.area +
+ _Thread_Executing->Start.Initial_stack.size - 16;
+
+ low[0] = 0x11111111;
+ low[1] = 0x22222222;
+ low[2] = 0x33333333;
+ low[3] = 0x44444444;
+
+ high[0] = 0x55555555;
+ high[1] = 0x66666666;
+ high[2] = 0x77777777;
+ high[3] = 0x88888888;
+
+}
diff --git a/c/src/tests/libtests/stackchk/init.c b/c/src/tests/libtests/stackchk/init.c
new file mode 100644
index 0000000000..0415493243
--- /dev/null
+++ b/c/src/tests/libtests/stackchk/init.c
@@ -0,0 +1,86 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST STACK CHECKER ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/libtests/stackchk/stackchk.scn b/c/src/tests/libtests/stackchk/stackchk.scn
new file mode 100644
index 0000000000..84a5c5e342
--- /dev/null
+++ b/c/src/tests/libtests/stackchk/stackchk.scn
@@ -0,0 +1,9 @@
+*** TEST STACK CHECKER ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+---> error indictation
diff --git a/c/src/tests/libtests/stackchk/system.h b/c/src/tests/libtests/stackchk/system.h
new file mode 100644
index 0000000000..56a8e9526a
--- /dev/null
+++ b/c/src/tests/libtests/stackchk/system.h
@@ -0,0 +1,49 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* macros */
+
+#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+void blow_stack( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/libtests/stackchk/task1.c b/c/src/tests/libtests/stackchk/task1.c
new file mode 100644
index 0000000000..de31ee1068
--- /dev/null
+++ b/c/src/tests/libtests/stackchk/task1.c
@@ -0,0 +1,44 @@
+/* task1.c
+ *
+ * This set of three tasks do some simple task switching for about
+ * 15 seconds and then call a routine to "blow the stack".
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 15 && tid == Task_id[ 1 ] ) {
+ blow_stack();
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/mptests/README b/c/src/tests/mptests/README
new file mode 100644
index 0000000000..68cb459b55
--- /dev/null
+++ b/c/src/tests/mptests/README
@@ -0,0 +1,10 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Multiprocessor Test Suite.
+The tests in this directory provide near complete (98%+) test
+coverage of the multiprocessor specific code in RTEMS.
+
+These tests are designed to test RTEMS in a two node configuration.
+
diff --git a/c/src/tests/mptests/mp01/init.c b/c/src/tests/mptests/mp01/init.c
new file mode 100644
index 0000000000..888151761f
--- /dev/null
+++ b/c/src/tests/mptests/mp01/init.c
@@ -0,0 +1,96 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+ char c;
+
+ printf(
+ "\n\n*** TEST 1 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ if ( Multiprocessing_configuration.node != 1 ) c = 'S';
+ else c = 'M';
+
+ Task_name[ 1 ] = rtems_build_name( c, 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( c, 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( c, 'A', '3', ' ' );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ puts( "Creating task 1 (Global)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 1" );
+
+ puts( "Creating task 2 (Global)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 2" );
+
+ puts( "Creating task 3 (Local)" );
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp01/node1/mp01.doc b/c/src/tests/mptests/mp01/node1/mp01.doc
new file mode 100644
index 0000000000..83e06e2357
--- /dev/null
+++ b/c/src/tests/mptests/mp01/node1/mp01.doc
@@ -0,0 +1,53 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test50
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter, t_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of a global task on the local processor.
+
+ i. Verifies that a task can delete itself or a global task on
+ the local processor.
+
+ j. Verifies Shared Memory Locked Queue driver for initialization,
+ getting a packet, broadcasting a packet, and returning a packet.
+
+ k. Can be used to verify that global packet type P_SYSVERIFY,
+ P_OBJCREATE (task), and P_OBJDELETE (task) are sent and
+ correctly processed by a remote node.
diff --git a/c/src/tests/mptests/mp01/node1/mp01.scn b/c/src/tests/mptests/mp01/node1/mp01.scn
new file mode 100644
index 0000000000..d399f79b2a
--- /dev/null
+++ b/c/src/tests/mptests/mp01/node1/mp01.scn
@@ -0,0 +1,15 @@
+*** TEST 1 -- NODE 1 ***
+Creating task 1 (Global)
+Creating task 2 (Global)
+Creating task 3 (Local)
+MA1 - rtems_clock_get - 09:00:00 12/31/1988
+MA2 - rtems_clock_get - 09:00:00 12/31/1988
+MA3 - rtems_clock_get - 09:00:00 12/31/1988
+MA1 - rtems_clock_get - 09:00:05 12/31/1988
+MA1 - deleting self
+MA2 - rtems_clock_get - 09:00:10 12/31/1988
+MA2 - waiting to be deleted by MA3
+MA3 - rtems_clock_get - 09:00:15 12/31/1988
+MA3 - getting TID of MA2
+MA3 - deleting MA2
+*** END OF TEST 1 ***
diff --git a/c/src/tests/mptests/mp01/node2/mp01.doc b/c/src/tests/mptests/mp01/node2/mp01.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp01/node2/mp01.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp01/node2/mp01.scn b/c/src/tests/mptests/mp01/node2/mp01.scn
new file mode 100644
index 0000000000..c9831ff9db
--- /dev/null
+++ b/c/src/tests/mptests/mp01/node2/mp01.scn
@@ -0,0 +1,15 @@
+*** TEST 1 -- NODE 2 ***
+Creating task 1 (Global)
+Creating task 2 (Global)
+Creating task 3 (Local)
+SA1 - rtems_clock_get - 09:00:00 12/31/1988
+SA2 - rtems_clock_get - 09:00:00 12/31/1988
+SA3 - rtems_clock_get - 09:00:00 12/31/1988
+SA1 - rtems_clock_get - 09:00:05 12/31/1988
+SA1 - deleting self
+SA2 - rtems_clock_get - 09:00:10 12/31/1988
+SA2 - waiting to be deleted by SA3
+SA3 - rtems_clock_get - 09:00:15 12/31/1988
+SA3 - getting TID of SA2
+SA3 - deleting SA2
+*** END OF TEST 1 ***
diff --git a/c/src/tests/mptests/mp01/system.h b/c/src/tests/mptests/mp01/system.h
new file mode 100644
index 0000000000..54e0134a7d
--- /dev/null
+++ b/c/src/tests/mptests/mp01/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_GLOBAL
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp01/task1.c b/c/src/tests/mptests/mp01/task1.c
new file mode 100644
index 0000000000..7f90bb3165
--- /dev/null
+++ b/c/src/tests/mptests/mp01/task1.c
@@ -0,0 +1,84 @@
+/* Test_task
+ *
+ * This task is used for three test tasks. It obtains its task id and
+ * based upon that id, performs certain actions.
+ *
+ * Task_1 delays 5 seconds and deletes itself.
+ * Task_2 delays 10 seconds and then loops until
+ * deleted by the third task.
+ * Task 3 delays 15 seconds, then deletes task 2 and itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ if ( task_number(tid) == 1 ) { /* TASK 1 */
+ put_name( Task_name[ 1 ], FALSE );
+ printf( " - deleting self\n" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+ else if ( task_number(tid) == 2 ) { /* TASK 2 */
+ put_name( Task_name[ 2 ], FALSE );
+ printf( " - waiting to be deleted by " );
+ put_name( Task_name[ 3 ], TRUE );
+ while ( FOREVER );
+ }
+ else { /* TASK 3 */
+ put_name( Task_name[ 3 ], FALSE );
+ printf( " - getting TID of " );
+ put_name( Task_name[ 2 ], TRUE );
+ do {
+ status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident" );
+
+ put_name( Task_name[ 3 ], FALSE );
+ printf( " - deleting " );
+ put_name( Task_name[ 2 ], TRUE );
+ status = rtems_task_delete( tid );
+ directive_failed( status, "rtems_task_delete of Task 2" );
+
+ puts( "*** END OF TEST 1 ***" );
+ exit(0);
+ }
+}
diff --git a/c/src/tests/mptests/mp02/init.c b/c/src/tests/mptests/mp02/init.c
new file mode 100644
index 0000000000..723e4ff5cd
--- /dev/null
+++ b/c/src/tests/mptests/mp02/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 2 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp02/node1/mp02.doc b/c/src/tests/mptests/mp02/node1/mp02.doc
new file mode 100644
index 0000000000..e74807f7f1
--- /dev/null
+++ b/c/src/tests/mptests/mp02/node1/mp02.doc
@@ -0,0 +1,47 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test51
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter, t_delete, t_restart, t_getreg, t_setreg
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ c. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ d. Verifies executive initialization performed correctly.
+
+ e. Verifies that a task can get the task identification number of itself.
+
+ f. Verifies that a task can get the task identification number
+ of another task.
+
+ g. Verifies that a task can delete itself or another task.
+
+ h. Verifies that errors are returned in the following situations:
+ 1) when attempting to delete a remote task.
+ 2) when attempting to start a remote task.
+ 3) when attempting to restart a remote task.
+
+ i. Verifies that a remote task's registers can be set and read.
diff --git a/c/src/tests/mptests/mp02/node1/mp02.scn b/c/src/tests/mptests/mp02/node1/mp02.scn
new file mode 100644
index 0000000000..72fdefe69d
--- /dev/null
+++ b/c/src/tests/mptests/mp02/node1/mp02.scn
@@ -0,0 +1,14 @@
+*** TEST 2 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task (all nodes)
+Getting TID of remote task (1 node)
+rtems_task_delete of remote task returned the correct error
+rtems_task_start of remote task returned the correct error
+rtems_task_restart of remote task returned the correct error
+Setting notepad 1 of the remote task to 1
+Getting a notepad of the remote task
+Remote notepad set and read correctly
+*** END OF TEST 2 ***
diff --git a/c/src/tests/mptests/mp02/node2/mp02.doc b/c/src/tests/mptests/mp02/node2/mp02.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp02/node2/mp02.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp02/node2/mp02.scn b/c/src/tests/mptests/mp02/node2/mp02.scn
new file mode 100644
index 0000000000..233a910999
--- /dev/null
+++ b/c/src/tests/mptests/mp02/node2/mp02.scn
@@ -0,0 +1,14 @@
+*** TEST 2 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task (all nodes)
+Getting TID of remote task (1 node)
+rtems_task_delete of remote task returned the correct error
+rtems_task_start of remote task returned the correct error
+rtems_task_restart of remote task returned the correct error
+Setting notepad 2 of the remote task to 2
+Getting a notepad of the remote task
+Remote notepad set and read correctly
+*** END OF TEST 2 ***
diff --git a/c/src/tests/mptests/mp02/system.h b/c/src/tests/mptests/mp02/system.h
new file mode 100644
index 0000000000..8e2e95806d
--- /dev/null
+++ b/c/src/tests/mptests/mp02/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp02/task1.c b/c/src/tests/mptests/mp02/task1.c
new file mode 100644
index 0000000000..44764486b0
--- /dev/null
+++ b/c/src/tests/mptests/mp02/task1.c
@@ -0,0 +1,118 @@
+/* Test_task
+ *
+ * This task tests the rtems_task_set_note directive on a remote task and that
+ * errors are returned when attempting to delete, start, or restart
+ * a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_id test_tid;
+ rtems_unsigned32 note;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ printf( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task (all nodes)" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task (1 node)" );
+ status = rtems_task_ident( Task_name[ remote_node ], remote_node, &test_tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ if ( test_tid != remote_tid ) {
+ puts( "rtems_task_ident tid's do not match!!" );
+ rtems_fatal_error_occurred( status );
+ }
+
+ status = rtems_task_delete( remote_tid );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_delete of remote task"
+ );
+ puts( "rtems_task_delete of remote task returned the correct error" );
+
+ status = rtems_task_start( remote_tid, Test_task, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_start of remote task"
+ );
+ puts( "rtems_task_start of remote task returned the correct error" );
+
+ status = rtems_task_restart( remote_tid, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_restart of remote task"
+ );
+ puts( "rtems_task_restart of remote task returned the correct error" );
+
+ printf(
+ "Setting notepad %d of the remote task to %d\n",
+ rtems_get_node(tid),
+ rtems_get_node(tid)
+ );
+ status = rtems_task_set_note(
+ remote_tid,
+ rtems_get_node(tid),
+ rtems_get_node(tid)
+ );
+ directive_failed( status, "rtems_task_set_note" );
+
+ puts( "Getting a notepad of the remote task" );
+ status = rtems_task_get_note( remote_tid, rtems_get_node(tid), &note );
+ directive_failed( status, "rtems_task_get_note" );
+
+ if ( note == rtems_get_node(tid) )
+ puts( "Remote notepad set and read correctly" );
+ else
+ printf(
+ "FAILURE!! Remote notepad was not set and read correctly (%d, %d)\n",
+ note,
+ rtems_get_node( tid )
+ );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp03/delay.c b/c/src/tests/mptests/mp03/delay.c
new file mode 100644
index 0000000000..6a6bb5f25e
--- /dev/null
+++ b/c/src/tests/mptests/mp03/delay.c
@@ -0,0 +1,31 @@
+/* Delayed_send_event
+ *
+ * This routine is a timer service routine which sends an event to task 1.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+}
diff --git a/c/src/tests/mptests/mp03/init.c b/c/src/tests/mptests/mp03/init.c
new file mode 100644
index 0000000000..9be30fd92e
--- /dev/null
+++ b/c/src/tests/mptests/mp03/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 3 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp03/node1/mp03.doc b/c/src/tests/mptests/mp03/node1/mp03.doc
new file mode 100644
index 0000000000..348afef85f
--- /dev/null
+++ b/c/src/tests/mptests/mp03/node1/mp03.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test52
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_wkafter, t_suspend, t_resume
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task (on another node).
+
+ i. Verifies that a task can suspend and resume a remote task.
diff --git a/c/src/tests/mptests/mp03/node1/mp03.scn b/c/src/tests/mptests/mp03/node1/mp03.scn
new file mode 100644
index 0000000000..129e5bccba
--- /dev/null
+++ b/c/src/tests/mptests/mp03/node1/mp03.scn
@@ -0,0 +1,24 @@
+*** TEST 3 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 222
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+
+ ........
+
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+*** END OF TEST 3 ***
diff --git a/c/src/tests/mptests/mp03/node2/mp03.doc b/c/src/tests/mptests/mp03/node2/mp03.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp03/node2/mp03.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp03/node2/mp03.scn b/c/src/tests/mptests/mp03/node2/mp03.scn
new file mode 100644
index 0000000000..d77c09e9f7
--- /dev/null
+++ b/c/src/tests/mptests/mp03/node2/mp03.scn
@@ -0,0 +1,24 @@
+*** TEST 3 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 111
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+
+ ........
+
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Suspending remote task
+222 - Resuming remote task
+222 - Suspending remote task
+222 - Resuming remote task
+222 - Suspending remote task
+222 - Resuming remote task
+*** END OF TEST 3 ***
diff --git a/c/src/tests/mptests/mp03/system.h b/c/src/tests/mptests/mp03/system.h
new file mode 100644
index 0000000000..39ba36ede3
--- /dev/null
+++ b/c/src/tests/mptests/mp03/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+TEST_EXTERN rtems_unsigned32 remote_node;
+TEST_EXTERN rtems_id remote_tid;
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp03/task1.c b/c/src/tests/mptests/mp03/task1.c
new file mode 100644
index 0000000000..c1f0f777fd
--- /dev/null
+++ b/c/src/tests/mptests/mp03/task1.c
@@ -0,0 +1,155 @@
+/* Test_task
+ *
+ * This task suspends and resumes a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+/*PAGE
+ *
+ * Test_Task_Support
+ *
+ */
+
+void Test_Task_Support(
+ rtems_unsigned32 node
+)
+{
+ rtems_event_set events;
+ rtems_status_code status;
+
+ if ( Multiprocessing_configuration.node == node ) {
+
+ for ( ; ; ) {
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive");
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ put_name( Task_name[ node ], FALSE );
+ puts( " - Suspending remote task" );
+
+ status = rtems_task_suspend( remote_tid );
+ directive_failed( status, "rtems_task_suspend" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ put_name( Task_name[ node ], FALSE );
+ puts( " - Resuming remote task" );
+
+ status = rtems_task_resume( remote_tid ) ;
+ directive_failed( status, "rtems_task_resume" );
+
+ }
+
+ } else {
+
+ for ( ; ; ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive");
+
+ put_name( Task_name[ remote_node ], FALSE );
+ puts( " - have I been suspended???" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ }
+
+}
+
+/*PAGE
+ *
+ * Test_task
+ */
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task" );
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ printf( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ Test_Task_Support( 1 );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ Test_Task_Support( 2 );
+
+ puts( "*** END OF TEST 3 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp04/init.c b/c/src/tests/mptests/mp04/init.c
new file mode 100644
index 0000000000..e3de164f09
--- /dev/null
+++ b/c/src/tests/mptests/mp04/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 4 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ Multiprocessing_configuration.node,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp04/node1/mp04.doc b/c/src/tests/mptests/mp04/node1/mp04.doc
new file mode 100644
index 0000000000..39a76d48a0
--- /dev/null
+++ b/c/src/tests/mptests/mp04/node1/mp04.doc
@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test53
+
+directives:
+ ex_init, ex_start, t_create, t_start, i_return, t_ident, tm_get,
+ tm_wkafter, tm_setpri
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies that the system can get the id of a remote task.
+
+ c. Verifies that the system can change the priority of a remote
+ task.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can delete itself or another task.
diff --git a/c/src/tests/mptests/mp04/node1/mp04.scn b/c/src/tests/mptests/mp04/node1/mp04.scn
new file mode 100644
index 0000000000..e9518f3ac2
--- /dev/null
+++ b/c/src/tests/mptests/mp04/node1/mp04.scn
@@ -0,0 +1,8 @@
+*** TEST 4 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 222
+Local task priority has been set
+*** END OF TEST 4 ***
diff --git a/c/src/tests/mptests/mp04/node2/mp04.doc b/c/src/tests/mptests/mp04/node2/mp04.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp04/node2/mp04.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp04/node2/mp04.scn b/c/src/tests/mptests/mp04/node2/mp04.scn
new file mode 100644
index 0000000000..8ccfcfef79
--- /dev/null
+++ b/c/src/tests/mptests/mp04/node2/mp04.scn
@@ -0,0 +1,8 @@
+*** TEST 4 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 111
+Local task priority has been set
+*** END OF TEST 4 ***
diff --git a/c/src/tests/mptests/mp04/system.h b/c/src/tests/mptests/mp04/system.h
new file mode 100644
index 0000000000..f67d16fe53
--- /dev/null
+++ b/c/src/tests/mptests/mp04/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp04/task1.c b/c/src/tests/mptests/mp04/task1.c
new file mode 100644
index 0000000000..7e7e0ca849
--- /dev/null
+++ b/c/src/tests/mptests/mp04/task1.c
@@ -0,0 +1,83 @@
+/* Test_task
+ *
+ * This task tests the rtems_task_set_priority directive on a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_task_priority previous_priority;
+ rtems_task_priority previous_priority_1;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task" );
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_task_set_priority(
+ remote_tid,
+ Multiprocessing_configuration.node,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ if ( previous_priority != remote_node ) {
+ printf(
+ "Remote priority (0x%x) does not match remote node (0x%x)!!!\n",
+ previous_priority,
+ remote_node
+ );
+ exit( 0xf0000 );
+ }
+
+ do {
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &previous_priority_1
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ } while ( previous_priority_1 != remote_node );
+
+ puts( "Local task priority has been set" );
+
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp05/asr.c b/c/src/tests/mptests/mp05/asr.c
new file mode 100644
index 0000000000..9f98e42692
--- /dev/null
+++ b/c/src/tests/mptests/mp05/asr.c
@@ -0,0 +1,37 @@
+/* Process_asr
+ *
+ * This routine performs the processing for task 1's RTEMS_ASR. It is called
+ * by an assembly routine which saves the necessary registers.
+ *
+ * Input parameters:
+ * signal - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set signal
+)
+{
+ if ( signal != expected_signal ) {
+ printf(
+ "ERROR: I was expecting signal 0x%.8x got 0x%.8x\n",
+ expected_signal,
+ signal
+ );
+ rtems_fatal_error_occurred( 0xf0000 );
+ }
+ signal_caught = 1;
+}
diff --git a/c/src/tests/mptests/mp05/init.c b/c/src/tests/mptests/mp05/init.c
new file mode 100644
index 0000000000..c6b9bb9f44
--- /dev/null
+++ b/c/src/tests/mptests/mp05/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 5 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp05/node1/mp05.doc b/c/src/tests/mptests/mp05/node1/mp05.doc
new file mode 100644
index 0000000000..6b9ccd556d
--- /dev/null
+++ b/c/src/tests/mptests/mp05/node1/mp05.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test54
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_wkafter, as_catch, as_return
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that a signal can be sent to a remote task.
diff --git a/c/src/tests/mptests/mp05/node1/mp05.scn b/c/src/tests/mptests/mp05/node1/mp05.scn
new file mode 100644
index 0000000000..472740ba18
--- /dev/null
+++ b/c/src/tests/mptests/mp05/node1/mp05.scn
@@ -0,0 +1,11 @@
+*** TEST 5 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+rtems_signal_catch: initializing signal catcher
+Remote task's name is : 222
+Getting TID of remote task
+Sending signal to remote task
+....................................................
+....................................................
+*** END OF TEST 5 ***
diff --git a/c/src/tests/mptests/mp05/node2/mp05.doc b/c/src/tests/mptests/mp05/node2/mp05.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp05/node2/mp05.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp05/node2/mp05.scn b/c/src/tests/mptests/mp05/node2/mp05.scn
new file mode 100644
index 0000000000..0c4b412f65
--- /dev/null
+++ b/c/src/tests/mptests/mp05/node2/mp05.scn
@@ -0,0 +1,10 @@
+*** TEST 5 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+rtems_signal_catch: initializing signal catcher
+Remote task's name is : 111
+Getting TID of remote task
+....................................................
+....................................................
+*** END OF TEST 5 ***
diff --git a/c/src/tests/mptests/mp05/system.h b/c/src/tests/mptests/mp05/system.h
new file mode 100644
index 0000000000..2ebc8b47b5
--- /dev/null
+++ b/c/src/tests/mptests/mp05/system.h
@@ -0,0 +1,59 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_asr Process_asr( rtems_signal_set );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+TEST_EXTERN rtems_unsigned32 remote_node;
+TEST_EXTERN rtems_id remote_tid;
+TEST_EXTERN rtems_signal_set remote_signal;
+TEST_EXTERN rtems_signal_set expected_signal;
+TEST_EXTERN volatile rtems_unsigned32 signal_count;
+TEST_EXTERN volatile rtems_unsigned32 signal_caught;
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp05/task1.c b/c/src/tests/mptests/mp05/task1.c
new file mode 100644
index 0000000000..6934663850
--- /dev/null
+++ b/c/src/tests/mptests/mp05/task1.c
@@ -0,0 +1,106 @@
+/* Test_task
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define SIGNALS_PER_DOT 15
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Stop_Test = FALSE;
+
+ signal_caught = 0;
+ signal_count = 0;
+
+ puts( "rtems_signal_catch: initializing signal catcher" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR|RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ if (Multiprocessing_configuration.node == 1) {
+ remote_node = 2;
+ remote_signal = RTEMS_SIGNAL_18;
+ expected_signal = RTEMS_SIGNAL_17;
+ }
+ else {
+ remote_node = 1;
+ remote_signal = RTEMS_SIGNAL_17;
+ expected_signal = RTEMS_SIGNAL_18;
+ }
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 3 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending signal to remote task" );
+ do {
+ status = rtems_signal_send( remote_tid, remote_signal );
+ if ( status == RTEMS_NOT_DEFINED )
+ continue;
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_signal_send" );
+ }
+
+ while ( Stop_Test == FALSE ) {
+ if ( signal_caught ) {
+ signal_caught = 0;
+ if ( ++signal_count >= SIGNALS_PER_DOT ) {
+ signal_count = 0;
+ put_dot( '.' );
+ }
+ status = rtems_signal_send( remote_tid, remote_signal );
+ directive_failed( status, "rtems_signal_send" );
+ }
+ }
+ puts( "\n*** END OF TEST 5 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp06/init.c b/c/src/tests/mptests/mp06/init.c
new file mode 100644
index 0000000000..f04f834956
--- /dev/null
+++ b/c/src/tests/mptests/mp06/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 6 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp06/node1/mp06.doc b/c/src/tests/mptests/mp06/node1/mp06.doc
new file mode 100644
index 0000000000..879c15d705
--- /dev/null
+++ b/c/src/tests/mptests/mp06/node1/mp06.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test55
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that events can be sent to a remote task.
diff --git a/c/src/tests/mptests/mp06/node1/mp06.scn b/c/src/tests/mptests/mp06/node1/mp06.scn
new file mode 100644
index 0000000000..592777e5d7
--- /dev/null
+++ b/c/src/tests/mptests/mp06/node1/mp06.scn
@@ -0,0 +1,11 @@
+*** TEST 6 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task
+Sending events to remote task
+....................................................
+....................................................
+*** END OF TEST 6 ***
+
diff --git a/c/src/tests/mptests/mp06/node2/mp06.doc b/c/src/tests/mptests/mp06/node2/mp06.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp06/node2/mp06.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp06/node2/mp06.scn b/c/src/tests/mptests/mp06/node2/mp06.scn
new file mode 100644
index 0000000000..9cb653c2f3
--- /dev/null
+++ b/c/src/tests/mptests/mp06/node2/mp06.scn
@@ -0,0 +1,12 @@
+*** TEST 6 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task
+Receiving events from remote task
+....................................................
+....................................................
+rtems_event_receive - correctly returned RTEMS_TIMEOUT
+*** END OF TEST 6 ***
+
diff --git a/c/src/tests/mptests/mp06/system.h b/c/src/tests/mptests/mp06/system.h
new file mode 100644
index 0000000000..a7c0048cdd
--- /dev/null
+++ b/c/src/tests/mptests/mp06/system.h
@@ -0,0 +1,50 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp06/task1.c b/c/src/tests/mptests/mp06/task1.c
new file mode 100644
index 0000000000..5b63a9ff76
--- /dev/null
+++ b/c/src/tests/mptests/mp06/task1.c
@@ -0,0 +1,176 @@
+/* Test_task
+ *
+ * This task tests global event operations. If running on node one, it
+ * continuously sends events. If running on node two, it continuously
+ * receives events.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define DOT_COUNT 25
+
+/*PAGE
+ *
+ * Stop_Test_TSR
+ */
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+/*PAGE
+ *
+ * Event_set_table
+ */
+
+rtems_event_set Event_set_table[] = {
+ RTEMS_EVENT_0,
+ RTEMS_EVENT_1,
+ RTEMS_EVENT_2,
+ RTEMS_EVENT_3,
+ RTEMS_EVENT_4,
+ RTEMS_EVENT_5,
+ RTEMS_EVENT_6,
+ RTEMS_EVENT_7,
+ RTEMS_EVENT_8,
+ RTEMS_EVENT_9,
+ RTEMS_EVENT_10,
+ RTEMS_EVENT_11,
+ RTEMS_EVENT_12,
+ RTEMS_EVENT_13,
+ RTEMS_EVENT_14,
+ RTEMS_EVENT_15,
+ RTEMS_EVENT_16,
+ RTEMS_EVENT_17,
+ RTEMS_EVENT_18,
+ RTEMS_EVENT_19,
+ RTEMS_EVENT_20,
+ RTEMS_EVENT_21,
+ RTEMS_EVENT_22,
+ RTEMS_EVENT_23,
+ RTEMS_EVENT_24,
+ RTEMS_EVENT_25,
+ RTEMS_EVENT_26,
+ RTEMS_EVENT_27,
+ RTEMS_EVENT_28,
+ RTEMS_EVENT_29,
+ RTEMS_EVENT_30,
+ RTEMS_EVENT_31
+};
+
+/*PAGE
+ *
+ * Test_task
+ */
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+ rtems_event_set event_for_this_iteration;
+
+ Stop_Test = FALSE;
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident FAILED!!" );
+
+ if ( Multiprocessing_configuration.node == 1 )
+ puts( "Sending events to remote task" );
+ else
+ puts( "Receiving events from remote task" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ count = 0;
+
+ for ( ; ; ) {
+ if ( Stop_Test == TRUE )
+ break;
+
+ event_for_this_iteration = Event_set_table[ count % 32 ];
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_event_send( remote_tid, event_for_this_iteration );
+ directive_failed( status, "rtems_event_send" );
+
+ status = rtems_task_wake_after( 1 );
+ directive_failed( status, "rtems_task_wake_after" );
+ } else {
+ status = rtems_event_receive(
+ event_for_this_iteration,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND,
+ &event_out
+ );
+ if ( rtems_are_statuses_equal( status, RTEMS_TIMEOUT ) ) {
+ if ( Multiprocessing_configuration.node == 2 )
+ puts( "\nCorrect behavior if the other node exitted." );
+ else
+ puts( "\nERROR... node 1 died" );
+ break;
+ } else
+ directive_failed( status, "rtems_event_receive" );
+ }
+
+ if ( (count % DOT_COUNT) == 0 )
+ put_dot('.');
+
+ count++;
+ }
+
+ putchar( '\n' );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND,
+ &event_out
+ );
+ fatal_directive_status( status, RTEMS_TIMEOUT, "rtems_event_receive" );
+ puts( "rtems_event_receive - correctly returned RTEMS_TIMEOUT" );
+ }
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp07/init.c b/c/src/tests/mptests/mp07/init.c
new file mode 100644
index 0000000000..a732434ead
--- /dev/null
+++ b/c/src/tests/mptests/mp07/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 7 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp07/node1/mp07.doc b/c/src/tests/mptests/mp07/node1/mp07.doc
new file mode 100644
index 0000000000..ca09867ab6
--- /dev/null
+++ b/c/src/tests/mptests/mp07/node1/mp07.doc
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test56
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that two tasks on different processors can alternate
+ sending each other events.
diff --git a/c/src/tests/mptests/mp07/node1/mp07.scn b/c/src/tests/mptests/mp07/node1/mp07.scn
new file mode 100644
index 0000000000..d348f48612
--- /dev/null
+++ b/c/src/tests/mptests/mp07/node1/mp07.scn
@@ -0,0 +1,10 @@
+*** TEST 7 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task
+Sending first event to remote task
+....................................................
+....................................................
+*** END OF TEST 7 ***
diff --git a/c/src/tests/mptests/mp07/node2/mp07.doc b/c/src/tests/mptests/mp07/node2/mp07.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp07/node2/mp07.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp07/node2/mp07.scn b/c/src/tests/mptests/mp07/node2/mp07.scn
new file mode 100644
index 0000000000..9e361d713c
--- /dev/null
+++ b/c/src/tests/mptests/mp07/node2/mp07.scn
@@ -0,0 +1,9 @@
+*** TEST 7 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task
+....................................................
+....................................................
+*** END OF TEST 7 ***
diff --git a/c/src/tests/mptests/mp07/system.h b/c/src/tests/mptests/mp07/system.h
new file mode 100644
index 0000000000..a7c0048cdd
--- /dev/null
+++ b/c/src/tests/mptests/mp07/system.h
@@ -0,0 +1,50 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp07/task1.c b/c/src/tests/mptests/mp07/task1.c
new file mode 100644
index 0000000000..70fc8c73c5
--- /dev/null
+++ b/c/src/tests/mptests/mp07/task1.c
@@ -0,0 +1,95 @@
+/* Test_task
+ *
+ * This task continuously sends an event to its counterpart on the
+ * other node, and then waits for it to send an event. The copy
+ * running on node one send the first event.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define DOT_COUNT 100
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+
+ Stop_Test = FALSE;
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending first event to remote task" );
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=DOT_COUNT ; count ; count-- ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ if ( status == RTEMS_TIMEOUT ) {
+ puts( "\nTA1 - RTEMS_TIMEOUT .. probably OK if the other node exits" );
+ break;
+ } else
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+ put_dot('.');
+ }
+ puts( "\n*** END OF TEST 7 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp08/init.c b/c/src/tests/mptests/mp08/init.c
new file mode 100644
index 0000000000..b16585c99c
--- /dev/null
+++ b/c/src/tests/mptests/mp08/init.c
@@ -0,0 +1,74 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 8 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', '\0' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Sempahore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ }
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp08/node1/mp08.doc b/c/src/tests/mptests/mp08/node1/mp08.doc
new file mode 100644
index 0000000000..3ec09a3335
--- /dev/null
+++ b/c/src/tests/mptests/mp08/node1/mp08.doc
@@ -0,0 +1,52 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test57
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ sm_create, sm_ident, sm_p, sm_v, sm_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the identification number of
+ a global sempahore.
+
+ h. Verifies that two tasks on different processors can
+ alternate accessing a semaphore.
+
+ i. Verifies operation of sm_delete on global semaphores
+ for both normal and error case.
+
+ j. Verifies Rpc and Process_pkt for packet types Q_SMP, Q_SMV,
+ P_OBJCREATE (semaphore), P_OBJDELETE (semaphore), P_SMDEL_TQ.
+
diff --git a/c/src/tests/mptests/mp08/node1/mp08.scn b/c/src/tests/mptests/mp08/node1/mp08.scn
new file mode 100644
index 0000000000..cde263420c
--- /dev/null
+++ b/c/src/tests/mptests/mp08/node1/mp08.scn
@@ -0,0 +1,11 @@
+*** TEST 8 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting SMID of semaphore
+pvpvpvpvpvp.......
+(continued) pvp
+
+Deleting global semaphore
+*** END OF TEST 8 ***
+
diff --git a/c/src/tests/mptests/mp08/node2/mp08.doc b/c/src/tests/mptests/mp08/node2/mp08.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp08/node2/mp08.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp08/node2/mp08.scn b/c/src/tests/mptests/mp08/node2/mp08.scn
new file mode 100644
index 0000000000..5a613f45e5
--- /dev/null
+++ b/c/src/tests/mptests/mp08/node2/mp08.scn
@@ -0,0 +1,12 @@
+*** TEST 8 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting SMID of semaphore
+rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+pvpvpvpvpvp.......
+(continued) pvp
+
+Global semaphore deleted
+*** END OF TEST 8 ***
+
diff --git a/c/src/tests/mptests/mp08/system.h b/c/src/tests/mptests/mp08/system.h
new file mode 100644
index 0000000000..42a2287af5
--- /dev/null
+++ b/c/src/tests/mptests/mp08/system.h
@@ -0,0 +1,49 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp08/task1.c b/c/src/tests/mptests/mp08/task1.c
new file mode 100644
index 0000000000..dbd1526795
--- /dev/null
+++ b/c/src/tests/mptests/mp08/task1.c
@@ -0,0 +1,89 @@
+/* Test_task
+ *
+ * This task tests global semaphore operations. It verifies that
+ * global semaphore errors are correctly returned.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_semaphore_delete did not return RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+ puts(
+ "rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+ }
+
+ count = 0; /* number of times node 1 releases semaphore */
+ while ( FOREVER ) {
+ put_dot( 'p' );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain"
+ );
+ puts( "\nGlobal semaphore deleted" );
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+ }
+
+ if ( Multiprocessing_configuration.node == 1 && ++count == 1000 ) {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "\nDeleting global semaphore" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete" );
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+ }
+ else {
+ put_dot( 'v' );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release FAILED!!" );
+ }
+ }
+}
diff --git a/c/src/tests/mptests/mp09/init.c b/c/src/tests/mptests/mp09/init.c
new file mode 100644
index 0000000000..b6f5195139
--- /dev/null
+++ b/c/src/tests/mptests/mp09/init.c
@@ -0,0 +1,74 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 9 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+ }
+
+ puts( "Creating Test_task (local)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp09/node1/mp09.doc b/c/src/tests/mptests/mp09/node1/mp09.doc
new file mode 100644
index 0000000000..15e05aae58
--- /dev/null
+++ b/c/src/tests/mptests/mp09/node1/mp09.doc
@@ -0,0 +1,50 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test58
+
+GLOBAL MESSAGE QUEUE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_wkafter, q_create, q_send, q_broadcast, q_urgent, q_receive,
+ q_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can delete itself.
+
+ i. Verifies Rpc and Process_pkt for message queue related packets.
+
+ j. Verifies normal and error paths for global message queue handling.
+
+NOTE: The SLAVE must be started first for this test to successfully run.
diff --git a/c/src/tests/mptests/mp09/node1/mp09.scn b/c/src/tests/mptests/mp09/node1/mp09.scn
new file mode 100644
index 0000000000..74cf06904d
--- /dev/null
+++ b/c/src/tests/mptests/mp09/node1/mp09.scn
@@ -0,0 +1,22 @@
+*** TEST 9 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Test_task (local)
+Starting Test_task (local)
+Deleting initialization task
+Getting QID of message queue
+Receiving message ...
+Received : 123456789012345
+Receiving message ...
+Received : abcdefghijklmno
+Receiving message ...
+Received : ABCDEFGHIJKLMNO
+Receiver delaying for a second
+rtems_message_queue_send: 123456789012345
+Delaying for a second
+rtems_message_queue_urgent: abcdefghijklmno
+Delaying for a second
+rtems_message_queue_broadcast: ABCDEFGHIJKLMNO
+Delaying for a second
+Delaying for 5 seconds
+Deleting Message queue
+*** END OF TEST 9 ***
diff --git a/c/src/tests/mptests/mp09/node2/mp09.doc b/c/src/tests/mptests/mp09/node2/mp09.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp09/node2/mp09.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp09/node2/mp09.scn b/c/src/tests/mptests/mp09/node2/mp09.scn
new file mode 100644
index 0000000000..1bd17cecd9
--- /dev/null
+++ b/c/src/tests/mptests/mp09/node2/mp09.scn
@@ -0,0 +1,27 @@
+*** TEST 9 -- NODE 2 ***
+Creating Test_task (local)
+Starting Test_task (local)
+Deleting initialization task
+Getting QID of message queue
+rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+rtems_message_queue_send: 123456789012345
+Delaying for a second
+rtems_message_queue_urgent: abcdefghijklmno
+Delaying for a second
+rtems_message_queue_broadcast: ABCDEFGHIJKLMNO
+Delaying for a second
+Receiving message ...
+Received : 123456789012345
+Receiving message ...
+Received : abcdefghijklmno
+Receiving message ...
+Received : ABCDEFGHIJKLMNO
+Receiver delaying for a second
+Flushing remote empty queue
+0 messages were flushed on the remote queue
+Send messages to be flushed from remote queue
+Flushing remote queue
+1 messages were flushed on the remote queue
+Waiting for message queue to be deleted
+Global message queue deleted
+*** END OF TEST 9 ***
diff --git a/c/src/tests/mptests/mp09/recvmsg.c b/c/src/tests/mptests/mp09/recvmsg.c
new file mode 100644
index 0000000000..fcdb75e966
--- /dev/null
+++ b/c/src/tests/mptests/mp09/recvmsg.c
@@ -0,0 +1,47 @@
+/* Receive_messages
+ *
+ * This routine receives and prints three messages.
+ * an error condition.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Receive_messages()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_unsigned32 size;
+ char receive_buffer[16];
+
+ for ( index=1 ; index <=3 ; index++ ) {
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "Received : ");
+ puts( receive_buffer );
+ }
+
+ puts( "Receiver delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+}
diff --git a/c/src/tests/mptests/mp09/sendmsg.c b/c/src/tests/mptests/mp09/sendmsg.c
new file mode 100644
index 0000000000..ee555af67c
--- /dev/null
+++ b/c/src/tests/mptests/mp09/sendmsg.c
@@ -0,0 +1,60 @@
+/* Send_messages
+ *
+ * This routine sends a series of three messages.
+ * an error condition.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Send_messages()
+{
+ rtems_status_code status;
+ rtems_unsigned32 broadcast_count;
+
+ puts_nocr( "rtems_message_queue_send: " );
+ puts( buffer1 );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "rtems_message_queue_urgent: " );
+ puts( buffer2 );
+ status = rtems_message_queue_urgent( Queue_id[ 1 ], (long (*)[4])buffer2, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "rtems_message_queue_broadcast: " );
+ puts( buffer3 );
+ status = rtems_message_queue_broadcast(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer3,
+ 16,
+ &broadcast_count
+ );
+ directive_failed( status, "rtems_message_queue_broadcast" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+}
diff --git a/c/src/tests/mptests/mp09/system.h b/c/src/tests/mptests/mp09/system.h
new file mode 100644
index 0000000000..3060262e8e
--- /dev/null
+++ b/c/src/tests/mptests/mp09/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+void Receive_messages( void );
+
+void Send_messages( void );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+extern char buffer1[16];
+extern char buffer2[16];
+extern char buffer3[16];
+extern char buffer4[16];
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp09/task1.c b/c/src/tests/mptests/mp09/task1.c
new file mode 100644
index 0000000000..c4818af23a
--- /dev/null
+++ b/c/src/tests/mptests/mp09/task1.c
@@ -0,0 +1,109 @@
+/* Test_task
+ *
+ * This task tests global message queue operations. It also generates
+ * an error condition.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+char buffer1[16] = "123456789012345";
+char buffer2[16] = "abcdefghijklmno";
+char buffer3[16] = "ABCDEFGHIJKLMNO";
+char buffer4[16] = "PQRSTUVWXYZ(){}";
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 size;
+ char receive_buffer[16];
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_message_queue_delete"
+ );
+ puts(
+ "rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+
+ Send_messages();
+ Receive_messages();
+
+ puts( "Flushing remote empty queue" );
+ status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
+ directive_failed( status, "rtems_message_queue_flush" );
+ printf( "%d messages were flushed on the remote queue\n", count );
+
+ puts( "Send messages to be flushed from remote queue" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "Flushing remote queue" );
+ status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
+ directive_failed( status, "rtems_message_queue_flush" );
+ printf( "%d messages were flushed on the remote queue\n", count );
+
+ puts( "Waiting for message queue to be deleted" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_message_queue_receive"
+ );
+ puts( "\nGlobal message queue deleted" );
+ }
+ else { /* node == 1 */
+ Receive_messages();
+ Send_messages();
+
+ puts( "Delaying for 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Message queue" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp10/init.c b/c/src/tests/mptests/mp10/init.c
new file mode 100644
index 0000000000..1413c7b897
--- /dev/null
+++ b/c/src/tests/mptests/mp10/init.c
@@ -0,0 +1,143 @@
+/* Init
+ *
+ * This routine is the initialization routine for this test program.
+ * Other than creating all objects needed by this test, if this routine
+ * is running on node one, it acquires a global semaphore to
+ * force all other tasks to pend. If running on node two, this task
+ * sleeps for a while, and then deletes two local tasks which are
+ * waiting on a remote message queue or a semaphore.
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 10 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'S', 'A', '3', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 0,
+ RTEMS_GLOBAL | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ } else {
+
+ puts( "Creating Test_task 1 (local)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 1 (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 2 (local)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 2 (local)" );
+ status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 3 (local)" );
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 3 (local)" );
+ status = rtems_task_start( Task_id[ 3 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Sleeping for 1 seconds ..." );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Test_task2" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of Task 2" );
+
+ puts( "Deleting Test_task1" );
+ status = rtems_task_delete( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_delete of Task 1" );
+
+ puts( "Restarting Test_task3" );
+ status = rtems_task_restart( Task_id[ 3 ], 1 );
+ directive_failed( status, "rtems_task_restart of Task 3" );
+
+ }
+ puts( "*** END OF TEST 10 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp10/node1/mp10.doc b/c/src/tests/mptests/mp10/node1/mp10.doc
new file mode 100644
index 0000000000..d75b176f8d
--- /dev/null
+++ b/c/src/tests/mptests/mp10/node1/mp10.doc
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test59
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that a task can delete itself or another task.
diff --git a/c/src/tests/mptests/mp10/node1/mp10.scn b/c/src/tests/mptests/mp10/node1/mp10.scn
new file mode 100644
index 0000000000..deeafc0a9a
--- /dev/null
+++ b/c/src/tests/mptests/mp10/node1/mp10.scn
@@ -0,0 +1,4 @@
+*** TEST 10 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Semaphore (Global)
+*** END OF TEST 10 ***
diff --git a/c/src/tests/mptests/mp10/node2/mp10.doc b/c/src/tests/mptests/mp10/node2/mp10.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp10/node2/mp10.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp10/node2/mp10.scn b/c/src/tests/mptests/mp10/node2/mp10.scn
new file mode 100644
index 0000000000..25c07e6202
--- /dev/null
+++ b/c/src/tests/mptests/mp10/node2/mp10.scn
@@ -0,0 +1,19 @@
+*** TEST 10 -- NODE 2 ***
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Creating Test_task 3 (local)
+Starting Test_task 3 (local)
+Sleeping for 1 seconds ...
+Getting QID of message queue
+Attempting to receive message ...
+Getting SMID of semaphore
+Attempting to acquire semaphore ...
+Getting SMID of semaphore
+Attempting to acquire semaphore ...
+Deleting Test_task2
+Deleting Test_task1
+Restarting Test_task3
+*** END OF TEST 10 ***
+
diff --git a/c/src/tests/mptests/mp10/system.h b/c/src/tests/mptests/mp10/system.h
new file mode 100644
index 0000000000..2c6d54d6a8
--- /dev/null
+++ b/c/src/tests/mptests/mp10/system.h
@@ -0,0 +1,62 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task3(
+ rtems_task_argument restart
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp10/task1.c b/c/src/tests/mptests/mp10/task1.c
new file mode 100644
index 0000000000..1c72c34b58
--- /dev/null
+++ b/c/src/tests/mptests/mp10/task1.c
@@ -0,0 +1,52 @@
+/* Test_task1
+ *
+ * This task attempts to receive a message from a global message queue.
+ * It should never actually receive the message.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+)
+{
+ char receive_buffer[16];
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to receive message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+
+}
diff --git a/c/src/tests/mptests/mp10/task2.c b/c/src/tests/mptests/mp10/task2.c
new file mode 100644
index 0000000000..560f3946cf
--- /dev/null
+++ b/c/src/tests/mptests/mp10/task2.c
@@ -0,0 +1,47 @@
+/* Test_task2
+ *
+ * This task attempts to receive control of a global semaphore.
+ * It should never receive control of the semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to acquire semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+}
diff --git a/c/src/tests/mptests/mp10/task3.c b/c/src/tests/mptests/mp10/task3.c
new file mode 100644
index 0000000000..905183268e
--- /dev/null
+++ b/c/src/tests/mptests/mp10/task3.c
@@ -0,0 +1,50 @@
+/* Test_task3
+ *
+ * This task attempts to receive control of a global semaphore.
+ * It should never receive control of the semaphore.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task3( restart )
+rtems_task_argument restart;
+{
+ rtems_status_code status;
+
+ if ( restart == 1 ) {
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to acquire semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+}
diff --git a/c/src/tests/mptests/mp11/init.c b/c/src/tests/mptests/mp11/init.c
new file mode 100644
index 0000000000..7c89be66c2
--- /dev/null
+++ b/c/src/tests/mptests/mp11/init.c
@@ -0,0 +1,105 @@
+/* Init
+ *
+ * This routine is the initialization and test routine for
+ * this test program. It attempts to create more global
+ * objects than are configured (zero should be configured).
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id junk_id;
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 11 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Attempting to create Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_task_create" );
+ puts( "rtems_task_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_create"
+ );
+ puts( "rtems_message_queue_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_semaphore_create" );
+ puts( "rtems_semaphore_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Partition (Global)" );
+ status = rtems_partition_create(
+ 1,
+ (rtems_unsigned8 *) my_partition,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_partition_create" );
+ puts( "rtems_partition_create correctly returned RTEMS_TOO_MANY" );
+ }
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp11/node1/mp11.doc b/c/src/tests/mptests/mp11/node1/mp11.doc
new file mode 100644
index 0000000000..05113ec6b6
--- /dev/null
+++ b/c/src/tests/mptests/mp11/node1/mp11.doc
@@ -0,0 +1,42 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test60
+
+TOO MANY GLOBAL OBJECTS ERROR TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_create, q_create, sm_create, pt_create
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that all object create directives correctly return
+ E_TOOMANYGOBJECTS.
diff --git a/c/src/tests/mptests/mp11/node1/mp11.scn b/c/src/tests/mptests/mp11/node1/mp11.scn
new file mode 100644
index 0000000000..fb26583852
--- /dev/null
+++ b/c/src/tests/mptests/mp11/node1/mp11.scn
@@ -0,0 +1,10 @@
+*** TEST 11 -- NODE 1 ***
+Attempting to create Test_task (Global)
+rtems_task_create correctly returned RTEMS_TOO_MANY
+Attempting to create Message Queue (Global)
+rtems_message_queue_create correctly returned RTEMS_TOO_MANY
+Attempting to create Semaphore (Global)
+rtems_semaphore_create correctly returned RTEMS_TOO_MANY
+Attempting to create Partition (Global)
+rtems_partition_create correctly returned RTEMS_TOO_MANY
+*** END OF TEST 11 ***
diff --git a/c/src/tests/mptests/mp11/node2/mp11.doc b/c/src/tests/mptests/mp11/node2/mp11.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp11/node2/mp11.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp11/node2/mp11.scn b/c/src/tests/mptests/mp11/node2/mp11.scn
new file mode 100644
index 0000000000..49bd8a3219
--- /dev/null
+++ b/c/src/tests/mptests/mp11/node2/mp11.scn
@@ -0,0 +1,2 @@
+*** TEST 11 -- NODE 2 ***
+*** END OF TEST 11 ***
diff --git a/c/src/tests/mptests/mp11/system.h b/c/src/tests/mptests/mp11/system.h
new file mode 100644
index 0000000000..39ab88e08c
--- /dev/null
+++ b/c/src/tests/mptests/mp11/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 0
+#define CONFIGURE_MP_MAXIMUM_PROXIES 0
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp12/init.c b/c/src/tests/mptests/mp12/init.c
new file mode 100644
index 0000000000..93d472e6e6
--- /dev/null
+++ b/c/src/tests/mptests/mp12/init.c
@@ -0,0 +1,113 @@
+/* Init
+ *
+ * This routine is the initialization routine and test code for
+ * global partitions. It creates a global partition, obtains and
+ * releases a buffer, and deletes the partition. The partition
+ * is created on node one, and an attempt is made to delete it
+ * by node two.
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Partition_area[ 1024 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *bufaddr;
+
+ printf(
+ "\n\n*** TEST 12 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
+
+ puts( "Got to initialization task" );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting ID of remote Partition (Global)" );
+
+ do {
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Partition_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to delete remote Partition (Global)" );
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_partition_delete"
+ );
+ puts(
+ "rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+
+ puts( "Obtaining a buffer from the global partition" );
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &bufaddr );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ printf( "Address returned was : 0x%p\n", bufaddr );
+
+ puts( "Releasing a buffer to the global partition" );
+ status = rtems_partition_return_buffer( Partition_id[ 1 ], bufaddr );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+ else {
+ puts( "Creating Partition (Global)" );
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+
+ puts( "Sleeping for two seconds" );
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Partition (Global)" );
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ directive_failed( status, "rtems_partition_delete" );
+ }
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp12/node1/mp12.doc b/c/src/tests/mptests/mp12/node1/mp12.doc
new file mode 100644
index 0000000000..2bb7bc4518
--- /dev/null
+++ b/c/src/tests/mptests/mp12/node1/mp12.doc
@@ -0,0 +1,52 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test61
+
+GLOBAL PARTITION TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ pt_create, pt_delete, pt_getbuf, pt_retbuf
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies the Shared Memory Locked Queue Driver.
+
+ h. Verifies _Rpc() and _Process_pkt() for the following packet types:
+ P_OBJCREATE (partitions),
+ P_OBJDELETE (partitions),
+ P_PTGETBUF, and
+ P_PTRETBUF.
+
+ i. Verifies normal and error paths (other than E_TOOMANYGOBJECTS)
+ for global partitions.
+
+ j. Verifies that a task can delete itself.
diff --git a/c/src/tests/mptests/mp12/node1/mp12.scn b/c/src/tests/mptests/mp12/node1/mp12.scn
new file mode 100644
index 0000000000..605a2c11db
--- /dev/null
+++ b/c/src/tests/mptests/mp12/node1/mp12.scn
@@ -0,0 +1,6 @@
+*** TEST 12 -- NODE 1 ***
+Got to initialization task
+Creating Partition (Global)
+Sleeping for two seconds
+Deleting Partition (Global)
+*** END OF TEST 12 ***
diff --git a/c/src/tests/mptests/mp12/node2/mp12.doc b/c/src/tests/mptests/mp12/node2/mp12.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp12/node2/mp12.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp12/node2/mp12.scn b/c/src/tests/mptests/mp12/node2/mp12.scn
new file mode 100644
index 0000000000..ad65e9cb32
--- /dev/null
+++ b/c/src/tests/mptests/mp12/node2/mp12.scn
@@ -0,0 +1,10 @@
+*** TEST 12 -- NODE 2 ***
+Got to initialization task
+Getting ID of remote Partition (Global)
+Attempting to delete remote Partition (Global)
+rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+Obtaining a buffer from the global partition
+>>>>>>> address returned will differ
+Address returned was : 0x200f0000
+Releasing a buffer to the global partition
+*** END OF TEST 12 ***
diff --git a/c/src/tests/mptests/mp12/system.h b/c/src/tests/mptests/mp12/system.h
new file mode 100644
index 0000000000..c743c4a415
--- /dev/null
+++ b/c/src/tests/mptests/mp12/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+#define PT_NAME rtems_build_name( 'P', 'A', 'R', '\0' )
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 1
+#define CONFIGURE_MP_MAXIMUM_PROXIES 0
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#elif ( NODE_NUMBER == 2 )
+#define CONFIGURE_MAXIMUM_PARTITIONS 2
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */
+TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp13/init.c b/c/src/tests/mptests/mp13/init.c
new file mode 100644
index 0000000000..1e96d5c69e
--- /dev/null
+++ b/c/src/tests/mptests/mp13/init.c
@@ -0,0 +1,115 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 13 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+ }
+
+ puts( "Creating Test_task 1 (local)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 1 (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 2 (local)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 2 (local)" );
+ status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+ }
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp13/node1/mp13.doc b/c/src/tests/mptests/mp13/node1/mp13.doc
new file mode 100644
index 0000000000..abf558b443
--- /dev/null
+++ b/c/src/tests/mptests/mp13/node1/mp13.doc
@@ -0,0 +1,48 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test62
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ sm_create, q_create, sm_p, q_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies the Shared Memory Locked Queue Driver.
+
+ h. Verifies that E_MESSAGETIMEOUT is when waiting on a
+ remote message queue.
+
+ i. Verifies that E_SEMTIMEOUT is when waiting on a remote semaphore.
+
+ j. Verifies that a task can delete itself.
diff --git a/c/src/tests/mptests/mp13/node1/mp13.scn b/c/src/tests/mptests/mp13/node1/mp13.scn
new file mode 100644
index 0000000000..d3bd11f65e
--- /dev/null
+++ b/c/src/tests/mptests/mp13/node1/mp13.scn
@@ -0,0 +1,14 @@
+*** TEST 13 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Semaphore (Global)
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Getting QID of message queue
+Receiving message ...
+Getting SMID of semaphore
+Releasing semaphore ...
+Getting semaphore ...
+Getting semaphore ...
+*** END OF TEST 13 ***
diff --git a/c/src/tests/mptests/mp13/node2/mp13.doc b/c/src/tests/mptests/mp13/node2/mp13.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp13/node2/mp13.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp13/node2/mp13.scn b/c/src/tests/mptests/mp13/node2/mp13.scn
new file mode 100644
index 0000000000..e9df202a94
--- /dev/null
+++ b/c/src/tests/mptests/mp13/node2/mp13.scn
@@ -0,0 +1,16 @@
+*** TEST 13 -- NODE 2 ***
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Deleting initialization task
+Getting QID of message queue
+Getting SMID of semaphore
+Getting semaphore ...
+Receiving message ...
+Releasing semaphore ...
+Getting semaphore ...
+rtems_message_queue_receive correctly returned RTEMS_TIMEOUT
+Deleting self
+rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT
+*** END OF TEST 13 ***
diff --git a/c/src/tests/mptests/mp13/system.h b/c/src/tests/mptests/mp13/system.h
new file mode 100644
index 0000000000..c3b0924a18
--- /dev/null
+++ b/c/src/tests/mptests/mp13/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/c/src/tests/mptests/mp13/task1.c b/c/src/tests/mptests/mp13/task1.c
new file mode 100644
index 0000000000..6b599f971a
--- /dev/null
+++ b/c/src/tests/mptests/mp13/task1.c
@@ -0,0 +1,73 @@
+/* Test_task1
+ *
+ * This task attempts to receive a message from a global message queue.
+ * If running on the node on which the queue resides, the wait is
+ * forever, otherwise it times out on a remote message queue.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+)
+{
+ char receive_buffer[16];
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "How did I get back from here????" );
+ directive_failed( status, "rtems_message_queue_receive" );
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 2 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
+ puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
+
+ puts( "Deleting self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/mptests/mp13/task2.c b/c/src/tests/mptests/mp13/task2.c
new file mode 100644
index 0000000000..a43b64d3cf
--- /dev/null
+++ b/c/src/tests/mptests/mp13/task2.c
@@ -0,0 +1,106 @@
+/* Test_task2
+ *
+ * This task attempts to receive control of a global semaphore.
+ * If running on the node on which the semaphore resides, the wait is
+ * forever, otherwise it times out on a remote semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ directive_failed( status, "rtems_semaphore_ident" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Releasing semaphore ..." );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "How did I get back from here????" );
+ directive_failed( status, "rtems_semaphore_obtain" );
+ }
+
+/*
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+*/
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ puts( "Releasing semaphore ..." );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 2 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_semaphore_obtain"
+ );
+ puts( "rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT" );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/mptests/mp14/delay.c b/c/src/tests/mptests/mp14/delay.c
new file mode 100644
index 0000000000..7062c4ad21
--- /dev/null
+++ b/c/src/tests/mptests/mp14/delay.c
@@ -0,0 +1,34 @@
+/* Delayed_send_event
+ *
+ * This routine is a timer service routine which sends an event to a task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id timer_id,
+ void *ignored
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send(
+ Task_id[ rtems_get_index( timer_id ) ],
+ RTEMS_EVENT_16
+ );
+ directive_failed( status, "rtems_event_send" );
+}
diff --git a/c/src/tests/mptests/mp14/evtask1.c b/c/src/tests/mptests/mp14/evtask1.c
new file mode 100644
index 0000000000..f14bb9d2fd
--- /dev/null
+++ b/c/src/tests/mptests/mp14/evtask1.c
@@ -0,0 +1,87 @@
+/* Test_task
+ *
+ * This task either continuously sends events to a remote task, or
+ * continuously receives events sent by a remote task. This decision
+ * is based upon the local node number.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+
+ remote_node = ((Multiprocessing_configuration.node == 1) ? 2 : 1);
+
+ puts( "About to go to sleep!" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ puts( "Waking up!" );
+
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ while ( FOREVER ) {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_task_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending events to remote task" );
+ while ( Stop_Test == FALSE ) {
+ for ( count=EVENT_TASK_DOT_COUNT; Stop_Test == FALSE && count; count-- ) {
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+ put_dot( 'e' );
+ }
+ }
+
+ puts( "Receiving events from remote task" );
+ while ( Stop_Test == FALSE ) {
+ for ( count=EVENT_TASK_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ directive_failed( status, "rtems_event_receive" );
+ }
+ put_dot( 'e' );
+ }
+
+ Exit_test();
+}
diff --git a/c/src/tests/mptests/mp14/evtmtask.c b/c/src/tests/mptests/mp14/evtmtask.c
new file mode 100644
index 0000000000..c540eb98fb
--- /dev/null
+++ b/c/src/tests/mptests/mp14/evtmtask.c
@@ -0,0 +1,65 @@
+/* Delayed_events_task
+ *
+ * This task continuously sends itself events at one tick
+ * intervals.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Delayed_events_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_unsigned32 previous_mode;
+ rtems_status_code status;
+ rtems_event_set events;
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT | RTEMS_TIMESLICE,
+ RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == FALSE && count; count-- ){
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 1,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_reset" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+ directive_failed( status, "rtems_event_receive" );
+ }
+ put_dot('.');
+ }
+
+ Exit_test();
+}
diff --git a/c/src/tests/mptests/mp14/exit.c b/c/src/tests/mptests/mp14/exit.c
new file mode 100644
index 0000000000..65fc0df49f
--- /dev/null
+++ b/c/src/tests/mptests/mp14/exit.c
@@ -0,0 +1,33 @@
+/* Exit_test
+ *
+ * This routine safely stops the test and prints some information
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Exit_test( void )
+{
+ rtems_status_code status;
+ rtems_mode old_mode;
+
+ status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ MPCI_Print_statistics();
+
+ rtems_shutdown_executive( 0 );
+}
diff --git a/c/src/tests/mptests/mp14/init.c b/c/src/tests/mptests/mp14/init.c
new file mode 100644
index 0000000000..ac17a1236b
--- /dev/null
+++ b/c/src/tests/mptests/mp14/init.c
@@ -0,0 +1,191 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ printf(
+ "\n\n*** TEST 14 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Stop_Test = FALSE;
+
+ status = rtems_timer_create(
+ rtems_build_name('S', 'T', 'O', 'P'),
+ &timer_id
+ );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_timer_fire_after(
+ timer_id,
+ MAX_LONG_TEST_DURATION * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_task_name[ 1 ] = rtems_build_name( 'M', 'T', '1', ' ' );
+ Queue_task_name[ 2 ] = rtems_build_name( 'M', 'T', '2', ' ' );
+
+ Partition_task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+ Partition_task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );
+
+ Semaphore_task_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_task_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', 'R', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 1,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Partition (Global)" );
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ (void *)my_partition,
+ 0x8000,
+ 0x3800,
+ RTEMS_GLOBAL,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+ }
+
+ puts( "Creating Event task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Event_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Event task (Global)" );
+ status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Semaphore task (Global)" );
+ status = rtems_task_create(
+ Semaphore_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Semaphore_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Semaphore task (Global)" );
+ status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Message Queue task (Global)" );
+ status = rtems_task_create(
+ Queue_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Queue_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ /* argument is index into Buffers */
+ puts( "Starting Message Queue task (Global)" );
+ status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Partition task (Global)" );
+ status = rtems_task_create(
+ Partition_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Partition_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Partition task (Global)" );
+ status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_ident(
+ RTEMS_SELF,
+ RTEMS_SEARCH_ALL_NODES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_ident" );
+
+ Delayed_events_task( 1 );
+}
diff --git a/c/src/tests/mptests/mp14/msgtask1.c b/c/src/tests/mptests/mp14/msgtask1.c
new file mode 100644
index 0000000000..a8a3ddbd60
--- /dev/null
+++ b/c/src/tests/mptests/mp14/msgtask1.c
@@ -0,0 +1,107 @@
+/* Message_queue_task
+ *
+ * This task continuously sends messages to and receives messages from
+ * a global message queue. The message buffer is viewed as an array
+ * of two sixty-four bit counts which are incremented when a message is
+ * received.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Message_queue_task(
+ rtems_task_argument index
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 yield_count;
+ rtems_unsigned32 *buffer_count;
+ rtems_unsigned32 *overflow_count;
+ rtems_unsigned32 size;
+
+ Msg_buffer[ index ][0] = 0;
+ Msg_buffer[ index ][1] = 0;
+ Msg_buffer[ index ][2] = 0;
+ Msg_buffer[ index ][3] = 0;
+
+ puts( "Getting ID of msg queue" );
+ while ( FOREVER ) {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_message_queue_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_message_queue_send(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+ overflow_count = &Msg_buffer[ index ][0];
+ buffer_count = &Msg_buffer[ index ][1];
+ } else {
+ overflow_count = &Msg_buffer[ index ][2];
+ buffer_count = &Msg_buffer[ index ][3];
+ }
+
+ while ( Stop_Test == FALSE ) {
+ yield_count = 100;
+
+ for ( count=MESSAGE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+
+ if ( *buffer_count == (rtems_unsigned32)0xffffffff ) {
+ *buffer_count = 0;
+ *overflow_count += 1;
+ } else
+ *buffer_count += 1;
+
+ status = rtems_message_queue_send(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ if (Stop_Test == FALSE)
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ yield_count = 100;
+ }
+ }
+ put_dot( 'm' );
+ }
+
+ Exit_test();
+}
diff --git a/c/src/tests/mptests/mp14/node1/mp14.doc b/c/src/tests/mptests/mp14/node1/mp14.doc
new file mode 100644
index 0000000000..5ac3f7e47a
--- /dev/null
+++ b/c/src/tests/mptests/mp14/node1/mp14.doc
@@ -0,0 +1,50 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test63
+
+INTERRUPT SATURATION TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_ident, tm_tick,
+ tm_evwhen, tm_wkafter, i_return, ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies printing of strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies printing of strings to the CRT on port 2 of the mvme136 board
+ using Write and Writeln and the TTY driver.
+
+ e. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ f. Verifies executive initialization performed correctly.
+
+ g. Verifies the executive trap handler except for the halt function.
+
+ h. Verifies that a task can get the task identification number of itself.
+
+ i. Verifies that a task can get the task identification number
+ of another task.
+
+ j. Verifies that events can be sent to a remote task.
diff --git a/c/src/tests/mptests/mp14/node1/mp14.scn b/c/src/tests/mptests/mp14/node1/mp14.scn
new file mode 100644
index 0000000000..f57c4f47b3
--- /dev/null
+++ b/c/src/tests/mptests/mp14/node1/mp14.scn
@@ -0,0 +1,41 @@
+*** TEST 14 -- NODE 1 ***
+Creating Semaphore (Global)
+Creating Message Queue (Global)
+Creating Partition (Global)
+Creating Event task (Global)
+Starting Event task (Global)
+Creating Semaphore task (Global)
+About to go to sleep!
+Starting Semaphore task (Global)
+Creating Message Queue task (Global)
+Getting SMID of semaphore
+Starting Message Queue task (Global)
+Creating Partition task (Global)
+Getting ID of msg queue
+Starting Partition task (Global)
+Getting ID of partition
+Waking up!
+Remote task's name is : 222
+Getting TID of remote task
+Sending events to remote task
+<stream of following characters>
+
+. - indicates 100 iterations of
+ tm_evafter of 1 tick and rtems_event_receive.
+
+e - indicates that 100
+ events have been sent to the remote task.
+
+m - indicates 100 iterations of
+ rtems_message_queue_send and rtems_message_queue_receive.
+
+p - indicates 100 iterations of
+ rtems_partition_get_buffer and rtems_partition_return_buffer.
+
+s - indicates 100 iterations of
+ rtems_semaphore_obtain and rtems_semaphore_release.
+
+NOTES: 1. The messages could be interspersed.
+ 2. If one of the nodes exits first, the other may report
+ timeout errors on blocking directives.
+
diff --git a/c/src/tests/mptests/mp14/node2/mp14.doc b/c/src/tests/mptests/mp14/node2/mp14.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/mptests/mp14/node2/mp14.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/mptests/mp14/node2/mp14.scn b/c/src/tests/mptests/mp14/node2/mp14.scn
new file mode 100644
index 0000000000..d128c870e9
--- /dev/null
+++ b/c/src/tests/mptests/mp14/node2/mp14.scn
@@ -0,0 +1,38 @@
+*** TEST 14 -- NODE 2 ***
+Creating Event task (Global)
+Starting Event task (Global)
+Creating Semaphore task (Global)
+About to go to sleep!
+Starting Semaphore task (Global)
+Creating Message Queue task (Global)
+Getting SMID of semaphore
+Starting Message Queue task (Global)
+Creating Partition task (Global)
+Getting ID of msg queue
+Starting Partition task (Global)
+Getting ID of partition
+Waking up!
+Remote task's name is : 111
+Getting TID of remote task
+Receiving events from remote task
+<stream of following characters>
+
+. - indicates 100 iterations of
+ tm_evafter of 1 tick and rtems_event_receive.
+
+e - indicates that 100
+ events have been sent to the remote task.
+
+m - indicates 100 iterations of
+ rtems_message_queue_send and rtems_message_queue_receive.
+
+p - indicates 100 iterations of
+ rtems_partition_get_buffer and rtems_partition_return_buffer.
+
+s - indicates 100 iterations of
+ rtems_semaphore_obtain and rtems_semaphore_release.
+
+NOTES: 1. The messages could be interspersed.
+ 2. If one of the nodes exits first, the other may report
+ timeout errors on blocking directives.
+
diff --git a/c/src/tests/mptests/mp14/pttask1.c b/c/src/tests/mptests/mp14/pttask1.c
new file mode 100644
index 0000000000..6aa1c714fc
--- /dev/null
+++ b/c/src/tests/mptests/mp14/pttask1.c
@@ -0,0 +1,71 @@
+/* Partition_task
+ *
+ * This task continuously gets a buffer from and returns that buffer
+ * to a global partition.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Partition_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 yield_count;
+ void *buffer;
+
+ puts( "Getting ID of partition" );
+ while ( FOREVER ) {
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Partition_id[ 1 ]
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ puts( "rtems_partition_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ yield_count = 100;
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=PARTITION_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer );
+ directive_failed( status, "rtems_partition_get_buffer" );
+
+ status = rtems_partition_return_buffer( Partition_id[ 1 ], buffer );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ if (Stop_Test == FALSE)
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( 1 );
+ directive_failed( status, "rtems_task_wake_after" );
+ yield_count = 100;
+ }
+ }
+ put_dot( 'p' );
+ }
+
+ Exit_test();
+}
diff --git a/c/src/tests/mptests/mp14/smtask1.c b/c/src/tests/mptests/mp14/smtask1.c
new file mode 100644
index 0000000000..5bb14ee0da
--- /dev/null
+++ b/c/src/tests/mptests/mp14/smtask1.c
@@ -0,0 +1,73 @@
+/* Sm_test_task
+ *
+ * This task continuously obtains and releases a global semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Semaphore_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 yield_count;
+
+ puts( "Getting SMID of semaphore" );
+ while ( FOREVER ) {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_semaphore_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ yield_count = 100;
+
+ while ( Stop_Test == FALSE ) {
+
+ for ( count=SEMAPHORE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ if ( Stop_Test == FALSE )
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ yield_count = 100;
+ }
+ }
+ put_dot( 's' );
+ }
+
+ Exit_test();
+}
diff --git a/c/src/tests/mptests/mp14/system.h b/c/src/tests/mptests/mp14/system.h
new file mode 100644
index 0000000000..051727e854
--- /dev/null
+++ b/c/src/tests/mptests/mp14/system.h
@@ -0,0 +1,115 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id timer_id,
+ void *ignored_address
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Delayed_events_task(
+ rtems_task_argument argument
+);
+
+rtems_task Message_queue_task(
+ rtems_task_argument index
+);
+
+rtems_task Partition_task(
+ rtems_task_argument argument
+);
+
+rtems_task Semaphore_task(
+ rtems_task_argument argument
+);
+
+void Exit_test( void );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 1
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_TIMERS 12
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#elif ( NODE_NUMBER == 2 )
+#define CONFIGURE_MAXIMUM_TIMERS 2
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Event_task_id[ 2 ]; /* event task ids */
+
+TEST_EXTERN rtems_id Semaphore_task_id[ 2 ]; /* semaphore task ids */
+TEST_EXTERN rtems_name Semaphore_task_name[ 2 ]; /* semaphore task names */
+
+TEST_EXTERN rtems_id Queue_task_id[ 3 ]; /* message queue task ids */
+TEST_EXTERN rtems_name Queue_task_name[ 3 ]; /* message queue task names */
+
+TEST_EXTERN rtems_id Partition_task_id[ 4 ]; /* partition task ids */
+TEST_EXTERN rtems_name Partition_task_name[ 4 ]; /* partition task names */
+
+TEST_EXTERN rtems_id Partition_id[ 3 ]; /* partition ids */
+TEST_EXTERN rtems_name Partition_name[ 3 ]; /* partition names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 3 ]; /* semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 3 ]; /* semaphore names */
+
+TEST_EXTERN rtems_id Queue_id[ 3 ]; /* message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 3 ]; /* message queue names */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* remote event task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* remote event task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* event timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* event timer names */
+
+TEST_EXTERN rtems_unsigned32 Msg_buffer[ 4 ][ 4 ];
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+TEST_EXTERN rtems_id timer_id;
+
+#define EVENT_TASK_DOT_COUNT 100
+#define EVENT_SEND_DOT_COUNT 100
+#define DELAYED_EVENT_DOT_COUNT 1000
+#define MESSAGE_DOT_COUNT 200
+#define PARTITION_DOT_COUNT 200
+#define SEMAPHORE_DOT_COUNT 200
+
+/* end of include file */
diff --git a/c/src/tests/samples/README b/c/src/tests/samples/README
new file mode 100644
index 0000000000..10f1c1d7bb
--- /dev/null
+++ b/c/src/tests/samples/README
@@ -0,0 +1,73 @@
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+# $Id$
+#
+
+This directory contains the RTEMS Sample Application Suite.
+The tests in this directory perform two functions:
+
+ + provide simple examples of applications which can be
+ used as a starting point for your application.
+
+ + help test a new board support package
+
+The hello and ticker applications are useful when first bringing up
+a new board support package. The base_mp test is useful when
+performing initial checkout on a new MPCI layer.
+
+The following describes each of the sample applications:
+
+ base_mp
+
+ This is a very simple two node multiprocessor application. It consists
+ of a single initialization task on each node which print out
+ their respective node numbers and task IDs. This test can be
+ used as a simple test of a new MPCI layer because it minimizes
+ the number of packets sent by RTEMS.
+
+ This is intended as a starting point for custom developed multiprocessor
+ applications.
+
+ base_sp
+
+ This is a simple single processor application which consists of
+ an initialization task which creates another task.
+
+ This is intended as a starting point for custom developed single
+ processor applications.
+
+ cdtest
+
+ A very simple C++ application which demonstrates that it is
+ possible to use C++ contructors and destructors in an RTEMS
+ application. Also does a perfunctory iostream test.
+
+ hello
+
+ This is the RTEMS version of the classic hello world program.
+ It consists of single initialization task which prints out
+ a few messages.
+
+ This test does not include a Clock Tick device driver and can
+ be used to test the startup code of the board support package
+ as well as console output.
+
+ paranoia
+
+ A public domain test of the floating point and math library
+ capabilities of a toolset. It reports discrepancies between
+ actual and expected results. It is a large test.
+
+ ticker
+
+ This is a simple test of the user's Clock Tick device driver.
+ This test has an initialization task create three application
+ tasks which sleep and periodically wake up and print the time.
+
diff --git a/c/src/tests/samples/base_mp/apptask.c b/c/src/tests/samples/base_mp/apptask.c
new file mode 100644
index 0000000000..4f0bc72c74
--- /dev/null
+++ b/c/src/tests/samples/base_mp/apptask.c
@@ -0,0 +1,37 @@
+/* Application_task
+ *
+ * This routine is as an example of an application task which
+ * prints a message including its RTEMS task id. This task
+ * then invokes exit to return to the monitor.
+ *
+ * Input parameters:
+ * node - processor's node number
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Application_task(
+ rtems_task_argument node
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ printf( "This task was invoked with the node argument (%d)\n", node );
+ printf( "This task has the id of 0x%x\n", tid );
+ printf( "*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ exit( 0 );
+}
diff --git a/c/src/tests/samples/base_mp/init.c b/c/src/tests/samples/base_mp/init.c
new file mode 100644
index 0000000000..1e73fd0e56
--- /dev/null
+++ b/c/src/tests/samples/base_mp/init.c
@@ -0,0 +1,46 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the application, the current time might be
+ * set by this task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_name task_name;
+ rtems_id tid;
+ rtems_status_code status;
+
+ printf( "\n\n*** SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ printf( "Creating and starting an application task\n" );
+ task_name = rtems_build_name( 'T', 'A', '1', ' ' );
+ status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
+ status = rtems_task_start(
+ tid,
+ Application_task,
+ Multiprocessing_configuration.node
+ );
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/c/src/tests/samples/base_mp/node1/base_mp.doc b/c/src/tests/samples/base_mp/node1/base_mp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/base_mp/node1/base_mp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/base_mp/node1/base_mp.scn b/c/src/tests/samples/base_mp/node1/base_mp.scn
new file mode 100644
index 0000000000..a2d2f359be
--- /dev/null
+++ b/c/src/tests/samples/base_mp/node1/base_mp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE MULTIPROCESSOR APPLICATION ***
+Creating and starting an application task
+This task was invoked with the node argument (1)
+This task has the id of 0x10002
+*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
diff --git a/c/src/tests/samples/base_mp/node2/base_mp.doc b/c/src/tests/samples/base_mp/node2/base_mp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/base_mp/node2/base_mp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/base_mp/node2/base_mp.scn b/c/src/tests/samples/base_mp/node2/base_mp.scn
new file mode 100644
index 0000000000..95bc96a808
--- /dev/null
+++ b/c/src/tests/samples/base_mp/node2/base_mp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE MULTIPROCESSOR APPLICATION ***
+Creating and starting an application task
+This task was invoked with the node argument (2)
+This task has the id of 0x20002
+*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
diff --git a/c/src/tests/samples/base_mp/system.h b/c/src/tests/samples/base_mp/system.h
new file mode 100644
index 0000000000..ec07193b72
--- /dev/null
+++ b/c/src/tests/samples/base_mp/system.h
@@ -0,0 +1,46 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Application_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+/*
+ * Put the overrides of default configuration parameters here.
+ */
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/c/src/tests/samples/base_sp/apptask.c b/c/src/tests/samples/base_sp/apptask.c
new file mode 100644
index 0000000000..03c406f9ff
--- /dev/null
+++ b/c/src/tests/samples/base_sp/apptask.c
@@ -0,0 +1,38 @@
+/* Application_task
+ *
+ * This routine is as an example of an application task which
+ * prints a message including its RTEMS task id. This task
+ * then invokes exit to return to the monitor.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Application_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+
+ printf( "Application task was invoked with argument (%d) "
+ "and has id of 0x%x\n", argument, tid );
+
+ printf( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ exit( 0 );
+}
diff --git a/c/src/tests/samples/base_sp/base_sp.doc b/c/src/tests/samples/base_sp/base_sp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/base_sp/base_sp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/base_sp/base_sp.scn b/c/src/tests/samples/base_sp/base_sp.scn
new file mode 100644
index 0000000000..117ddaecb8
--- /dev/null
+++ b/c/src/tests/samples/base_sp/base_sp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE SINGLE PROCESSOR APPLICATION ***
+Creating and starting an application task
+Application task was invoked with argument (0) and has id of 0x10002
+*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
+
diff --git a/c/src/tests/samples/base_sp/init.c b/c/src/tests/samples/base_sp/init.c
new file mode 100644
index 0000000000..e40d5e008a
--- /dev/null
+++ b/c/src/tests/samples/base_sp/init.c
@@ -0,0 +1,48 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the application, the current time might be
+ * set by this task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+#define ARGUMENT 0
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_name task_name;
+ rtems_id tid;
+ rtems_status_code status;
+
+ printf( "\n\n*** SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ printf( "Creating and starting an application task\n" );
+
+ task_name = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
+
+ status = rtems_task_start( tid, Application_task, ARGUMENT );
+
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/c/src/tests/samples/base_sp/system.h b/c/src/tests/samples/base_sp/system.h
new file mode 100644
index 0000000000..172ced543d
--- /dev/null
+++ b/c/src/tests/samples/base_sp/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Application_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/c/src/tests/samples/cdtest/cdtest.scn b/c/src/tests/samples/cdtest/cdtest.scn
new file mode 100644
index 0000000000..a832a72372
--- /dev/null
+++ b/c/src/tests/samples/cdtest/cdtest.scn
@@ -0,0 +1,31 @@
+Hey I'm in base class constructor number 1 for 0x400010cc.
+Hey I'm in base class constructor number 2 for 0x400010d4.
+Hey I'm in derived class constructor number 3 for 0x400010d4.
+
+
+*** CONSTRUCTOR/DESTRUCTOR TEST ***
+Hey I'm in base class constructor number 4 for 0x4009ee08.
+Hey I'm in base class constructor number 5 for 0x4009ee10.
+Hey I'm in base class constructor number 6 for 0x4009ee18.
+Hey I'm in base class constructor number 7 for 0x4009ee20.
+Hey I'm in derived class constructor number 8 for 0x4009ee20.
+Testing a C++ I/O stream
+Hey I'm in derived class destructor number 8 for 0x4009ee20.
+Derived class - Instantiation order 8
+Hey I'm in base class destructor number 7 for 0x4009ee20.
+Instantiation order 8
+Hey I'm in base class destructor number 6 for 0x4009ee18.
+Instantiation order 6
+Hey I'm in base class destructor number 5 for 0x4009ee10.
+Instantiation order 5
+Hey I'm in base class destructor number 4 for 0x4009ee08.
+Instantiation order 5
+*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***
+
+
+Hey I'm in derived class destructor number 3 for 0x400010d4.
+Derived class - Instantiation order 3
+Hey I'm in base class destructor number 2 for 0x400010d4.
+Instantiation order 3
+Hey I'm in base class destructor number 1 for 0x400010cc.
+Instantiation order 1
diff --git a/c/src/tests/samples/cdtest/init.c b/c/src/tests/samples/cdtest/init.c
new file mode 100644
index 0000000000..6f3736550c
--- /dev/null
+++ b/c/src/tests/samples/cdtest/init.c
@@ -0,0 +1,26 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+#include <stdio.h>
diff --git a/c/src/tests/samples/cdtest/main.cc b/c/src/tests/samples/cdtest/main.cc
new file mode 100644
index 0000000000..d6b7126e5c
--- /dev/null
+++ b/c/src/tests/samples/cdtest/main.cc
@@ -0,0 +1,145 @@
+/* main
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * Based in part on OAR works.
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+#include <iostream.h>
+
+extern "C" {
+extern rtems_task main_task(rtems_task_argument);
+}
+
+static int num_inst = 0;
+
+class A {
+public:
+ A(void)
+ {
+ num_inst++;
+ printf(
+ "Hey I'm in base class constructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+
+ /*
+ * Make sure we use some space
+ */
+
+ string = new char[50];
+ sprintf(string, "Instantiation order %d", num_inst);
+ };
+
+ virtual ~A()
+ {
+ printf(
+ "Hey I'm in base class destructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+ print();
+ num_inst--;
+ };
+
+ virtual void print() { printf("%s\n", string); };
+
+protected:
+ char *string;
+};
+
+class B : public A {
+public:
+ B(void)
+ {
+ num_inst++;
+ printf(
+ "Hey I'm in derived class constructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+
+ /*
+ * Make sure we use some space
+ */
+
+ string = new char[50];
+ sprintf(string, "Instantiation order %d", num_inst);
+ };
+
+ ~B()
+ {
+ printf(
+ "Hey I'm in derived class destructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+ print();
+ num_inst--;
+ };
+
+ void print() { printf("Derived class - %s\n", string); }
+};
+
+
+A foo;
+B foobar;
+
+void
+cdtest(void)
+{
+ A bar, blech, blah;
+ B bleak;
+
+ cout << "Testing a C++ I/O stream" << endl;
+
+ bar = blech;
+}
+
+//
+// main equivalent
+// It can not be called 'main' since the bsp owns that name
+// in many implementations in order to get global constructors
+// run.
+//
+// Ref: c/src/lib/libbsp/hppa1_1/pxfl/startup/bspstart.c
+//
+
+
+rtems_task main_task(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** CONSTRUCTOR/DESTRUCTOR TEST ***\n" );
+
+ cdtest();
+
+ printf( "*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***\n\n\n" );
+
+ exit(0);
+}
diff --git a/c/src/tests/samples/cdtest/system.h b/c/src/tests/samples/cdtest/system.h
new file mode 100644
index 0000000000..2400478ed9
--- /dev/null
+++ b/c/src/tests/samples/cdtest/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task main_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
+#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' )
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/c/src/tests/samples/hello/hello.doc b/c/src/tests/samples/hello/hello.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/hello/hello.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/hello/hello.scn b/c/src/tests/samples/hello/hello.scn
new file mode 100644
index 0000000000..d9e92d81d5
--- /dev/null
+++ b/c/src/tests/samples/hello/hello.scn
@@ -0,0 +1,3 @@
+*** HELLO WORLD TEST ***
+Hello World
+*** END OF HELLO WORLD TEST ***
diff --git a/c/src/tests/samples/hello/init.c b/c/src/tests/samples/hello/init.c
new file mode 100644
index 0000000000..c1c25bf045
--- /dev/null
+++ b/c/src/tests/samples/hello/init.c
@@ -0,0 +1,36 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+#include <stdio.h>
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** HELLO WORLD TEST ***\n" );
+ printf( "Hello World\n" );
+ printf( "*** END OF HELLO WORLD TEST ***\n" );
+ exit( 0 );
+}
diff --git a/c/src/tests/samples/hello/system.h b/c/src/tests/samples/hello/system.h
new file mode 100644
index 0000000000..8af4376e0f
--- /dev/null
+++ b/c/src/tests/samples/hello/system.h
@@ -0,0 +1,35 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/c/src/tests/samples/paranoia/init.c b/c/src/tests/samples/paranoia/init.c
new file mode 100644
index 0000000000..9c54e0d416
--- /dev/null
+++ b/c/src/tests/samples/paranoia/init.c
@@ -0,0 +1,39 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+extern int paranoia(int, char **);
+
+char *args[2] = { "paranoia", 0 };
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** PARANOIA TEST ***\n" );
+ paranoia(1, args);
+ printf( "*** END OF PARANOIA TEST ***\n" );
+ exit( 0 );
+}
diff --git a/c/src/tests/samples/paranoia/paranoia.c b/c/src/tests/samples/paranoia/paranoia.c
new file mode 100644
index 0000000000..3b860c3b4a
--- /dev/null
+++ b/c/src/tests/samples/paranoia/paranoia.c
@@ -0,0 +1,2300 @@
+/*
+ * $Id$
+ *
+ * A C version of Kahan's Floating Point Test "Paranoia"
+ *
+ * Thos Sumner, UCSF, Feb. 1985
+ * David Gay, BTL, Jan. 1986
+ *
+ * This is a rewrite from the Pascal version by
+ *
+ * B. A. Wichmann, 18 Jan. 1985
+ *
+ * (and does NOT exhibit good C programming style).
+ *
+ * Sun May 16 18:21:51 MDT 1993 Jeffrey Wheat (cassidy@cygnus.com)
+ * Removed KR_headers defines, removed ANSI prototyping
+ * Cleaned up and reformated code. Added special CYGNUS
+ * "verbose" mode type messages (-DCYGNUS).
+ * Note: This code is VERY NASTY.
+ *
+ * Adjusted to use Standard C headers 19 Jan. 1992 (dmg);
+ * compile with -DKR_headers or insert
+ * #define KR_headers
+ * at the beginning if you have an old-style C compiler.
+ *
+ * (C) Apr 19 1983 in BASIC version by:
+ * Professor W. M. Kahan,
+ * 567 Evans Hall
+ * Electrical Engineering & Computer Science Dept.
+ * University of California
+ * Berkeley, California 94720
+ * USA
+ *
+ * converted to Pascal by:
+ * B. A. Wichmann
+ * National Physical Laboratory
+ * Teddington Middx
+ * TW11 OLW
+ * UK
+ *
+ * converted to C by:
+ *
+ * David M. Gay and Thos Sumner
+ * AT&T Bell Labs Computer Center, Rm. U-76
+ * 600 Mountain Avenue University of California
+ * Murray Hill, NJ 07974 San Francisco, CA 94143
+ * USA USA
+ *
+ * with simultaneous corrections to the Pascal source (reflected
+ * in the Pascal source available over netlib).
+ * [A couple of bug fixes from dgh = sun!dhough incorporated 31 July 1986.]
+ *
+ * Reports of results on various systems from all the versions
+ * of Paranoia are being collected by Richard Karpinski at the
+ * same address as Thos Sumner. This includes sample outputs,
+ * bug reports, and criticisms.
+ *
+ * You may copy this program freely if you acknowledge its source.
+ * Comments on the Pascal version to NPL, please.
+ *
+ *
+ * The C version catches signals from floating-point exceptions.
+ * If signal(SIGFPE,...) is unavailable in your environment, you may
+ * #define NOSIGNAL to comment out the invocations of signal.
+ *
+ * This source file is too big for some C compilers, but may be split
+ * into pieces. Comments containing "SPLIT" suggest convenient places
+ * for this splitting. At the end of these comments is an "ed script"
+ * (for the UNIX(tm) editor ed) that will do this splitting.
+ *
+ * By #defining SINGLE_PRECISION when you compile this source, you may
+ * obtain a single-precision C version of Paranoia.
+ *
+ * The following is from the introductory commentary from Wichmann's work:
+ *
+ * The BASIC program of Kahan is written in Microsoft BASIC using many
+ * facilities which have no exact analogy in Pascal. The Pascal
+ * version below cannot therefore be exactly the same. Rather than be
+ * a minimal transcription of the BASIC program, the Pascal coding
+ * follows the conventional style of block-structured languages. Hence
+ * the Pascal version could be useful in producing versions in other
+ * structured languages.
+ *
+ * Rather than use identifiers of minimal length (which therefore have
+ * little mnemonic significance), the Pascal version uses meaningful
+ * identifiers as follows [Note: A few changes have been made for C]:
+ *
+ *
+ * BASIC C BASIC C BASIC C
+ *
+ * A J S StickyBit
+ * A1 AInverse J0 NoErrors T
+ * B Radix [Failure] T0 Underflow
+ * B1 BInverse J1 NoErrors T2 ThirtyTwo
+ * B2 RadixD2 [SeriousDefect] T5 OneAndHalf
+ * B9 BMinusU2 J2 NoErrors T7 TwentySeven
+ * C [Defect] T8 TwoForty
+ * C1 CInverse J3 NoErrors U OneUlp
+ * D [Flaw] U0 UnderflowThreshold
+ * D4 FourD K PageNo U1
+ * E0 L Milestone U2
+ * E1 M V
+ * E2 Exp2 N V0
+ * E3 N1 V8
+ * E5 MinSqEr O Zero V9
+ * E6 SqEr O1 One W
+ * E7 MaxSqEr O2 Two X
+ * E8 O3 Three X1
+ * E9 O4 Four X8
+ * F1 MinusOne O5 Five X9 Random1
+ * F2 Half O8 Eight Y
+ * F3 Third O9 Nine Y1
+ * F6 P Precision Y2
+ * F9 Q Y9 Random2
+ * G1 GMult Q8 Z
+ * G2 GDiv Q9 Z0 PseudoZero
+ * G3 GAddSub R Z1
+ * H R1 RMult Z2
+ * H1 HInverse R2 RDiv Z9
+ * I R3 RAddSub
+ * IO NoTrials R4 RSqrt
+ * I3 IEEE R9 Random9
+ *
+ * SqRWrng
+ *
+ * All the variables in BASIC are true variables and in consequence,
+ * the program is more difficult to follow since the "constants" must
+ * be determined (the glossary is very helpful). The Pascal version
+ * uses Real constants, but checks are added to ensure that the values
+ * are correctly converted by the compiler.
+ *
+ * The major textual change to the Pascal version apart from the
+ * identifiersis that named procedures are used, inserting parameters
+ * wherehelpful. New procedures are also introduced. The
+ * correspondence is as follows:
+ *
+ *
+ * BASIC Pascal
+ * lines
+ *
+ * 90- 140 Pause
+ * 170- 250 Instructions
+ * 380- 460 Heading
+ * 480- 670 Characteristics
+ * 690- 870 History
+ * 2940-2950 Random
+ * 3710-3740 NewD
+ * 4040-4080 DoesYequalX
+ * 4090-4110 PrintIfNPositive
+ * 4640-4850 TestPartialUnderflow
+ *
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * To compile this on host using only libm from newlib (and using host libc)
+ * do:
+ * gcc -g -DNEED_REENT -DCYGNUS paranoia.c .../newlib-1.6/newlib/libm.a
+ */
+
+#ifdef NEED_REENT
+#include <reent.h>
+struct _reent libm_reent = _REENT_INIT(libm_reent);
+struct _reent *_impure_ptr = &libm_reent;
+#endif
+
+#ifndef NOSIGNAL
+#include <signal.h>
+#include <setjmp.h>
+#else /* NOSIGNAL */
+#define longjmp(e,v)
+#define setjmp(e) 0
+#define jmp_buf int
+#endif /* NOSIGNAL */
+
+#ifdef SINGLE_PRECISION
+#define FLOAT float
+#define FABS(x) (float)fabs((double)(x))
+#define FLOOR(x) (float)floor((double)(x))
+#define LOG(x) (float)log((double)(x))
+#define POW(x,y) (float)pow((double)(x),(double)(y))
+#define SQRT(x) (float)sqrt((double)(x))
+#else /* !SINGLE_PRECISION */
+#define FLOAT double
+#define FABS(x) fabs(x)
+#define FLOOR(x) floor(x)
+#define LOG(x) log(x)
+#define POW(x,y) pow(x,y)
+#define SQRT(x) sqrt(x)
+#endif /* SINGLE_PRECISION */
+
+jmp_buf ovfl_buf;
+extern double fabs (), floor (), log (), pow (), sqrt ();
+extern void exit ();
+typedef void (*Sig_type) ();
+FLOAT Sign (), Random ();
+extern void BadCond ();
+extern void SqXMinX ();
+extern void TstCond ();
+extern void notify ();
+extern int read ();
+extern void Characteristics ();
+extern void Heading ();
+extern void History ();
+extern void Instructions ();
+extern void IsYeqX ();
+extern void NewD ();
+extern void Pause ();
+extern void PrintIfNPositive ();
+extern void SR3750 ();
+extern void SR3980 ();
+extern void TstPtUf ();
+
+Sig_type sigsave;
+
+#define KEYBOARD 0
+
+FLOAT Radix, BInvrse, RadixD2, BMinusU2;
+
+/*Small floating point constants.*/
+FLOAT Zero = 0.0;
+FLOAT Half = 0.5;
+FLOAT One = 1.0;
+FLOAT Two = 2.0;
+FLOAT Three = 3.0;
+FLOAT Four = 4.0;
+FLOAT Five = 5.0;
+FLOAT Eight = 8.0;
+FLOAT Nine = 9.0;
+FLOAT TwentySeven = 27.0;
+FLOAT ThirtyTwo = 32.0;
+FLOAT TwoForty = 240.0;
+FLOAT MinusOne = -1.0;
+FLOAT OneAndHalf = 1.5;
+
+/*Integer constants*/
+int NoTrials = 20; /*Number of tests for commutativity. */
+#define False 0
+#define True 1
+
+/*
+ * Definitions for declared types
+ * Guard == (Yes, No);
+ * Rounding == (Chopped, Rounded, Other);
+ * Message == packed array [1..40] of char;
+ * Class == (Flaw, Defect, Serious, Failure);
+ */
+#define Yes 1
+#define No 0
+#define Chopped 2
+#define Rounded 1
+#define Other 0
+#define Flaw 3
+#define Defect 2
+#define Serious 1
+#define Failure 0
+typedef int Guard, Rounding, Class;
+typedef char Message;
+
+/* Declarations of Variables */
+int Indx;
+char ch[8];
+FLOAT AInvrse, A1;
+FLOAT C, CInvrse;
+FLOAT D, FourD;
+FLOAT E0, E1, Exp2, E3, MinSqEr;
+FLOAT SqEr, MaxSqEr, E9;
+FLOAT Third;
+FLOAT F6, F9;
+FLOAT H, HInvrse;
+int I;
+FLOAT StickyBit, J;
+FLOAT MyZero;
+FLOAT Precision;
+FLOAT Q, Q9;
+FLOAT R, Random9;
+FLOAT T, Underflow, S;
+FLOAT OneUlp, UfThold, U1, U2;
+FLOAT V, V0, V9;
+FLOAT W;
+FLOAT X, X1, X2, X8, Random1;
+FLOAT Y, Y1, Y2, Random2;
+FLOAT Z, PseudoZero, Z1, Z2, Z9;
+int ErrCnt[4];
+int fpecount;
+int Milestone;
+int PageNo;
+int M, N, N1;
+Guard GMult, GDiv, GAddSub;
+Rounding RMult, RDiv, RAddSub, RSqrt;
+int Break, Done, NotMonot, Monot, Anomaly, IEEE, SqRWrng, UfNGrad;
+
+/* Computed constants.
+ * U1 gap below 1.0, i.e, 1.0 - U1 is next number below 1.0
+ * U2 gap above 1.0, i.e, 1.0 + U2 is next number above 1.0
+ */
+
+int batchmode; /* global batchmode test */
+
+/* program name and version variables and macro */
+char *temp;
+char *program_name;
+char *program_vers;
+
+#ifndef VERSION
+#define VERSION "1.1 [cygnus]"
+#endif /* VERSION */
+
+#define basename(cp) ((temp=(char *)strrchr((cp), '/')) ? temp+1 : (cp))
+
+#ifndef BATCHMODE
+# ifdef CYGNUS
+# define BATCHMODE
+# endif
+#endif
+
+/* floating point exception receiver */
+void
+_sigfpe (x)
+int x;
+{
+ fpecount++;
+ printf ("\n* * * FLOATING-POINT ERROR %d * * *\n", x);
+ fflush (stdout);
+ if (sigsave) {
+#ifndef NOSIGNAL
+ signal (SIGFPE, sigsave);
+#endif /* NOSIGNAL */
+ sigsave = 0;
+ longjmp (ovfl_buf, 1);
+ }
+ exit (1);
+}
+
+#ifdef NOMAIN
+#define main paranoia
+#endif
+
+int
+main (argc, argv)
+int argc;
+char **argv;
+{
+ /* First two assignments use integer right-hand sides. */
+ Zero = 0;
+ One = 1;
+ Two = One + One;
+ Three = Two + One;
+ Four = Three + One;
+ Five = Four + One;
+ Eight = Four + Four;
+ Nine = Three * Three;
+ TwentySeven = Nine * Three;
+ ThirtyTwo = Four * Eight;
+ TwoForty = Four * Five * Three * Four;
+ MinusOne = -One;
+ Half = One / Two;
+ OneAndHalf = One + Half;
+ ErrCnt[Failure] = 0;
+ ErrCnt[Serious] = 0;
+ ErrCnt[Defect] = 0;
+ ErrCnt[Flaw] = 0;
+ PageNo = 1;
+
+#ifdef BATCHMODE
+ batchmode = 1; /* run test in batchmode? */
+#else /* !BATCHMODE */
+ batchmode = 0; /* run test interactively */
+#endif /* BATCHMODE */
+
+ program_name = basename (argv[0]);
+ program_vers = VERSION;
+
+ printf ("%s version %s\n", program_name, program_vers);
+
+ /*=============================================*/
+ Milestone = 0;
+ /*=============================================*/
+#ifndef NOSIGNAL
+ signal (SIGFPE, _sigfpe);
+#endif
+
+ if (!batchmode) {
+ Instructions ();
+ Pause ();
+ Heading ();
+ Instructions ();
+ Pause ();
+ Heading ();
+ Pause ();
+ Characteristics ();
+ Pause ();
+ History ();
+ Pause ();
+ }
+
+ /*=============================================*/
+ Milestone = 7;
+ /*=============================================*/
+ printf ("Program is now RUNNING tests on small integers:\n");
+ TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero)
+ && (One > Zero) && (One + One == Two),
+ "0+0 != 0, 1-1 != 0, 1 <= 0, or 1+1 != 2");
+ Z = -Zero;
+ if (Z != 0.0) {
+ ErrCnt[Failure] = ErrCnt[Failure] + 1;
+ printf ("Comparison alleges that -0.0 is Non-zero!\n");
+ U1 = 0.001;
+ Radix = 1;
+ TstPtUf ();
+ }
+ TstCond (Failure, (Three == Two + One) && (Four == Three + One)
+ && (Four + Two * (-Two) == Zero)
+ && (Four - Three - One == Zero),
+ "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0");
+ TstCond (Failure, (MinusOne == (0 - One))
+ && (MinusOne + One == Zero) && (One + MinusOne == Zero)
+ && (MinusOne + FABS (One) == Zero)
+ && (MinusOne + MinusOne * MinusOne == Zero),
+ "-1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0");
+ TstCond (Failure, Half + MinusOne + Half == Zero,
+ "1/2 + (-1) + 1/2 != 0");
+ /*=============================================*/
+ Milestone = 10;
+ /*=============================================*/
+ TstCond (Failure, (Nine == Three * Three)
+ && (TwentySeven == Nine * Three) && (Eight == Four + Four)
+ && (ThirtyTwo == Eight * Four)
+ && (ThirtyTwo - TwentySeven - Four - One == Zero),
+ "9 != 3*3, 27 != 9*3, 32 != 8*4, or 32-27-4-1 != 0");
+ TstCond (Failure, (Five == Four + One) &&
+ (TwoForty == Four * Five * Three * Four)
+ && (TwoForty / Three - Four * Four * Five == Zero)
+ && (TwoForty / Four - Five * Three * Four == Zero)
+ && (TwoForty / Five - Four * Three * Four == Zero),
+ "5 != 4+1, 240/3 != 80, 240/4 != 60, or 240/5 != 48");
+ if (ErrCnt[Failure] == 0) {
+ printf ("-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.\n");
+ printf ("\n");
+ }
+ printf ("Searching for Radix and Precision.\n");
+ W = One;
+ do {
+ W = W + W;
+ Y = W + One;
+ Z = Y - W;
+ Y = Z - One;
+ }
+ while (MinusOne + FABS (Y) < Zero);
+ /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/
+ Precision = Zero;
+ Y = One;
+ do {
+ Radix = W + Y;
+ Y = Y + Y;
+ Radix = Radix - W;
+ }
+ while (Radix == Zero);
+ if (Radix < Two)
+ Radix = One;
+ printf ("Radix = %f .\n", Radix);
+ if (Radix != 1) {
+ W = One;
+ do {
+ Precision = Precision + One;
+ W = W * Radix;
+ Y = W + One;
+ }
+ while ((Y - W) == One);
+ }
+ /*... now W == Radix^Precision is barely too big to satisfy (W+1)-W == 1
+ ...*/
+ U1 = One / W;
+ U2 = Radix * U1;
+ printf ("Closest relative separation found is U1 = %.7e .\n\n", U1);
+ printf ("Recalculating radix and precision\n ");
+
+ /*save old values*/
+ E0 = Radix;
+ E1 = U1;
+ E9 = U2;
+ E3 = Precision;
+
+ X = Four / Three;
+ Third = X - One;
+ F6 = Half - Third;
+ X = F6 + F6;
+ X = FABS (X - Third);
+ if (X < U2)
+ X = U2;
+
+ /*... now X = (unknown no.) ulps of 1+...*/
+ do {
+ U2 = X;
+ Y = Half * U2 + ThirtyTwo * U2 * U2;
+ Y = One + Y;
+ X = Y - One;
+ }
+ while (!((U2 <= X) || (X <= Zero)));
+
+ /*... now U2 == 1 ulp of 1 + ... */
+ X = Two / Three;
+ F6 = X - Half;
+ Third = F6 + F6;
+ X = Third - Half;
+ X = FABS (X + F6);
+ if (X < U1)
+ X = U1;
+
+ /*... now X == (unknown no.) ulps of 1 -... */
+ do {
+ U1 = X;
+ Y = Half * U1 + ThirtyTwo * U1 * U1;
+ Y = Half - Y;
+ X = Half + Y;
+ Y = Half - X;
+ X = Half + Y;
+ }
+ while (!((U1 <= X) || (X <= Zero)));
+ /*... now U1 == 1 ulp of 1 - ... */
+ if (U1 == E1)
+ printf ("confirms closest relative separation U1 .\n");
+ else
+ printf ("gets better closest relative separation U1 = %.7e .\n", U1);
+ W = One / U1;
+ F9 = (Half - U1) + Half;
+ Radix = FLOOR (0.01 + U2 / U1);
+ if (Radix == E0)
+ printf ("Radix confirmed.\n");
+ else
+ printf ("MYSTERY: recalculated Radix = %.7e .\n", Radix);
+ TstCond (Defect, Radix <= Eight + Eight,
+ "Radix is too big: roundoff problems");
+ TstCond (Flaw, (Radix == Two) || (Radix == 10)
+ || (Radix == One), "Radix is not as good as 2 or 10");
+ /*=============================================*/
+ Milestone = 20;
+ /*=============================================*/
+ TstCond (Failure, F9 - Half < Half,
+ "(1-U1)-1/2 < 1/2 is FALSE, prog. fails?");
+ X = F9;
+ I = 1;
+ Y = X - Half;
+ Z = Y - Half;
+ TstCond (Failure, (X != One)
+ || (Z == Zero), "Comparison is fuzzy,X=1 but X-1/2-1/2 != 0");
+ X = One + U2;
+ I = 0;
+ /*=============================================*/
+ Milestone = 25;
+ /*=============================================*/
+ /*... BMinusU2 = nextafter(Radix, 0) */
+ BMinusU2 = Radix - One;
+ BMinusU2 = (BMinusU2 - U2) + One;
+ /* Purify Integers */
+ if (Radix != One) {
+ X = -TwoForty * LOG (U1) / LOG (Radix);
+ Y = FLOOR (Half + X);
+ if (FABS (X - Y) * Four < One)
+ X = Y;
+ Precision = X / TwoForty;
+ Y = FLOOR (Half + Precision);
+ if (FABS (Precision - Y) * TwoForty < Half)
+ Precision = Y;
+ }
+ if ((Precision != FLOOR (Precision)) || (Radix == One)) {
+ printf ("Precision cannot be characterized by an Integer number\n");
+ printf ("of significant digits but, by itself, this is a minor flaw.\n");
+ }
+ if (Radix == One)
+ printf ("logarithmic encoding has precision characterized solely by U1.\n");
+ else
+ printf ("The number of significant digits of the Radix is %f .\n",
+ Precision);
+ TstCond (Serious, U2 * Nine * Nine * TwoForty < One,
+ "Precision worse than 5 decimal figures ");
+ /*=============================================*/
+ Milestone = 30;
+ /*=============================================*/
+ /* Test for extra-precise subepressions */
+ X = FABS (((Four / Three - One) - One / Four) * Three - One / Four);
+ do {
+ Z2 = X;
+ X = (One + (Half * Z2 + ThirtyTwo * Z2 * Z2)) - One;
+ }
+ while (!((Z2 <= X) || (X <= Zero)));
+ X = Y = Z = FABS ((Three / Four - Two / Three) * Three - One / Four);
+ do {
+ Z1 = Z;
+ Z = (One / Two - ((One / Two - (Half * Z1 + ThirtyTwo * Z1 * Z1))
+ + One / Two)) + One / Two;
+ }
+ while (!((Z1 <= Z) || (Z <= Zero)));
+ do {
+ do {
+ Y1 = Y;
+ Y = (Half - ((Half - (Half * Y1 + ThirtyTwo * Y1 * Y1)) + Half
+ )) + Half;
+ }
+ while (!((Y1 <= Y) || (Y <= Zero)));
+ X1 = X;
+ X = ((Half * X1 + ThirtyTwo * X1 * X1) - F9) + F9;
+ }
+ while (!((X1 <= X) || (X <= Zero)));
+ if ((X1 != Y1) || (X1 != Z1)) {
+ BadCond (Serious, "Disagreements among the values X1, Y1, Z1,\n");
+ printf ("respectively %.7e, %.7e, %.7e,\n", X1, Y1, Z1);
+ printf ("are symptoms of inconsistencies introduced\n");
+ printf ("by extra-precise evaluation of arithmetic subexpressions.\n");
+ notify ("Possibly some part of this");
+ if ((X1 == U1) || (Y1 == U1) || (Z1 == U1))
+ printf (
+ "That feature is not tested further by this program.\n");
+ } else {
+ if ((Z1 != U1) || (Z2 != U2)) {
+ if ((Z1 >= U1) || (Z2 >= U2)) {
+ BadCond (Failure, "");
+ notify ("Precision");
+ printf ("\tU1 = %.7e, Z1 - U1 = %.7e\n", U1, Z1 - U1);
+ printf ("\tU2 = %.7e, Z2 - U2 = %.7e\n", U2, Z2 - U2);
+ } else {
+ if ((Z1 <= Zero) || (Z2 <= Zero)) {
+ printf ("Because of unusual Radix = %f", Radix);
+ printf (", or exact rational arithmetic a result\n");
+ printf ("Z1 = %.7e, or Z2 = %.7e ", Z1, Z2);
+ notify ("of an\nextra-precision");
+ }
+ if (Z1 != Z2 || Z1 > Zero) {
+ X = Z1 / U1;
+ Y = Z2 / U2;
+ if (Y > X)
+ X = Y;
+ Q = -LOG (X);
+ printf ("Some subexpressions appear to be calculated extra\n");
+ printf ("precisely with about %g extra B-digits, i.e.\n",
+ (Q / LOG (Radix)));
+ printf ("roughly %g extra significant decimals.\n",
+ Q / LOG (10.));
+ }
+ printf ("That feature is not tested further by this program.\n");
+ }
+ }
+ }
+ Pause ();
+ /*=============================================*/
+ Milestone = 35;
+ /*=============================================*/
+ if (Radix >= Two) {
+ X = W / (Radix * Radix);
+ Y = X + One;
+ Z = Y - X;
+ T = Z + U2;
+ X = T - Z;
+ TstCond (Failure, X == U2,
+ "Subtraction is not normalized X=Y,X+Z != Y+Z!");
+ if (X == U2)
+ printf (
+ "Subtraction appears to be normalized, as it should be.");
+ }
+ printf ("\nChecking for guard digit in *, /, and -.\n");
+ Y = F9 * One;
+ Z = One * F9;
+ X = F9 - Half;
+ Y = (Y - Half) - X;
+ Z = (Z - Half) - X;
+ X = One + U2;
+ T = X * Radix;
+ R = Radix * X;
+ X = T - Radix;
+ X = X - Radix * U2;
+ T = R - Radix;
+ T = T - Radix * U2;
+ X = X * (Radix - One);
+ T = T * (Radix - One);
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero))
+ GMult = Yes;
+ else {
+ GMult = No;
+ TstCond (Serious, False,
+ "* lacks a Guard Digit, so 1*X != X");
+ }
+ Z = Radix * U2;
+ X = One + Z;
+ Y = FABS ((X + Z) - X * X) - U2;
+ X = One - U2;
+ Z = FABS ((X - U2) - X * X) - U1;
+ TstCond (Failure, (Y <= Zero)
+ && (Z <= Zero), "* gets too many final digits wrong.\n");
+ Y = One - U2;
+ X = One + U2;
+ Z = One / Y;
+ Y = Z - X;
+ X = One / Three;
+ Z = Three / Nine;
+ X = X - Z;
+ T = Nine / TwentySeven;
+ Z = Z - T;
+ TstCond (Defect, X == Zero && Y == Zero && Z == Zero,
+ "Division lacks a Guard Digit, so error can exceed 1 ulp\n\
+or 1/3 and 3/9 and 9/27 may disagree");
+ Y = F9 / One;
+ X = F9 - Half;
+ Y = (Y - Half) - X;
+ X = One + U2;
+ T = X / One;
+ X = T - X;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero))
+ GDiv = Yes;
+ else {
+ GDiv = No;
+ TstCond (Serious, False,
+ "Division lacks a Guard Digit, so X/1 != X");
+ }
+ X = One / (One + U2);
+ Y = X - Half - Half;
+ TstCond (Serious, Y < Zero,
+ "Computed value of 1/1.000..1 >= 1");
+ X = One - U2;
+ Y = One + Radix * U2;
+ Z = X * Radix;
+ T = Y * Radix;
+ R = Z / Radix;
+ StickyBit = T / Radix;
+ X = R - X;
+ Y = StickyBit - Y;
+ TstCond (Failure, X == Zero && Y == Zero,
+ "* and/or / gets too many last digits wrong");
+ Y = One - U1;
+ X = One - F9;
+ Y = One - Y;
+ T = Radix - U2;
+ Z = Radix - BMinusU2;
+ T = Radix - T;
+ if ((X == U1) && (Y == U1) && (Z == U2) && (T == U2))
+ GAddSub = Yes;
+ else {
+ GAddSub = No;
+ TstCond (Serious, False,
+ "- lacks Guard Digit, so cancellation is obscured");
+ }
+ if (F9 != One && F9 - One >= Zero) {
+ BadCond (Serious, "comparison alleges (1-U1) < 1 although\n");
+ printf (" subtraction yields (1-U1) - 1 = 0 , thereby vitiating\n");
+ printf (" such precautions against division by zero as\n");
+ printf (" ... if (X == 1.0) {.....} else {.../(X-1.0)...}\n");
+ }
+ if (GMult == Yes && GDiv == Yes && GAddSub == Yes)
+ printf (
+ " *, /, and - appear to have guard digits, as they should.\n");
+ /*=============================================*/
+ Milestone = 40;
+ /*=============================================*/
+ Pause ();
+ printf ("Checking rounding on multiply, divide and add/subtract.\n");
+ RMult = Other;
+ RDiv = Other;
+ RAddSub = Other;
+ RadixD2 = Radix / Two;
+ A1 = Two;
+ Done = False;
+ do {
+ AInvrse = Radix;
+ do {
+ X = AInvrse;
+ AInvrse = AInvrse / A1;
+ }
+ while (!(FLOOR (AInvrse) != AInvrse));
+ Done = (X == One) || (A1 > Three);
+ if (!Done)
+ A1 = Nine + One;
+ }
+ while (!(Done));
+ if (X == One)
+ A1 = Radix;
+ AInvrse = One / A1;
+ X = A1;
+ Y = AInvrse;
+ Done = False;
+ do {
+ Z = X * Y - Half;
+ TstCond (Failure, Z == Half,
+ "X * (1/X) differs from 1");
+ Done = X == Radix;
+ X = Radix;
+ Y = One / X;
+ }
+ while (!(Done));
+ Y2 = One + U2;
+ Y1 = One - U2;
+ X = OneAndHalf - U2;
+ Y = OneAndHalf + U2;
+ Z = (X - U2) * Y2;
+ T = Y * Y1;
+ Z = Z - X;
+ T = T - X;
+ X = X * Y2;
+ Y = (Y + U2) * Y1;
+ X = X - OneAndHalf;
+ Y = Y - OneAndHalf;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T <= Zero)) {
+ X = (OneAndHalf + U2) * Y2;
+ Y = OneAndHalf - U2 - U2;
+ Z = OneAndHalf + U2 + U2;
+ T = (OneAndHalf - U2) * Y1;
+ X = X - (Z + U2);
+ StickyBit = Y * Y1;
+ S = Z * Y2;
+ T = T - Y;
+ Y = (U2 - Y) + StickyBit;
+ Z = S - (Z + U2 + U2);
+ StickyBit = (Y2 + U2) * Y1;
+ Y1 = Y2 * Y1;
+ StickyBit = StickyBit - Y2;
+ Y1 = Y1 - Half;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)
+ && (StickyBit == Zero) && (Y1 == Half)) {
+ RMult = Rounded;
+ printf ("Multiplication appears to round correctly.\n");
+ } else if ((X + U2 == Zero) && (Y < Zero) && (Z + U2 == Zero)
+ && (T < Zero) && (StickyBit + U2 == Zero)
+ && (Y1 < Half)) {
+ RMult = Chopped;
+ printf ("Multiplication appears to chop.\n");
+ } else
+ printf ("* is neither chopped nor correctly rounded.\n");
+ if ((RMult == Rounded) && (GMult == No))
+ notify ("Multiplication");
+ } else
+ printf ("* is neither chopped nor correctly rounded.\n");
+ /*=============================================*/
+ Milestone = 45;
+ /*=============================================*/
+ Y2 = One + U2;
+ Y1 = One - U2;
+ Z = OneAndHalf + U2 + U2;
+ X = Z / Y2;
+ T = OneAndHalf - U2 - U2;
+ Y = (T - U2) / Y1;
+ Z = (Z + U2) / Y2;
+ X = X - OneAndHalf;
+ Y = Y - T;
+ T = T / Y1;
+ Z = Z - (OneAndHalf + U2);
+ T = (U2 - OneAndHalf) + T;
+ if (!((X > Zero) || (Y > Zero) || (Z > Zero) || (T > Zero))) {
+ X = OneAndHalf / Y2;
+ Y = OneAndHalf - U2;
+ Z = OneAndHalf + U2;
+ X = X - Y;
+ T = OneAndHalf / Y1;
+ Y = Y / Y1;
+ T = T - (Z + U2);
+ Y = Y - Z;
+ Z = Z / Y2;
+ Y1 = (Y2 + U2) / Y2;
+ Z = Z - OneAndHalf;
+ Y2 = Y1 - Y2;
+ Y1 = (F9 - U1) / F9;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)
+ && (Y2 == Zero) && (Y2 == Zero)
+ && (Y1 - Half == F9 - Half)) {
+ RDiv = Rounded;
+ printf ("Division appears to round correctly.\n");
+ if (GDiv == No)
+ notify ("Division");
+ } else if ((X < Zero) && (Y < Zero) && (Z < Zero) && (T < Zero)
+ && (Y2 < Zero) && (Y1 - Half < F9 - Half)) {
+ RDiv = Chopped;
+ printf ("Division appears to chop.\n");
+ }
+ }
+ if (RDiv == Other)
+ printf ("/ is neither chopped nor correctly rounded.\n");
+ BInvrse = One / Radix;
+ TstCond (Failure, (BInvrse * Radix - Half == Half),
+ "Radix * ( 1 / Radix ) differs from 1");
+ /*=============================================*/
+ Milestone = 50;
+ /*=============================================*/
+ TstCond (Failure, ((F9 + U1) - Half == Half)
+ && ((BMinusU2 + U2) - One == Radix - One),
+ "Incomplete carry-propagation in Addition");
+ X = One - U1 * U1;
+ Y = One + U2 * (One - U2);
+ Z = F9 - Half;
+ X = (X - Half) - Z;
+ Y = Y - One;
+ if ((X == Zero) && (Y == Zero)) {
+ RAddSub = Chopped;
+ printf ("Add/Subtract appears to be chopped.\n");
+ }
+ if (GAddSub == Yes) {
+ X = (Half + U2) * U2;
+ Y = (Half - U2) * U2;
+ X = One + X;
+ Y = One + Y;
+ X = (One + U2) - X;
+ Y = One - Y;
+ if ((X == Zero) && (Y == Zero)) {
+ X = (Half + U2) * U1;
+ Y = (Half - U2) * U1;
+ X = One - X;
+ Y = One - Y;
+ X = F9 - X;
+ Y = One - Y;
+ if ((X == Zero) && (Y == Zero)) {
+ RAddSub = Rounded;
+ printf ("Addition/Subtraction appears to round correctly.\n");
+ if (GAddSub == No)
+ notify ("Add/Subtract");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ S = One;
+ X = One + Half * (One + Half);
+ Y = (One + U2) * Half;
+ Z = X - Y;
+ T = Y - X;
+ StickyBit = Z + T;
+ if (StickyBit != Zero) {
+ S = Zero;
+ BadCond (Flaw, "(X - Y) + (Y - X) is non zero!\n");
+ }
+ StickyBit = Zero;
+ if ((GMult == Yes) && (GDiv == Yes) && (GAddSub == Yes)
+ && (RMult == Rounded) && (RDiv == Rounded)
+ && (RAddSub == Rounded) && (FLOOR (RadixD2) == RadixD2)) {
+ printf ("Checking for sticky bit.\n");
+ X = (Half + U1) * U2;
+ Y = Half * U2;
+ Z = One + Y;
+ T = One + X;
+ if ((Z - One <= Zero) && (T - One >= U2)) {
+ Z = T + Y;
+ Y = Z - X;
+ if ((Z - T >= U2) && (Y - T == Zero)) {
+ X = (Half + U1) * U1;
+ Y = Half * U1;
+ Z = One - Y;
+ T = One - X;
+ if ((Z - One == Zero) && (T - F9 == Zero)) {
+ Z = (Half - U1) * U1;
+ T = F9 - Z;
+ Q = F9 - Y;
+ if ((T - F9 == Zero) && (F9 - U1 - Q == Zero)) {
+ Z = (One + U2) * OneAndHalf;
+ T = (OneAndHalf + U2) - Z + U2;
+ X = One + Half / Radix;
+ Y = One + Radix * U2;
+ Z = X * Y;
+ if (T == Zero && X + Radix * U2 - Z == Zero) {
+ if (Radix != Two) {
+ X = Two + U2;
+ Y = X / Two;
+ if ((Y - One == Zero))
+ StickyBit = S;
+ } else
+ StickyBit = S;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (StickyBit == One)
+ printf ("Sticky bit apparently used correctly.\n");
+ else
+ printf ("Sticky bit used incorrectly or not at all.\n");
+ TstCond (Flaw, !(GMult == No || GDiv == No || GAddSub == No ||
+ RMult == Other || RDiv == Other || RAddSub == Other),
+ "lack(s) of guard digits or failure(s) to correctly round or chop\n\
+(noted above) count as one flaw in the final tally below");
+ /*=============================================*/
+ Milestone = 60;
+ /*=============================================*/
+ printf ("\n");
+ printf ("Does Multiplication commute? ");
+ printf ("Testing on %d random pairs.\n", NoTrials);
+ Random9 = SQRT (3.0);
+ Random1 = Third;
+ I = 1;
+ do {
+ X = Random ();
+ Y = Random ();
+ Z9 = Y * X;
+ Z = X * Y;
+ Z9 = Z - Z9;
+ I = I + 1;
+ }
+ while (!((I > NoTrials) || (Z9 != Zero)));
+ if (I == NoTrials) {
+ Random1 = One + Half / Three;
+ Random2 = (U2 + U1) + One;
+ Z = Random1 * Random2;
+ Y = Random2 * Random1;
+ Z9 = (One + Half / Three) * ((U2 + U1) + One) - (One + Half /
+ Three) * ((U2 + U1) + One);
+ }
+ if (!((I == NoTrials) || (Z9 == Zero)))
+ BadCond (Defect, "X * Y == Y * X trial fails.\n");
+ else
+ printf (" No failures found in %d integer pairs.\n", NoTrials);
+ /*=============================================*/
+ Milestone = 70;
+ /*=============================================*/
+ printf ("\nRunning test of square root(x).\n");
+ TstCond (Failure, (Zero == SQRT (Zero))
+ && (-Zero == SQRT (-Zero))
+ && (One == SQRT (One)), "Square root of 0.0, -0.0 or 1.0 wrong");
+ MinSqEr = Zero;
+ MaxSqEr = Zero;
+ J = Zero;
+ X = Radix;
+ OneUlp = U2;
+ SqXMinX (Serious);
+ X = BInvrse;
+ OneUlp = BInvrse * U1;
+ SqXMinX (Serious);
+ X = U1;
+ OneUlp = U1 * U1;
+ SqXMinX (Serious);
+ if (J != Zero)
+ Pause ();
+ printf ("Testing if sqrt(X * X) == X for %d Integers X.\n", NoTrials);
+ J = Zero;
+ X = Two;
+ Y = Radix;
+ if ((Radix != One))
+ do {
+ X = Y;
+ Y = Radix * Y;
+ }
+ while (!((Y - X >= NoTrials)));
+ OneUlp = X * U2;
+ I = 1;
+ while (I <= NoTrials) {
+ X = X + One;
+ SqXMinX (Defect);
+ if (J > Zero)
+ break;
+ I = I + 1;
+ }
+ printf ("Test for sqrt monotonicity.\n");
+ I = -1;
+ X = BMinusU2;
+ Y = Radix;
+ Z = Radix + Radix * U2;
+ NotMonot = False;
+ Monot = False;
+ while (!(NotMonot || Monot)) {
+ I = I + 1;
+ X = SQRT (X);
+ Q = SQRT (Y);
+ Z = SQRT (Z);
+ if ((X > Q) || (Q > Z))
+ NotMonot = True;
+ else {
+ Q = FLOOR (Q + Half);
+ if ((I > 0) || (Radix == Q * Q))
+ Monot = True;
+ else if (I > 0) {
+ if (I > 1)
+ Monot = True;
+ else {
+ Y = Y * BInvrse;
+ X = Y - U1;
+ Z = Y + U1;
+ }
+ } else {
+ Y = Q;
+ X = Y - U2;
+ Z = Y + U2;
+ }
+ }
+ }
+ if (Monot)
+ printf ("sqrt has passed a test for Monotonicity.\n");
+ else {
+ BadCond (Defect, "");
+ printf ("sqrt(X) is non-monotonic for X near %.7e .\n", Y);
+ }
+ /*=============================================*/
+ Milestone = 80;
+ /*=============================================*/
+ MinSqEr = MinSqEr + Half;
+ MaxSqEr = MaxSqEr - Half;
+ Y = (SQRT (One + U2) - One) / U2;
+ SqEr = (Y - One) + U2 / Eight;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ SqEr = Y + U2 / Eight;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ Y = ((SQRT (F9) - U2) - (One - U2)) / U1;
+ SqEr = Y + U1 / Eight;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ SqEr = (Y + One) + U1 / Eight;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ OneUlp = U2;
+ X = OneUlp;
+ for (Indx = 1; Indx <= 3; ++Indx) {
+ Y = SQRT ((X + U1 + X) + F9);
+ Y = ((Y - U2) - ((One - U2) + X)) / OneUlp;
+ Z = ((U1 - X) + F9) * Half * X * X / OneUlp;
+ SqEr = (Y + Half) + Z;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ SqEr = (Y - Half) + Z;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ if (((Indx == 1) || (Indx == 3)))
+ X = OneUlp * Sign (X) * FLOOR (Eight / (Nine * SQRT (OneUlp)));
+ else {
+ OneUlp = U1;
+ X = -OneUlp;
+ }
+ }
+ /*=============================================*/
+ Milestone = 85;
+ /*=============================================*/
+ SqRWrng = False;
+ Anomaly = False;
+ RSqrt = Other; /* ~dgh */
+ if (Radix != One) {
+ printf ("Testing whether sqrt is rounded or chopped.\n");
+ D = FLOOR (Half + POW (Radix, One + Precision - FLOOR (Precision)));
+ /* ... == Radix^(1 + fract) if (Precision == Integer + fract. */
+ X = D / Radix;
+ Y = D / A1;
+ if ((X != FLOOR (X)) || (Y != FLOOR (Y))) {
+ Anomaly = True;
+ } else {
+ X = Zero;
+ Z2 = X;
+ Y = One;
+ Y2 = Y;
+ Z1 = Radix - One;
+ FourD = Four * D;
+ do {
+ if (Y2 > Z2) {
+ Q = Radix;
+ Y1 = Y;
+ do {
+ X1 = FABS (Q + FLOOR (Half - Q / Y1) * Y1);
+ Q = Y1;
+ Y1 = X1;
+ }
+ while (!(X1 <= Zero));
+ if (Q <= One) {
+ Z2 = Y2;
+ Z = Y;
+ }
+ }
+ Y = Y + Two;
+ X = X + Eight;
+ Y2 = Y2 + X;
+ if (Y2 >= FourD)
+ Y2 = Y2 - FourD;
+ }
+ while (!(Y >= D));
+ X8 = FourD - Z2;
+ Q = (X8 + Z * Z) / FourD;
+ X8 = X8 / Eight;
+ if (Q != FLOOR (Q))
+ Anomaly = True;
+ else {
+ Break = False;
+ do {
+ X = Z1 * Z;
+ X = X - FLOOR (X / Radix) * Radix;
+ if (X == One)
+ Break = True;
+ else
+ Z1 = Z1 - One;
+ }
+ while (!(Break || (Z1 <= Zero)));
+ if ((Z1 <= Zero) && (!Break))
+ Anomaly = True;
+ else {
+ if (Z1 > RadixD2)
+ Z1 = Z1 - Radix;
+ do {
+ NewD ();
+ }
+ while (!(U2 * D >= F9));
+ if (D * Radix - D != W - D)
+ Anomaly = True;
+ else {
+ Z2 = D;
+ I = 0;
+ Y = D + (One + Z) * Half;
+ X = D + Z + Q;
+ SR3750 ();
+ Y = D + (One - Z) * Half + D;
+ X = D - Z + D;
+ X = X + Q + X;
+ SR3750 ();
+ NewD ();
+ if (D - Z2 != W - Z2)
+ Anomaly = True;
+ else {
+ Y = (D - Z2) + (Z2 + (One - Z) * Half);
+ X = (D - Z2) + (Z2 - Z + Q);
+ SR3750 ();
+ Y = (One + Z) * Half;
+ X = Q;
+ SR3750 ();
+ if (I == 0)
+ Anomaly = True;
+ }
+ }
+ }
+ }
+ }
+ if ((I == 0) || Anomaly) {
+ BadCond (Failure, "Anomalous arithmetic with Integer < ");
+ printf ("Radix^Precision = %.7e\n", W);
+ printf (" fails test whether sqrt rounds or chops.\n");
+ SqRWrng = True;
+ }
+ }
+ if (!Anomaly) {
+ if (!((MinSqEr < Zero) || (MaxSqEr > Zero))) {
+ RSqrt = Rounded;
+ printf ("Square root appears to be correctly rounded.\n");
+ } else {
+ if ((MaxSqEr + U2 > U2 - Half) || (MinSqEr > Half)
+ || (MinSqEr + Radix < Half))
+ SqRWrng = True;
+ else {
+ RSqrt = Chopped;
+ printf ("Square root appears to be chopped.\n");
+ }
+ }
+ }
+ if (SqRWrng) {
+ printf ("Square root is neither chopped nor correctly rounded.\n");
+ printf ("Observed errors run from %.7e ", MinSqEr - Half);
+ printf ("to %.7e ulps.\n", Half + MaxSqEr);
+ TstCond (Serious, MaxSqEr - MinSqEr < Radix * Radix,
+ "sqrt gets too many last digits wrong");
+ }
+ /*=============================================*/
+ Milestone = 90;
+ /*=============================================*/
+ Pause ();
+ printf ("Testing powers Z^i for small Integers Z and i.\n");
+ N = 0;
+ /* ... test powers of zero. */
+ I = 0;
+ Z = -Zero;
+ M = 3;
+ Break = False;
+ do {
+ X = One;
+ SR3980 ();
+ if (I <= 10) {
+ I = 1023;
+ SR3980 ();
+ }
+ if (Z == MinusOne)
+ Break = True;
+ else {
+ Z = MinusOne;
+ /* .. if(-1)^N is invalid, replace MinusOne by One. */
+ I = -4;
+ }
+ }
+ while (!Break);
+ PrintIfNPositive ();
+ N1 = N;
+ N = 0;
+ Z = A1;
+ M = (int) FLOOR (Two * LOG (W) / LOG (A1));
+ Break = False;
+ do {
+ X = Z;
+ I = 1;
+ SR3980 ();
+ if (Z == AInvrse)
+ Break = True;
+ else
+ Z = AInvrse;
+ }
+ while (!(Break));
+ /*=============================================*/
+ Milestone = 100;
+ /*=============================================*/
+ /* Powers of Radix have been tested, */
+ /* next try a few primes */
+ M = NoTrials;
+ Z = Three;
+ do {
+ X = Z;
+ I = 1;
+ SR3980 ();
+ do {
+ Z = Z + Two;
+ }
+ while (Three * FLOOR (Z / Three) == Z);
+ }
+ while (Z < Eight * Three);
+ if (N > 0) {
+ printf ("Errors like this may invalidate financial calculations\n");
+ printf ("\tinvolving interest rates.\n");
+ }
+ PrintIfNPositive ();
+ N += N1;
+ if (N == 0)
+ printf ("... no discrepancies found.\n");
+ if (N > 0)
+ Pause ();
+ else
+ printf ("\n");
+ /*=============================================*/
+ Milestone = 110;
+ /*=============================================*/
+ printf ("Seeking Underflow thresholds UfThold and E0.\n");
+ D = U1;
+ if (Precision != FLOOR (Precision)) {
+ D = BInvrse;
+ X = Precision;
+ do {
+ D = D * BInvrse;
+ X = X - One;
+ }
+ while (X > Zero);
+ }
+ Y = One;
+ Z = D;
+ /* ... D is power of 1/Radix < 1. */
+ do {
+ C = Y;
+ Y = Z;
+ Z = Y * Y;
+ }
+ while ((Y > Z) && (Z + Z > Z));
+ Y = C;
+ Z = Y * D;
+ do {
+ C = Y;
+ Y = Z;
+ Z = Y * D;
+ }
+ while ((Y > Z) && (Z + Z > Z));
+ if (Radix < Two)
+ HInvrse = Two;
+ else
+ HInvrse = Radix;
+ H = One / HInvrse;
+ /* ... 1/HInvrse == H == Min(1/Radix, 1/2) */
+ CInvrse = One / C;
+ E0 = C;
+ Z = E0 * H;
+ /* ...1/Radix^(BIG Integer) << 1 << CInvrse == 1/C */
+ do {
+ Y = E0;
+ E0 = Z;
+ Z = E0 * H;
+ }
+ while ((E0 > Z) && (Z + Z > Z));
+ UfThold = E0;
+ E1 = Zero;
+ Q = Zero;
+ E9 = U2;
+ S = One + E9;
+ D = C * S;
+ if (D <= C) {
+ E9 = Radix * U2;
+ S = One + E9;
+ D = C * S;
+ if (D <= C) {
+ BadCond (Failure, "multiplication gets too many last digits wrong.\n");
+ Underflow = E0;
+ Y1 = Zero;
+ PseudoZero = Z;
+ Pause ();
+ }
+ } else {
+ Underflow = D;
+ PseudoZero = Underflow * H;
+ UfThold = Zero;
+ do {
+ Y1 = Underflow;
+ Underflow = PseudoZero;
+ if (E1 + E1 <= E1) {
+ Y2 = Underflow * HInvrse;
+ E1 = FABS (Y1 - Y2);
+ Q = Y1;
+ if ((UfThold == Zero) && (Y1 != Y2))
+ UfThold = Y1;
+ }
+ PseudoZero = PseudoZero * H;
+ }
+ while ((Underflow > PseudoZero)
+ && (PseudoZero + PseudoZero > PseudoZero));
+ }
+ /* Comment line 4530 .. 4560 */
+ if (PseudoZero != Zero) {
+ printf ("\n");
+ Z = PseudoZero;
+ /* ... Test PseudoZero for "phoney- zero" violates */
+ /* ... PseudoZero < Underflow or PseudoZero < PseudoZero + PseudoZero
+ ... */
+ if (PseudoZero <= Zero) {
+ BadCond (Failure, "Positive expressions can underflow to an\n");
+ printf ("allegedly negative value\n");
+ printf ("PseudoZero that prints out as: %g .\n", PseudoZero);
+ X = -PseudoZero;
+ if (X <= Zero) {
+ printf ("But -PseudoZero, which should be\n");
+ printf ("positive, isn't; it prints out as %g .\n", X);
+ }
+ } else {
+ BadCond (Flaw, "Underflow can stick at an allegedly positive\n");
+ printf ("value PseudoZero that prints out as %g .\n", PseudoZero);
+ }
+ TstPtUf ();
+ }
+ /*=============================================*/
+ Milestone = 120;
+ /*=============================================*/
+ if (CInvrse * Y > CInvrse * Y1) {
+ S = H * S;
+ E0 = Underflow;
+ }
+ if (!((E1 == Zero) || (E1 == E0))) {
+ BadCond (Defect, "");
+ if (E1 < E0) {
+ printf ("Products underflow at a higher");
+ printf (" threshold than differences.\n");
+ if (PseudoZero == Zero)
+ E0 = E1;
+ } else {
+ printf ("Difference underflows at a higher");
+ printf (" threshold than products.\n");
+ }
+ }
+ printf ("Smallest strictly positive number found is E0 = %g .\n", E0);
+ Z = E0;
+ TstPtUf ();
+ Underflow = E0;
+ if (N == 1)
+ Underflow = Y;
+ I = 4;
+ if (E1 == Zero)
+ I = 3;
+ if (UfThold == Zero)
+ I = I - 2;
+ UfNGrad = True;
+ switch (I) {
+ case 1:
+ UfThold = Underflow;
+ if ((CInvrse * Q) != ((CInvrse * Y) * S)) {
+ UfThold = Y;
+ BadCond (Failure, "Either accuracy deteriorates as numbers\n");
+ printf ("approach a threshold = %.17e\n", UfThold);;
+ printf (" coming down from %.17e\n", C);
+ printf (" or else multiplication gets too many last digits wrong.\n");
+ }
+ Pause ();
+ break;
+
+ case 2:
+ BadCond (Failure, "Underflow confuses Comparison, which alleges that\n");
+ printf ("Q == Y while denying that |Q - Y| == 0; these values\n");
+ printf ("print out as Q = %.17e, Y = %.17e .\n", Q, Y2);
+ printf ("|Q - Y| = %.17e .\n", FABS (Q - Y2));
+ UfThold = Q;
+ break;
+
+ case 3:
+ X = X;
+ break;
+
+ case 4:
+ if ((Q == UfThold) && (E1 == E0)
+ && (FABS (UfThold - E1 / E9) <= E1)) {
+ UfNGrad = False;
+ printf ("Underflow is gradual; it incurs Absolute Error =\n");
+ printf ("(roundoff in UfThold) < E0.\n");
+ Y = E0 * CInvrse;
+ Y = Y * (OneAndHalf + U2);
+ X = CInvrse * (One + U2);
+ Y = Y / X;
+ IEEE = (Y == E0);
+ }
+ }
+ if (UfNGrad) {
+ printf ("\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf)) {
+ printf ("Underflow / UfThold failed!\n");
+ R = H + H;
+ } else
+ R = SQRT (Underflow / UfThold);
+ sigsave = 0;
+ if (R <= H) {
+ Z = R * UfThold;
+ X = Z * (One + R * H * (One + H));
+ } else {
+ Z = UfThold;
+ X = Z * (One + H * H * (One + H));
+ }
+ if (!((X == Z) || (X - Z != Zero))) {
+ BadCond (Flaw, "");
+ printf ("X = %.17e\n\tis not equal to Z = %.17e .\n", X, Z);
+ Z9 = X - Z;
+ printf ("yet X - Z yields %.17e .\n", Z9);
+ printf (" Should this NOT signal Underflow, ");
+ printf ("this is a SERIOUS DEFECT\nthat causes ");
+ printf ("confusion when innocent statements like\n");;
+ printf (" if (X == Z) ... else");
+ printf (" ... (f(X) - f(Z)) / (X - Z) ...\n");
+ printf ("encounter Division by Zero although actually\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ printf ("X / Z fails!\n");
+ else
+ printf ("X / Z = 1 + %g .\n", (X / Z - Half) - Half);
+ sigsave = 0;
+ }
+ }
+ printf ("The Underflow threshold is %.17e, %s\n", UfThold,
+ " below which");
+ printf ("calculation may suffer larger Relative error than ");
+ printf ("merely roundoff.\n");
+ Y2 = U1 * U1;
+ Y = Y2 * Y2;
+ Y2 = Y * U1;
+ if (Y2 <= UfThold) {
+ if (Y > E0) {
+ BadCond (Defect, "");
+ I = 5;
+ } else {
+ BadCond (Serious, "");
+ I = 4;
+ }
+ printf ("Range is too narrow; U1^%d Underflows.\n", I);
+ }
+ /*=============================================*/
+ Milestone = 130;
+ /*=============================================*/
+ Y = -FLOOR (Half - TwoForty * LOG (UfThold) / LOG (HInvrse)) / TwoForty;
+ Y2 = Y + Y;
+ printf ("Since underflow occurs below the threshold\n");
+ printf ("UfThold = (%.17e) ^ (%.17e)\nonly underflow ", HInvrse, Y);
+ printf ("should afflict the expression\n\t(%.17e) ^ (%.17e);\n",
+ HInvrse, Y2);
+ printf ("actually calculating yields:");
+ if (setjmp (ovfl_buf)) {
+ sigsave = 0;
+ BadCond (Serious, "trap on underflow.\n");
+ } else {
+ sigsave = _sigfpe;
+ V9 = POW (HInvrse, Y2);
+ sigsave = 0;
+ printf (" %.17e .\n", V9);
+ if (!((V9 >= Zero) && (V9 <= (Radix + Radix + E9) * UfThold))) {
+ BadCond (Serious, "this is not between 0 and underflow\n");
+ printf (" threshold = %.17e .\n", UfThold);
+ } else if (!(V9 > UfThold * (One + E9)))
+ printf ("This computed value is O.K.\n");
+ else {
+ BadCond (Defect, "this is not between 0 and underflow\n");
+ printf (" threshold = %.17e .\n", UfThold);
+ }
+ }
+ /*=============================================*/
+ Milestone = 140;
+ /*=============================================*/
+ printf ("\n");
+ /* ...calculate Exp2 == exp(2) == 7.389056099... */
+ X = Zero;
+ I = 2;
+ Y = Two * Three;
+ Q = Zero;
+ N = 0;
+ do {
+ Z = X;
+ I = I + 1;
+ Y = Y / (I + I);
+ R = Y + Q;
+ X = Z + R;
+ Q = (Z - X) + R;
+ }
+ while (X > Z);
+ Z = (OneAndHalf + One / Eight) + X / (OneAndHalf * ThirtyTwo);
+ X = Z * Z;
+ Exp2 = X * X;
+ X = F9;
+ Y = X - U1;
+ printf ("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n",
+ Exp2);
+ for (I = 1;;) {
+ Z = X - BInvrse;
+ Z = (X + One) / (Z - (One - BInvrse));
+ Q = POW (X, Z) - Exp2;
+ if (FABS (Q) > TwoForty * U2) {
+ N = 1;
+ V9 = (X - BInvrse) - (One - BInvrse);
+ BadCond (Defect, "Calculated");
+ printf (" %.17e for\n", POW (X, Z));
+ printf ("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z);
+ printf ("\tdiffers from correct value by %.17e .\n", Q);
+ printf ("\tThis much error may spoil financial\n");
+ printf ("\tcalculations involving tiny interest rates.\n");
+ break;
+ } else {
+ Z = (Y - X) * Two + Y;
+ X = Y;
+ Y = Z;
+ Z = One + (X - F9) * (X - F9);
+ if (Z > One && I < NoTrials)
+ I++;
+ else {
+ if (X > One) {
+ if (N == 0)
+ printf ("Accuracy seems adequate.\n");
+ break;
+ } else {
+ X = One + U2;
+ Y = U2 + U2;
+ Y += X;
+ I = 1;
+ }
+ }
+ }
+ }
+ /*=============================================*/
+ Milestone = 150;
+ /*=============================================*/
+ printf ("Testing powers Z^Q at four nearly extreme values.\n");
+ N = 0;
+ Z = A1;
+ Q = FLOOR (Half - LOG (C) / LOG (A1));
+ Break = False;
+ do {
+ X = CInvrse;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ Q = -Q;
+ X = C;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ if (Z < One)
+ Break = True;
+ else
+ Z = AInvrse;
+ }
+ while (!(Break));
+ PrintIfNPositive ();
+ if (N == 0)
+ printf (" ... no discrepancies found.\n");
+ printf ("\n");
+
+ /*=============================================*/
+ Milestone = 160;
+ /*=============================================*/
+ Pause ();
+ printf ("Searching for Overflow threshold:\n");
+ printf ("This may generate an error.\n");
+ Y = -CInvrse;
+ V9 = HInvrse * Y;
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf)) {
+ I = 0;
+ V9 = Y;
+ goto overflow;
+ }
+ do {
+ V = Y;
+ Y = V9;
+ V9 = HInvrse * Y;
+ }
+ while (V9 < Y);
+ I = 1;
+ overflow:
+ sigsave = 0;
+ Z = V9;
+ printf ("Can `Z = -Y' overflow?\n");
+ printf ("Trying it on Y = %.17e .\n", Y);
+ V9 = -Y;
+ V0 = V9;
+ if (V - Y == V + V0)
+ printf ("Seems O.K.\n");
+ else {
+ printf ("finds a ");
+ BadCond (Flaw, "-(-Y) differs from Y.\n");
+ }
+ if (Z != Y) {
+ BadCond (Serious, "");
+ printf ("overflow past %.17e\n\tshrinks to %.17e .\n", Y, Z);
+ }
+ if (I) {
+ Y = V * (HInvrse * U2 - HInvrse);
+ Z = Y + ((One - HInvrse) * U2) * V;
+ if (Z < V0)
+ Y = Z;
+ if (Y < V0)
+ V = Y;
+ if (V0 - V < V0)
+ V = V0;
+ } else {
+ V = Y * (HInvrse * U2 - HInvrse);
+ V = V + ((One - HInvrse) * U2) * Y;
+ }
+ printf ("Overflow threshold is V = %.17e .\n", V);
+ if (I)
+ printf ("Overflow saturates at V0 = %.17e .\n", V0);
+ else
+ printf ("There is no saturation value because \
+the system traps on overflow.\n");
+ V9 = V * One;
+ printf ("No Overflow should be signaled for V * 1 = %.17e\n", V9);
+ V9 = V / One;
+ printf (" nor for V / 1 = %.17e .\n", V9);
+ printf ("Any overflow signal separating this * from the one\n");
+ printf ("above is a DEFECT.\n");
+ /*=============================================*/
+ Milestone = 170;
+ /*=============================================*/
+ if (!(-V < V && -V0 < V0 && -UfThold < V && UfThold < V)) {
+ BadCond (Failure, "Comparisons involving ");
+ printf ("+-%g, +-%g\nand +-%g are confused by Overflow.",
+ V, V0, UfThold);
+ }
+ /*=============================================*/
+ Milestone = 175;
+ /*=============================================*/
+ printf ("\n");
+ for (Indx = 1; Indx <= 3; ++Indx) {
+ switch (Indx) {
+ case 1:
+ Z = UfThold;
+ break;
+ case 2:
+ Z = E0;
+ break;
+ case 3:
+ Z = PseudoZero;
+ break;
+ }
+ if (Z != Zero) {
+ V9 = SQRT (Z);
+ Y = V9 * V9;
+ if (Y / (One - Radix * E9) < Z
+ || Y > (One + Radix * E9) * Z) { /* dgh: + E9 --> * E9 */
+ if (V9 > U1)
+ BadCond (Serious, "");
+ else
+ BadCond (Defect, "");
+ printf ("Comparison alleges that what prints as Z = %.17e\n", Z);
+ printf (" is too far from sqrt(Z) ^ 2 = %.17e .\n", Y);
+ }
+ }
+ }
+ /*=============================================*/
+ Milestone = 180;
+ /*=============================================*/
+ for (Indx = 1; Indx <= 2; ++Indx) {
+ if (Indx == 1)
+ Z = V;
+ else
+ Z = V0;
+ V9 = SQRT (Z);
+ X = (One - Radix * E9) * V9;
+ V9 = V9 * X;
+ if (((V9 < (One - Two * Radix * E9) * Z) || (V9 > Z))) {
+ Y = V9;
+ if (X < W)
+ BadCond (Serious, "");
+ else
+ BadCond (Defect, "");
+ printf ("Comparison alleges that Z = %17e\n", Z);
+ printf (" is too far from sqrt(Z) ^ 2 (%.17e) .\n", Y);
+ }
+ }
+ /*=============================================*/
+ Milestone = 190;
+ /*=============================================*/
+ Pause ();
+ X = UfThold * V;
+ Y = Radix * Radix;
+ if (X * Y < One || X > Y) {
+ if (X * Y < U1 || X > Y / U1)
+ BadCond (Defect, "Badly");
+ else
+ BadCond (Flaw, "");
+
+ printf (" unbalanced range; UfThold * V = %.17e\n\t%s\n",
+ X, "is too far from 1.\n");
+ }
+ /*=============================================*/
+ Milestone = 200;
+ /*=============================================*/
+ for (Indx = 1; Indx <= 5; ++Indx) {
+ X = F9;
+ switch (Indx) {
+ case 2:
+ X = One + U2;
+ break;
+ case 3:
+ X = V;
+ break;
+ case 4:
+ X = UfThold;
+ break;
+ case 5:
+ X = Radix;
+ }
+ Y = X;
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ printf (" X / X traps when X = %g\n", X);
+ else {
+ V9 = (Y / X - Half) - Half;
+ if (V9 == Zero)
+ continue;
+ if (V9 == -U1 && Indx < 5)
+ BadCond (Flaw, "");
+ else
+ BadCond (Serious, "");
+ printf (" X / X differs from 1 when X = %.17e\n", X);
+ printf (" instead, X / X - 1/2 - 1/2 = %.17e .\n", V9);
+ }
+ sigsave = 0;
+ }
+ /*=============================================*/
+ Milestone = 210;
+ /*=============================================*/
+ MyZero = Zero;
+ printf ("\n");
+ printf ("What message and/or values does Division by Zero produce?\n");
+#ifndef BATCHMODE
+ printf ("This can interupt your program. You can ");
+ printf ("skip this part if you wish.\n");
+ printf ("Do you wish to compute 1 / 0? ");
+ fflush (stdout);
+ read (KEYBOARD, ch, 8);
+ if ((ch[0] == 'Y') || (ch[0] == 'y')) {
+#endif /* !BATCHMODE */
+ sigsave = _sigfpe;
+ printf (" Trying to compute 1 / 0 produces ...");
+ if (!setjmp (ovfl_buf))
+ printf (" %.7e .\n", One / MyZero);
+ sigsave = 0;
+#ifndef BATCHMODE
+ } else
+ printf ("O.K.\n");
+ printf ("\nDo you wish to compute 0 / 0? ");
+ fflush (stdout);
+ read (KEYBOARD, ch, 80);
+ if ((ch[0] == 'Y') || (ch[0] == 'y')) {
+#endif /* !BATCHMODE */
+ sigsave = _sigfpe;
+ printf ("\n Trying to compute 0 / 0 produces ...");
+ if (!setjmp (ovfl_buf))
+ printf (" %.7e .\n", Zero / MyZero);
+ sigsave = 0;
+#ifndef BATCHMODE
+ } else
+ printf ("O.K.\n");
+#endif /* !BATCHMODE */
+ /*=============================================*/
+ Milestone = 220;
+ /*=============================================*/
+
+ Pause ();
+ printf ("\n");
+ {
+ static char *msg[] =
+ {
+ "FAILUREs encountered =",
+ "SERIOUS DEFECTs discovered =",
+ "DEFECTs discovered =",
+ "FLAWs discovered ="};
+ int i;
+ for (i = 0; i < 4; i++)
+ if (ErrCnt[i])
+ printf ("The number of %-29s %d.\n",
+ msg[i], ErrCnt[i]);
+ }
+
+ printf ("\n");
+ if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[Defect]
+ + ErrCnt[Flaw]) > 0) {
+ if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[
+ Defect] == 0) && (ErrCnt[Flaw] > 0)) {
+ printf ("The arithmetic diagnosed seems ");
+ printf ("Satisfactory though flawed.\n");
+ }
+ if ((ErrCnt[Failure] + ErrCnt[Serious] == 0)
+ && (ErrCnt[Defect] > 0)) {
+ printf ("The arithmetic diagnosed may be Acceptable\n");
+ printf ("despite inconvenient Defects.\n");
+ }
+ if ((ErrCnt[Failure] + ErrCnt[Serious]) > 0) {
+ printf ("The arithmetic diagnosed has ");
+ printf ("unacceptable Serious Defects.\n");
+ }
+ if (ErrCnt[Failure] > 0) {
+ printf ("Potentially fatal FAILURE may have spoiled this");
+ printf (" program's subsequent diagnoses.\n");
+ }
+ } else {
+
+ printf ("No failures, defects nor flaws have been discovered.\n");
+ if (!((RMult == Rounded) && (RDiv == Rounded)
+ && (RAddSub == Rounded) && (RSqrt == Rounded)))
+ printf ("The arithmetic diagnosed seems Satisfactory.\n");
+ else {
+ if (StickyBit >= One &&
+ (Radix - Two) * (Radix - Nine - One) == Zero) {
+ printf ("Rounding appears to conform to ");
+ printf ("the proposed IEEE standard P");
+ if ((Radix == Two) &&
+ ((Precision - Four * Three * Two) *
+ (Precision - TwentySeven -
+ TwentySeven + One) == Zero))
+ printf ("754");
+ else
+ printf ("854");
+ if (IEEE)
+ printf (".\n");
+ else {
+ printf (",\nexcept for possibly Double Rounding");
+ printf (" during Gradual Underflow.\n");
+ }
+ }
+ printf ("The arithmetic diagnosed appears to be Excellent!\n");
+ }
+ }
+
+ if (fpecount)
+ printf ("\nA total of %d floating point exceptions were registered.\n",
+ fpecount);
+ printf ("END OF TEST.\n");
+ return 0;
+}
+
+FLOAT
+Sign (X)
+ FLOAT X;
+{
+ return X >= 0. ? 1.0 : -1.0;
+}
+
+void
+Pause ()
+{
+#ifndef BATCHMODE
+ char ch[8];
+
+ printf ("\nTo continue, press RETURN");
+ fflush (stdout);
+ read (KEYBOARD, ch, 8);
+#endif /* !BATCHMODE */
+#ifndef CYGNUS
+ printf ("\nDiagnosis resumes after milestone Number %d", Milestone);
+ printf (" Page: %d\n\n", PageNo);
+ ++Milestone;
+ ++PageNo;
+#endif /* !CYGNUS */
+}
+
+void
+TstCond (K, Valid, T)
+ int K, Valid;
+ char *T;
+{
+#ifdef CYGNUS
+ printf ("TEST: %s\n", T);
+#endif /* CYGNUS */
+ if (!Valid) {
+ BadCond (K, T);
+ printf (".\n");
+ }
+#ifdef CYGNUS
+ printf ("PASS: %s\n", T);
+#endif /* CYGNUS */
+}
+
+void
+BadCond (K, T)
+ int K;
+ char *T;
+{
+ static char *msg[] =
+ {"FAILURE", "SERIOUS DEFECT", "DEFECT", "FLAW"};
+
+ ErrCnt[K] = ErrCnt[K] + 1;
+#ifndef CYGNUS
+ printf ("%s: %s", msg[K], T);
+#else
+ printf ("ERROR: Severity: %s: %s", msg[K], T);
+#endif /* CYGNUS */
+}
+
+/*
+ * Random computes
+ * X = (Random1 + Random9)^5
+ * Random1 = X - FLOOR(X) + 0.000005 * X;
+ * and returns the new value of Random1
+*/
+FLOAT
+Random ()
+{
+ FLOAT X, Y;
+
+ X = Random1 + Random9;
+ Y = X * X;
+ Y = Y * Y;
+ X = X * Y;
+ Y = X - FLOOR (X);
+ Random1 = Y + X * 0.000005;
+ return (Random1);
+}
+
+void
+SqXMinX (ErrKind)
+ int ErrKind;
+{
+ FLOAT XA, XB;
+
+ XB = X * BInvrse;
+ XA = X - XB;
+ SqEr = ((SQRT (X * X) - XB) - XA) / OneUlp;
+ if (SqEr != Zero) {
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ J = J + 1.0;
+ BadCond (ErrKind, "\n");
+ printf ("sqrt( %.17e) - %.17e = %.17e\n", X * X, X, OneUlp * SqEr);
+ printf ("\tinstead of correct value 0 .\n");
+ }
+}
+
+void
+NewD ()
+{
+ X = Z1 * Q;
+ X = FLOOR (Half - X / Radix) * Radix + X;
+ Q = (Q - X * Z) / Radix + X * X * (D / Radix);
+ Z = Z - Two * X * D;
+ if (Z <= Zero) {
+ Z = -Z;
+ Z1 = -Z1;
+ }
+ D = Radix * D;
+}
+
+void
+SR3750 ()
+{
+ if (!((X - Radix < Z2 - Radix) || (X - Z2 > W - Z2))) {
+ I = I + 1;
+ X2 = SQRT (X * D);
+ Y2 = (X2 - Z2) - (Y - Z2);
+ X2 = X8 / (Y - Half);
+ X2 = X2 - Half * X2 * X2;
+ SqEr = (Y2 + Half) + (Half - X2);
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ SqEr = Y2 - X2;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ }
+}
+
+void
+IsYeqX ()
+{
+ if (Y != X) {
+ if (N <= 0) {
+ if (Z == Zero && Q <= Zero)
+ printf ("WARNING: computing\n");
+ else
+ BadCond (Defect, "computing\n");
+ printf ("\t(%.17e) ^ (%.17e)\n", Z, Q);
+ printf ("\tyielded %.17e;\n", Y);
+ printf ("\twhich compared unequal to correct %.17e ;\n",
+ X);
+ printf ("\t\tthey differ by %.17e .\n", Y - X);
+ }
+ N = N + 1; /* ... count discrepancies. */
+ }
+}
+
+void
+SR3980 ()
+{
+ do {
+ Q = (FLOAT) I;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ if (++I > M)
+ break;
+ X = Z * X;
+ }
+ while (X < W);
+}
+
+void
+PrintIfNPositive ()
+{
+ if (N > 0)
+ printf ("Similar discrepancies have occurred %d times.\n", N);
+}
+
+void
+TstPtUf ()
+{
+ N = 0;
+ if (Z != Zero) {
+ printf ("Since comparison denies Z = 0, evaluating ");
+ printf ("(Z + Z) / Z should be safe.\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ goto very_serious;
+ Q9 = (Z + Z) / Z;
+ printf ("What the machine gets for (Z + Z) / Z is %.17e .\n",
+ Q9);
+ if (FABS (Q9 - Two) < Radix * U2) {
+ printf ("This is O.K., provided Over/Underflow");
+ printf (" has NOT just been signaled.\n");
+ } else {
+ if ((Q9 < One) || (Q9 > Two)) {
+ very_serious:
+ N = 1;
+ ErrCnt[Serious] = ErrCnt[Serious] + 1;
+ printf ("This is a VERY SERIOUS DEFECT!\n");
+ } else {
+ N = 1;
+ ErrCnt[Defect] = ErrCnt[Defect] + 1;
+ printf ("This is a DEFECT!\n");
+ }
+ }
+ sigsave = 0;
+ V9 = Z * One;
+ Random1 = V9;
+ V9 = One * Z;
+ Random2 = V9;
+ V9 = Z / One;
+ if ((Z == Random1) && (Z == Random2) && (Z == V9)) {
+ if (N > 0)
+ Pause ();
+ } else {
+ N = 1;
+ BadCond (Defect, "What prints as Z = ");
+ printf ("%.17e\n\tcompares different from ", Z);
+ if (Z != Random1)
+ printf ("Z * 1 = %.17e ", Random1);
+ if (!((Z == Random2)
+ || (Random2 == Random1)))
+ printf ("1 * Z == %g\n", Random2);
+ if (!(Z == V9))
+ printf ("Z / 1 = %.17e\n", V9);
+ if (Random2 != Random1) {
+ ErrCnt[Defect] = ErrCnt[Defect] + 1;
+ BadCond (Defect, "Multiplication does not commute!\n");
+ printf ("\tComparison alleges that 1 * Z = %.17e\n",
+ Random2);
+ printf ("\tdiffers from Z * 1 = %.17e\n", Random1);
+ }
+ Pause ();
+ }
+ }
+}
+
+void
+notify (s)
+ char *s;
+{
+ printf ("%s test appears to be inconsistent...\n", s);
+ printf (" PLEASE NOTIFY KARPINKSI!\n");
+}
+
+void
+msglist (s)
+ char **s;
+{
+ while (*s)
+ printf ("%s\n", *s++);
+}
+
+void
+Instructions ()
+{
+ static char *instr[] =
+ {
+ "Lest this program stop prematurely, i.e. before displaying\n",
+ " `END OF TEST',\n",
+ "try to persuade the computer NOT to terminate execution when an",
+ "error like Over/Underflow or Division by Zero occurs, but rather",
+ "to persevere with a surrogate value after, perhaps, displaying some",
+ "warning. If persuasion avails naught, don't despair but run this",
+ "program anyway to see how many milestones it passes, and then",
+ "amend it to make further progress.\n",
+ "Answer questions with Y, y, N or n (unless otherwise indicated).\n",
+ 0};
+
+ msglist (instr);
+}
+
+void
+Heading ()
+{
+ static char *head[] =
+ {
+ "Users are invited to help debug and augment this program so it will",
+ "cope with unanticipated and newly uncovered arithmetic pathologies.\n",
+ "Please send suggestions and interesting results to",
+ "\tRichard Karpinski",
+ "\tComputer Center U-76",
+ "\tUniversity of California",
+ "\tSan Francisco, CA 94143-0704, USA\n",
+ "In doing so, please include the following information:",
+#ifdef SINGLE_PRECISION
+ "\tPrecision:\tsingle;",
+#else /* !SINGLE_PRECISION */
+ "\tPrecision:\tdouble;",
+#endif /* SINGLE_PRECISION */
+ "\tVersion:\t10 February 1989;",
+ "\tComputer:\n",
+ "\tCompiler:\n",
+ "\tOptimization level:\n",
+ "\tOther relevant compiler options:",
+ 0};
+
+ msglist (head);
+}
+
+void
+Characteristics ()
+{
+ static char *chars[] =
+ {
+ "Running this program should reveal these characteristics:",
+ " Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...",
+ " Precision = number of significant digits carried.",
+ " U2 = Radix/Radix^Precision = One Ulp",
+ "\t(OneUlpnit in the Last Place) of 1.000xxx .",
+ " U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .",
+ " Adequacy of guard digits for Mult., Div. and Subt.",
+ " Whether arithmetic is chopped, correctly rounded, or something else",
+ "\tfor Mult., Div., Add/Subt. and Sqrt.",
+ " Whether a Sticky Bit used correctly for rounding.",
+ " UnderflowThreshold = an underflow threshold.",
+ " E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.",
+ " V = an overflow threshold, roughly.",
+ " V0 tells, roughly, whether Infinity is represented.",
+ " Comparisions are checked for consistency with subtraction",
+ "\tand for contamination with pseudo-zeros.",
+ " Sqrt is tested. Y^X is not tested.",
+ " Extra-precise subexpressions are revealed but NOT YET tested.",
+ " Decimal-Binary conversion is NOT YET tested for accuracy.",
+ 0};
+
+ msglist (chars);
+}
+
+void
+History ()
+{ /* History */
+ /* Converted from Brian Wichmann's Pascal version to C by Thos Sumner,
+ with further massaging by David M. Gay. */
+
+ static char *hist[] =
+ {
+ "The program attempts to discriminate among",
+ " FLAWs, like lack of a sticky bit,",
+ " Serious DEFECTs, like lack of a guard digit, and",
+ " FAILUREs, like 2+2 == 5 .",
+ "Failures may confound subsequent diagnoses.\n",
+ "The diagnostic capabilities of this program go beyond an earlier",
+ "program called `MACHAR', which can be found at the end of the",
+ "book `Software Manual for the Elementary Functions' (1980) by",
+ "W. J. Cody and W. Waite. Although both programs try to discover",
+ "the Radix, Precision and range (over/underflow thresholds)",
+ "of the arithmetic, this program tries to cope with a wider variety",
+ "of pathologies, and to say how well the arithmetic is implemented.",
+ "\nThe program is based upon a conventional radix representation for",
+ "floating-point numbers, but also allows logarithmic encoding",
+ "as used by certain early WANG machines.\n",
+ "BASIC version of this program (C) 1983 by Prof. W. M. Kahan;",
+ "see source comments for more history.",
+ 0};
+
+ msglist (hist);
+}
diff --git a/c/src/tests/samples/paranoia/paranoia.doc b/c/src/tests/samples/paranoia/paranoia.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/paranoia/paranoia.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/paranoia/system.h b/c/src/tests/samples/paranoia/system.h
new file mode 100644
index 0000000000..3837d9d902
--- /dev/null
+++ b/c/src/tests/samples/paranoia/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
+
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/c/src/tests/samples/ticker/init.c b/c/src/tests/samples/ticker/init.c
new file mode 100644
index 0000000000..d4d1f0176a
--- /dev/null
+++ b/c/src/tests/samples/ticker/init.c
@@ -0,0 +1,61 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ puts( "\n\n*** CLOCK TICK TEST ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
+ );
+ status = rtems_task_create(
+ Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
+ );
+ status = rtems_task_create(
+ Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
+ );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
+ status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
+ status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
+
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/c/src/tests/samples/ticker/system.h b/c/src/tests/samples/ticker/system.h
new file mode 100644
index 0000000000..51a9c082df
--- /dev/null
+++ b/c/src/tests/samples/ticker/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/samples/ticker/tasks.c b/c/src/tests/samples/ticker/tasks.c
new file mode 100644
index 0000000000..ec7c6baa2e
--- /dev/null
+++ b/c/src/tests/samples/ticker/tasks.c
@@ -0,0 +1,44 @@
+/* Test_task
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument unused
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ task_index = task_number( tid );
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ if ( time.second >= 35 ) {
+ puts( "*** END OF CLOCK TICK TEST ***" );
+ exit( 0 );
+ }
+ put_name( Task_name[ task_index ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+ status = rtems_task_wake_after( task_index * 5 * TICKS_PER_SECOND );
+ }
+}
diff --git a/c/src/tests/samples/ticker/ticker.doc b/c/src/tests/samples/ticker/ticker.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/samples/ticker/ticker.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/samples/ticker/ticker.scn b/c/src/tests/samples/ticker/ticker.scn
new file mode 100644
index 0000000000..35952e6170
--- /dev/null
+++ b/c/src/tests/samples/ticker/ticker.scn
@@ -0,0 +1,16 @@
+*** CLOCK TICK TEST ***
+TA1 - tm_get - 09:00:00 12/31/1988
+TA2 - tm_get - 09:00:00 12/31/1988
+TA3 - tm_get - 09:00:00 12/31/1988
+TA1 - tm_get - 09:00:05 12/31/1988
+TA1 - tm_get - 09:00:10 12/31/1988
+TA2 - tm_get - 09:00:10 12/31/1988
+TA1 - tm_get - 09:00:15 12/31/1988
+TA3 - tm_get - 09:00:15 12/31/1988
+TA1 - tm_get - 09:00:20 12/31/1988
+TA2 - tm_get - 09:00:20 12/31/1988
+TA1 - tm_get - 09:00:25 12/31/1988
+TA1 - tm_get - 09:00:30 12/31/1988
+TA2 - tm_get - 09:00:30 12/31/1988
+TA3 - tm_get - 09:00:30 12/31/1988
+*** END OF CLOCK TICK TEST ***
diff --git a/c/src/tests/sptests/README b/c/src/tests/sptests/README
new file mode 100644
index 0000000000..2843063c31
--- /dev/null
+++ b/c/src/tests/sptests/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Single Processor Test Suite.
+The tests in this directory provide near complete (98%+) test
+coverage of the non-multiprocessor code in RTEMS.
+
+
diff --git a/c/src/tests/sptests/sp01/init.c b/c/src/tests/sptests/sp01/init.c
new file mode 100644
index 0000000000..894cc3e890
--- /dev/null
+++ b/c/src/tests/sptests/sp01/init.c
@@ -0,0 +1,86 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 1 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(31),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 3,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp01/sp01.doc b/c/src/tests/sptests/sp01/sp01.doc
new file mode 100644
index 0000000000..79b1aaaa87
--- /dev/null
+++ b/c/src/tests/sptests/sp01/sp01.doc
@@ -0,0 +1,43 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test1
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handle a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+output:
+ "TA1" is printed once every 5 seconds. "TA2" is printed once
+ every 10 seconds. "TA3" is printed once every 15 seconds.
diff --git a/c/src/tests/sptests/sp01/sp01.scn b/c/src/tests/sptests/sp01/sp01.scn
new file mode 100644
index 0000000000..d4fcc4561b
--- /dev/null
+++ b/c/src/tests/sptests/sp01/sp01.scn
@@ -0,0 +1,18 @@
+*** TEST 1 ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA2 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:25 12/31/1988
+TA3 - rtems_clock_get - 09:00:30 12/31/1988
+TA1 - rtems_clock_get - 09:00:30 12/31/1988
+TA2 - rtems_clock_get - 09:00:30 12/31/1988
+*** END OF TEST 1 ***
+
+NOTE: The order of the prints at each time interval is irrelevant.
diff --git a/c/src/tests/sptests/sp01/system.h b/c/src/tests/sptests/sp01/system.h
new file mode 100644
index 0000000000..08e71c4bb8
--- /dev/null
+++ b/c/src/tests/sptests/sp01/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp01/task1.c b/c/src/tests/sptests/sp01/task1.c
new file mode 100644
index 0000000000..b45d3abce6
--- /dev/null
+++ b/c/src/tests/sptests/sp01/task1.c
@@ -0,0 +1,50 @@
+/* Task_1_through_3
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 35 ) {
+ puts( "*** END OF TEST 1 ***" );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/sptests/sp02/init.c b/c/src/tests/sptests/sp02/init.c
new file mode 100644
index 0000000000..b7be2dd680
--- /dev/null
+++ b/c/src/tests/sptests/sp02/init.c
@@ -0,0 +1,152 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 2 ***" );
+
+ Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' );
+
+ status = rtems_task_create(
+ Preempt_task_name,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Preempt_task_id
+ );
+ directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
+
+ status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
+ directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
+
+ puts( "INIT - rtems_task_wake_after - yielding processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ puts( "INIT - suspending TA2 while middle task on a ready chain" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ status = rtems_task_delete( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_delete of TA1" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp02/preempt.c b/c/src/tests/sptests/sp02/preempt.c
new file mode 100644
index 0000000000..7e93f7af57
--- /dev/null
+++ b/c/src/tests/sptests/sp02/preempt.c
@@ -0,0 +1,32 @@
+/* Preempt_task
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "PREEMPT - rtems_task_delete - deleting self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_PREEMPT" );
+}
diff --git a/c/src/tests/sptests/sp02/sp02.doc b/c/src/tests/sptests/sp02/sp02.doc
new file mode 100644
index 0000000000..00f2e0e7b3
--- /dev/null
+++ b/c/src/tests/sptests/sp02/sp02.doc
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test2
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ t_delete, tm_wkafter, t_setpri, t_suspend
+
+concepts:
+
+ a. Verifies that a task can delete another task and also delete itself.
+
+ b. Verifies that memory is freed back to the heap correctly.
+
+ c. Verifies that TCBs are freed back to the inactive chain correctly.
+
+ d. Verifies that a task can get the task identification number of
+ another task.
+
+ e. Verifies the _Set_state routine where the task is not READY.
+
+ f. Verifies the break statement in the _Block_activate routine.
+
+ g. Verifies the while loop in the _Prev_tcb routine.
diff --git a/c/src/tests/sptests/sp02/sp02.scn b/c/src/tests/sptests/sp02/sp02.scn
new file mode 100644
index 0000000000..d3f3d61cd1
--- /dev/null
+++ b/c/src/tests/sptests/sp02/sp02.scn
@@ -0,0 +1,15 @@
+*** TEST 2 ***
+INIT - rtems_task_wake_after - yielding processor
+PREEMPT - rtems_task_delete - deleting self
+INIT - suspending TA2 while middle task on a ready chain
+TA1 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 minute
+TA3 - rtems_task_wake_after - sleep 5 seconds
+TA1 - rtems_task_ident - tid of TA2 (0x08010007)
+TA1 - rtems_task_ident - tid of TA3 (0x08010008)
+TA1 - rtems_task_set_priority - set TA3's priority to 2
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_delete - delete TA2
+TA1 - rtems_task_wake_after - sleep for 5 seconds
+TA3 - rtems_task_delete - delete self
+*** END OF TEST 2 ***
diff --git a/c/src/tests/sptests/sp02/system.h b/c/src/tests/sptests/sp02/system.h
new file mode 100644
index 0000000000..95cae6c0e2
--- /dev/null
+++ b/c/src/tests/sptests/sp02/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Preempt_task_id; /* preempt task id */
+TEST_EXTERN rtems_name Preempt_task_name; /* preempt task name */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp02/task1.c b/c/src/tests/sptests/sp02/task1.c
new file mode 100644
index 0000000000..0f6152dbb2
--- /dev/null
+++ b/c/src/tests/sptests/sp02/task1.c
@@ -0,0 +1,66 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid2;
+ rtems_id tid3;
+ rtems_status_code status;
+ rtems_unsigned32 previous_priority;
+
+ puts( "TA1 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 );
+ directive_failed( status, "rtems_task_ident of TA2" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA2 (0x%.8x)\n", tid2 );
+
+ status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 );
+ directive_failed( status, "rtems_task_ident of TA3" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA3 (0x%.8x)\n", tid3 );
+
+ status = rtems_task_set_priority( tid3, 2, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" );
+
+
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( tid2 );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_delete - delete TA2" );
+ status = rtems_task_delete( tid2 );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp02/task2.c b/c/src/tests/sptests/sp02/task2.c
new file mode 100644
index 0000000000..f39cc5b9fc
--- /dev/null
+++ b/c/src/tests/sptests/sp02/task2.c
@@ -0,0 +1,34 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It sleeps for 1 minute but
+ * does not expect to wake up. Task 1 should suspend then delete it
+ * so that it appears to never wake up.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
+ status = rtems_task_wake_after( 60*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA2" );
+}
diff --git a/c/src/tests/sptests/sp02/task3.c b/c/src/tests/sptests/sp02/task3.c
new file mode 100644
index 0000000000..89bda38b7c
--- /dev/null
+++ b/c/src/tests/sptests/sp02/task3.c
@@ -0,0 +1,37 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply sleeps for 5 seconds
+ * and then deletes itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA3" );
+
+ puts( "TA3 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA3" );
+}
diff --git a/c/src/tests/sptests/sp03/init.c b/c/src/tests/sptests/sp03/init.c
new file mode 100644
index 0000000000..0de15f689c
--- /dev/null
+++ b/c/src/tests/sptests/sp03/init.c
@@ -0,0 +1,67 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 3 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp03/sp03.doc b/c/src/tests/sptests/sp03/sp03.doc
new file mode 100644
index 0000000000..96d6d41d94
--- /dev/null
+++ b/c/src/tests/sptests/sp03/sp03.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test3
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ tm_wkwhen, tm_set, tm_get
+
+concepts:
+
+ a. Verifies conversion routines - _Utd_to_etd and _Etd_to_utd
diff --git a/c/src/tests/sptests/sp03/sp03.scn b/c/src/tests/sptests/sp03/sp03.scn
new file mode 100644
index 0000000000..496982e86f
--- /dev/null
+++ b/c/src/tests/sptests/sp03/sp03.scn
@@ -0,0 +1,26 @@
+*** TEST 3 ***
+TA1 sets clock: 09:15:00 12/31/1988
+TA1 going to sleep: 09:15:00 12/31/1988
+TA2 09:15:01 12/31/1988
+TA2 09:15:02 12/31/1988
+TA2 09:15:03 12/31/1988
+TA2 09:15:04 12/31/1988
+TA1 awakened: 09:15:05 12/31/1988
+TA1 going to sleep: 09:15:05 12/31/1988
+TA2 09:15:05 12/31/1988
+TA2 09:15:06 12/31/1988
+TA2 09:15:07 12/31/1988
+TA2 09:15:08 12/31/1988
+TA2 09:15:09 12/31/1988
+TA1 awakened: 09:15:10 12/31/1988
+TA1 going to sleep: 09:15:10 12/31/1988
+TA2 09:15:10 12/31/1988
+TA2 09:15:11 12/31/1988
+TA2 09:15:12 12/31/1988
+TA2 09:15:13 12/31/1988
+TA2 09:15:14 12/31/1988
+TA1 awakened: 09:15:15 12/31/1988
+TA1 going to sleep: 09:15:15 12/31/1988
+TA2 09:15:15 12/31/1988
+TA2 09:15:16 12/31/1988
+*** END OF TEST 3 ***
diff --git a/c/src/tests/sptests/sp03/system.h b/c/src/tests/sptests/sp03/system.h
new file mode 100644
index 0000000000..d83cb3f510
--- /dev/null
+++ b/c/src/tests/sptests/sp03/system.h
@@ -0,0 +1,47 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp03/task1.c b/c/src/tests/sptests/sp03/task1.c
new file mode 100644
index 0000000000..e59fad45cf
--- /dev/null
+++ b/c/src/tests/sptests/sp03/task1.c
@@ -0,0 +1,59 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the capability to
+ * set and read the executives calender and clock.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " sets clock: ", &time, "\n" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " going to sleep: ", &time, "\n" );
+
+ time.second += 5;
+ time.minute += ( time.second / 60 );
+ time.second %= 60;
+ time.hour += ( time.minute / 60 );
+ time.minute %= 60;
+ time.hour %= 24;
+
+ status = rtems_task_wake_when( &time );
+ directive_failed( status, "rtems_task_wake_when" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " awakened: ", &time, "\n" );
+ }
+}
diff --git a/c/src/tests/sptests/sp03/task2.c b/c/src/tests/sptests/sp03/task2.c
new file mode 100644
index 0000000000..8838c1db67
--- /dev/null
+++ b/c/src/tests/sptests/sp03/task2.c
@@ -0,0 +1,46 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It repeatedly gets the system time
+ * and date, converts it to printable form, and print it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ while( FOREVER ) {
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 17 ) {
+ puts( "*** END OF TEST 3 *** " );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ 2 ], FALSE );
+ print_time( " ", &time, "\n" );
+ }
+}
diff --git a/c/src/tests/sptests/sp04/init.c b/c/src/tests/sptests/sp04/init.c
new file mode 100644
index 0000000000..c14e0ce918
--- /dev/null
+++ b/c/src/tests/sptests/sp04/init.c
@@ -0,0 +1,110 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_extensions_table Extensions = {
+ NULL, /* task create user extension */
+ NULL, /* task start user extension */
+ NULL, /* task restart user extension */
+ NULL, /* task delete user extension */
+ Task_switch, /* task switch user extension */
+ NULL, /* task begin user extension */
+ NULL, /* task exitted user extension */
+ NULL /* fatal error user extension */
+};
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ puts( "\n\n*** TEST 4 ***" );
+ build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
+
+ status = rtems_extension_create(
+ Extension_name[ 1 ],
+ &Extensions,
+ &Extension_id[ 1 ]
+ );
+ directive_failed( status, "rtems_extension_create" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Run_count[ 1 ] = 0;
+ Run_count[ 2 ] = 0;
+ Run_count[ 3 ] = 0;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp04/sp04.doc b/c/src/tests/sptests/sp04/sp04.doc
new file mode 100644
index 0000000000..6f6355abfa
--- /dev/null
+++ b/c/src/tests/sptests/sp04/sp04.doc
@@ -0,0 +1,38 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test4
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_set, tm_get, ev_receive, t_mode
+
+concepts:
+
+ a. Verifies timeslicing ( all tasks are in timeslice mode ).
+
+ b. Verifies the tswitch user extension.
+
+ c. Verifies the no preemption mode.
+
+ d. Verifies time-slice gets reset even if only one task ready.
+
+output:
+ The task name and the current time are printed out each time that a new
+ task is being dispatched. The configured timeslice is 100 ticks
+ ( 1 second ); therefore, a task name and the time are printed once
+ every second. After each task runs 3 times, task 1 changes its mode to
+ no preempt and runs for about 6 seconds and then changes its mode back to
+ preempt mode.
diff --git a/c/src/tests/sptests/sp04/sp04.scn b/c/src/tests/sptests/sp04/sp04.scn
new file mode 100644
index 0000000000..f104c0c482
--- /dev/null
+++ b/c/src/tests/sptests/sp04/sp04.scn
@@ -0,0 +1,24 @@
+*** TEST 4 ***
+TA1 - 09:15:00 12/31/1988
+TA1 - rtems_task_suspend - on Task 2
+TA1 - rtems_task_suspend - on Task 3
+TA1 - killing time
+TA1 - rtems_task_resume - on Task 2
+TA1 - rtems_task_resume - on Task 3
+TA2 - 09:15:03 12/31/1988
+TA3 - 09:15:04 12/31/1988
+TA1 - 09:15:05 12/31/1988
+TA2 - 09:15:06 12/31/1988
+TA3 - 09:15:07 12/31/1988
+TA1 - 09:15:08 12/31/1988
+TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT
+TA1 - 09:15:09 12/31/1988
+TA1 - 09:15:10 12/31/1988
+TA1 - 09:15:11 12/31/1988
+TA1 - 09:15:12 12/31/1988
+TA1 - 09:15:13 12/31/1988
+TA1 - 09:15:14 12/31/1988
+TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT
+TA2 - 09:15:15 12/31/1988
+TA3 - 09:15:16 12/31/1988
+*** END OF TEST 4 ***
diff --git a/c/src/tests/sptests/sp04/system.h b/c/src/tests/sptests/sp04/system.h
new file mode 100644
index 0000000000..27e716a701
--- /dev/null
+++ b/c/src/tests/sptests/sp04/system.h
@@ -0,0 +1,65 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+void Task_switch(
+ rtems_tcb *unused,
+ rtems_tcb *heir
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Extension_id[ 4 ];
+TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
+
+/* array of task run counts */
+TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ];
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp04/task1.c b/c/src/tests/sptests/sp04/task1.c
new file mode 100644
index 0000000000..671ae5483d
--- /dev/null
+++ b/c/src/tests/sptests/sp04/task1.c
@@ -0,0 +1,103 @@
+/* Task_1
+ *
+ * This test serves as a test task. It verifies timeslicing activities
+ * and tswitch extension processing.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 seconds;
+ rtems_unsigned32 old_seconds;
+ rtems_mode previous_mode;
+ rtems_time_of_day time;
+ rtems_status_code status;
+ rtems_unsigned32 start_time;
+ rtems_unsigned32 end_time;
+
+ puts( "TA1 - rtems_task_suspend - on Task 2" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_suspend - on Task 3" );
+ status = rtems_task_suspend( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_suspend of TA3" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start_time );
+ directive_failed( status, "rtems_clock_get" );
+
+ puts( "TA1 - killing time" );
+
+ for ( ; ; ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end_time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( end_time > (start_time + 2) )
+ break;
+ }
+
+ puts( "TA1 - rtems_task_resume - on Task 2" );
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_resume of TA2" );
+
+ puts( "TA1 - rtems_task_resume - on Task 3" );
+ status = rtems_task_resume( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_resume of TA3" );
+
+ while ( FOREVER ) {
+ if ( Run_count[ 1 ] == 3 ) {
+ puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ old_seconds = time.second;
+
+ for ( seconds = 0 ; seconds < 6 ; ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second != old_seconds ) {
+ old_seconds = time.second;
+ seconds++;
+ print_time( "TA1 - ", &time, "\n" );
+ }
+ }
+
+ puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" );
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ while ( FOREVER );
+ }
+ }
+}
diff --git a/c/src/tests/sptests/sp04/task2.c b/c/src/tests/sptests/sp04/task2.c
new file mode 100644
index 0000000000..7574e7dc9f
--- /dev/null
+++ b/c/src/tests/sptests/sp04/task2.c
@@ -0,0 +1,29 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It is just a CPU bound task
+ * requiring timesliced operation.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ while( FOREVER );
+}
diff --git a/c/src/tests/sptests/sp04/task3.c b/c/src/tests/sptests/sp04/task3.c
new file mode 100644
index 0000000000..a0e7482944
--- /dev/null
+++ b/c/src/tests/sptests/sp04/task3.c
@@ -0,0 +1,29 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It is just a CPU bound task
+ * requiring timesliced operation.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ while( FOREVER );
+}
diff --git a/c/src/tests/sptests/sp04/tswitch.c b/c/src/tests/sptests/sp04/tswitch.c
new file mode 100644
index 0000000000..766d09e93b
--- /dev/null
+++ b/c/src/tests/sptests/sp04/tswitch.c
@@ -0,0 +1,59 @@
+/* Task_switch
+ *
+ * This routine is the tswitch user extension. It determines which
+ * task is being switched to and displays a message indicating the
+ * time and date that it gained control.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * heir - pointer to heir TCB
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_switch(
+ rtems_tcb *unused,
+ rtems_tcb *heir
+)
+{
+ rtems_unsigned32 index;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ index = task_number( heir->Object.id );
+
+ switch( index ) {
+ case 1:
+ case 2:
+ case 3:
+ Run_count[ index ] += 1;
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ index ], FALSE );
+ print_time( "- ", &time, "\n" );
+
+ if ( time.second >= 16 ) {
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+ }
+ break;
+
+ case 0:
+ default:
+ break;
+ }
+}
diff --git a/c/src/tests/sptests/sp05/init.c b/c/src/tests/sptests/sp05/init.c
new file mode 100644
index 0000000000..5c1dbc0236
--- /dev/null
+++ b/c/src/tests/sptests/sp05/init.c
@@ -0,0 +1,81 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 5 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp05/sp05.doc b/c/src/tests/sptests/sp05/sp05.doc
new file mode 100644
index 0000000000..583381a37e
--- /dev/null
+++ b/c/src/tests/sptests/sp05/sp05.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test5
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident
+ tm_wkafter, t_suspend, t_resume
+
+concepts:
+
+ a. Verifies that a task can be suspended and resumed.
+
+ b. Verifies that a task can suspend itself.
diff --git a/c/src/tests/sptests/sp05/sp05.scn b/c/src/tests/sptests/sp05/sp05.scn
new file mode 100644
index 0000000000..40afb2d4b2
--- /dev/null
+++ b/c/src/tests/sptests/sp05/sp05.scn
@@ -0,0 +1,47 @@
+*** TEST 5 ***
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_suspend - suspend self
+TA3 - rtems_task_suspend - suspend self
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+*** END OF TEST 5 ***
diff --git a/c/src/tests/sptests/sp05/system.h b/c/src/tests/sptests/sp05/system.h
new file mode 100644
index 0000000000..8f8cd58a30
--- /dev/null
+++ b/c/src/tests/sptests/sp05/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp05/task1.c b/c/src/tests/sptests/sp05/task1.c
new file mode 100644
index 0000000000..9b99586fc8
--- /dev/null
+++ b/c/src/tests/sptests/sp05/task1.c
@@ -0,0 +1,78 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies that tasks can
+ * be suspended and resumed.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: The rtems_task_suspend() directives fail on the first iteration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid2;
+ rtems_id tid3;
+ rtems_unsigned32 pass;
+ rtems_status_code status;
+
+ status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 );
+ directive_failed( status, "rtems_task_ident of TA2" );
+
+ status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 );
+ directive_failed( status, "rtems_task_ident of TA3" );
+
+ for ( pass=1 ; pass <= 3 ; pass++ ) {
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA1" );
+
+ puts( "TA1 - rtems_task_suspend - suspend TA3" );
+ status = rtems_task_suspend( tid3 );
+ if ( pass == 1 ) {
+ fatal_directive_status(
+ status,
+ RTEMS_ALREADY_SUSPENDED,
+ "rtems_task_suspend of TA3"
+ );
+ } else {
+ directive_failed( status, "rtems_task_suspend of TA3" );
+ }
+
+ puts( "TA1 - rtems_task_resume - resume TA2" );
+ status = rtems_task_resume( tid2 );
+ directive_failed( status, "rtems_task_resume of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( tid2 );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_resume - resume TA3" );
+ status = rtems_task_resume( tid3 );
+ directive_failed( status, "rtems_task_resume" );
+ }
+
+ puts( "*** END OF TEST 5 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp05/task2.c b/c/src/tests/sptests/sp05/task2.c
new file mode 100644
index 0000000000..3878d8106d
--- /dev/null
+++ b/c/src/tests/sptests/sp05/task2.c
@@ -0,0 +1,39 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Makes sure a task can suspend
+ * itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_task_suspend - suspend self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ while( FOREVER ) {
+ puts( "TA2 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA2" );
+ }
+}
diff --git a/c/src/tests/sptests/sp05/task3.c b/c/src/tests/sptests/sp05/task3.c
new file mode 100644
index 0000000000..c03c6de75b
--- /dev/null
+++ b/c/src/tests/sptests/sp05/task3.c
@@ -0,0 +1,39 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Makes sure a task can suspend
+ * itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_task_suspend - suspend self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA3" );
+
+ while( FOREVER ) {
+ puts( "TA3 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA3" );
+ }
+}
diff --git a/c/src/tests/sptests/sp06/init.c b/c/src/tests/sptests/sp06/init.c
new file mode 100644
index 0000000000..6d8af5f01d
--- /dev/null
+++ b/c/src/tests/sptests/sp06/init.c
@@ -0,0 +1,87 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ puts( "\n\n*** TEST 6 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Argument = 0;
+ Restart_argument = 1;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, Argument );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, Argument );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_set_priority( Task_id[ 3 ], 5, &previous_priority );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp06/sp06.doc b/c/src/tests/sptests/sp06/sp06.doc
new file mode 100644
index 0000000000..e8b96f1f6b
--- /dev/null
+++ b/c/src/tests/sptests/sp06/sp06.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test6
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_wkafter, t_restart
+
+concepts:
+
+ a. Verifies that a task can restart a task other than itself.
+
+ b. Verifies that a task can restart itself.
diff --git a/c/src/tests/sptests/sp06/sp06.scn b/c/src/tests/sptests/sp06/sp06.scn
new file mode 100644
index 0000000000..64f6489dc8
--- /dev/null
+++ b/c/src/tests/sptests/sp06/sp06.scn
@@ -0,0 +1,40 @@
+*** TEST 6 ***
+TA1 - is beginning to run
+TA1 - restarting TA3
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+*** END OF TEST 6 ***
+
+NOTE: The prints from TA2 may not be as regular as indicated in the screen.
+ The important point is that TA2 is running and gets restarted.
diff --git a/c/src/tests/sptests/sp06/system.h b/c/src/tests/sptests/sp06/system.h
new file mode 100644
index 0000000000..aa75d36f06
--- /dev/null
+++ b/c/src/tests/sptests/sp06/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_task_argument Argument; /* generic task argument */
+TEST_EXTERN rtems_task_argument Restart_argument; /* task 1 restart argument */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp06/task1.c b/c/src/tests/sptests/sp06/task1.c
new file mode 100644
index 0000000000..6d0f67f395
--- /dev/null
+++ b/c/src/tests/sptests/sp06/task1.c
@@ -0,0 +1,61 @@
+/* Task_1
+ *
+ * This task serves as a test task. Verifies that a task can restart
+ * both itself and other tasks.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1( argument )
+rtems_unsigned32 argument;
+{
+ rtems_unsigned32 pass;
+ rtems_status_code status;
+
+ puts( "TA1 - is beginning to run" );
+
+ pass = argument + 1;
+
+ if ( pass == 5 ) {
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+ }
+
+ if ( pass == 1 ) {
+ puts( "TA1 - restarting TA3" );
+ status = rtems_task_restart( Task_id[ 3 ], Restart_argument );
+ directive_failed( status, "rtems_task_restart of TA3" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_restart - restarting TA2" );
+ status = rtems_task_restart( Task_id[ 2 ], Restart_argument );
+ directive_failed( status, "rtems_task_restart TA2" );
+
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_restart - restarting self" );
+ status = rtems_task_restart( Task_id[ 1 ], pass );
+ directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp06/task2.c b/c/src/tests/sptests/sp06/task2.c
new file mode 100644
index 0000000000..0c9e10bc07
--- /dev/null
+++ b/c/src/tests/sptests/sp06/task2.c
@@ -0,0 +1,40 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It simply runs forever so
+ * another task can restart it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2( argument )
+rtems_task_argument argument;
+{
+ rtems_status_code status;
+
+ puts( "TA2 - is beginning to run" );
+ if ( argument == Argument ) {
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ while( FOREVER ) {
+ puts( "TA2 - rtems_task_wake_after - sleep 1/2 second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/sptests/sp06/task3.c b/c/src/tests/sptests/sp06/task3.c
new file mode 100644
index 0000000000..379ef8de92
--- /dev/null
+++ b/c/src/tests/sptests/sp06/task3.c
@@ -0,0 +1,32 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It is started, has its priority
+ * changed, and when it runs it deletes itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp07/init.c b/c/src/tests/sptests/sp07/init.c
new file mode 100644
index 0000000000..d0fb6975af
--- /dev/null
+++ b/c/src/tests/sptests/sp07/init.c
@@ -0,0 +1,128 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_extensions_table Extensions = {
+ Task_create_extension, /* task create user extension */
+ Task_start_extension, /* task start user extension */
+ Task_restart_extension, /* task restart user extension */
+ Task_delete_extension, /* task delete user extension */
+ NULL, /* task switch user extension */
+ NULL, /* begin user extension */
+ Task_exit_extension, /* task exitted user extension */
+ NULL /* fatal error extension */
+};
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 7 ***" );
+
+ Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
+
+ status = rtems_extension_create(
+ Extension_name[ 1 ],
+ &Extensions,
+ &Extension_id[ 1 ]
+ );
+ directive_failed( status, "rtems_extension_create" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_restart( Task_id[ 3 ], 0 );
+ directive_failed( status, "rtems_task_restart of TA3" );
+
+ status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 );
+ directive_failed( status, "task_set_node of TA1" );
+ printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " );
+ puts ( "to TA1's priority: 04" );
+
+ status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, 4 );
+ directive_failed( status, "task_set_node of TA2" );
+ printf( "INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 " );
+ puts ( "to TA2's priority: 04");
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp07/sp07.doc b/c/src/tests/sptests/sp07/sp07.doc
new file mode 100644
index 0000000000..47411194c6
--- /dev/null
+++ b/c/src/tests/sptests/sp07/sp07.doc
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test7
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_delete, t_setreg, t_getreg, t_setpri, t_suspend
+
+concepts:
+
+ a. Verifies that tasks can communicate with each other via the
+ t_setreg and t_getreg directives.
+
+ b. Verifies that the highest priority task is dispatched to execute.
+
+ c. Verifies setting the priority of both a ready and a blocked task.
+
+ d. Verifies the deletion of ready and blocked tasks.
+
+ e. Verifies the tcreate user extension.
+
+ f. Verifies the tstart user extension.
+
+ g. Verifies the tdelete user extension.
diff --git a/c/src/tests/sptests/sp07/sp07.scn b/c/src/tests/sptests/sp07/sp07.scn
new file mode 100644
index 0000000000..1f6de2d93d
--- /dev/null
+++ b/c/src/tests/sptests/sp07/sp07.scn
@@ -0,0 +1,33 @@
+*** TEST 7 ***
+TASK_CREATE - TA1 - created.
+TASK_CREATE - TA2 - created.
+TASK_CREATE - TA3 - created.
+TASK_CREATE - TA4 - created.
+TASK_START - TA1 - started.
+TASK_START - TA2 - started.
+TASK_START - TA3 - started.
+TASK_START - TA4 - started.
+TASK_RESTART - TA3 - restarted.
+INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 to TA1's priority: 04
+INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 to TA2's priority: 04
+<pause>
+TA1 - rtems_task_set_priority - get initial priority of self: 04
+TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 04
+TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 03
+TA1 - rtems_task_set_priority - set TA2's priority: 03
+TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 03
+TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: 02
+TA2 - rtems_task_set_priority - set TA1's priority: 02
+TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 02
+TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 01
+TA1 - rtems_task_set_priority - set TA2's priority: 01
+TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 01
+TA2 - rtems_task_suspend - suspend TA1
+TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )
+TASK_DELETE - TA2 deleting TA1
+TASK_DELETE - TA2 deleting TA3
+TASK_DELETE - TA2 deleting TA2
+TA4 - exitting task
+RTEMS_TASK_EXITTED - extension invoked for TA4
+*** END OF TEST 7 ***
+TASK_DELETE - TA4 deleting TA4 <---- may not appear
diff --git a/c/src/tests/sptests/sp07/system.h b/c/src/tests/sptests/sp07/system.h
new file mode 100644
index 0000000000..3bd1ee69b5
--- /dev/null
+++ b/c/src/tests/sptests/sp07/system.h
@@ -0,0 +1,85 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_boolean Task_create_extension(
+ rtems_tcb *unused,
+ rtems_tcb *created_task
+);
+
+rtems_extension Task_delete_extension(
+ rtems_tcb *running_task,
+ rtems_tcb *deleted_task
+);
+
+rtems_extension Task_restart_extension(
+ rtems_tcb *unused,
+ rtems_tcb *restarted_task
+);
+
+rtems_extension Task_start_extension(
+ rtems_tcb *unused,
+ rtems_tcb *started_task
+);
+
+rtems_extension Task_exit_extension(
+ rtems_tcb *running_task
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Extension_id[ 4 ];
+TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp07/task1.c b/c/src/tests/sptests/sp07/task1.c
new file mode 100644
index 0000000000..f5abb10fa5
--- /dev/null
+++ b/c/src/tests/sptests/sp07/task1.c
@@ -0,0 +1,85 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies intertask communication
+ * using task notepads and verifies the the user extensions (tcreate, etc).
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority the_priority;
+ rtems_task_priority previous_priority;
+
+ rtems_test_pause();
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &the_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ printf(
+ "TA1 - rtems_task_set_priority - get initial priority of self: %02d\n",
+ the_priority
+ );
+
+ while( FOREVER ) {
+ status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
+ directive_failed( status, "rtems_task_get_note" );
+ printf(
+"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n",
+ the_priority
+ );
+
+ if ( --the_priority == 0 ) {
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" );
+ status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+
+ printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, the_priority );
+ directive_failed( status, "rtems_task_set_note" );
+
+ printf( "TA1 - rtems_task_set_priority - set TA2's priority: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_priority(
+ Task_id[ 2 ],
+ the_priority,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ }
+}
diff --git a/c/src/tests/sptests/sp07/task2.c b/c/src/tests/sptests/sp07/task2.c
new file mode 100644
index 0000000000..622bdd8e3d
--- /dev/null
+++ b/c/src/tests/sptests/sp07/task2.c
@@ -0,0 +1,78 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Plays with priorities to verify
+ * that the highest priority task is always executed.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority the_priority;
+ rtems_task_priority previous_priority;
+
+ while( FOREVER ) {
+
+ status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
+ directive_failed( status, "rtems_task_get_note" );
+ printf(
+"TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n",
+ the_priority
+ );
+
+ if ( --the_priority == 0 ) {
+ puts( "TA2 - rtems_task_suspend - suspend TA1" );
+ status = rtems_task_suspend( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" );
+ status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */
+ directive_failed( status, "rtems_task_delete of TA1" );
+
+ status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of SELD" );
+
+ } else {
+
+ printf( "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_note(Task_id[ 1 ], RTEMS_NOTEPAD_8, the_priority);
+ directive_failed( status, "rtems_task_set_note" );
+
+ printf( "TA2 - rtems_task_set_priority - set TA1's priority: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_priority(
+ Task_id[ 1 ],
+ the_priority,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ }
+ }
+}
diff --git a/c/src/tests/sptests/sp07/task3.c b/c/src/tests/sptests/sp07/task3.c
new file mode 100644
index 0000000000..dce44b283b
--- /dev/null
+++ b/c/src/tests/sptests/sp07/task3.c
@@ -0,0 +1,34 @@
+/* Task_3
+ *
+ * This routine serves as a low priority test task that should never
+ * execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ while( FOREVER ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/sptests/sp07/task4.c b/c/src/tests/sptests/sp07/task4.c
new file mode 100644
index 0000000000..cc9de6d4c3
--- /dev/null
+++ b/c/src/tests/sptests/sp07/task4.c
@@ -0,0 +1,30 @@
+/* Task_4
+ *
+ * This routine serves as a low priority test task that should exit
+ * a soon as it runs to test the taskexitted user extension.
+ * execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ puts( "TA4 - exitting task" );
+}
diff --git a/c/src/tests/sptests/sp07/taskexit.c b/c/src/tests/sptests/sp07/taskexit.c
new file mode 100644
index 0000000000..ad52d1f3a7
--- /dev/null
+++ b/c/src/tests/sptests/sp07/taskexit.c
@@ -0,0 +1,33 @@
+/* Task_exit_extension
+ *
+ * This routine is the task exitted user extension.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_exit_extension(
+ rtems_tcb *running_task
+)
+{
+ if ( task_number( running_task->Object.id ) > 0 ) {
+ puts_nocr( "RTEMS_TASK_EXITTED - extension invoked for " );
+ put_name( Task_name[ task_number( running_task->Object.id ) ], TRUE );
+ }
+
+ puts("*** END OF TEST 7 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp07/tcreate.c b/c/src/tests/sptests/sp07/tcreate.c
new file mode 100644
index 0000000000..aff47ed191
--- /dev/null
+++ b/c/src/tests/sptests/sp07/tcreate.c
@@ -0,0 +1,35 @@
+/* Task_create_extension
+ *
+ * This routine is the tcreate user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * created_task - pointer to new TCB being created
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_boolean Task_create_extension(
+ rtems_tcb *unused,
+ rtems_tcb *created_task
+)
+{
+ if ( task_number( created_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_CREATE - " );
+ put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE );
+ puts( " - created." );
+ }
+ return TRUE;
+}
diff --git a/c/src/tests/sptests/sp07/tdelete.c b/c/src/tests/sptests/sp07/tdelete.c
new file mode 100644
index 0000000000..9d7c5749c1
--- /dev/null
+++ b/c/src/tests/sptests/sp07/tdelete.c
@@ -0,0 +1,37 @@
+/* Task_delete_extension
+ *
+ * This routine is the delete user extension.
+ *
+ * Input parameters:
+ * running_task - pointer to running TCB
+ * deleted_task - pointer to TCB deleted
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_delete_extension(
+ rtems_tcb *running_task,
+ rtems_tcb *deleted_task
+)
+{
+ if ( task_number( running_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_DELETE - " );
+ put_name( Task_name[ task_number( running_task->Object.id ) ], FALSE );
+ }
+ if ( task_number( deleted_task->Object.id ) > 0 ) {
+ puts_nocr( " deleting " );
+ put_name( Task_name[ task_number( deleted_task->Object.id ) ], TRUE );
+ }
+}
diff --git a/c/src/tests/sptests/sp07/trestart.c b/c/src/tests/sptests/sp07/trestart.c
new file mode 100644
index 0000000000..6cefb485a6
--- /dev/null
+++ b/c/src/tests/sptests/sp07/trestart.c
@@ -0,0 +1,34 @@
+/* Task_restart_extension
+ *
+ * This routine is the trestart user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * restarted_task - pointer to new TCB being started
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Task_restart_extension(
+ rtems_tcb *unused,
+ rtems_tcb *restarted_task
+)
+{
+ if ( task_number( restarted_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_RESTART - " );
+ put_name( Task_name[ task_number( restarted_task->Object.id ) ], FALSE );
+ puts( " - restarted." );
+ }
+}
diff --git a/c/src/tests/sptests/sp07/tstart.c b/c/src/tests/sptests/sp07/tstart.c
new file mode 100644
index 0000000000..1b1fc795b7
--- /dev/null
+++ b/c/src/tests/sptests/sp07/tstart.c
@@ -0,0 +1,34 @@
+/* Task_start_extension
+ *
+ * This routine is the tstart user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * started_task - pointer to new TCB being started
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_start_extension(
+ rtems_tcb *unused,
+ rtems_tcb *started_task
+)
+{
+ if ( task_number( started_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_START - " );
+ put_name( Task_name[ task_number( started_task->Object.id ) ], FALSE );
+ puts( " - started." );
+ }
+}
diff --git a/c/src/tests/sptests/sp08/init.c b/c/src/tests/sptests/sp08/init.c
new file mode 100644
index 0000000000..7d6e63e00f
--- /dev/null
+++ b/c/src/tests/sptests/sp08/init.c
@@ -0,0 +1,53 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 8 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp08/sp08.doc b/c/src/tests/sptests/sp08/sp08.doc
new file mode 100644
index 0000000000..2b152779d7
--- /dev/null
+++ b/c/src/tests/sptests/sp08/sp08.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test8
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_mode
+
+concepts:
+
+ a. Verifies every mode change possible.
+
+ b. Verifies the fatal error handler.
diff --git a/c/src/tests/sptests/sp08/sp08.scn b/c/src/tests/sptests/sp08/sp08.scn
new file mode 100644
index 0000000000..d85ccc384f
--- /dev/null
+++ b/c/src/tests/sptests/sp08/sp08.scn
@@ -0,0 +1,22 @@
+*** TEST 8 ***
+TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400
+TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400
+TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200
+TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200
+TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100
+TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100
+TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003
+TA1 - rtems_task_mode - set all modes - previous mode: 00000005
+TA1 - rtems_task_mode - set all modes - previous mode: 00000703
+TA1 - rtems_task_mode - clear all modes - previous mode: 00000703
+TA1 - rtems_task_mode - get current mode - previous mode: 00000000
+*** END OF TEST 8 ***
+
+NOTE: The interrupt level lines will be different on CPUs with few levels.
diff --git a/c/src/tests/sptests/sp08/system.h b/c/src/tests/sptests/sp08/system.h
new file mode 100644
index 0000000000..85cb0c7dcd
--- /dev/null
+++ b/c/src/tests/sptests/sp08/system.h
@@ -0,0 +1,48 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+#define put_mode( _comment, _output_mode ) \
+ printf( "%s %08x\n", _comment, _output_mode );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp08/task1.c b/c/src/tests/sptests/sp08/task1.c
new file mode 100644
index 0000000000..eddcb11191
--- /dev/null
+++ b/c/src/tests/sptests/sp08/task1.c
@@ -0,0 +1,256 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies all combinations of
+ * task mode changes.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+/* BEGINNING OF RTEMS_ASR */
+
+ status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_ASR */
+
+/* BEGINNING OF RTEMS_TIMESLICE */
+
+ status = rtems_task_mode(
+ RTEMS_NO_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_TIMESLICE */
+
+/* BEGINNING OF RTEMS_PREEMPT */
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_PREEMPT */
+
+/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3),
+ RTEMS_INTERRUPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(5),
+ RTEMS_INTERRUPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_INTERRUPT_LEVEL */
+
+/* BEGINNING OF COMBINATIONS */
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
+ RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - set all modes - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
+ RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - set all modes - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - clear all modes - previous mode: ",
+ previous_mode
+ );
+
+/* END OF COMBINATIONS */
+
+/* BEGINNING OF CURRENT MODE */
+
+ status = rtems_task_mode(
+ RTEMS_CURRENT_MODE,
+ RTEMS_CURRENT_MODE,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - get current mode - previous mode: ",
+ previous_mode
+ );
+
+/* END OF CURRENT MODE */
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp09/delay.c b/c/src/tests/sptests/sp09/delay.c
new file mode 100644
index 0000000000..dd78610be8
--- /dev/null
+++ b/c/src/tests/sptests/sp09/delay.c
@@ -0,0 +1,28 @@
+/* Delayed_routine
+ *
+ * This routine is used as the timer routine for Timer Manager tests.
+ *
+ * Input parameters:
+ * ignored - this parameter is ignored
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_routine(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+}
diff --git a/c/src/tests/sptests/sp09/init.c b/c/src/tests/sptests/sp09/init.c
new file mode 100644
index 0000000000..b879eff42e
--- /dev/null
+++ b/c/src/tests/sptests/sp09/init.c
@@ -0,0 +1,120 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 9 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+ Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' );
+ Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' );
+ Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' );
+ Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' );
+ Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+ Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' );
+ Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+
+ Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' );
+
+ Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' );
+
+ Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+#if 0
+ status = rtems_task_create(
+ Task_name[1],
+ 4,
+ 10,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_task_create with illegal stack size"
+ );
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE" );
+#endif
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED" );
+
+ status = rtems_task_create(
+ Task_name[1],
+ 0,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_PRIORITY,
+ "rtems_task_create with illegal priority"
+ );
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_PRIORITY" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 3,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_restart( Task_id[ 1 ], 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_restart of DORMANT task"
+ );
+ puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp09/isr.c b/c/src/tests/sptests/sp09/isr.c
new file mode 100644
index 0000000000..292e9c0225
--- /dev/null
+++ b/c/src/tests/sptests/sp09/isr.c
@@ -0,0 +1,27 @@
+/* Service_routine
+ *
+ * This routine is used as the timer routine for Interrupt Manager tests.
+ *
+ * Input parameters:
+ * ignored - this parameter is ignored
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_isr Service_routine(
+ rtems_vector_number ignored
+)
+{
+}
diff --git a/c/src/tests/sptests/sp09/screen01.c b/c/src/tests/sptests/sp09/screen01.c
new file mode 100644
index 0000000000..39012f5051
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen01.c
@@ -0,0 +1,168 @@
+/* Screen1
+ *
+ * This routine generates error screen 1 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen1()
+{
+ rtems_unsigned32 notepad_value;
+ rtems_id self_id;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ status = rtems_task_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_delete with illegal id"
+ );
+ puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" );
+
+ status = rtems_task_get_note( RTEMS_SELF, 100, &notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_task_get_note with illegal notepad"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, &notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_get_note with illegal id"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ if ( self_id != Task_id[ 1 ] ) {
+ puts( "ERROR - rtems_task_ident - incorrect ID returned!" );
+ }
+ puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_ident with illegal name (local)"
+ );
+ puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" );
+
+ status = rtems_task_ident( 100, 1, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_ident with illegal name (global)"
+ );
+ puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" );
+
+ status = rtems_task_ident( 100, 2, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NODE,
+ "rtems_task_ident with illegal node"
+ );
+ puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" );
+
+ status = rtems_task_restart( 100, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_restart with illegal id"
+ );
+ puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" );
+
+ status = rtems_task_resume( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_resume with illegal id"
+ );
+ puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" );
+
+ status = rtems_task_resume( RTEMS_SELF );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_resume of ready task"
+ );
+ puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_PRIORITY,
+ "rtems_task_set_priority with illegal priority"
+ );
+ puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" );
+
+ status = rtems_task_set_priority( 100, 8, &previous_priority );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_set_priority with illegal id"
+ );
+ puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" );
+
+ status = rtems_task_set_note(
+ RTEMS_SELF,
+ RTEMS_NOTEPAD_LAST+10,
+ notepad_value
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_task_set_note with illegal notepad"
+ );
+ puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_set_note with illegal id"
+ );
+ puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" );
+
+ status = rtems_task_start( 100, Task_1, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_start with illegal id"
+ );
+ puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" );
+
+ status = rtems_task_start( 0, Task_1, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_start of ready task"
+ );
+ puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_suspend( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_suspend with illegal id"
+ );
+ puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" );
+}
diff --git a/c/src/tests/sptests/sp09/screen02.c b/c/src/tests/sptests/sp09/screen02.c
new file mode 100644
index 0000000000..5f2ef82205
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen02.c
@@ -0,0 +1,192 @@
+/* Screen2
+ *
+ * This routine generates error screen 2 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen2()
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+/* errors before clock is set */
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+ "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_clock_get before clock is set"
+ );
+ puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" );
+ }
+
+ status = rtems_task_wake_when( &time );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_task_wake_when before clock is set"
+ );
+ puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" );
+ }
+
+ status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+ "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "task_fire_when before clock is set"
+ );
+ puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" );
+ }
+
+ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid year"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 15, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid month"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 32, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid day"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 25, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid hour"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 61, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid minute"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 61, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid second"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid ticks per second"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set successful" );
+ puts( " - RTEMS_SUCCESSFUL" );
+
+/* rtems_task_wake_when */
+
+ build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 );
+ time.second += 3;
+ puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" );
+
+ status = rtems_task_wake_when( &time );
+ directive_failed(
+ status,
+ "rtems_task_wake_when with invalid ticks per second"
+ );
+ puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" );
+
+ build_time( &time, 2, 5, 1961, 8, 30, 48, 0 );
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when with invalid year"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 25, 30, 48, 0 );
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when with invalid hour"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ print_time( "TA1 - current time - ", &time, "\n" );
+
+ time.month = 1;
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when before current time"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+}
diff --git a/c/src/tests/sptests/sp09/screen03.c b/c/src/tests/sptests/sp09/screen03.c
new file mode 100644
index 0000000000..eecab6066a
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen03.c
@@ -0,0 +1,217 @@
+/* Screen3
+ *
+ * This routine generates error screen 3 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_configuration_table BSP_Configuration;
+extern rtems_cpu_table _CPU_Table;
+
+void Screen3()
+{
+ rtems_name task_name;
+ rtems_status_code status;
+
+ task_name = 1;
+ status = rtems_task_create(
+ 0,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_create with illegal name"
+ );
+ puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" );
+
+ /*
+ * If the bsp provides its own stack allocator, then
+ * skip the test that tries to allocate a stack that is too big.
+ */
+
+ if (_CPU_Table.stack_allocate_hook)
+ {
+ puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED -- SKIPPED" );
+ }
+ else
+ {
+ status = rtems_task_create(
+ task_name,
+ 1,
+ BSP_Configuration.work_space_size,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_task_create with a stack size larger than the workspace"
+ );
+ puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" );
+ }
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+ puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+ puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ALREADY_SUSPENDED,
+ "rtems_task_suspend of suspended TA2"
+ );
+ puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" );
+
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_resume of TA2" );
+ puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+ puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+ puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+ puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 6 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 6 ]
+ );
+ directive_failed( status, "rtems_task_create of TA6" );
+ puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 7 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 7 ]
+ );
+ directive_failed( status, "rtems_task_create of TA7" );
+ puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 8 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 8 ]
+ );
+ directive_failed( status, "rtems_task_create of TA8" );
+ puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 9 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 9 ]
+ );
+ directive_failed( status, "rtems_task_create of TA9" );
+ puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 10 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 10 ]
+ );
+ directive_failed( status, "rtems_task_create of TA10" );
+ puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ task_name,
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_task_create for too many tasks"
+ );
+ puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" );
+
+ status = rtems_task_create(
+ task_name,
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_task_create of global task in a single cpu system"
+ );
+ puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" );
+}
diff --git a/c/src/tests/sptests/sp09/screen04.c b/c/src/tests/sptests/sp09/screen04.c
new file mode 100644
index 0000000000..6e3866cb05
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen04.c
@@ -0,0 +1,85 @@
+/* Screen4
+ *
+ * This routine generates error screen 4 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen4()
+{
+ rtems_event_set event_out;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive unsatisfied (ALL)"
+ );
+ puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_EVENT_ANY | RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive unsatisfied (ANY)"
+ );
+ puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )" );
+
+ puts( "TA1 - rtems_event_receive - timeout in 3 seconds" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_event_receive"
+ );
+ puts( "TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_event_send( 100, RTEMS_EVENT_16 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_event_send with illegal id"
+ );
+ puts( "TA1 - rtems_event_send - RTEMS_INVALID_ID" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ puts( " - RTEMS_SUCCESSFUL" );
+}
diff --git a/c/src/tests/sptests/sp09/screen05.c b/c/src/tests/sptests/sp09/screen05.c
new file mode 100644
index 0000000000..c47a25f89d
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen05.c
@@ -0,0 +1,164 @@
+/* Screen5
+ *
+ * This routine generates error screen 5 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen5()
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_create(
+ 0,
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_create with illegal name"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" );
+
+ do {
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ } while (status == RTEMS_SUCCESSFUL);
+
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_semaphore_create of too many"
+ );
+ puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 2,
+ RTEMS_BINARY_SEMAPHORE,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_semaphore_create of binary semaphore with count > 1"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_semaphore_create of mp not configured"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_semaphore_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_delete( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with local illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (local)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_ident( 100, 1, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (global)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
+}
diff --git a/c/src/tests/sptests/sp09/screen06.c b/c/src/tests/sptests/sp09/screen06.c
new file mode 100644
index 0000000000..40ad75d606
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen06.c
@@ -0,0 +1,125 @@
+/* Screen6
+ *
+ * This routine generates error screen 6 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen6()
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ 100,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_obtain with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain successful" );
+ puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_semaphore_obtain not available"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_semaphore_obtain timeout"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_semaphore_release and not owner"
+ );
+ puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ status = rtems_semaphore_release( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_release with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
+
+ puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+ puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain");
+
+ puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_semaphore_delete of SM2"
+ );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_delete after the task has been deleted"
+ );
+}
diff --git a/c/src/tests/sptests/sp09/screen07.c b/c/src/tests/sptests/sp09/screen07.c
new file mode 100644
index 0000000000..2c58160edd
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen07.c
@@ -0,0 +1,192 @@
+/* Screen7
+ *
+ * This routine generates error screen 7 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen7()
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ status = rtems_message_queue_broadcast( 100, (long (*)[4]) buffer, 16, &count );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_broadcast with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_create(
+ 0,
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_message_queue_create with illegal name"
+ );
+
+ puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 1,
+ 16,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_message_queue_create of mp not configured"
+ );
+ puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 2 ],
+ 1,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_create of too many"
+ );
+ puts( "TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY" );
+
+ status = rtems_message_queue_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_create with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_delete with local illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_message_queue_ident with illegal name"
+ );
+ puts( "TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_message_queue_flush( 100, &count );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_flush with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_receive(
+ 100,
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 0
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_receive wit illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_message_queue_receive unsatisfied"
+ );
+ puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_message_queue_receive 3 second timeout"
+ );
+
+ puts(
+ "TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT"
+ );
+
+ status = rtems_message_queue_send( 100, (long (*)[4]) buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_send with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_send - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to a limited queue"
+ );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" );
+}
diff --git a/c/src/tests/sptests/sp09/screen08.c b/c/src/tests/sptests/sp09/screen08.c
new file mode 100644
index 0000000000..cc80bd2635
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen08.c
@@ -0,0 +1,128 @@
+/* Screen8
+ *
+ * This routine generates error screen 8 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen8()
+{
+ long buffer[ 4 ];
+ rtems_status_code status;
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to limited queue"
+ );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" );
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to limited queue"
+ );
+ puts(
+ "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY"
+ );
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ puts( "TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL" );
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ puts( "TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+}
diff --git a/c/src/tests/sptests/sp09/screen09.c b/c/src/tests/sptests/sp09/screen09.c
new file mode 100644
index 0000000000..c6fd1d3d72
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen09.c
@@ -0,0 +1,144 @@
+/* Screen9
+ *
+ * This routine generates error screen 9 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen9()
+{
+ void *converted;
+ rtems_status_code status;
+ rtems_isr_entry old_service_routine;
+
+ status = rtems_interrupt_catch(
+ Service_routine,
+ ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 10,
+ &old_service_routine
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_interrupt_catch with invalid vector"
+ );
+ puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_interrupt_catch( NULL, 3, &old_service_routine );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_interrupt_catch with invalid handler"
+ );
+ puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_signal_send( 100, RTEMS_SIGNAL_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_signal_send with illegal id"
+ );
+ puts( "TA1 - rtems_signal_send - RTEMS_INVALID_ID" );
+
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_signal_send with no handler"
+ );
+ puts( "TA1 - rtems_signal_send - RTEMS_NOT_DEFINED" );
+
+ status = rtems_port_create(
+ 0,
+ Internal_port_area,
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_port_create with illegal name"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ &((char *)Internal_port_area)[ 1 ],
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_port_create with illegal address"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ Internal_port_area,
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_port_create of too many"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_TOO_MANY" );
+
+ status = rtems_port_delete( 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_delete with illegal id"
+ );
+ puts( "TA1 - rtems_port_delete - RTEMS_INVALID_ID" );
+
+ status = rtems_port_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_port_ident with illegal name"
+ );
+ puts( "TA1 - rtems_port_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_port_external_to_internal(
+ 100,
+ Internal_port_area,
+ &converted
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_external_to_internal with illegal id"
+ );
+ puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID" );
+ status = rtems_port_internal_to_external(
+ 100,
+ Internal_port_area,
+ &converted
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_internal_to_external with illegal id"
+ );
+ puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" );
+}
diff --git a/c/src/tests/sptests/sp09/screen10.c b/c/src/tests/sptests/sp09/screen10.c
new file mode 100644
index 0000000000..53a5a8d6dc
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen10.c
@@ -0,0 +1,164 @@
+/* Screen10
+ *
+ * This routine generates error screen 10 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen10()
+{
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_rate_monotonic_create with illegal name"
+ );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_create successful" );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_rate_monotonic_create of too many"
+ );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" );
+
+ status = rtems_rate_monotonic_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_rate_monotonic_ident with illegal name"
+ );
+ puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_rate_monotonic_period( 100, 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_period with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_period( 0x10100, 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_period with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_rate_monotonic_period status not defined"
+ );
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED"
+ );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 );
+ directive_failed( status, "rtems_rate_monotonic_period successful" );
+ puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
+ directive_failed( status, "rtems_rate_monotonic_period status" );
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL"
+ );
+
+ while ( FOREVER ) {
+
+ status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS);
+
+ if ( status == RTEMS_TIMEOUT ) break;
+
+ directive_failed(
+ status,
+ "rtems_rate_monotonic_period waiting for timeout"
+ );
+ }
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT"
+ );
+
+ status = rtems_rate_monotonic_cancel( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_cancel with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_cancel( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_cancel will illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_cancel" );
+ puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ directive_failed( status, "rtems_rate_monotonic_period restart" );
+
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_rate_monotonic_period"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ puts( "TA1 - yielding to TA4" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ status = rtems_rate_monotonic_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_delete with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_delete with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_delete( Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_delete" );
+ puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" );
+}
diff --git a/c/src/tests/sptests/sp09/screen11.c b/c/src/tests/sptests/sp09/screen11.c
new file mode 100644
index 0000000000..8c13cd2490
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen11.c
@@ -0,0 +1,250 @@
+/* Screen11
+ *
+ * This routine generates error screen 11 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen11()
+{
+ void *buffer_address_1;
+ void *buffer_address_2;
+ void *buffer_address_3;
+ rtems_status_code status;
+
+ status = rtems_partition_create(
+ 0,
+ Partition_good_area,
+ 128,
+ 40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_partition_create with illegal name"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 0,
+ 80,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with illegal length"
+ );
+ puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with illegal buffer size"
+ );
+ puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 256,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with buffer_size > length"
+ );
+ puts(
+ "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE"
+ );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_partition_create of global"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_bad_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_create with bad address"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 34,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with unaligned buffer_size"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_delete with illegal id"
+ );
+ puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_partition_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_delete with illegal id"
+ );
+ puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_partition_get_buffer( 100, &buffer_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_get_buffer with illegal id"
+ );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" );
+
+ status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_partition_ident with illegal name"
+ );
+ puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_partition_return_buffer( 100, buffer_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_return_buffer with illegal id"
+ );
+ puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 64,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+ puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_partition_create of too many"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 );
+ directive_failed( status, "rtems_partition_get_buffer");
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_partition_get_buffer unsatisfied"
+ );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" );
+
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_partition_delete with buffers in use"
+ );
+ puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" );
+
+ status = rtems_partition_return_buffer(
+ Partition_id[ 1 ],
+ Region_good_area /* NOTE: Region Memory */
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_return_buffer with buffer address out of partition"
+ );
+ puts(
+ "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range"
+ );
+
+ status = rtems_partition_return_buffer(
+ Partition_id[ 1 ],
+ &Partition_good_area[ 7 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_return_buffer with buffer address not on boundary"
+ );
+ puts_nocr( "TA1 - rtems_partition_return_buffer - " );
+ puts ( "RTEMS_INVALID_ADDRESS - not on boundary");
+}
diff --git a/c/src/tests/sptests/sp09/screen12.c b/c/src/tests/sptests/sp09/screen12.c
new file mode 100644
index 0000000000..75212d5fc2
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen12.c
@@ -0,0 +1,337 @@
+/* Screen12
+ *
+ * This routine generates error screen 12 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen12()
+{
+ void *segment_address_1;
+ void *segment_address_2;
+ void *segment_address_3;
+ rtems_unsigned32 offset;
+ rtems_unsigned32 good_front_flag;
+ rtems_unsigned32 good_back_flag;
+ rtems_status_code status;
+
+ status = rtems_region_create(
+ 0,
+ Region_good_area,
+ 0x40,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_region_create with illegal name"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_bad_area,
+ 0x40,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_create with illegal address"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_good_area,
+ 0x40,
+ 34,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_region_create with illegal size"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET ],
+ REGION_LENGTH,
+ 0x40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create" );
+ puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_good_area,
+ 512,
+ 0x40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_region_create of too many"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" );
+
+ status = rtems_region_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_delete with illegal id"
+ );
+ puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_region_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_delete with illegal id"
+ );
+ puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_region_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_region_ident with illegal name"
+ );
+ puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_region_get_segment(
+ 100,
+ 0x40,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_get_segment with illegal id"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ sizeof( Region_good_area ) * 2,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_region_get_segment with illegal size"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 384,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ REGION_LENGTH / 2,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_region_get_segment unsatisfied"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 128,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND,
+ &segment_address_3
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_region_get_segment timeout"
+ );
+ puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_region_delete( Region_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_region_delete with buffers in use"
+ );
+ puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" );
+
+ status = rtems_region_return_segment( 100, segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_return_segment with illegal id"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with illegal segment"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+/*
+ * The following generate internal heap errors. Thus this code
+ * is subject to change if the heap code changes.
+ */
+
+ puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" );
+ rtems_debug_disable( RTEMS_DEBUG_REGION );
+
+#if 0
+
+ offset = (segment_address_1 - (void *)Region_good_area) / 4;
+
+/* bad FRONT_FLAG error */
+
+ good_front_flag = Region_good_area[ offset - 1 ];
+ Region_good_area[ offset - 1 ] = good_front_flag + 2;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with back_flag != front_flag"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+ Region_good_area[ offset - 1 ] = good_front_flag;
+
+/* bad FRONT_FLAG error */
+
+ good_back_flag = Region_good_area[ offset - 2 ];
+ Region_good_area[ offset - 2 ] = 1024;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with back_flag != front_flag"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+ Region_good_area[ offset - 2 ] = good_back_flag;
+
+#else
+ offset = 0;
+ good_front_flag = 0;
+ good_back_flag = 0;
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
+#endif
+
+ puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" );
+ rtems_debug_enable( RTEMS_DEBUG_REGION );
+
+ status = rtems_region_extend(
+ 100,
+ Region_good_area,
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_extend with illegal id"
+ );
+ puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET + 16 ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_extend with illegal starting address"
+ );
+ puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ Region_bad_area,
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED"
+ );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED"
+ );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED"
+ );
+
+}
diff --git a/c/src/tests/sptests/sp09/screen13.c b/c/src/tests/sptests/sp09/screen13.c
new file mode 100644
index 0000000000..f58f42998d
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen13.c
@@ -0,0 +1,114 @@
+/* Screen13
+ *
+ * This routine generates error screen 13 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen13()
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_io_close( 0xffff, 0x0000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_control( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_initialize( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_initialize with bad major number"
+ );
+ puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_open( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_open with bad major number"
+ );
+ puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_read( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_read with bad major number"
+ );
+ puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_write( 0xffff, 0x0ffff, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_write with bad major number"
+ );
+ puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" );
+
+ build_time( &time, 12, 31, 2000, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1999, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2100, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1991, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+}
diff --git a/c/src/tests/sptests/sp09/screen14.c b/c/src/tests/sptests/sp09/screen14.c
new file mode 100644
index 0000000000..c0e75b1b98
--- /dev/null
+++ b/c/src/tests/sptests/sp09/screen14.c
@@ -0,0 +1,154 @@
+/* Screen14
+ *
+ * This routine generates error screen 14 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen14()
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ status = rtems_timer_create( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_timer_create with illegal name"
+ );
+ puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+ puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_timer_create( 2, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_timer_create for too many"
+ );
+ puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" );
+
+ status = rtems_timer_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_delete with illegal id"
+ );
+ puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_timer_delete( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_delete with illegal id"
+ );
+ puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" );
+
+ status = rtems_timer_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_timer_ident with illegal name"
+ );
+ puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_timer_cancel( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_cancel with illegal id"
+ );
+ puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_reset( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_reset with illegal id"
+ );
+ puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_reset( Timer_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_timer_reset before initiated"
+ );
+ puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" );
+
+ status = rtems_timer_fire_after(
+ 0x010100,
+ 5 * TICKS_PER_SECOND,
+ Delayed_routine,
+ NULL
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_fire_after illegal id"
+ );
+ puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" );
+
+ build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
+ status = rtems_timer_fire_when( 0x010100, &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_fire_when with illegal id"
+ );
+ puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_timer_fire_after with 0 ticks"
+ );
+ puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" );
+
+ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+ status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_timer_fire_when with illegal time"
+ );
+ print_time(
+ "TA1 - rtems_timer_fire_when - ",
+ &time,
+ " - RTEMS_INVALID_CLOCK\n"
+ );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+ build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
+ status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_timer_fire_when before current time"
+ );
+ print_time(
+ "TA1 - rtems_timer_fire_when - ",
+ &time,
+ " - before RTEMS_INVALID_CLOCK\n"
+ );
+}
diff --git a/c/src/tests/sptests/sp09/sp09.doc b/c/src/tests/sptests/sp09/sp09.doc
new file mode 100644
index 0000000000..f4e8391c47
--- /dev/null
+++ b/c/src/tests/sptests/sp09/sp09.doc
@@ -0,0 +1,36 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test9
+
+directives:
+ ex_init, ex_start, tm_tick, i_return,
+ t_create,t_delete, t_getreg, t_ident, t_restart, t_resume, t_setpri,
+ t_setreg, t_start, t_suspend, tm_delete, tm_get,
+ tm_set, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete,
+ sm_ident, sm_p, sm_v, q_broadcast, q_create, q_delete, q_ident, q_receive,
+ q_send, q_urgent, as_catch, as_send, as_return, rn_create, rn_delete,
+ rn_getseg, rn_ident, rn_retseg, pt_create, pt_delete, pt_getbug, pt_ident,
+ pt_retbuf, de_close, de_cntrl, de_init, de_open, de_read, de_write
+
+concepts:
+
+ a. Verifies all error codes returned by the executive in single
+ processor configurations.
+
+ b. Verifies error conditions in the following kernel routines or macros:
+ _Ck_date_time, _Expired, _Q_submit, _Get_mnodes, _Get_node,
+ _Free_mem, _Get_mem, _Valid_block, _Set_tcb, _Set_resource,
+ _In_range, _On_boundary
diff --git a/c/src/tests/sptests/sp09/sp09.scn b/c/src/tests/sptests/sp09/sp09.scn
new file mode 100644
index 0000000000..e1c59f6397
--- /dev/null
+++ b/c/src/tests/sptests/sp09/sp09.scn
@@ -0,0 +1,249 @@
+*** TEST 9 ***
+INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED
+INIT - rtems_task_create - RTEMS_INVALID_PRIORITY
+INIT - rtems_task_restart - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_delete - RTEMS_INVALID_ID
+TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER
+TA1 - rtems_task_get_note - RTEMS_INVALID_ID
+TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL
+TA1 - rtems_task_ident - global RTEMS_INVALID_NAME
+TA1 - rtems_task_ident - local RTEMS_INVALID_NAME
+TA1 - rtems_task_ident - RTEMS_INVALID_NODE
+TA1 - rtems_task_restart - RTEMS_INVALID_ID
+TA1 - rtems_task_resume - RTEMS_INVALID_ID
+TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY
+TA1 - rtems_task_set_priority - RTEMS_INVALID_ID
+TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER
+TA1 - rtems_task_set_note - RTEMS_INVALID_ID
+TA1 - rtems_task_start - RTEMS_INVALID_ID
+TA1 - rtems_task_start - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_suspend - RTEMS_INVALID_ID
+<pause - screen 2>
+TA1 - rtems_clock_get - RTEMS_NOT_DEFINED
+TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED
+TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED
+TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds
+TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK
+TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - current time - 08:30:51 02/05/1988
+TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK
+<pause - screen 3>
+TA1 - rtems_task_create - RTEMS_INVALID_NAME
+TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED
+TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED
+TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY
+TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED
+<pause - screen 4>
+TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )
+TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )
+TA1 - rtems_event_receive - timeout in 3 seconds
+TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT
+TA1 - rtems_event_send - RTEMS_INVALID_ID
+TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL
+<pause - screen 5>
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY
+TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER
+TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID
+TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME
+<pause - screen 6>
+TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID
+TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED
+TA1 - rtems_semaphore_obtain - timeout in 3 seconds
+TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT
+TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE
+TA1 - rtems_semaphore_release - RTEMS_INVALID_ID
+TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER
+TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - binary semaphore
+TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED
+TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+<pause - screen 7>
+TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME
+TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID
+TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME
+TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED
+TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds
+TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT
+TA1 - rtems_message_queue_send - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY
+<pause - screen 8>
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER
+TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED
+TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+<pause - screen 9>
+TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER
+TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS
+TA1 - rtems_signal_send - RTEMS_INVALID_ID
+TA1 - rtems_signal_send - RTEMS_NOT_DEFINED
+TA1 - rtems_port_create - RTEMS_INVALID_NAME
+TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_port_create - RTEMS_TOO_MANY
+TA1 - rtems_port_delete - RTEMS_INVALID_ID
+TA1 - rtems_port_ident - RTEMS_INVALID_NAME
+TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID
+TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID
+<pause - screen 10>
+TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME
+TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY
+TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME
+TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED
+TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT
+TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT
+TA1 - yielding to TA4
+TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE
+TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE
+TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL
+<pause - screen 11>
+TA1 - rtems_partition_create - RTEMS_INVALID_NAME
+TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_partition_create - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_partition_delete - local RTEMS_INVALID_ID
+TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID
+TA1 - rtems_partition_ident - RTEMS_INVALID_NAME
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID
+TA1 - rtems_partition_create - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_create - RTEMS_TOO_MANY
+TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED
+TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - not on boundary
+<pause - screen 12>
+TA1 - rtems_region_create - RTEMS_INVALID_NAME
+TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_create - RTEMS_INVALID_SIZE
+TA1 - rtems_region_create - RTEMS_SUCCESSFUL
+TA1 - rtems_region_create - RTEMS_TOO_MANY
+TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_region_delete - local RTEMS_INVALID_ID
+TA1 - rtems_region_ident - RTEMS_INVALID_NAME
+TA1 - rtems_region_get_segment - RTEMS_INVALID_ID
+TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE
+TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL
+TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED
+TA1 - rtems_region_get_segment - timeout in 3 seconds
+TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT
+TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ID
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION
+TA1 - rtems_region_extend - RTEMS_INVALID_ID
+TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED
+TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED
+TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED
+<pause - screen 13>
+TA1 - rtems_io_close - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_control - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_open - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_read - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_write - RTEMS_INVALID_NUMBER
+TA1 - rtems_clock_set - 23:59:59 12/31/2000 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2001 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/1999 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2000 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/2100 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2101 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/2099 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2100 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/1991 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/1992 - RTEMS_SUCCESSFUL
+<pause - screen 14>
+TA1 - rtems_timer_create - RTEMS_INVALID_NAME
+TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY
+TA1 - rtems_timer_delete - local RTEMS_INVALID_ID
+TA1 - rtems_timer_delete - global RTEMS_INVALID_ID
+TA1 - rtems_timer_ident - RTEMS_INVALID_NAME
+TA1 - rtems_timer_cancel - RTEMS_INVALID_ID
+TA1 - rtems_timer_reset - RTEMS_INVALID_ID
+TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED
+TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID
+TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID
+TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
+TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_get - 00:00:00 01/01/1992
+TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
+*** END OF TEST 9 ***
diff --git a/c/src/tests/sptests/sp09/system.h b/c/src/tests/sptests/sp09/system.h
new file mode 100644
index 0000000000..f688cf729a
--- /dev/null
+++ b/c/src/tests/sptests/sp09/system.h
@@ -0,0 +1,139 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_routine(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_isr Service_routine(
+ rtems_vector_number ignored
+);
+
+rtems_timer_service_routine Io_during_interrupt(
+ rtems_id ignored
+);
+
+void Screen1( void );
+
+void Screen2( void );
+
+void Screen3( void );
+
+void Screen4( void );
+
+void Screen5( void );
+
+void Screen6( void );
+
+void Screen7( void );
+
+void Screen8( void );
+
+void Screen9( void );
+
+void Screen10( void );
+
+void Screen11( void );
+
+void Screen12( void );
+
+void Screen13( void );
+
+void Screen14( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES 2
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_REGIONS 1
+#define CONFIGURE_MAXIMUM_PERIODS 1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */
+
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+
+TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
+TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */
+
+TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */
+TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */
+
+TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
+TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */
+
+TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */
+TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */
+
+TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */
+TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */
+
+TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */
+TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */
+
+TEST_EXTERN rtems_id Junk_id; /* id used to return errors */
+
+#define Internal_port_area (void *) 0x00001000
+#define External_port_area (void *) 0x00002000
+
+TEST_EXTERN rtems_unsigned8 Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT;
+#define Partition_bad_area (void *) 0x00000006
+
+TEST_EXTERN rtems_unsigned32 Region_good_area[4096] CPU_STRUCTURE_ALIGNMENT;
+#define Region_bad_area (void *) 0x00000006
+#define REGION_START_OFFSET 1024
+#define REGION_LENGTH 512
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp09/task1.c b/c/src/tests/sptests/sp09/task1.c
new file mode 100644
index 0000000000..c9e40851cc
--- /dev/null
+++ b/c/src/tests/sptests/sp09/task1.c
@@ -0,0 +1,70 @@
+/* Task_1
+ *
+ * This task generates all possible errors for the RTEMS executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ Screen1();
+ rtems_test_pause_and_screen_number( 2 );
+
+ Screen2();
+ rtems_test_pause_and_screen_number( 3 );
+
+ Screen3();
+ rtems_test_pause_and_screen_number( 4 );
+
+ Screen4();
+ rtems_test_pause_and_screen_number( 5 );
+
+ Screen5();
+ rtems_test_pause_and_screen_number( 6 );
+
+ Screen6();
+ rtems_test_pause_and_screen_number( 7 );
+
+ Screen7();
+ rtems_test_pause_and_screen_number( 8 );
+
+ Screen8();
+ rtems_test_pause_and_screen_number( 9 );
+
+ Screen9();
+ rtems_test_pause_and_screen_number( 10 );
+
+ Screen10();
+ rtems_test_pause_and_screen_number( 11 );
+
+ Screen11();
+ rtems_test_pause_and_screen_number( 12 );
+
+ Screen12();
+ rtems_test_pause_and_screen_number( 13 );
+
+ Screen13();
+ rtems_test_pause_and_screen_number( 14 );
+
+ Screen14();
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp09/task2.c b/c/src/tests/sptests/sp09/task2.c
new file mode 100644
index 0000000000..e9bda81fa3
--- /dev/null
+++ b/c/src/tests/sptests/sp09/task2.c
@@ -0,0 +1,48 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Its only purpose is to generate the
+ * error where a semaphore is deleted while a task is waiting for it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain waiting to be deleted"
+ );
+ puts(
+ "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED"
+ );
+
+ puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/c/src/tests/sptests/sp09/task3.c b/c/src/tests/sptests/sp09/task3.c
new file mode 100644
index 0000000000..3ec1b0162c
--- /dev/null
+++ b/c/src/tests/sptests/sp09/task3.c
@@ -0,0 +1,53 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Its only purpose in life is to
+ * generate the error where a message queue is deleted while a task
+ * is waiting there for a message.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+
+ puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_message_queue_receive waiting to be deleted"
+ );
+ puts(
+ "TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED"
+ );
+
+ puts( "TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA3" );
+}
diff --git a/c/src/tests/sptests/sp09/task4.c b/c/src/tests/sptests/sp09/task4.c
new file mode 100644
index 0000000000..73cd63373c
--- /dev/null
+++ b/c/src/tests/sptests/sp09/task4.c
@@ -0,0 +1,50 @@
+/* Task_4
+ *
+ * This routine serves as a test task. Its only purpose in life is to
+ * generate the error where a rate monotonic period is accessed by a
+ * task other than its creator.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_rate_monotonic_cancel not the owner"
+ );
+ puts( "TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_rate_monotonic_period not the owner"
+ );
+ puts( "TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ puts( "TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA4" );
+}
diff --git a/c/src/tests/sptests/sp11/init.c b/c/src/tests/sptests/sp11/init.c
new file mode 100644
index 0000000000..9524f3ff82
--- /dev/null
+++ b/c/src/tests/sptests/sp11/init.c
@@ -0,0 +1,92 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 11 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+ Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
+ Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' );
+ Timer_name[ 4 ] = rtems_build_name( 'T', 'M', '4', ' ' );
+ Timer_name[ 5 ] = rtems_build_name( 'T', 'M', '5', ' ' );
+ Timer_name[ 6 ] = rtems_build_name( 'T', 'M', '6', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create of TM1" );
+
+ status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] );
+ directive_failed( status, "rtems_timer_create of TM2" );
+
+ status = rtems_timer_create( Timer_name[ 3 ], &Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_create of TM3" );
+
+ status = rtems_timer_create( Timer_name[ 4 ], &Timer_id[ 4 ] );
+ directive_failed( status, "rtems_timer_create of TM4" );
+
+ status = rtems_timer_create( Timer_name[ 5 ], &Timer_id[ 5 ] );
+ directive_failed( status, "rtems_timer_create of TM5" );
+
+ status = rtems_timer_create( Timer_name[ 6 ], &Timer_id[ 6 ] );
+ directive_failed( status, "rtems_timer_create of TM6" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp11/sp11.doc b/c/src/tests/sptests/sp11/sp11.doc
new file mode 100644
index 0000000000..d88f5eb86d
--- /dev/null
+++ b/c/src/tests/sptests/sp11/sp11.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test11
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ ev_send, ev_receive
+ tm_wkafter, tm_set, tm_get
+
+concepts:
+
+ a. This test checks out the event manager along with the associated
+ event directives contained in the time manager.
diff --git a/c/src/tests/sptests/sp11/sp11.scn b/c/src/tests/sptests/sp11/sp11.scn
new file mode 100644
index 0000000000..db0469eb60
--- /dev/null
+++ b/c/src/tests/sptests/sp11/sp11.scn
@@ -0,0 +1,74 @@
+*** TEST 11 ***
+TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_14 and RTEMS_EVENT_15
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16
+TA2 - RTEMS_EVENT_16 received - eventout => 00010000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1
+TA2 - rtems_event_receive - RTEMS_EVENT_17 or RTEMS_EVENT_18 - forever and ANY
+TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => 0000c000
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2
+TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14
+TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => 00040000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1
+TA2 - rtems_clock_set - 08:15:00 02/12/1988
+TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 4 seconds
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10
+TA1 - RTEMS_EVENT_14 received - eventout => 00004000
+TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2
+TA1 - rtems_clock_get - 08:15:00 02/12/1988
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18
+TA2 - RTEMS_EVENT_10 received - eventout => 00000400
+TA2 - rtems_clock_get - 08:15:05 02/12/1988
+TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS
+TA2 - eventout => 00080000
+TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT
+TA2 - RTEMS_EVENT_19 received - eventout => 00080000
+TA2 - rtems_task_delete - deletes self
+TA1 - RTEMS_EVENT_18 received - eventout => 00040000
+TA1 - rtems_clock_get - 08:15:05 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_3 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY
+TA1 - RTEMS_EVENT_3 received - eventout => 00000008
+TA1 - rtems_event_send - send RTEMS_EVENT_4 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY
+TA1 - RTEMS_EVENT_4 received - eventout => 00000010
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18
+TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_1 every second
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:01 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:02 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:03 02/12/1988
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1
+<pause>
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 08:15:03 02/15/1988
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11
+TA1 - RTEMS_EVENT_11 received - eventout => 00000800
+<pause>
+TA1 - rtems_event_send/rtems_event_receive combination
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_receive all outstanding events
+TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 07:15:00 02/12/1988
+TA1 - set time backwards
+TA1 - no events received
+TA1 - rtems_clock_set - 07:15:00 02/14/1988
+TA1 - set time forwards (leave a timer)
+TA1 - RTEMS_EVENT_10 received
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks
+*** END OF TEST 11 ***
diff --git a/c/src/tests/sptests/sp11/system.h b/c/src/tests/sptests/sp11/system.h
new file mode 100644
index 0000000000..983ed077b5
--- /dev/null
+++ b/c/src/tests/sptests/sp11/system.h
@@ -0,0 +1,88 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine TA1_send_18_to_self_5_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_8_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_9_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_1_to_self_every_second(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_11_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA2_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 6
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 7 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 7 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp11/task1.c b/c/src/tests/sptests/sp11/task1.c
new file mode 100644
index 0000000000..6384789b43
--- /dev/null
+++ b/c/src/tests/sptests/sp11/task1.c
@@ -0,0 +1,410 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the event maager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting forever on "
+ "RTEMS_EVENT_14 and RTEMS_EVENT_15"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14 | RTEMS_EVENT_15,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 );
+ directive_failed( status, "rtems_event_send" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_18,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 18" );
+ printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08x\n", eventout );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "TA1 rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_3 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_3 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - RTEMS_EVENT_3 or "
+ "RTEMS_EVENT_22 - NO_WAIT and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_3 | RTEMS_EVENT_22,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 3 and 22" );
+ printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts (
+ "TA1 - rtems_event_receive - RTEMS_EVENT_4 or "
+ "RTEMS_EVENT_5 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_4 | RTEMS_EVENT_5,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08x\n", eventout );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_8_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 2 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_9_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts(
+ "TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds"
+ );
+ status = rtems_timer_fire_after(
+ Timer_id[ 3 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_1 every second" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ TICKS_PER_SECOND,
+ TA1_send_1_to_self_every_second,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 1 second" );
+
+ for ( index = 0; index < 3; index++ ) {
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_1,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08x - ", eventout );
+ print_time( "at ", &time, "\n" );
+
+ if ( index < 2 ) {
+ status = rtems_timer_reset( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_reset" );
+ };
+
+ }
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+rtems_test_pause();
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 7;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 8; /* so code below has correct time/date */
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_cancel( Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ time.day = 15;
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA1 rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08x\n", eventout );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send/rtems_event_receive combination" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 10,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 10 ticks" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_receive all outstanding events" );
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ 0,
+ &eventout
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ build_time( &time, 2, 12, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time backwards" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout ) printf( "ERROR -0x%08x events received\n", eventout );
+ else puts( "TA1 - no events received" );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ build_time( &time, 2, 14, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time forwards (leave a timer)" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" );
+ else printf( "ERROR -0x%08x events received\n", eventout );
+ directive_failed( status, "rtems_event_receive all events" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 100,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 100 ticks" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 200,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 200 ticks" );
+
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp11/task2.c b/c/src/tests/sptests/sp11/task2.c
new file mode 100644
index 0000000000..d5ac476dac
--- /dev/null
+++ b/c/src/tests/sptests/sp11/task2.c
@@ -0,0 +1,126 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Multiple tasks are required to
+ * verify all capabilities of the event manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout );
+
+ puts(
+ "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1"
+ );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA2 - rtems_event_receive - RTEMS_EVENT_17 or "
+ "RTEMS_EVENT_18 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_17 | RTEMS_EVENT_18,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 );
+ directive_failed( status, "rtems_event_send" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+ print_time( "TA2 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA2 rtems_clock_set" );
+
+ time.second += 4;
+ puts(
+ "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 4 seconds"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 5 ],
+ &time,
+ TA2_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when after 4 seconds" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_10,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout );
+ print_time( "TA2 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" );
+ status = rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_19,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_task_delete - deletes self" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/c/src/tests/sptests/sp11/timer.c b/c/src/tests/sptests/sp11/timer.c
new file mode 100644
index 0000000000..3ec11b7345
--- /dev/null
+++ b/c/src/tests/sptests/sp11/timer.c
@@ -0,0 +1,97 @@
+/* Timer_functions
+ *
+ * These routines are the timer service routines used by this test.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine TA1_send_18_to_self_5_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send of 18" );
+}
+
+rtems_timer_service_routine TA1_send_8_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_8 );
+ directive_failed( status, "rtems_event_send of 8" );
+}
+
+rtems_timer_service_routine TA1_send_9_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_9 );
+ directive_failed( status, "rtems_event_send of 9" );
+}
+
+rtems_timer_service_routine TA1_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}
+
+rtems_timer_service_routine TA1_send_1_to_self_every_second(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_1 );
+ directive_failed( status, "rtems_event_send of 1" );
+}
+
+rtems_timer_service_routine TA1_send_11_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_11 );
+ directive_failed( status, "rtems_event_send of 11" );
+}
+
+rtems_timer_service_routine TA2_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}
diff --git a/c/src/tests/sptests/sp12/init.c b/c/src/tests/sptests/sp12/init.c
new file mode 100644
index 0000000000..159382ca94
--- /dev/null
+++ b/c/src/tests/sptests/sp12/init.c
@@ -0,0 +1,179 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 12 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
+ Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
+ Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
+ Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
+ Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+ Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 3 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM3" );
+
+ puts( "INIT - Forward priority queue test" );
+ Priority_test_driver( 0 );
+
+ puts( "INIT - Backward priority queue test" );
+ Priority_test_driver( 32 );
+
+rtems_test_pause();
+
+ puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ Priority_test_driver( 64 );
+
+rtems_test_pause();
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority SM2" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp12/pridrv.c b/c/src/tests/sptests/sp12/pridrv.c
new file mode 100644
index 0000000000..7d6e1f9dc4
--- /dev/null
+++ b/c/src/tests/sptests/sp12/pridrv.c
@@ -0,0 +1,131 @@
+/* Priority_test_driver
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * priority_base - priority_base switch
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Priority_test_driver(
+ rtems_unsigned32 priority_base
+)
+{
+ rtems_task_priority previous_priority;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ switch ( index ) {
+ case 1:
+ case 2:
+ case 3:
+ Task_priority[ index ] = priority_base + index;
+ break;
+ default:
+ Task_priority[ index ] = priority_base + 3;
+ break;
+ }
+
+ status = rtems_task_create(
+ Priority_task_name[ index ],
+ Task_priority[ index ],
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Priority_task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ }
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+ } else {
+ for ( index = 5 ; index >= 1 ; index-- ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after loop" );
+
+ if ( priority_base == 64 ) {
+ if ( index == 4 ) {
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ priority_base + 4,
+ &previous_priority
+ );
+ printf( "PDRV - change priority of PRI5 from %d to %d\n",
+ previous_priority,
+ priority_base + 4
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority" );
+ }
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ RTEMS_CURRENT_PRIORITY,
+ &previous_priority
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority CURRENT" );
+ printf( "PDRV - priority of PRI5 is %d\n", previous_priority );
+ }
+ }
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after after loop" );
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release loop" );
+ }
+ }
+
+ if ( priority_base == 64 ) {
+ puts( "PDRV - rtems_task_resume - PRI5" );
+ status = rtems_task_resume( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_resume" );
+
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after so PRI5 can run" );
+
+ status = rtems_task_delete( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_delete of PRI5" );
+ }
+ else {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+ }
+}
diff --git a/c/src/tests/sptests/sp12/pritask.c b/c/src/tests/sptests/sp12/pritask.c
new file mode 100644
index 0000000000..155ef345cd
--- /dev/null
+++ b/c/src/tests/sptests/sp12/pritask.c
@@ -0,0 +1,91 @@
+/* Priority_task
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * its_index - priority index
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Priority_task(
+ rtems_task_argument its_index
+)
+{
+ rtems_interval timeout;
+ rtems_task_priority its_priority;
+ rtems_task_priority current_priority;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ its_priority = Task_priority[ its_index ];
+
+ if ( its_priority < 3 )
+ timeout = 5 * TICKS_PER_SECOND;
+ else
+ timeout = RTEMS_NO_TIMEOUT;
+
+ put_name( Priority_task_name[ its_index ], FALSE );
+ puts( " - rtems_semaphore_obtain - wait forever on SM2" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+
+ if ( its_priority < 64 ) {
+ printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority );
+ exit( 0 );
+ }
+
+ if ( its_index == 5 )
+ puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" );
+ for ( index = 1 ; index < 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+
+ puts( "PRI5 - rtems_semaphore_obtain - nested" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain nested" );
+
+ puts( "PRI5 - rtems_semaphore_release - nested" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release nested " );
+
+ puts( "PRI5 - rtems_semaphore_release - restore priority" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &current_priority
+ );
+ directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" );
+ printf( "PRI5 - priority of PRI5 is %d\n", current_priority );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
diff --git a/c/src/tests/sptests/sp12/sp12.doc b/c/src/tests/sptests/sp12/sp12.doc
new file mode 100644
index 0000000000..fc19d92ed7
--- /dev/null
+++ b/c/src/tests/sptests/sp12/sp12.doc
@@ -0,0 +1,27 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test12
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ sm_create, sm_ident, sm_delete, sm_p, sm_v, tm_wkafter, t_setpri
+
+concepts:
+
+ a. This test checks out the semaphore manager.
+
+ b. This test forces _Flush_taskq() to unblock a task waiting
+ on a deleted object.
diff --git a/c/src/tests/sptests/sp12/sp12.scn b/c/src/tests/sptests/sp12/sp12.scn
new file mode 100644
index 0000000000..e87a729259
--- /dev/null
+++ b/c/src/tests/sptests/sp12/sp12.scn
@@ -0,0 +1,78 @@
+*** TEST 12 ***
+INIT - Forward priority queue test
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+INIT - Backward priority queue test
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+INIT - Binary Semaphore and Priority Inheritance Test
+INIT - rtems_semaphore_create - allocated binary semaphore
+INIT - rtems_semaphore_release - allocated binary semaphore
+INIT - rtems_semaphore_delete - allocated binary semaphore
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_task_suspend - until all priority tasks blocked
+PDRV - priority of PRI5 is 67
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - change priority of PRI5 from 67 to 68
+PDRV - priority of PRI5 is 67
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 67
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 66
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 65
+PDRV - rtems_task_resume - PRI5
+PRI5 - rtems_task_delete - all tasks waiting on SM2
+PRI5 - rtems_semaphore_obtain - nested
+PRI5 - rtems_semaphore_release - nested
+PRI5 - rtems_semaphore_release - restore priority
+PRI5 - priority of PRI5 is 68
+<pause>
+TA1 - rtems_semaphore_ident - smid => 14010002
+TA1 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM2
+TA1 - rtems_semaphore_obtain - wait forever on SM3
+TA1 - got SM3
+TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT
+TA1 - got SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_semaphore_obtain - wait forever on SM1
+TA3 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout
+TA2 - got SM1
+TA2 - rtems_semaphore_release - release SM1
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM1
+TA1 - rtems_semaphore_release - release SM2
+TA2 - got SM2
+TA2 - rtems_semaphore_release - release SM2
+TA2 - rtems_task_delete - delete self
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - got SM2
+TA3 - rtems_semaphore_release - release SM2
+TA3 - rtems_semaphore_obtain - wait forever on SM3
+<pause>
+TA1 - rtems_task_delete - delete TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA4 - rtems_semaphore_obtain - wait forever on SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_task_delete - delete TA4
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA5 - got SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_semaphore_delete - delete SM1
+TA1 - rtems_semaphore_delete - delete SM3
+TA1 - rtems_task_delete - delete self
+TA5 - SM1 deleted by TA1
+*** END OF TEST 12 ***
diff --git a/c/src/tests/sptests/sp12/system.h b/c/src/tests/sptests/sp12/system.h
new file mode 100644
index 0000000000..81af1abbd9
--- /dev/null
+++ b/c/src/tests/sptests/sp12/system.h
@@ -0,0 +1,80 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void Priority_test_driver(
+ rtems_unsigned32 priority_base
+);
+
+rtems_task Priority_task(
+ rtems_task_argument its_index
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_task Task5(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
+#define CONFIGURE_MAXIMUM_SEMAPHORES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Priority_task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Priority_task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN rtems_task_priority Task_priority[ 6 ];
+
+TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp12/task1.c b/c/src/tests/sptests/sp12/task1.c
new file mode 100644
index 0000000000..ab133cc782
--- /dev/null
+++ b/c/src/tests/sptests/sp12/task1.c
@@ -0,0 +1,153 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id smid;
+ rtems_status_code status;
+
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &smid
+ );
+ printf( "TA1 - rtems_semaphore_ident - smid => %08x\n", smid );
+ directive_failed( status, "rtems_semaphore_ident of SM1" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+ puts( "TA1 - got SM2" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM3" );
+ puts( "TA1 - got SM3" );
+
+ puts( "TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release of SM1" );
+
+ puts(
+ "TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout"
+ );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_task_delete - delete TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], Task5, 0 );
+ directive_failed( status, "rtems_task_start of TA5" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA4" );
+ status = rtems_task_delete( Task_id[ 4 ] );
+ directive_failed( status, "rtems_task_delete of TA4" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM1" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM3" );
+ status = rtems_semaphore_delete( Semaphore_id[ 3 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM3" );
+
+ puts( "TA1 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA1" );
+}
diff --git a/c/src/tests/sptests/sp12/task2.c b/c/src/tests/sptests/sp12/task2.c
new file mode 100644
index 0000000000..41d6735162
--- /dev/null
+++ b/c/src/tests/sptests/sp12/task2.c
@@ -0,0 +1,65 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It simply obtains semaphores
+ * 1 and 2, the later when it is a high priority task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM1" );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority on TA2" );
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM2" );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA2 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/c/src/tests/sptests/sp12/task3.c b/c/src/tests/sptests/sp12/task3.c
new file mode 100644
index 0000000000..7340b84ce6
--- /dev/null
+++ b/c/src/tests/sptests/sp12/task3.c
@@ -0,0 +1,50 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply obtains semaphore
+ * 2 and waits forever attempting to obtain semaphore 3.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+ puts( "TA3 - got SM2" );
+
+ puts( "TA3 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM3" );
+}
diff --git a/c/src/tests/sptests/sp12/task4.c b/c/src/tests/sptests/sp12/task4.c
new file mode 100644
index 0000000000..9a0e952613
--- /dev/null
+++ b/c/src/tests/sptests/sp12/task4.c
@@ -0,0 +1,37 @@
+/* Task_4
+ *
+ * This routine serves as a test task. It waits forever attempting
+ * to obtain semaphore 1. However, it should never get the semaphore!
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA4 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+}
diff --git a/c/src/tests/sptests/sp12/task5.c b/c/src/tests/sptests/sp12/task5.c
new file mode 100644
index 0000000000..ccf10cd11a
--- /dev/null
+++ b/c/src/tests/sptests/sp12/task5.c
@@ -0,0 +1,55 @@
+/* Task5
+ *
+ * This routine serves as a test task. It obtains semaphore 1 correctly
+ * once, then waits for semaphore 1 again. Task 1 should delete the
+ * semaphore, thus waking this task up.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task5(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+ puts( "TA5 - got SM1" );
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain on SM1"
+ );
+ puts( "TA5 - SM1 deleted by TA1" );
+
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp13/fillbuff.c b/c/src/tests/sptests/sp13/fillbuff.c
new file mode 100644
index 0000000000..43ccd86803
--- /dev/null
+++ b/c/src/tests/sptests/sp13/fillbuff.c
@@ -0,0 +1,31 @@
+/* Fill_buffer
+ *
+ * This test routine copies a given source string to a given destination
+ * buffer.
+ *
+ * Input parameters:
+ * source - pointer to string to be copied
+ * buffer - pointer to message buffer to be filled
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Fill_buffer(
+ char *source,
+ long *buffer
+)
+{
+ memcpy( buffer, source, 16 );
+}
diff --git a/c/src/tests/sptests/sp13/init.c b/c/src/tests/sptests/sp13/init.c
new file mode 100644
index 0000000000..9a778f2fff
--- /dev/null
+++ b/c/src/tests/sptests/sp13/init.c
@@ -0,0 +1,112 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 13 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ Queue_name[ 1 ] = rtems_build_name( 'Q', '1', ' ', ' ' );
+ Queue_name[ 2 ] = rtems_build_name( 'Q', '2', ' ', ' ' );
+ Queue_name[ 3 ] = rtems_build_name( 'Q', '3', ' ', ' ' );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 2 ],
+ 10,
+ 16,
+ RTEMS_PRIORITY,
+ &Queue_id[ 2 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q2" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 3 ],
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 3 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp13/putbuff.c b/c/src/tests/sptests/sp13/putbuff.c
new file mode 100644
index 0000000000..ed75a54fa4
--- /dev/null
+++ b/c/src/tests/sptests/sp13/putbuff.c
@@ -0,0 +1,29 @@
+/* Put_buffer
+ *
+ * This test routine prints the given buffer.
+ * buffer.
+ *
+ * Input parameters:
+ * buffer - pointer to message buffer to be printer
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Put_buffer(
+ long *buffer
+)
+{
+ printf( "%16s", (char *)buffer );
+}
diff --git a/c/src/tests/sptests/sp13/sp13.doc b/c/src/tests/sptests/sp13/sp13.doc
new file mode 100644
index 0000000000..4a0c9d24a0
--- /dev/null
+++ b/c/src/tests/sptests/sp13/sp13.doc
@@ -0,0 +1,25 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test13
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ q_create, q_ident, q_delete, q_send, q_urgent, q_broadcast, q_receive,
+ tm_wkafter, t_setpri
+
+concepts:
+
+ a. This test checks out the message manager.
diff --git a/c/src/tests/sptests/sp13/sp13.scn b/c/src/tests/sptests/sp13/sp13.scn
new file mode 100644
index 0000000000..11adfb8eb3
--- /dev/null
+++ b/c/src/tests/sptests/sp13/sp13.scn
@@ -0,0 +1,72 @@
+*** TEST 13 ***
+TA1 - rtems_message_queue_ident - qid => 18010001
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT
+TA2 - buffer received: BUFFER 1 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER
+TA2 - buffer received: BUFFER 2 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER
+TA3 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+<pause>
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2
+TA2 - buffer received: BUFFER 1 TO Q 2
+TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2
+TA2 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout
+TA1 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout
+TA3 - buffer received: BUFFER 2 TO Q 2
+TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA3 - number of tasks awakened = 02
+TA3 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 1
+TA1 - rtems_task_delete - delete TA2
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - buffer received: BUFFER 1 TO Q 3
+TA3 - rtems_task_delete - delete self
+<pause>
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3
+TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 5 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 4 TO Q 3
+TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 2
+<pause>
+TA1 - rtems_message_queue_delete - delete queue 1
+TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - rtems_message_queue_delete - delete queue 2
+TA1 - rtems_message_queue_flush - empty Q 3
+TA1 - 0 messages were flushed from Q 3
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_flush - Q 3
+TA1 - 3 messages were flushed from Q 3
+TA1 - rtems_message_queue_send until all message buffers consumed
+TA1 - all message buffers consumed
+TA1 - rtems_message_queue_flush - Q 3
+TA1 - 100 messages were flushed from Q 3
+<pause>
+TA1 - create message queue of 20 bytes on queue 1
+TA1 - rtems_message_queue_delete - delete queue 1
+<pause>
+TA1 - rtems_message_queue_create - variable sizes
+TA1 - rtems_message_queue_create and send - variable sizes
+*** END OF TEST 13 ***
diff --git a/c/src/tests/sptests/sp13/system.h b/c/src/tests/sptests/sp13/system.h
new file mode 100644
index 0000000000..cb4b81bb63
--- /dev/null
+++ b/c/src/tests/sptests/sp13/system.h
@@ -0,0 +1,66 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void Fill_buffer(
+ char source[],
+ long *buffer
+);
+
+void Put_buffer(
+ long *buffer
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 4 ]; /* array of queue ids */
+TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp13/task1.c b/c/src/tests/sptests/sp13/task1.c
new file mode 100644
index 0000000000..e84bfc5b2e
--- /dev/null
+++ b/c/src/tests/sptests/sp13/task1.c
@@ -0,0 +1,344 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the message manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include <string.h> /* for memcmp */
+
+extern rtems_configuration_table BSP_Configuration;
+
+char big_send_buffer[2048];
+char big_receive_buffer[2048];
+
+long buffer[ 4 ];
+
+void dope_buffer(unsigned char *buff,
+ int buff_size,
+ unsigned32 v)
+{
+ int i;
+ unsigned char ch;
+
+ ch = (' ' + (v % (0x7f - ' ')));
+
+ for (i=0; i<buff_size; i++)
+ {
+ *buff++ = ch++;
+ if (ch >= 0x7f)
+ ch = ' ';
+ }
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id qid;
+ rtems_unsigned32 index;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 size;
+ rtems_unsigned32 queue_size;
+ char *cp;
+
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &qid
+ );
+ printf( "TA1 - rtems_message_queue_ident - qid => %08x\n", qid );
+ directive_failed( status, "rtems_message_queue_ident" );
+
+ Fill_buffer( "BUFFER 1 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 2 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Fill_buffer( "BUFFER 3 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ Fill_buffer( "BUFFER 1 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2" );
+ status = rtems_message_queue_send( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts_nocr( "TA1 - rtems_message_queue_receive - receive from queue 1 - " );
+ puts ( "10 second timeout" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA1 - rtems_task_delete - delete TA2" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete" );
+
+ Fill_buffer( "BUFFER 1 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ Fill_buffer( "BUFFER 2 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 3 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 4 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 5 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3" );
+ status = rtems_message_queue_urgent( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ for ( index = 1 ; index <= 4 ; index++ ) {
+ puts(
+ "TA1 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+ }
+
+ Fill_buffer( "BUFFER 3 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" );
+ status = rtems_message_queue_urgent( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts(
+ "TA1 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 1" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+ Fill_buffer( "BUFFER 3 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" );
+ status = rtems_message_queue_urgent( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 2" );
+ status = rtems_message_queue_delete( Queue_id[ 2 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+ puts( "TA1 - rtems_message_queue_flush - empty Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+ Fill_buffer( "BUFFER 1 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 2 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 3 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_message_queue_flush - Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+ puts( "TA1 - rtems_message_queue_send until all message buffers consumed" );
+ while ( FOREVER ) {
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ if ( status == RTEMS_TOO_MANY ) break;
+ directive_failed( status, "rtems_message_queue_send loop" );
+ }
+
+ puts( "TA1 - all message buffers consumed" );
+ puts( "TA1 - rtems_message_queue_flush - Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+rtems_test_pause();
+
+ puts( "TA1 - create message queue of 20 bytes on queue 1" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 100,
+ 20,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q1; 20 bytes each" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], big_send_buffer, 40 );
+ fatal_directive_status(status, RTEMS_INVALID_SIZE, "expected RTEMS_INVALID_SIZE");
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 1" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_message_queue_create - variable sizes " );
+ for (queue_size = 1; queue_size < 1030; queue_size++)
+ {
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2, /* just 2 msgs each */
+ queue_size,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ printf("TA1 - msq que size: %d\n", queue_size);
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+ }
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "TA1 - rtems_message_queue_create and send - variable sizes " );
+ for (queue_size = 1; queue_size < 1030; queue_size++)
+ {
+ /* printf("TA1 - message queue size: %d\n", queue_size); */
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2, /* just 2 msgs each */
+ queue_size,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+
+ dope_buffer(big_send_buffer, sizeof(big_send_buffer), queue_size);
+ memset(big_receive_buffer, 'Z', sizeof(big_receive_buffer));
+
+ /* send a msg too big */
+ status = rtems_message_queue_send( Queue_id[ 1 ],
+ big_send_buffer,
+ queue_size + 1 );
+
+ fatal_directive_status(status,
+ RTEMS_INVALID_SIZE,
+ "rtems_message_queue_send too large");
+
+ /* send a msg that is just right */
+ status = rtems_message_queue_send(Queue_id[ 1 ],
+ big_send_buffer,
+ queue_size);
+ directive_failed(status, "rtems_message_queue_send exact size");
+
+ /* now read and verify the message just sent */
+ status = rtems_message_queue_receive(Queue_id[ 1 ],
+ big_receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND);
+ directive_failed(status, "rtems_message_queue_receive exact size");
+ if (size != queue_size)
+ {
+ puts("TA1 - exact size size match failed");
+ exit(1);
+ }
+
+ if (memcmp(big_send_buffer, big_receive_buffer, size) != 0)
+ {
+ puts("TA1 - exact size data match failed");
+ exit(1);
+ }
+
+ for (cp = (big_receive_buffer + size);
+ cp < (big_receive_buffer + sizeof(big_receive_buffer));
+ cp++)
+ if (*cp != 'Z')
+ {
+ puts("TA1 - exact size overrun match failed");
+ exit(1);
+ }
+
+ /* all done with this one; delete it */
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp13/task2.c b/c/src/tests/sptests/sp13/task2.c
new file mode 100644
index 0000000000..1541d6c8bd
--- /dev/null
+++ b/c/src/tests/sptests/sp13/task2.c
@@ -0,0 +1,139 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Multiple tasks are required to
+ * verify all message manager capabilities.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer );
+ puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "10 second timeout"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+}
diff --git a/c/src/tests/sptests/sp13/task3.c b/c/src/tests/sptests/sp13/task3.c
new file mode 100644
index 0000000000..f86f91a463
--- /dev/null
+++ b/c/src/tests/sptests/sp13/task3.c
@@ -0,0 +1,78 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Its major function is to
+ * broadcast a messge to all the other tasks.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ puts(
+ "TA3 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA3 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer );
+ puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" );
+ status = rtems_message_queue_broadcast(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ 16,
+ &count
+ );
+ printf( "TA3 - number of tasks awakened = %02d\n", count );
+ puts(
+ "TA3 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA3 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA3 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp14/asr.c b/c/src/tests/sptests/sp14/asr.c
new file mode 100644
index 0000000000..af7e212877
--- /dev/null
+++ b/c/src/tests/sptests/sp14/asr.c
@@ -0,0 +1,47 @@
+/* Process_asr
+ *
+ * This is the asynchronous signal routine (asr) for task 1.
+ * It demonstrates that ASRs can block execute and block.
+ *
+ * Input parameters:
+ * the_signal_set - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set the_signal_set
+)
+{
+ rtems_status_code status;
+
+ printf( "ASR - ENTRY - signal => %08x\n", the_signal_set );
+ switch( the_signal_set ) {
+ case RTEMS_SIGNAL_16:
+ case RTEMS_SIGNAL_17:
+ case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19:
+ break;
+ case RTEMS_SIGNAL_0:
+ case RTEMS_SIGNAL_1:
+ puts( "ASR - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after yield" );
+ break;
+ case RTEMS_SIGNAL_3:
+ Asr_fired = TRUE;
+ break;
+ }
+ printf( "ASR - EXIT - signal => %08x\n", the_signal_set );
+}
diff --git a/c/src/tests/sptests/sp14/init.c b/c/src/tests/sptests/sp14/init.c
new file mode 100644
index 0000000000..dd3a593229
--- /dev/null
+++ b/c/src/tests/sptests/sp14/init.c
@@ -0,0 +1,72 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 14 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create of TM1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp14/sp14.doc b/c/src/tests/sptests/sp14/sp14.doc
new file mode 100644
index 0000000000..16aa420183
--- /dev/null
+++ b/c/src/tests/sptests/sp14/sp14.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test14
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ as_catch, as_return, as_send, tm_wkafter
+
+concepts:
+
+ a. This test checks out the signal manager.
diff --git a/c/src/tests/sptests/sp14/sp14.scn b/c/src/tests/sptests/sp14/sp14.scn
new file mode 100644
index 0000000000..31e6d067d2
--- /dev/null
+++ b/c/src/tests/sptests/sp14/sp14.scn
@@ -0,0 +1,33 @@
+*** TEST 14 ***
+TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )
+TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self
+ASR - ENTRY - signal => 00010000
+ASR - EXIT - signal => 00010000
+TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self
+ASR - ENTRY - signal => 00000001
+ASR - rtems_task_wake_after - yield processor
+TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1
+TA2 - rtems_task_wake_after - yield processor
+ASR - ENTRY - signal => 00020000
+ASR - EXIT - signal => 00020000
+ASR - EXIT - signal => 00000001
+TA1 - rtems_signal_catch - RTEMS_NO_ASR
+<pause>
+TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self
+ASR - ENTRY - signal => 00000002
+ASR - rtems_task_wake_after - yield processor
+TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1
+TA2 - rtems_task_wake_after - yield processor
+ASR - EXIT - signal => 00000002
+ASR - ENTRY - signal => 000c0000
+ASR - EXIT - signal => 000c0000
+TA1 - rtems_task_mode - disable ASRs
+TA1 - sending signal to RTEMS_SELF from timer
+TA1 - waiting for signal to arrive
+TA1 - timer routine got the correct arguments
+TA1 - rtems_task_mode - enable ASRs
+ASR - ENTRY - signal => 00000008
+ASR - EXIT - signal => 00000008
+TA1 - rtems_signal_catch - asraddr of NULL
+TA1 - rtems_task_delete - delete self
+*** END OF TEST 14 ***
diff --git a/c/src/tests/sptests/sp14/system.h b/c/src/tests/sptests/sp14/system.h
new file mode 100644
index 0000000000..7193f893f2
--- /dev/null
+++ b/c/src/tests/sptests/sp14/system.h
@@ -0,0 +1,76 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Signal_3_to_task_1(
+ rtems_id id,
+ void *pointer
+);
+
+rtems_asr Process_asr(
+ rtems_signal_set the_signal_set
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_unsigned32 Signals_sent;
+ /* set to TRUE to indicate that a */
+ /* signal set has been sent from */
+ /* an ISR to the executing task */
+
+TEST_EXTERN volatile rtems_unsigned32 Asr_fired;
+ /* set to TRUE to indicate that the */
+ /* RTEMS_ASR has executed and was */
+ /* passed the correct signal set */
+
+TEST_EXTERN volatile rtems_id Timer_got_this_id;
+
+TEST_EXTERN volatile void *Timer_got_this_pointer;
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp14/task1.c b/c/src/tests/sptests/sp14/task1.c
new file mode 100644
index 0000000000..50dff2b9d8
--- /dev/null
+++ b/c/src/tests/sptests/sp14/task1.c
@@ -0,0 +1,116 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It establishes an RTEMS_ASR and
+ * sends signal to itself to determine if the RTEMS_ASR gets to execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Signal_3_to_task_1(
+ rtems_id id,
+ void *pointer
+)
+{
+ rtems_status_code status;
+
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 );
+ directive_failed( status, "rtems_signal_send of 3" );
+
+ Timer_got_this_id = id;
+ Timer_got_this_pointer = pointer;
+
+ Signals_sent = TRUE;
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+ puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
+ status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
+ directive_failed( status, "rtems_signal_catch" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_task_mode - disable ASRs" );
+ status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ Timer_got_this_id = 0;
+ Timer_got_this_pointer = NULL;
+
+ puts( "TA1 - sending signal to RTEMS_SELF from timer" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ TICKS_PER_SECOND / 2,
+ Signal_3_to_task_1,
+ Task_1
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - waiting for signal to arrive" );
+
+ Signals_sent = FALSE;
+ Asr_fired = FALSE;
+
+ while ( Signals_sent == FALSE )
+ ;
+
+ if ( Timer_got_this_id == Timer_id[ 1 ] &&
+ Timer_got_this_pointer == Task_1 )
+ puts( "TA1 - timer routine got the correct arguments" );
+ else
+ printf(
+ "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n",
+ Timer_got_this_id,
+ Timer_got_this_pointer,
+ Timer_id[ 1 ],
+ Task_1
+ );
+
+ puts( "TA1 - rtems_task_mode - enable ASRs" );
+ status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
+ status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp14/task2.c b/c/src/tests/sptests/sp14/task2.c
new file mode 100644
index 0000000000..bf1e7cc224
--- /dev/null
+++ b/c/src/tests/sptests/sp14/task2.c
@@ -0,0 +1,48 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It verifies that one task can
+ * send signals to another task ( invoking the other task's RTEMS_ASR ).
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" );
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_17 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA2 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1");
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA2 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 14 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp15/init.c b/c/src/tests/sptests/sp15/init.c
new file mode 100644
index 0000000000..7c4d301e45
--- /dev/null
+++ b/c/src/tests/sptests/sp15/init.c
@@ -0,0 +1,78 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 15 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+ Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ puts("INIT - rtems_partition_create - partition 1");
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Area_1,
+ 4096,
+ 512,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create of PT1" );
+
+ puts("INIT - rtems_partition_create - partition 2");
+ status = rtems_partition_create(
+ Partition_name[ 2 ],
+ Area_2,
+ 274,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 2 ]
+ );
+ directive_failed( status, "rtems_partition_create of PT2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp15/sp15.doc b/c/src/tests/sptests/sp15/sp15.doc
new file mode 100644
index 0000000000..3ec20ae92b
--- /dev/null
+++ b/c/src/tests/sptests/sp15/sp15.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test15
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ pt_create, pt_ident, pt_getbuf, pt_retbuf, pt_delete
+
+concepts:
+
+ a. This test checks out the partition manager.
diff --git a/c/src/tests/sptests/sp15/sp15.scn b/c/src/tests/sptests/sp15/sp15.scn
new file mode 100644
index 0000000000..f1a800dc0d
--- /dev/null
+++ b/c/src/tests/sptests/sp15/sp15.scn
@@ -0,0 +1,16 @@
+*** TEST 15 ***
+INIT - rtems_partition_create - partition 1
+INIT - rtems_partition_create - partition 2
+TA1 - rtems_partition_ident - partition 1 id = 1c010001
+TA1 - rtems_partition_ident - partition 2 id = 1c010002
+TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - 0x00000000
+TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - 0x00000200
+TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - 0x00000000
+TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - 0x00000080
+TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - 0x00000000
+TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - 0x00000200
+TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - 0x00000000
+TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - 0x00000080
+TA1 - rtems_partition_delete - delete partition 1
+TA1 - rtems_partition_delete - delete partition 2
+*** END OF TEST 15 ***
diff --git a/c/src/tests/sptests/sp15/system.h b/c/src/tests/sptests/sp15/system.h
new file mode 100644
index 0000000000..c06714e3fc
--- /dev/null
+++ b/c/src/tests/sptests/sp15/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_PARTITIONS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_name Partition_id[ 4 ]; /* array of partition ids */
+TEST_EXTERN rtems_name Partition_name[ 4 ]; /* array of partition names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_2[274] CPU_STRUCTURE_ALIGNMENT;
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+#define Put_address_from_area_2( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 )
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp15/task1.c b/c/src/tests/sptests/sp15/task1.c
new file mode 100644
index 0000000000..f22d27efe3
--- /dev/null
+++ b/c/src/tests/sptests/sp15/task1.c
@@ -0,0 +1,129 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the partition manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id ptid_1;
+ rtems_id ptid_2;
+ void *buffer_address_1;
+ void *buffer_address_2;
+ void *buffer_address_3;
+ void *buffer_address_4;
+ rtems_status_code status;
+
+ puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " );
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &ptid_1
+ );
+ directive_failed( status, "rtems_partition_ident of PT1" );
+ printf( "%08x\n", ptid_1 );
+
+ puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " );
+ status = rtems_partition_ident(
+ Partition_name[ 2 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &ptid_2
+ );
+ directive_failed( status, "rtems_partition_ident of PT2" );
+ printf( "%08x\n", ptid_2 );
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - "
+ );
+ status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_1( buffer_address_1 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - "
+ );
+ status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_1( buffer_address_2 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - "
+ );
+ status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_2( buffer_address_3 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - "
+ );
+ status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_2( buffer_address_4 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - "
+ );
+ Put_address_from_area_1( buffer_address_1 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_1, buffer_address_1 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - "
+ );
+ Put_address_from_area_1( buffer_address_2 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_1, buffer_address_2 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - "
+ );
+ Put_address_from_area_2( buffer_address_3 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_2, buffer_address_3 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - "
+ );
+ Put_address_from_area_2( buffer_address_4 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_2, buffer_address_4 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts( "TA1 - rtems_partition_delete - delete partition 1"
+ );
+ status = rtems_partition_delete( ptid_1 );
+ directive_failed( status, "rtems_partition_delete" );
+
+ puts( "TA1 - rtems_partition_delete - delete partition 2"
+ );
+ status = rtems_partition_delete( ptid_2 );
+ directive_failed( status, "rtems_partition_delete" );
+
+ puts( "*** END OF TEST 15 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp16/init.c b/c/src/tests/sptests/sp16/init.c
new file mode 100644
index 0000000000..3b57b78c51
--- /dev/null
+++ b/c/src/tests/sptests/sp16/init.c
@@ -0,0 +1,128 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 16 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' );
+ Region_name[ 2 ] = rtems_build_name( 'R', 'N', '2', ' ' );
+ Region_name[ 3 ] = rtems_build_name( 'R', 'N', '3', ' ' );
+ Region_name[ 4 ] = rtems_build_name( 'R', 'N', '4', ' ' );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Area_1,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create of RN1" );
+
+ status = rtems_region_create(
+ Region_name[ 2 ],
+ Area_2,
+ 4096,
+ 128,
+ RTEMS_PRIORITY,
+ &Region_id[ 2 ]
+ );
+ directive_failed( status, "rtems_region_create of RN2" );
+
+ status = rtems_region_create(
+ Region_name[ 3 ],
+ Area_3,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 3 ]
+ );
+ directive_failed( status, "rtems_region_create of RN3" );
+
+ status = rtems_region_create(
+ Region_name[ 4 ],
+ Area_4,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 4 ]
+ );
+ directive_failed( status, "rtems_region_create of RN4" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp16/sp16.doc b/c/src/tests/sptests/sp16/sp16.doc
new file mode 100644
index 0000000000..c5512af051
--- /dev/null
+++ b/c/src/tests/sptests/sp16/sp16.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test16
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ rn_create, rn_ident, rn_getbuf, rn_retbuf, rn_delete
+
+concepts:
+
+ a. This test checks out the region manager.
diff --git a/c/src/tests/sptests/sp16/sp16.scn b/c/src/tests/sptests/sp16/sp16.scn
new file mode 100644
index 0000000000..36d533c2b4
--- /dev/null
+++ b/c/src/tests/sptests/sp16/sp16.scn
@@ -0,0 +1,58 @@
+*** TEST 16 ***
+TA1 - rtems_region_ident - rnid => 20010002
+TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2
+TA1 - got segment from region 2 - 0x00000f78
+TA1 - rtems_region_get_segment - wait on 3K segment from region 3
+TA1 - got segment from region 3 - 0x000003f8
+TA1 - rtems_region_get_segment - get 3080 byte segment from region 1 - NO_WAIT
+TA1 - got segment from region 1 - 0x00000378
+TA1 - rtems_task_wake_after - yield processor
+TA2 - rtems_region_get_segment - wait on 2K segment from region 1
+TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2
+<pause>
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x00000378
+TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1
+TA2 - got segment from region 1 - 0x000007f8
+TA2 - rtems_region_return_segment - return segment to region 1 - 0x000007f8
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_region_get_segment - wait on 3968 byte segment
+TA1 - got segment from region 1 - 0x000003f8
+TA1 - rtems_region_return_segment - return segment to region 2 - 0x00000f78
+TA2 - got segment from region 2 - 0x00000008
+TA2 - rtems_region_return_segment - return segment to region 2 - 0x00000008
+TA2 - rtems_task_delete - delete self
+TA1 - rtems_task_wake_after - yield processor
+TA3 - got segment from region 2 - 0x00000008
+TA3 - rtems_region_get_segment - wait on 2K segment from region 3
+TA1 - rtems_task_delete - delete TA3
+<pause>
+TA1 - rtems_task_wake_after - yield processor
+TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1
+TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA4 - got and returned 0x000009f8
+TA5 - got and returned 0x000003f0
+TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1
+TA1 - got segment from region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA4 - rtems_region_get_segment - wait on 3K segment from region 1
+TA5 - rtems_region_get_segment - wait on 3K segment from region 1
+TA1 - rtems_task_delete - delete TA4
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA5 - got segment from region 1 - 0x000003f8
+TA5 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA5 - rtems_task_delete - delete self
+TA1 - rtems_region_delete - delete region 1
+TA1 - rtems_region_get_segment - get 3K segment from region 4
+TA1 - got segment from region 4 - 0x000003f8
+TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4
+TA1 - rtems_task_get_note - RTEMS_UNSATISFIED
+TA1 - rtems_region_extend - extend region 4 by 4K
+TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4
+TA1 - got 3K segment from region 4 - 0x00001400
+TA1 - rtems_region_return_segment - return segment to region 4 - 0x000003f8
+TA1 - rtems_region_return_segment - return segment to region 4 - 0x00001400
+TA1 - rtems_region_delete - delete region 4
+*** END OF TEST 16 ***
diff --git a/c/src/tests/sptests/sp16/system.h b/c/src/tests/sptests/sp16/system.h
new file mode 100644
index 0000000000..f28780be08
--- /dev/null
+++ b/c/src/tests/sptests/sp16/system.h
@@ -0,0 +1,83 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_task Task5(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_REGIONS 4
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+TEST_EXTERN rtems_id Region_id[ 5 ]; /* array of region ids */
+TEST_EXTERN rtems_name Region_name[ 5 ]; /* array of region names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_2[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_3[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_4[8192] CPU_STRUCTURE_ALIGNMENT;
+
+#define BASE_PRIORITY 140
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+#define Put_address_from_area_2( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 )
+
+#define Put_address_from_area_3( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_3 )
+
+#define Put_address_from_area_4( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_4 )
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp16/task1.c b/c/src/tests/sptests/sp16/task1.c
new file mode 100644
index 0000000000..a9ef6548b9
--- /dev/null
+++ b/c/src/tests/sptests/sp16/task1.c
@@ -0,0 +1,282 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the region manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id rnid;
+ void *segment_address_1;
+ void *segment_address_2;
+ void *segment_address_3;
+ void *segment_address_4;
+ rtems_status_code status;
+
+ status = rtems_region_ident( Region_name[ 1 ], &rnid );
+ printf( "TA1 - rtems_region_ident - rnid => %08x\n", rnid );
+ directive_failed( status, "rtems_region_ident of RN1" );
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 100,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 2 - " );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+
+ puts( "TA1 - rtems_region_get_segment - wait on 3K segment from region 3" );
+ status = rtems_region_get_segment(
+ Region_id[ 3 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 3 - " );
+ Put_address_from_area_3( segment_address_2 );
+ new_line;
+
+ puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " );
+ puts ( "from region 1 - NO_WAIT" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3080,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_3 );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_3 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait 10 seconds for 3K "
+ "segment from region 1"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &segment_address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_4 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 2 - "
+ );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+ status = rtems_region_return_segment( Region_id[ 2 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+rtems_test_pause();
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], Task5, 0 );
+ directive_failed( status, "rtems_task_start of TA5" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " );
+ puts ( "segment from region 1");
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &segment_address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_4 );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA4" );
+ status = rtems_task_delete( Task_id[ 4 ] );
+ directive_failed( status, "rtems_task_delete of TA4" );
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ puts( "TA1 - rtems_region_delete - delete region 1" );
+ status = rtems_region_delete( Region_id[ 1 ] );
+ directive_failed( status, "rtems_region_delete" );
+
+ puts( "TA1 - rtems_region_get_segment - get 3K segment from region 4" );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 4 - " );
+ Put_address_from_area_4( segment_address_1 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_task_get_segment with no memory left"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_region_extend - extend region 4 by 4K" );
+ status = rtems_region_extend(
+ Region_id[ 4 ],
+ &Area_4[4096],
+ 4096
+ );
+ directive_failed( status, "rtems_region_extend" );
+
+ puts(
+ "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got 3K segment from region 4 - " );
+ Put_address_from_area_4( segment_address_3 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 4 - "
+ );
+ Put_address_from_area_4( segment_address_1 );
+ status = rtems_region_return_segment( Region_id[ 4 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 4 - "
+ );
+ Put_address_from_area_4( segment_address_3 );
+ status = rtems_region_return_segment( Region_id[ 4 ], segment_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_region_delete - delete region 4" );
+ status = rtems_region_delete( Region_id[ 4 ] );
+ directive_failed( status, "rtems_region_delete" );
+
+ puts( "*** END OF TEST 16 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp16/task2.c b/c/src/tests/sptests/sp16/task2.c
new file mode 100644
index 0000000000..d5bc312b27
--- /dev/null
+++ b/c/src/tests/sptests/sp16/task2.c
@@ -0,0 +1,86 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA2 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ puts_nocr(
+ "TA2 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_1 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ BASE_PRIORITY-1,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts("TA2 - rtems_region_get_segment - wait on 3968 byte segment");
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 3968,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA2 - got segment from region 2 - ");
+ Put_address_from_area_2( segment_address_2 );
+ new_line;
+
+ puts_nocr(
+ "TA2 - rtems_region_return_segment - return segment to region 2 - "
+ );
+ Put_address_from_area_2( segment_address_2 );
+ status = rtems_region_return_segment( Region_id[ 2 ], segment_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA2 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp16/task3.c b/c/src/tests/sptests/sp16/task3.c
new file mode 100644
index 0000000000..292e5824f6
--- /dev/null
+++ b/c/src/tests/sptests/sp16/task3.c
@@ -0,0 +1,57 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts(
+ "TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 3968,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA3 - got segment from region 2 - " );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+ directive_failed( status, "rtems_region_return_segment" );
+
+ puts( "TA3 - rtems_region_get_segment - wait on 2K segment from region 3" );
+ status = rtems_region_get_segment(
+ Region_id[ 3 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+}
diff --git a/c/src/tests/sptests/sp16/task4.c b/c/src/tests/sptests/sp16/task4.c
new file mode 100644
index 0000000000..f3da89b72e
--- /dev/null
+++ b/c/src/tests/sptests/sp16/task4.c
@@ -0,0 +1,60 @@
+/* Task_4
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts( "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1536,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ puts_nocr( "TA4 - got and returned " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA4 - rtems_region_get_segment - wait on 3K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+}
diff --git a/c/src/tests/sptests/sp16/task5.c b/c/src/tests/sptests/sp16/task5.c
new file mode 100644
index 0000000000..5defa75f9c
--- /dev/null
+++ b/c/src/tests/sptests/sp16/task5.c
@@ -0,0 +1,73 @@
+/* Task5
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task5(
+ rtems_task_argument argument
+)
+{
+ void *segment_address_1;
+ void *segment_address_2;
+ rtems_status_code status;
+
+ puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1536,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ puts_nocr( "TA5 - got and returned " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ puts_nocr( "TA5 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_2 );
+ new_line;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 );
+ puts_nocr(
+ "TA5 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_2 );
+ new_line;
+
+ puts( "TA5 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp17/asr.c b/c/src/tests/sptests/sp17/asr.c
new file mode 100644
index 0000000000..1795bbd522
--- /dev/null
+++ b/c/src/tests/sptests/sp17/asr.c
@@ -0,0 +1,32 @@
+/* Process_asr
+ *
+ * This routine performs the processing for task 1's RTEMS_ASR. It is called
+ * by an assembly routine which saves the necessary registers.
+ *
+ * Input parameters:
+ * signal - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set signal_set
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "RTEMS_ASR - rtems_task_resume of TA2" );
+}
diff --git a/c/src/tests/sptests/sp17/init.c b/c/src/tests/sptests/sp17/init.c
new file mode 100644
index 0000000000..92c8812a8d
--- /dev/null
+++ b/c/src/tests/sptests/sp17/init.c
@@ -0,0 +1,69 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 17 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ Task_2_preempted = FALSE;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp17/sp17.doc b/c/src/tests/sptests/sp17/sp17.doc
new file mode 100644
index 0000000000..b4258461cf
--- /dev/null
+++ b/c/src/tests/sptests/sp17/sp17.doc
@@ -0,0 +1,35 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test17
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ as_catch, as_return
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ c. Verifies executive initialization performed correctly.
+
+ d. Verifies that a task can get the task identification number
+ of another task.
+
+ e. Verifies that a signal can be sent to a remote task.
diff --git a/c/src/tests/sptests/sp17/sp17.scn b/c/src/tests/sptests/sp17/sp17.scn
new file mode 100644
index 0000000000..47fd140e2a
--- /dev/null
+++ b/c/src/tests/sptests/sp17/sp17.scn
@@ -0,0 +1,8 @@
+*** TEST 17 ***
+TA2 - Suspending self
+TA1 - rtems_signal_catch: initializing signal catcher
+TA1 - Sending signal to self
+TA2 - signal_return preempted correctly
+TA1 - TA2 correctly preempted me
+TA1 - Got Back!!!
+*** END OF TEST 17 ***
diff --git a/c/src/tests/sptests/sp17/system.h b/c/src/tests/sptests/sp17/system.h
new file mode 100644
index 0000000000..e95b27635b
--- /dev/null
+++ b/c/src/tests/sptests/sp17/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_asr Process_asr(
+ rtems_signal_set signal_set
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(25)
+#define CONFIGURE_TICKS_PER_TIMESLICE 1000
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_unsigned32 Task_2_preempted;
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp17/task1.c b/c/src/tests/sptests/sp17/task1.c
new file mode 100644
index 0000000000..282c161a39
--- /dev/null
+++ b/c/src/tests/sptests/sp17/task1.c
@@ -0,0 +1,48 @@
+/* Task_1
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA1 - rtems_signal_catch: initializing signal catcher" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR | RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - Sending signal to self" );
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_16 );
+ directive_failed( status, "rtems_signal_send" );
+
+ if ( Task_2_preempted == TRUE )
+ puts( "TA1 - TA2 correctly preempted me" );
+
+ puts("TA1 - Got Back!!!");
+
+ puts( "*** END OF TEST 17 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp17/task2.c b/c/src/tests/sptests/sp17/task2.c
new file mode 100644
index 0000000000..cd3e16c7c0
--- /dev/null
+++ b/c/src/tests/sptests/sp17/task2.c
@@ -0,0 +1,45 @@
+/* Task_2
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Task_2_preempted = FALSE;
+
+ puts( "TA2 - Suspending self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA2 - signal_return preempted correctly" );
+
+ Task_2_preempted = TRUE;
+
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+}
diff --git a/c/src/tests/sptests/sp19/first.c b/c/src/tests/sptests/sp19/first.c
new file mode 100644
index 0000000000..94bdedd5ad
--- /dev/null
+++ b/c/src/tests/sptests/sp19/first.c
@@ -0,0 +1,66 @@
+/* First_FP_task
+ *
+ * This routine serves as a floating point test task. It verifies the
+ * basic task switching capabilities of the executive when floating
+ * point is configured.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "fptest.h"
+#include "inttest.h"
+
+rtems_task First_FP_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+ FP_LOAD( FP_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+ put_name( Task_name[ task_index ], FALSE );
+#if ( RTEMS_HAS_HARDWARE_FP == 1 )
+ printf( " - float base = (%g)\n", FP_factors[ task_index ] );
+#else
+ printf( " - float base = (NA)\n" );
+#endif
+
+ if ( argument == 0 ) {
+ status = rtems_task_restart( RTEMS_SELF, 1 );
+ directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
+ } else {
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+}
diff --git a/c/src/tests/sptests/sp19/fptask.c b/c/src/tests/sptests/sp19/fptask.c
new file mode 100644
index 0000000000..b8e881e6cd
--- /dev/null
+++ b/c/src/tests/sptests/sp19/fptask.c
@@ -0,0 +1,98 @@
+/* FP_task
+ *
+ * This routine serves as a floating point test task. It verifies the
+ * basic task switching capabilities of the executive when floating
+ * point is configured.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "fptest.h"
+#include "inttest.h"
+
+rtems_task FP_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ rtems_unsigned32 previous_seconds;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+ FP_LOAD( FP_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+ put_name( Task_name[ task_index ], FALSE );
+#if ( RTEMS_HAS_HARDWARE_FP == 1 )
+ printf( " - float base = (%g)\n", FP_factors[ task_index ] );
+#else
+ printf( " - float base = (NA)\n" );
+#endif
+
+ previous_seconds = -1;
+
+ while( FOREVER ) {
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 16 ) {
+
+ if ( task_number( tid ) == 4 ) {
+ puts( "TA4 - rtems_task_delete - self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA4" );
+ }
+ puts( "TA5 - rtems_task_delete - TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ puts( "*** END OF TEST 19 *** " );
+ exit( 0 );
+ }
+
+ if (previous_seconds != time.second)
+ {
+ put_name( Task_name[ task_index ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+ previous_seconds = time.second;
+ }
+
+ INTEGER_CHECK( INTEGER_factors[ task_index ] );
+ FP_CHECK( FP_factors[ task_index ] );
+
+ /* for the first 4 seconds we spin as fast as possible
+ * so that we likely are interrupted
+ * After that, we go to sleep for a second at a time
+ */
+ if (time.second >= 4)
+ {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+ }
+}
diff --git a/c/src/tests/sptests/sp19/fptest.h b/c/src/tests/sptests/sp19/fptest.h
new file mode 100644
index 0000000000..a8f3a925cb
--- /dev/null
+++ b/c/src/tests/sptests/sp19/fptest.h
@@ -0,0 +1,165 @@
+/* fptest.h
+ *
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * FP_load( &context )
+ * FP_check( &context )
+ *
+ * FP_load - loads the specified floating point context
+ * FP_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * fptest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __FPTEST_h
+#define __FPTEST_h
+
+#include <stdio.h>
+
+#ifndef RTEMS_HAS_HARDWARE_FP
+#error "This CPU does not have RTEMS_HAS_HARDWARE_FP defined"
+#endif
+
+#if ( RTEMS_HAS_HARDWARE_FP == FALSE )
+
+#define FP_DECLARE ;
+#define FP_LOAD( _factor )
+#define FP_CHECK( _factor ) 0
+
+#else
+
+#define FP_DECLARE \
+ double fp01 = 1.0; \
+ double fp02 = 2.0; \
+ double fp03 = 3.0; \
+ double fp04 = 4.0; \
+ double fp05 = 5.0; \
+ double fp06 = 6.0; \
+ double fp07 = 7.0; \
+ double fp08 = 8.0; \
+ double fp09 = 9.0; \
+ double fp10 = 10.0; \
+ double fp11 = 11.0; \
+ double fp12 = 12.0; \
+ double fp13 = 13.0; \
+ double fp14 = 14.0; \
+ double fp15 = 15.0; \
+ double fp16 = 16.0; \
+ double fp17 = 17.0; \
+ double fp18 = 18.0; \
+ double fp19 = 19.0; \
+ double fp20 = 20.0; \
+ double fp21 = 21.0; \
+ double fp22 = 22.0; \
+ double fp23 = 23.0; \
+ double fp24 = 24.0; \
+ double fp25 = 25.0; \
+ double fp26 = 26.0; \
+ double fp27 = 27.0; \
+ double fp28 = 28.0; \
+ double fp29 = 29.0; \
+ double fp30 = 30.0; \
+ double fp31 = 31.0; \
+ double fp32 = 32.0
+
+#define FP_LOAD( _factor ) \
+ do { \
+ fp01 += _factor; \
+ fp02 += _factor; \
+ fp03 += _factor; \
+ fp04 += _factor; \
+ fp05 += _factor; \
+ fp06 += _factor; \
+ fp07 += _factor; \
+ fp08 += _factor; \
+ fp09 += _factor; \
+ fp10 += _factor; \
+ fp11 += _factor; \
+ fp12 += _factor; \
+ fp13 += _factor; \
+ fp14 += _factor; \
+ fp15 += _factor; \
+ fp16 += _factor; \
+ fp17 += _factor; \
+ fp18 += _factor; \
+ fp19 += _factor; \
+ fp20 += _factor; \
+ fp21 += _factor; \
+ fp22 += _factor; \
+ fp23 += _factor; \
+ fp24 += _factor; \
+ fp25 += _factor; \
+ fp26 += _factor; \
+ fp27 += _factor; \
+ fp28 += _factor; \
+ fp29 += _factor; \
+ fp30 += _factor; \
+ fp31 += _factor; \
+ fp32 += _factor; \
+ } while (0)
+
+#define EPSILON (0.0005)
+#define FPABS(d) (((d) < 0.0) ? -(d) : (d))
+#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON)
+
+#define FP_CHECK_ONE( _v, _base, _factor ) \
+ if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \
+ printf("%d: " #_v " wrong -- (%g not %g)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define FP_CHECK( _factor ) \
+ do { \
+ FP_CHECK_ONE( fp01, 1.0, (_factor) ); \
+ FP_CHECK_ONE( fp02, 2.0, (_factor) ); \
+ FP_CHECK_ONE( fp03, 3.0, (_factor) ); \
+ FP_CHECK_ONE( fp04, 4.0, (_factor) ); \
+ FP_CHECK_ONE( fp05, 5.0, (_factor) ); \
+ FP_CHECK_ONE( fp06, 6.0, (_factor) ); \
+ FP_CHECK_ONE( fp07, 7.0, (_factor) ); \
+ FP_CHECK_ONE( fp08, 8.0, (_factor) ); \
+ FP_CHECK_ONE( fp09, 9.0, (_factor) ); \
+ FP_CHECK_ONE( fp10, 10.0, (_factor) ); \
+ FP_CHECK_ONE( fp11, 11.0, (_factor) ); \
+ FP_CHECK_ONE( fp12, 12.0, (_factor) ); \
+ FP_CHECK_ONE( fp13, 13.0, (_factor) ); \
+ FP_CHECK_ONE( fp14, 14.0, (_factor) ); \
+ FP_CHECK_ONE( fp15, 15.0, (_factor) ); \
+ FP_CHECK_ONE( fp16, 16.0, (_factor) ); \
+ FP_CHECK_ONE( fp17, 17.0, (_factor) ); \
+ FP_CHECK_ONE( fp18, 18.0, (_factor) ); \
+ FP_CHECK_ONE( fp19, 19.0, (_factor) ); \
+ FP_CHECK_ONE( fp20, 20.0, (_factor) ); \
+ FP_CHECK_ONE( fp21, 21.0, (_factor) ); \
+ FP_CHECK_ONE( fp22, 22.0, (_factor) ); \
+ FP_CHECK_ONE( fp23, 23.0, (_factor) ); \
+ FP_CHECK_ONE( fp24, 24.0, (_factor) ); \
+ FP_CHECK_ONE( fp25, 25.0, (_factor) ); \
+ FP_CHECK_ONE( fp26, 26.0, (_factor) ); \
+ FP_CHECK_ONE( fp27, 27.0, (_factor) ); \
+ FP_CHECK_ONE( fp28, 28.0, (_factor) ); \
+ FP_CHECK_ONE( fp29, 29.0, (_factor) ); \
+ FP_CHECK_ONE( fp30, 30.0, (_factor) ); \
+ FP_CHECK_ONE( fp31, 31.0, (_factor) ); \
+ FP_CHECK_ONE( fp32, 32.0, (_factor) ); \
+ } while (0)
+
+#endif
+
+#endif
diff --git a/c/src/tests/sptests/sp19/init.c b/c/src/tests/sptests/sp19/init.c
new file mode 100644
index 0000000000..0d1cce26ef
--- /dev/null
+++ b/c/src/tests/sptests/sp19/init.c
@@ -0,0 +1,150 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 19 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+ Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_create(
+ Task_name[ 6 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 6 ]
+ );
+ directive_failed( status, "rtems_task_create of FP1" );
+
+ status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 );
+ directive_failed( status, "rtems_task_start of FP1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_start( Task_id[ 4 ], FP_task, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], FP_task, 0 );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ /*
+ * Load "task dependent factors" in the context areas
+ */
+
+
+ FP_factors[0] = 0.0;
+ FP_factors[1] = 1000.1;
+ FP_factors[2] = 2000.2;
+ FP_factors[3] = 3000.3;
+ FP_factors[4] = 4000.4;
+ FP_factors[5] = 5000.5;
+ FP_factors[6] = 6000.6;
+ FP_factors[7] = 7000.7;
+ FP_factors[8] = 8000.8;
+ FP_factors[9] = 9000.9;
+
+ INTEGER_factors[0] = 0x0000;
+ INTEGER_factors[1] = 0x1000;
+ INTEGER_factors[2] = 0x2000;
+ INTEGER_factors[3] = 0x3000;
+ INTEGER_factors[4] = 0x4000;
+ INTEGER_factors[5] = 0x5000;
+ INTEGER_factors[6] = 0x6000;
+ INTEGER_factors[7] = 0x7000;
+ INTEGER_factors[8] = 0x8000;
+ INTEGER_factors[9] = 0x9000;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA1" );
+}
diff --git a/c/src/tests/sptests/sp19/inttest.h b/c/src/tests/sptests/sp19/inttest.h
new file mode 100644
index 0000000000..5dfb0af636
--- /dev/null
+++ b/c/src/tests/sptests/sp19/inttest.h
@@ -0,0 +1,149 @@
+/* inttest.h
+ *
+ * XXX: ???
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * INTEGER_load( &context )
+ * INTEGER_check( &context )
+ *
+ * INTEGER_load - loads the specified floating point context
+ * INTEGER_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * inttest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __INTEGER_TEST_h
+#define __INTEGER_TEST_h
+
+#include <stdio.h>
+#define REG_VARIABLE rtems_unsigned32
+
+#define INTEGER_DECLARE \
+ REG_VARIABLE int01 = 1; \
+ REG_VARIABLE int02 = 2; \
+ REG_VARIABLE int03 = 3; \
+ REG_VARIABLE int04 = 4; \
+ REG_VARIABLE int05 = 5; \
+ REG_VARIABLE int06 = 6; \
+ REG_VARIABLE int07 = 7; \
+ REG_VARIABLE int08 = 8; \
+ REG_VARIABLE int09 = 9; \
+ REG_VARIABLE int10 = 10; \
+ REG_VARIABLE int11 = 11; \
+ REG_VARIABLE int12 = 12; \
+ REG_VARIABLE int13 = 13; \
+ REG_VARIABLE int14 = 14; \
+ REG_VARIABLE int15 = 15; \
+ REG_VARIABLE int16 = 16; \
+ REG_VARIABLE int17 = 17; \
+ REG_VARIABLE int18 = 18; \
+ REG_VARIABLE int19 = 19; \
+ REG_VARIABLE int20 = 20; \
+ REG_VARIABLE int21 = 21; \
+ REG_VARIABLE int22 = 22; \
+ REG_VARIABLE int23 = 23; \
+ REG_VARIABLE int24 = 24; \
+ REG_VARIABLE int25 = 25; \
+ REG_VARIABLE int26 = 26; \
+ REG_VARIABLE int27 = 27; \
+ REG_VARIABLE int28 = 28; \
+ REG_VARIABLE int29 = 29; \
+ REG_VARIABLE int30 = 30; \
+ REG_VARIABLE int31 = 31; \
+ REG_VARIABLE int32 = 32
+
+#define INTEGER_LOAD( _factor ) \
+ do { \
+ int01 += _factor; \
+ int02 += _factor; \
+ int03 += _factor; \
+ int04 += _factor; \
+ int05 += _factor; \
+ int06 += _factor; \
+ int07 += _factor; \
+ int08 += _factor; \
+ int09 += _factor; \
+ int10 += _factor; \
+ int11 += _factor; \
+ int12 += _factor; \
+ int13 += _factor; \
+ int14 += _factor; \
+ int15 += _factor; \
+ int16 += _factor; \
+ int17 += _factor; \
+ int18 += _factor; \
+ int19 += _factor; \
+ int20 += _factor; \
+ int21 += _factor; \
+ int22 += _factor; \
+ int23 += _factor; \
+ int24 += _factor; \
+ int25 += _factor; \
+ int26 += _factor; \
+ int27 += _factor; \
+ int28 += _factor; \
+ int29 += _factor; \
+ int30 += _factor; \
+ int31 += _factor; \
+ int32 += _factor; \
+ } while (0)
+
+#define INTEGER_CHECK_ONE( _v, _base, _factor ) \
+ if ( (_v) != ((_base) + (_factor)) ) { \
+ printf("%d: " #_v " wrong -- (0x%x not 0x%x)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define INTEGER_CHECK( _factor ) \
+ do { \
+ INTEGER_CHECK_ONE( int01, 1, (_factor) ); \
+ INTEGER_CHECK_ONE( int02, 2, (_factor) ); \
+ INTEGER_CHECK_ONE( int03, 3, (_factor) ); \
+ INTEGER_CHECK_ONE( int04, 4, (_factor) ); \
+ INTEGER_CHECK_ONE( int05, 5, (_factor) ); \
+ INTEGER_CHECK_ONE( int06, 6, (_factor) ); \
+ INTEGER_CHECK_ONE( int07, 7, (_factor) ); \
+ INTEGER_CHECK_ONE( int08, 8, (_factor) ); \
+ INTEGER_CHECK_ONE( int09, 9, (_factor) ); \
+ INTEGER_CHECK_ONE( int10, 10, (_factor) ); \
+ INTEGER_CHECK_ONE( int11, 11, (_factor) ); \
+ INTEGER_CHECK_ONE( int12, 12, (_factor) ); \
+ INTEGER_CHECK_ONE( int13, 13, (_factor) ); \
+ INTEGER_CHECK_ONE( int14, 14, (_factor) ); \
+ INTEGER_CHECK_ONE( int15, 15, (_factor) ); \
+ INTEGER_CHECK_ONE( int16, 16, (_factor) ); \
+ INTEGER_CHECK_ONE( int17, 17, (_factor) ); \
+ INTEGER_CHECK_ONE( int18, 18, (_factor) ); \
+ INTEGER_CHECK_ONE( int19, 19, (_factor) ); \
+ INTEGER_CHECK_ONE( int20, 20, (_factor) ); \
+ INTEGER_CHECK_ONE( int21, 21, (_factor) ); \
+ INTEGER_CHECK_ONE( int22, 22, (_factor) ); \
+ INTEGER_CHECK_ONE( int23, 23, (_factor) ); \
+ INTEGER_CHECK_ONE( int24, 24, (_factor) ); \
+ INTEGER_CHECK_ONE( int25, 25, (_factor) ); \
+ INTEGER_CHECK_ONE( int26, 26, (_factor) ); \
+ INTEGER_CHECK_ONE( int27, 27, (_factor) ); \
+ INTEGER_CHECK_ONE( int28, 28, (_factor) ); \
+ INTEGER_CHECK_ONE( int29, 29, (_factor) ); \
+ INTEGER_CHECK_ONE( int30, 30, (_factor) ); \
+ INTEGER_CHECK_ONE( int31, 31, (_factor) ); \
+ INTEGER_CHECK_ONE( int32, 32, (_factor) ); \
+ } while (0)
+
+#endif
diff --git a/c/src/tests/sptests/sp19/sp19.doc b/c/src/tests/sptests/sp19/sp19.doc
new file mode 100644
index 0000000000..78ac463c9f
--- /dev/null
+++ b/c/src/tests/sptests/sp19/sp19.doc
@@ -0,0 +1,23 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test19
+
+directives:
+
+concepts:
+
+ a. Verifies system can dispatch a mixture of floating point and
+ non-floating point tasks.
diff --git a/c/src/tests/sptests/sp19/sp19.scn b/c/src/tests/sptests/sp19/sp19.scn
new file mode 100644
index 0000000000..76ded9f7d0
--- /dev/null
+++ b/c/src/tests/sptests/sp19/sp19.scn
@@ -0,0 +1,55 @@
+*** TEST 19 ***
+FP1 - integer base = (0x6000)
+FP1 - float base = (6000.6)
+FP1 - integer base = (0x6000)
+FP1 - float base = (6000.6)
+TA1 - integer base = (0x1000)
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - integer base = (0x2000)
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - integer base = (0x3000)
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA4 - integer base = (0x4000)
+TA4 - float base = (4000.4)
+TA4 - rtems_clock_get - 09:00:00 12/31/1988
+TA5 - integer base = (0x5000)
+TA5 - float base = (5000.5)
+TA5 - rtems_clock_get - 09:00:00 12/31/1988
+TA4 - rtems_clock_get - 09:00:01 12/31/1988
+TA5 - rtems_clock_get - 09:00:01 12/31/1988
+TA4 - rtems_clock_get - 09:00:02 12/31/1988
+TA5 - rtems_clock_get - 09:00:02 12/31/1988
+TA4 - rtems_clock_get - 09:00:03 12/31/1988
+TA5 - rtems_clock_get - 09:00:03 12/31/1988
+TA4 - rtems_clock_get - 09:00:04 12/31/1988
+TA5 - rtems_clock_get - 09:00:04 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA4 - rtems_clock_get - 09:00:05 12/31/1988
+TA5 - rtems_clock_get - 09:00:05 12/31/1988
+TA4 - rtems_clock_get - 09:00:06 12/31/1988
+TA5 - rtems_clock_get - 09:00:06 12/31/1988
+TA4 - rtems_clock_get - 09:00:07 12/31/1988
+TA5 - rtems_clock_get - 09:00:07 12/31/1988
+TA4 - rtems_clock_get - 09:00:08 12/31/1988
+TA5 - rtems_clock_get - 09:00:08 12/31/1988
+TA4 - rtems_clock_get - 09:00:09 12/31/1988
+TA5 - rtems_clock_get - 09:00:09 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA4 - rtems_clock_get - 09:00:10 12/31/1988
+TA5 - rtems_clock_get - 09:00:10 12/31/1988
+TA4 - rtems_clock_get - 09:00:11 12/31/1988
+TA5 - rtems_clock_get - 09:00:11 12/31/1988
+TA4 - rtems_clock_get - 09:00:12 12/31/1988
+TA5 - rtems_clock_get - 09:00:12 12/31/1988
+TA4 - rtems_clock_get - 09:00:13 12/31/1988
+TA5 - rtems_clock_get - 09:00:13 12/31/1988
+TA4 - rtems_clock_get - 09:00:14 12/31/1988
+TA5 - rtems_clock_get - 09:00:14 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA4 - rtems_clock_get - 09:00:15 12/31/1988
+TA5 - rtems_clock_get - 09:00:15 12/31/1988
+TA4 - rtems_task_delete - self
+TA5 - rtems_task_delete - TA3
+*** END OF TEST 19 ***
diff --git a/c/src/tests/sptests/sp19/system.h b/c/src/tests/sptests/sp19/system.h
new file mode 100644
index 0000000000..6052075250
--- /dev/null
+++ b/c/src/tests/sptests/sp19/system.h
@@ -0,0 +1,55 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task First_FP_task(
+ rtems_task_argument argument
+);
+
+rtems_task FP_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */
+TEST_EXTERN rtems_id Task_name[ 7 ]; /* array of task names */
+
+TEST_EXTERN rtems_double FP_factors[ 10 ]; /* FP "uniqueness" factors */
+TEST_EXTERN rtems_unsigned32 INTEGER_factors[ 10 ]; /* INT "uniqueness" factors */
+/* end of include file */
diff --git a/c/src/tests/sptests/sp19/task1.c b/c/src/tests/sptests/sp19/task1.c
new file mode 100644
index 0000000000..874fbcc614
--- /dev/null
+++ b/c/src/tests/sptests/sp19/task1.c
@@ -0,0 +1,59 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "inttest.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ INTEGER_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ INTEGER_CHECK( INTEGER_factors[ task_index ] );
+
+ status = rtems_task_wake_after(
+ ( task_number( tid ) ) * 5 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/sptests/sp20/getall.c b/c/src/tests/sptests/sp20/getall.c
new file mode 100644
index 0000000000..cff3841dff
--- /dev/null
+++ b/c/src/tests/sptests/sp20/getall.c
@@ -0,0 +1,43 @@
+/* Get_all_counters
+ *
+ * This routine allows TA5 to atomically obtain the iteration counters.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Get_all_counters()
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode to RTEMS_NO_PREEMPT" );
+
+ Temporary_count = Count;
+ Count.count[ 1 ] = 0;
+ Count.count[ 2 ] = 0;
+ Count.count[ 3 ] = 0;
+ Count.count[ 4 ] = 0;
+ Count.count[ 5 ] = 0;
+
+ status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" );
+}
diff --git a/c/src/tests/sptests/sp20/init.c b/c/src/tests/sptests/sp20/init.c
new file mode 100644
index 0000000000..d2bc2ec00d
--- /dev/null
+++ b/c/src/tests/sptests/sp20/init.c
@@ -0,0 +1,68 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 20 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_create(
+ Task_name[ index ],
+ Priorities[ index ],
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+ }
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Count.count[ 1 ] = 0;
+ Count.count[ 2 ] = 0;
+ Count.count[ 3 ] = 0;
+ Count.count[ 4 ] = 0;
+ Count.count[ 5 ] = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp20/sp20.doc b/c/src/tests/sptests/sp20/sp20.doc
new file mode 100644
index 0000000000..4a029a4b89
--- /dev/null
+++ b/c/src/tests/sptests/sp20/sp20.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test20
+
+directives:
+
+ rm_create, rm_period
+
+concepts:
+
+ a. Verifies Rate Monotonic Manager behavior.
diff --git a/c/src/tests/sptests/sp20/sp20.scn b/c/src/tests/sptests/sp20/sp20.scn
new file mode 100644
index 0000000000..bb4e8814da
--- /dev/null
+++ b/c/src/tests/sptests/sp20/sp20.scn
@@ -0,0 +1,27 @@
+*** TEST 20 ***
+TA1 - rtems_rate_monotonic_create id = 0x28010001
+TA1 - rtems_rate_monotonic_ident id = 0x28010001
+TA1 - (0x28010001) period 2
+TA2 - rtems_rate_monotonic_create id = 0x28010002
+TA2 - rtems_rate_monotonic_ident id = 0x28010002
+TA2 - (0x28010002) period 2
+TA3 - rtems_rate_monotonic_create id = 0x28010003
+TA3 - rtems_rate_monotonic_ident id = 0x28010003
+TA3 - (0x28010003) period 2
+TA4 - rtems_rate_monotonic_create id = 0x28010004
+TA4 - rtems_rate_monotonic_ident id = 0x28010004
+TA4 - (0x28010004) period 2
+TA5 - rtems_rate_monotonic_create id = 0x28010005
+TA5 - rtems_rate_monotonic_ident id = 0x28010005
+TA5 - (0x28010005) period 100
+TA5 - PERIODS CHECK OK (1)
+TA5 - PERIODS CHECK OK (2)
+TA5 - PERIODS CHECK OK (3)
+TA5 - PERIODS CHECK OK (4)
+TA5 - PERIODS CHECK OK (5)
+TA5 - PERIODS CHECK OK (6)
+TA5 - PERIODS CHECK OK (7)
+TA5 - PERIODS CHECK OK (8)
+TA5 - PERIODS CHECK OK (9)
+TA5 - PERIODS CHECK OK (10)
+*** END OF TEST 20 ***
diff --git a/c/src/tests/sptests/sp20/system.h b/c/src/tests/sptests/sp20/system.h
new file mode 100644
index 0000000000..ddd68c336e
--- /dev/null
+++ b/c/src/tests/sptests/sp20/system.h
@@ -0,0 +1,59 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* types */
+
+struct counters {
+ rtems_unsigned32 count[6];
+};
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_5(
+ rtems_task_argument argument
+);
+
+void Get_all_counters( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_PRIORITY 10
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+#define CONFIGURE_MAXIMUM_PERIODS 10
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN struct counters Count; /* iteration counters */
+TEST_EXTERN struct counters Temporary_count;
+extern rtems_task_priority Priorities[ 6 ];
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp20/task1.c b/c/src/tests/sptests/sp20/task1.c
new file mode 100644
index 0000000000..c5eda1a9ae
--- /dev/null
+++ b/c/src/tests/sptests/sp20/task1.c
@@ -0,0 +1,116 @@
+/* Task_1_through_5
+ *
+ * This routine serves as a test task for the period capabilities of the
+ * Rate Monotonic Manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 };
+rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 };
+rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
+
+rtems_task Task_1_through_5(
+ rtems_unsigned32 argument
+)
+{
+ rtems_id rmid;
+ rtems_id test_rmid;
+ rtems_unsigned32 index;
+ rtems_unsigned32 pass;
+ rtems_unsigned32 failed;
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( argument, &rmid );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid );
+
+ status = rtems_rate_monotonic_ident( argument, &test_rmid );
+ directive_failed( status, "rtems_rate_monotonic_ident" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid );
+
+ if ( rmid != test_rmid ) {
+ printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] );
+
+ status = rtems_task_wake_after( 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ switch ( argument ) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ while ( FOREVER ) {
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+ Count.count[ argument ]++;
+ }
+ break;
+ case 5:
+ pass = 0;
+ failed = 0;
+
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
+
+ Get_all_counters();
+
+ while ( FOREVER ) {
+
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
+
+ Get_all_counters();
+
+ for( index = 1 ; index <= 4 ; index++ ) {
+ if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
+ puts_nocr( "FAIL -- " );
+ put_name ( Task_name[ index ], FALSE );
+ printf ( " Actual=%d, Expected=%d\n",
+ Temporary_count.count[ index ],
+ Iterations[ index ]
+ );
+ failed += 1;
+ }
+ }
+
+ if ( failed == 5 )
+ exit( 0 );
+
+ pass += 1;
+
+ printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
+
+ fflush( stdout );
+
+ if ( pass == 10 ) {
+ puts( "*** END OF TEST 20 ***" );
+ exit( 0 );
+ }
+
+ }
+ break;
+ }
+}
diff --git a/c/src/tests/sptests/sp21/init.c b/c/src/tests/sptests/sp21/init.c
new file mode 100644
index 0000000000..a8ea3e7ed2
--- /dev/null
+++ b/c/src/tests/sptests/sp21/init.c
@@ -0,0 +1,53 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 21 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp21/sp21.doc b/c/src/tests/sptests/sp21/sp21.doc
new file mode 100644
index 0000000000..55ed6282bc
--- /dev/null
+++ b/c/src/tests/sptests/sp21/sp21.doc
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test21
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete
+ de_init, de_open, de_close, de_read, de_write, de_cntrl
+
+concepts:
+
+ a. Verifies all I/O manager directives always return successful for
+ null drivers.
+
+ b. Verifies all I/O manager directives call and return from the driver
+ entry points in the driver address table.
diff --git a/c/src/tests/sptests/sp21/sp21.scn b/c/src/tests/sptests/sp21/sp21.scn
new file mode 100644
index 0000000000..c6392e3ea3
--- /dev/null
+++ b/c/src/tests/sptests/sp21/sp21.scn
@@ -0,0 +1,19 @@
+*** TEST 21 ***
+----- TESTING THE NULL DRIVER CHECKS -----
+TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL
+----- TESTING THE I/O MANAGER DIRECTIVES -----
+TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL
+----- RETURNING INVALID MAJOR NUMBER -----
+TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_open - RTEMS_INVALID_NUMBER
+*** END OF TEST 21 ***
diff --git a/c/src/tests/sptests/sp21/system.h b/c/src/tests/sptests/sp21/system.h
new file mode 100644
index 0000000000..9c68c795b4
--- /dev/null
+++ b/c/src/tests/sptests/sp21/system.h
@@ -0,0 +1,44 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_TEST_NEEDS_STUB_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp21/task1.c b/c/src/tests/sptests/sp21/task1.c
new file mode 100644
index 0000000000..03bde1db75
--- /dev/null
+++ b/c/src/tests/sptests/sp21/task1.c
@@ -0,0 +1,105 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the I/O manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define STUB_DRIVER_MAJOR 0x2
+#define NO_DRIVER_MAJOR 0x3
+#define INVALID_DRIVER_MAJOR 0x5
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "----- TESTING THE NULL DRIVER CHECKS -----" );
+
+ status = rtems_io_initialize( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_initialize" );
+ puts( "TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_open( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_open" );
+ puts( "TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_close( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_close" );
+ puts( "TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_read( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_read" );
+ puts( "TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_write( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_write" );
+ puts( "TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_control( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_control" );
+ puts( "TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ puts( "----- TESTING THE I/O MANAGER DIRECTIVES -----" );
+
+ status = rtems_io_initialize( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_initialize" );
+ puts( "TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_open( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_open" );
+ puts( "TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_close( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_close" );
+ puts( "TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_read( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_read" );
+ puts( "TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_write( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_write" );
+ puts( "TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_control( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_control" );
+ puts( "TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ puts( "----- RETURNING INVALID MAJOR NUMBER -----" );
+
+ status = rtems_io_initialize( INVALID_DRIVER_MAJOR, 0, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_initialize"
+ );
+ puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_open"
+ );
+ puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
+
+ puts( "*** END OF TEST 21 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp22/delay.c b/c/src/tests/sptests/sp22/delay.c
new file mode 100644
index 0000000000..bcf9e014a7
--- /dev/null
+++ b/c/src/tests/sptests/sp22/delay.c
@@ -0,0 +1,32 @@
+/* Delayed_resume
+ *
+ * This routine is scheduled to be fired as a timer service routine.
+ * When fired this subprogram resumes Task_1.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_resume(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_resume of self" );
+}
diff --git a/c/src/tests/sptests/sp22/init.c b/c/src/tests/sptests/sp22/init.c
new file mode 100644
index 0000000000..1ebc50bb20
--- /dev/null
+++ b/c/src/tests/sptests/sp22/init.c
@@ -0,0 +1,66 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 22 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ puts( "INIT - rtems_timer_create - creating timer 1" );
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp22/prtime.c b/c/src/tests/sptests/sp22/prtime.c
new file mode 100644
index 0000000000..f3871eb9fd
--- /dev/null
+++ b/c/src/tests/sptests/sp22/prtime.c
@@ -0,0 +1,32 @@
+/* Print_time
+ *
+ * This routine prints the name of Task_1 and the current time of day.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Print_time( void )
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( "- rtems_clock_get - ", &time, "\n" );
+}
diff --git a/c/src/tests/sptests/sp22/sp22.doc b/c/src/tests/sptests/sp22/sp22.doc
new file mode 100644
index 0000000000..9208d7a695
--- /dev/null
+++ b/c/src/tests/sptests/sp22/sp22.doc
@@ -0,0 +1,20 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test22
+
+directives:
+
+concepts:
diff --git a/c/src/tests/sptests/sp22/sp22.scn b/c/src/tests/sptests/sp22/sp22.scn
new file mode 100644
index 0000000000..6fb08156c5
--- /dev/null
+++ b/c/src/tests/sptests/sp22/sp22.scn
@@ -0,0 +1,29 @@
+*** TEST 22 ***
+INIT - rtems_timer_create - creating timer 1
+INIT - timer 1 has id (0x10010001)
+TA1 - rtems_timer_ident - identing timer 1
+TA1 - timer 1 has id (0x10010001)
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:03 12/31/1988
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:04 12/31/1988
+TA1 - rtems_timer_reset - timer 1
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:07 12/31/1988
+<pause>
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_clock_get - 09:00:07 12/31/1988
+TA1 - rtems_timer_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_timer_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:11 12/31/1988
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_task_wake_after - YIELD (only task at priority)
+TA1 - timer_deleting - timer 1
+*** END OF TEST 22 ***
diff --git a/c/src/tests/sptests/sp22/system.h b/c/src/tests/sptests/sp22/system.h
new file mode 100644
index 0000000000..c7d0636ba3
--- /dev/null
+++ b/c/src/tests/sptests/sp22/system.h
@@ -0,0 +1,55 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_resume(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+void Print_time( void );
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 2
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp22/task1.c b/c/src/tests/sptests/sp22/task1.c
new file mode 100644
index 0000000000..547c8391cf
--- /dev/null
+++ b/c/src/tests/sptests/sp22/task1.c
@@ -0,0 +1,164 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tmid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+/* Get id */
+
+ puts( "TA1 - rtems_timer_ident - identing timer 1" );
+ status = rtems_timer_ident( Timer_name[ 1 ], &tmid );
+ directive_failed( status, "rtems_timer_ident" );
+ printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
+
+/* after which is allowed to fire */
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+/* after which is reset and allowed to fire */
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_task_wake_after - 1 second" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_reset - timer 1" );
+ status = rtems_timer_reset( tmid );
+ directive_failed( status, "rtems_timer_reset" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+ rtems_test_pause();
+
+ /*
+ * Reset the time since we do not know how long the user waited
+ * before pressing <cr> at the pause. This insures that the
+ * actual output matches the screen.
+ */
+
+ build_time( &time, 12, 31, 1988, 9, 0, 7, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+/* after which is canceled */
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_timer_cancel - timer 1" );
+ status = rtems_timer_cancel( tmid );
+ directive_failed( status, "rtems_timer_cancel" );
+
+/* when which is allowed to fire */
+
+ Print_time();
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ time.second += 3;
+
+ puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL );
+ directive_failed( status, "rtems_timer_fire_when" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+/* when which is canceled */
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ time.second += 3;
+
+ puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL );
+ directive_failed( status, "rtems_timer_fire_when" );
+
+ puts( "TA1 - rtems_task_wake_after - 1 second" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_cancel - timer 1" );
+ status = rtems_timer_cancel( tmid );
+ directive_failed( status, "rtems_timer_cancel" );
+
+/* delete */
+ puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - timer_deleting - timer 1" );
+ status = rtems_timer_delete( tmid );
+ directive_failed( status, "rtems_timer_delete" );
+
+ puts( "*** END OF TEST 22 *** " );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp23/init.c b/c/src/tests/sptests/sp23/init.c
new file mode 100644
index 0000000000..9ca4b634c8
--- /dev/null
+++ b/c/src/tests/sptests/sp23/init.c
@@ -0,0 +1,69 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 23 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ Internal_port_area,
+ External_port_area,
+ 0xff,
+ &Port_id[ 1 ]
+ );
+ directive_failed( status, "rtems_port_create of DP1" );
+
+ printf( "INIT - rtems_port_create - DP1 - int = %p ext = %p\n",
+ Internal_port_area,
+ External_port_area
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp23/sp23.doc b/c/src/tests/sptests/sp23/sp23.doc
new file mode 100644
index 0000000000..485a4ec466
--- /dev/null
+++ b/c/src/tests/sptests/sp23/sp23.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test23
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete,
+ m_ext2int, m_int2ext
+
+concepts:
+
+ a. Verifies the dual ported RAM directives work correctly.
+
+output:
diff --git a/c/src/tests/sptests/sp23/sp23.scn b/c/src/tests/sptests/sp23/sp23.scn
new file mode 100644
index 0000000000..b8b5633855
--- /dev/null
+++ b/c/src/tests/sptests/sp23/sp23.scn
@@ -0,0 +1,9 @@
+*** TEST 23 ***
+INIT - rtems_port_create - DP1 - int = 0x00001000 ext = 0x00002000
+TA1 - rtems_port_ident - 0x24010001
+TA1 - rtems_port_external_to_internal - 0x0000200e => 0x0000100e
+TA1 - rtems_port_internal_to_external - 0x0000100e => 0x0000200e
+TA1 - rtems_port_external_to_internal - 0x0000300e => 0x0000300e
+TA1 - rtems_port_internal_to_external - 0x0000050e => 0x0000050e
+TA1 - rtems_port_delete - DP1
+*** END OF TEST 23 ***
diff --git a/c/src/tests/sptests/sp23/system.h b/c/src/tests/sptests/sp23/system.h
new file mode 100644
index 0000000000..5a2ad3ff4e
--- /dev/null
+++ b/c/src/tests/sptests/sp23/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_PORTS 1
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */
+TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */
+
+#define Internal_port_area ((rtems_unsigned8 *) 0x00001000)
+#define External_port_area ((rtems_unsigned8 *) 0x00002000)
+
+#define Below_port_area ((rtems_unsigned8 *) 0x00000500)
+#define Above_port_area ((rtems_unsigned8 *) 0x00003000)
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp23/task1.c b/c/src/tests/sptests/sp23/task1.c
new file mode 100644
index 0000000000..73ebce778c
--- /dev/null
+++ b/c/src/tests/sptests/sp23/task1.c
@@ -0,0 +1,96 @@
+/* Task_1
+ *
+ * This task verifies that the dual ported RAM directives work
+ * correctly by converting external addresses to internal addresses and
+ * internal addresses to external addresses.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id dpid;
+ void *to_be_converted;
+ void *converted;
+ rtems_status_code status;
+
+ status = rtems_port_ident( Port_name[ 1 ], &dpid );
+ directive_failed( status, "rtems_port_ident" );
+ printf( "TA1 - rtems_port_ident - 0x%08x\n", dpid );
+
+ to_be_converted = &External_port_area[ 0xe ];
+ status = rtems_port_external_to_internal(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_external_to_internal" );
+ printf(
+ "TA1 - rtems_port_external_to_internal - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Internal_port_area[ 0xe ];
+ status = rtems_port_internal_to_external(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_internal_to_external" );
+ printf(
+ "TA1 - rtems_port_internal_to_external - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Above_port_area[ 0xe ];
+ status = rtems_port_external_to_internal(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_external_to_internal" );
+ printf(
+ "TA1 - rtems_port_external_to_internal - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Below_port_area[ 0xe ];
+ status = rtems_port_internal_to_external(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_internal_to_external" );
+ printf(
+ "TA1 - rtems_port_internal_to_external - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ status = rtems_port_delete( Port_id[ 1 ] );
+ directive_failed( status, "rtems_port_delete" );
+ puts( "TA1 - rtems_port_delete - DP1" );
+
+ puts( "*** END OF TEST 23 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp24/init.c b/c/src/tests/sptests/sp24/init.c
new file mode 100644
index 0000000000..74114ab82a
--- /dev/null
+++ b/c/src/tests/sptests/sp24/init.c
@@ -0,0 +1,76 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 24 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+ Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
+ Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' );
+
+ for ( index = 1 ; index <= 3 ; index++ ) {
+ status = rtems_task_create(
+ Task_name[ index ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_timer_create(
+ Timer_name[ index ],
+ &Timer_id[ index ]
+ );
+ directive_failed( status, "rtems_timer_create loop" );
+ }
+
+ for ( index = 1 ; index <= 3 ; index++ ) {
+ status = rtems_task_start( Task_id[ index ], Task_1_through_3, index );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp24/resume.c b/c/src/tests/sptests/sp24/resume.c
new file mode 100644
index 0000000000..c73696c109
--- /dev/null
+++ b/c/src/tests/sptests/sp24/resume.c
@@ -0,0 +1,34 @@
+/* Resume_task
+ *
+ * This subprogram is scheduled as a timer service routine. When
+ * it fires it resumes the task which is mapped to this timer.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Resume_task(
+ rtems_id timer_id,
+ void *ignored_address
+)
+{
+ rtems_id task_to_resume;
+ rtems_status_code status;
+
+ task_to_resume = Task_id[ rtems_get_index( timer_id ) ];
+ status = rtems_task_resume( task_to_resume );
+ directive_failed( status, "rtems_task_resume" );
+}
diff --git a/c/src/tests/sptests/sp24/sp24.doc b/c/src/tests/sptests/sp24/sp24.doc
new file mode 100644
index 0000000000..14b743d588
--- /dev/null
+++ b/c/src/tests/sptests/sp24/sp24.doc
@@ -0,0 +1,51 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test24
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_receive
+
+concepts:
+
+ a. This test is a cyclic version of test1. The times printed by
+ each test should not skew as in test1 (see output section).
+
+ b. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ c. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ d. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ e. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ f. Verifies executive initialization performed correctly.
+
+ g. Verifies the executive trap handler except for the halt function.
+
+ h. Verifies that a task can get the task identification number of itself.
+
+output:
+ "TA1" is printed once every 5 seconds. "TA2" is printed once
+ every 10 seconds. "TA3" is printed once every 15 seconds.
+
+ The times printed should be multiples of 5 seconds for TA1, 10 seconds
+ for TA2, and 15 seconds for TA3. If this does not happen, the calendar
+ time does not correspond correctly to the number of ticks.
diff --git a/c/src/tests/sptests/sp24/sp24.scn b/c/src/tests/sptests/sp24/sp24.scn
new file mode 100644
index 0000000000..577dc4f7b2
--- /dev/null
+++ b/c/src/tests/sptests/sp24/sp24.scn
@@ -0,0 +1,16 @@
+*** TEST 24 ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA1 - rtems_clock_get - 09:00:20 12/31/1988
+TA2 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:25 12/31/1988
+TA1 - rtems_clock_get - 09:00:30 12/31/1988
+TA2 - rtems_clock_get - 09:00:30 12/31/1988
+TA3 - rtems_clock_get - 09:00:30 12/31/1988
+*** END OF TEST 24 ***
diff --git a/c/src/tests/sptests/sp24/system.h b/c/src/tests/sptests/sp24/system.h
new file mode 100644
index 0000000000..b54beb7add
--- /dev/null
+++ b/c/src/tests/sptests/sp24/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Resume_task(
+ rtems_id timer_id,
+ void *ignored_address
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 3
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp24/task1.c b/c/src/tests/sptests/sp24/task1.c
new file mode 100644
index 0000000000..bb3540acee
--- /dev/null
+++ b/c/src/tests/sptests/sp24/task1.c
@@ -0,0 +1,58 @@
+/* Task_1_through_3
+ *
+ * This task is a cyclic version of test1 to asssure that the times
+ * displayed are not skewed as in test1. "TA1" is printed once every
+ * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is
+ * printed once every 15 seconds. The times displayed should be
+ * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively.
+ * If the times are skewed from these values, then the calendar time
+ * does not correspond correctly with the number of ticks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ while ( FOREVER ) {
+ status = rtems_timer_fire_after(
+ Timer_id[ argument ],
+ task_number( tid ) * 5 * TICKS_PER_SECOND,
+ Resume_task,
+ NULL
+ );
+ directive_failed( status, "tm_fire_after failed" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get failed" );
+
+ if ( time.second >= 35 ) {
+ puts( "*** END OF TEST 24 ***" );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+ }
+}
diff --git a/c/src/tests/sptests/sp25/init.c b/c/src/tests/sptests/sp25/init.c
new file mode 100644
index 0000000000..10a3f8cc52
--- /dev/null
+++ b/c/src/tests/sptests/sp25/init.c
@@ -0,0 +1,66 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 25 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1');
+
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Area_1,
+ sizeof( Area_1 ),
+ 64,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create of RN1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp25/sp25.doc b/c/src/tests/sptests/sp25/sp25.doc
new file mode 100644
index 0000000000..98684f53b3
--- /dev/null
+++ b/c/src/tests/sptests/sp25/sp25.doc
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test25
+
+directives:
+ task_create
+ task_start
+ task_delete
+ region_create
+ region_ident
+ region_get_segment
+ region_return_segment
+ region_delete
+
+concepts:
+
+ a. Verifies that the heap maintains it's integrity trhough a series
+ on region_get_segments and region_return_segments.
+
diff --git a/c/src/tests/sptests/sp25/sp25.scn b/c/src/tests/sptests/sp25/sp25.scn
new file mode 100644
index 0000000000..af2599663d
--- /dev/null
+++ b/c/src/tests/sptests/sp25/sp25.scn
@@ -0,0 +1,29 @@
+*** TEST 25 ***
+TA1 - rtems_region_ident - 0x20010002
+TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f9b8
+TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f930
+TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f828
+TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f620
+TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f218
+TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000ea10
+TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000da08
+TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000ba00
+<pause>
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f828
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f620
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f9b8
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f930
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000da08
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ea10
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ba00
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f218
+TA1 - rtems_region_delete - walks heap if debug enabled
+*** END OF TEST 25 ***
diff --git a/c/src/tests/sptests/sp25/system.h b/c/src/tests/sptests/sp25/system.h
new file mode 100644
index 0000000000..dfcee7551b
--- /dev/null
+++ b/c/src/tests/sptests/sp25/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_REGIONS 1
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */
+TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[64000] CPU_STRUCTURE_ALIGNMENT;
+
+#define BASE_PRIORITY 140
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp25/task1.c b/c/src/tests/sptests/sp25/task1.c
new file mode 100644
index 0000000000..44a8194efd
--- /dev/null
+++ b/c/src/tests/sptests/sp25/task1.c
@@ -0,0 +1,241 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the region manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ void *address_1;
+ void *address_2;
+ void *address_3;
+ void *address_4;
+ void *address_5;
+ void *address_6;
+ void *address_7;
+ void *address_8;
+ rtems_status_code status;
+ rtems_id region_id;
+
+ status = rtems_region_ident(Region_name[ 1 ], &region_id);
+ printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id );
+ directive_failed(status, "rtems_region_ident of RN01");
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 64,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_1 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 128,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_2 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 256,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_3 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 512,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_4 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1024,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_5
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_5 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_6
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_6 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 4096,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_7
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_7 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 8192,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_8
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_8 );
+ new_line;
+
+rtems_test_pause();
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_3 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_3 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_4 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_1 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_1 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_2 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_2 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_7 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_7 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_7 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_6 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_6 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_6 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_8 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_8 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_8 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_5 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_5 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_5 = 0;
+
+ puts( "TA1 - rtems_region_delete - walks heap if debug enabled" );
+ rtems_region_delete(Region_id[ 1 ]);
+
+ puts( "*** END OF TEST 25 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/spfatal/fatal.c b/c/src/tests/sptests/spfatal/fatal.c
new file mode 100644
index 0000000000..fa3dd547bd
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/fatal.c
@@ -0,0 +1,135 @@
+/* Fatal Error Test
+ *
+ * NOTE:
+ *
+ * This test actually modifies the Configuration table and restarts
+ * the executive. It is very carefully constructed to do this and
+ * uses the Configuration very carefully.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#include <setjmp.h>
+
+char Workspace[ 64 * 1024 ] CPU_STRUCTURE_ALIGNMENT;
+
+typedef enum {
+ FATAL_WORKSPACE_OF_ZERO,
+ FATAL_NULL_WORKSPACE,
+ FATAL_WORKSPACE_TOO_SMALL,
+ FATAL_TASK_CREATE,
+ FATAL_TASK_START
+} Fatal_errors_t;
+
+#define FATAL_LAST FATAL_TASK_START
+
+volatile Fatal_errors_t Case_in_switch;
+
+rtems_status_code Expected_Errors[] = {
+ RTEMS_UNSATISFIED,
+ RTEMS_INVALID_ADDRESS,
+ RTEMS_UNSATISFIED,
+ RTEMS_INVALID_PRIORITY,
+ RTEMS_TASK_EXITTED
+};
+
+rtems_status_code Error_Happened[ FATAL_LAST + 1];
+
+jmp_buf Restart_Context;
+
+/*
+ * We depend on this being zeroed during initialization. This
+ * occurs automatically because this is part of the BSS.
+ */
+
+rtems_unsigned32 First_Time_Through;
+
+void Process_case();
+
+rtems_extension Fatal_extension(
+ rtems_unsigned32 error,
+ boolean is_internal
+)
+{
+ int index;
+
+ Error_Happened[ Case_in_switch ] = error;
+
+ if ( First_Time_Through == 0 ) {
+ Case_in_switch = FATAL_WORKSPACE_OF_ZERO;
+ First_Time_Through = 1;
+ setjmp( Restart_Context );
+ } else if ( Case_in_switch == FATAL_LAST ) {
+
+ /*
+ * Depending on the C library we use, we cannot get the
+ * task exitted error so do not check for it.
+ */
+
+ puts( "*** TEST FATAL ***" );
+ for ( index=0 ; index< FATAL_LAST ; index++ )
+ put_error( Error_Happened[ index ], Expected_Errors[ index ] );
+ puts( "NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS" );
+ puts( "*** END OF TEST FATAL ***" );
+
+ /*
+ * returns to the default fatal error handler instead of
+ * calling rtems_shutdown_executive
+ */
+ return;
+
+ } else {
+
+ longjmp( Restart_Context, 1 );
+ }
+
+ Process_case();
+}
+
+
+
+void Process_case()
+{
+ switch ( Case_in_switch ) {
+ case FATAL_WORKSPACE_OF_ZERO:
+ New_Configuration = BSP_Configuration;
+ New_Configuration.work_space_start = NULL;
+ Case_in_switch = FATAL_NULL_WORKSPACE;
+ break;
+
+ case FATAL_NULL_WORKSPACE:
+ New_Configuration.work_space_start = Workspace;
+ New_Configuration.work_space_size = 256;
+ Case_in_switch = FATAL_WORKSPACE_TOO_SMALL;
+ break;
+
+ case FATAL_WORKSPACE_TOO_SMALL:
+ Initialization_tasks[ 0 ].initial_priority = RTEMS_CURRENT_PRIORITY;
+ New_Configuration.work_space_size = sizeof( Workspace );
+ Case_in_switch = FATAL_TASK_CREATE;
+ break;
+
+ case FATAL_TASK_CREATE:
+ Initialization_tasks[ 0 ].initial_priority = 1;
+ Initialization_tasks[ 0 ].entry_point = NULL;
+ Case_in_switch = FATAL_TASK_START;
+ break;
+
+ case FATAL_TASK_START:
+ /* this extension exits the test */
+ Initialization_tasks[ 0 ].entry_point = Init;
+ break;
+ }
+ rtems_initialize_executive( &New_Configuration, &Cpu_table );
+}
+
diff --git a/c/src/tests/sptests/spfatal/init.c b/c/src/tests/sptests/spfatal/init.c
new file mode 100644
index 0000000000..5abcec46a4
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/init.c
@@ -0,0 +1,51 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/spfatal/puterr.c b/c/src/tests/sptests/spfatal/puterr.c
new file mode 100644
index 0000000000..f7d79e5f34
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/puterr.c
@@ -0,0 +1,68 @@
+/* put_error
+ *
+ * This routine verifies that the given error is the expected error.
+ *
+ * Input parameters:
+ * error - actual error code
+ * expected - expected error code
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+char *Errors[] = {
+ "RTEMS_SUCCESSFUL", /* successful completion */
+ "RTEMS_TASK_EXITTED", /* returned from a task */
+ "RTEMS_MP_NOT_CONFIGURED", /* multiprocessing not configured */
+ "RTEMS_INVALID_NAME", /* invalid object name */
+ "RTEMS_INVALID_ID", /* invalid object id */
+ "RTEMS_TOO_MANY", /* too many */
+ "RTEMS_TIMEOUT", /* timed out waiting */
+ "RTEMS_OBJECT_WAS_DELETED", /* object was deleted while waiting */
+ "RTEMS_INVALID_SIZE", /* specified size was invalid */
+ "RTEMS_INVALID_ADDRESS", /* address specified is invalid */
+ "RTEMS_INVALID_NUMBER", /* number was invalid */
+ "RTEMS_NOT_DEFINED", /* item has not been initialized */
+ "RTEMS_RESOURCE_IN_USE", /* resources still outstanding */
+ "RTEMS_UNSATISFIED", /* request not satisfied */
+ "RTEMS_INCORRECT_STATE", /* task is in wrong state */
+ "RTEMS_ALREADY_SUSPENDED", /* task already in state */
+ "RTEMS_ILLEGAL_ON_SELF", /* illegal operation on calling task */
+ "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
+ "RTEMS_CALLED_FROM_ISR", /* called from ISR */
+ "RTEMS_INVALID_PRIORITY", /* invalid task priority */
+ "RTEMS_INVALID_CLOCK", /* invalid date/time */
+ "RTEMS_INVALID_NODE", /* invalid node id */
+ "RTEMS_NOT_OWNER_OF_RESOURCE", /* not owner of resource */
+ "RTEMS_NOT_CONFIGURED", /* directive not configured */
+ "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */
+};
+
+/* Task states */
+
+void put_error(
+ rtems_unsigned32 error,
+ rtems_status_code expected
+)
+{
+
+ if ( error <= RTEMS_NOT_IMPLEMENTED )
+ printf( "EXPECTED FATAL - error code is correctly %s\n", Errors[ error ] );
+ else
+ printf( "ERROR - out of range error code is %d\n", error );
+
+ if ( error != expected ) {
+ printf( "ERROR - did not get expected code of %d\n", expected );
+ }
+}
diff --git a/c/src/tests/sptests/spfatal/spfatal.doc b/c/src/tests/sptests/spfatal/spfatal.doc
new file mode 100644
index 0000000000..501f278670
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/spfatal.doc
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: testfatal
+
+directives: none
+
+concepts:
+
+ a. Verifies that the proper error is reported by k_fatal when a task
+ exits.
+
+ b. Verifies that the task exitted extension works correctly.
+
+ c. Verifies that the fatal error extension works corectly.
+
diff --git a/c/src/tests/sptests/spfatal/spfatal.scn b/c/src/tests/sptests/spfatal/spfatal.scn
new file mode 100644
index 0000000000..ecb9f63597
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/spfatal.scn
@@ -0,0 +1,8 @@
+*** TEST FATAL ***
+EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED
+EXPECTED FATAL - error code is correctly RTEMS_INVALID_ADDRESS
+EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED
+EXPECTED FATAL - error code is correctly RTEMS_INVALID_PRIORITY
+EXPECTED FATAL - error code is correctly RTEMS_TASK_EXITTED
+NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS
+*** END OF TEST FATAL ***
diff --git a/c/src/tests/sptests/spfatal/system.h b/c/src/tests/sptests/spfatal/system.h
new file mode 100644
index 0000000000..a1e3578a64
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/system.h
@@ -0,0 +1,79 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void put_error(
+ rtems_unsigned32 error,
+ rtems_status_code expected
+);
+
+rtems_extension Fatal_extension(
+ rtems_unsigned32 error,
+ boolean is_internal
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+extern rtems_extensions_table initial_extensions;
+
+#ifdef TEST_INIT
+rtems_extensions_table initial_extensions = {
+ NULL, /* create */
+ NULL, /* start */
+ NULL, /* restart */
+ NULL, /* delete */
+ NULL, /* switch */
+ NULL, /* begin */
+ NULL, /* exitted */
+ Fatal_extension /* fatal */
+};
+#endif
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(0)
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#define CONFIGURE_INITIAL_EXTENSIONS &initial_extensions
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_configuration_table New_Configuration;
+
+extern rtems_extensions_table Extensions;
+extern rtems_configuration_table BSP_Configuration;
+extern rtems_cpu_table Cpu_table;
+
+/* end of include file */
diff --git a/c/src/tests/sptests/spfatal/task1.c b/c/src/tests/sptests/spfatal/task1.c
new file mode 100644
index 0000000000..d06d25e690
--- /dev/null
+++ b/c/src/tests/sptests/spfatal/task1.c
@@ -0,0 +1,29 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ puts( "\n\n*** TEST FATAL ***" );
+ puts( "TA1 - exitting task" );
+}
diff --git a/c/src/tests/sptests/spsize/getint.c b/c/src/tests/sptests/spsize/getint.c
new file mode 100644
index 0000000000..43d1f695c9
--- /dev/null
+++ b/c/src/tests/sptests/spsize/getint.c
@@ -0,0 +1,32 @@
+/* getint
+ *
+ * This routine reads and returns an integer.
+ * It assumes decimal.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters:
+ * returns - number read
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int getint( void )
+{
+ char buff[16];
+
+ gets(buff);
+ return atoi(buff);
+}
diff --git a/c/src/tests/sptests/spsize/init.c b/c/src/tests/sptests/spsize/init.c
new file mode 100644
index 0000000000..d0d5490966
--- /dev/null
+++ b/c/src/tests/sptests/spsize/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Test_task();
+void size_rtems( int mode );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int choice;
+
+ setvbuf(stdout, 0, _IONBF, 0);
+
+ puts( "\n*** RTEMS SIZE PROGRAM ***" );
+ size_rtems( 1 );
+ puts( "*** END OF RTEMS SIZE PROGRAM ***" );
+ exit( 0 );
+#if 0
+ do {
+ printf( "\n\nPlease select program mode:\n" );
+ printf( " 1) Print Formulas\n" );
+ printf( " 2) Determine Workspace Size\n" );
+ printf( " 3) Exit\n" );
+ printf( "Enter number of choice (1,2,3) : " );
+
+ choice = getint();
+ switch( choice ) {
+ case 1: size_rtems( 1 ); break;
+ case 2: size_rtems( 0 ); break;
+ case 3: exit( 0 );
+ default: continue;
+ }
+ } while ( FOREVER );
+#endif
+}
diff --git a/c/src/tests/sptests/spsize/size.c b/c/src/tests/sptests/spsize/size.c
new file mode 100644
index 0000000000..9b1035e5ce
--- /dev/null
+++ b/c/src/tests/sptests/spsize/size.c
@@ -0,0 +1,648 @@
+/* main
+ *
+ * This program is run to determine the data space and work space
+ * requirements of the current version of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/directives.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/copyrt.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/extension.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/io.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+
+#include <stdlib.h>
+
+/* These are always defined by the executive.
+ *
+ * #include <rtems/copyrt.h>
+ * #include <rtems/tables.h>
+ * #include <rtems/sptables.h>
+ */
+#define HEAP_OVHD 16 /* wasted heap space per task stack */
+#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */
+#define READYCHAINS_SIZE \
+ ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))
+
+#define PER_TASK \
+ (sizeof (Thread_Control) + \
+ NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ))
+#define PER_SEMAPHORE \
+ (sizeof (Semaphore_Control) + NAME_PTR_SIZE)
+#define PER_TIMER \
+ (sizeof (Timer_Control) + NAME_PTR_SIZE)
+#define PER_MSGQ \
+ (sizeof (Message_queue_Control) + NAME_PTR_SIZE)
+#define PER_REGN \
+ (sizeof (Region_Control) + NAME_PTR_SIZE)
+#define PER_PART \
+ (sizeof (Partition_Control) + NAME_PTR_SIZE)
+#define PER_PERIOD \
+ (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE)
+#define PER_PORT \
+ (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE)
+#define PER_EXTENSION \
+ (sizeof (Extension_Control) + NAME_PTR_SIZE)
+
+#define PER_DRV (0)
+#define PER_FPTASK (CONTEXT_FP_SIZE)
+#define PER_GOBTBL (sizeof (Chain_Control)*4)
+#define PER_NODE PER_GOBTBL
+#define PER_GOBJECT (sizeof (Objects_MP_Control))
+#define PER_PROXY (sizeof (Thread_Proxy_control))
+
+#if (CPU_ALL_TASKS_ARE_FP == TRUE)
+#define MPCI_RECEIVE_SERVER_FP (sizeof( Context_Control_fp ))
+#else
+#define MPCI_RECEIVE_SERVER_FP 0
+#endif
+
+#if (CPU_IDLE_TASK_IS_FP == TRUE)
+#define SYSTEM_IDLE_FP (sizeof( Context_Control_fp ))
+#else
+#define SYSTEM_IDLE_FP 0
+#endif
+
+#define SYSTEM_TASKS \
+ (THREAD_IDLE_STACK_SIZE + \
+ MPCI_RECEIVE_SERVER_STACK_SIZE + \
+ (2*sizeof(Thread_Control))) + \
+ MPCI_RECEIVE_SERVER_FP + \
+ SYSTEM_IDLE_FP
+
+#define rtems_unsigned32 unsigned32
+
+rtems_unsigned32 sys_req;
+
+/* to avoid warnings */
+int puts();
+int printf();
+int getint();
+#undef getchar
+int getchar();
+void help_size();
+void print_formula();
+
+void size_rtems(
+ int mode
+)
+{
+int uninitialized = 0;
+int initialized = 0;
+
+/*
+ * The following data is allocated for each Manager:
+ *
+ * + Per Manager Object Information
+ * - local pointer table
+ * - local name table
+ * - the object's control blocks
+ * - global name chains
+ *
+ * The following is the data allocate from the RTEMS Workspace Area.
+ * The order indicates the order in which RTEMS allocates it.
+ *
+ * + Object MP
+ * - Global Object CB's
+ * + Thread
+ * - Ready Chain
+ * + Thread MP
+ * - Proxies Chain
+ * + Interrupt Manager
+ * - Interrupt Stack
+ * + Timer Manager
+ * - per Manager Object Data
+ * + Extension Manager
+ * - per Manager Object Data
+ * + Message Queue Manager
+ * - per Manager Object Data
+ * - Message Buffers
+ * + Semaphore Manager
+ * - per Manager Object Data
+ * + Partition Manager
+ * - per Manager Object Data
+ * + Region Manager
+ * - per Manager Object Data
+ * + Dual Ported Memory Manager
+ * - per Manager Object Data
+ * + Rate Monotonic Manager
+ * - per Manager Object Data
+ * + Internal Threads Handler
+ * - MPCI Receive Server Thread TCB
+ * - IDLE Thread TCB
+ * - MPCI Receive Server Thread stack
+ * - MPCI Receive Server Thread FP area (if CPU requires this)
+ * - IDLE Thread stack
+ * - IDLE Thread FP area (if CPU requires this)
+ *
+ * This does not take into account any CPU dependent alignment requirements.
+ *
+ * The following calculates the overhead needed by RTEMS from the
+ * Workspace Area.
+ */
+sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */
+ NAME_PTR_SIZE + /* Task Overhead */
+ READYCHAINS_SIZE + /* Ready Chains */
+ NAME_PTR_SIZE + /* Timer Overhead */
+ NAME_PTR_SIZE + /* Semaphore Overhead */
+ NAME_PTR_SIZE + /* Message Queue Overhead */
+ NAME_PTR_SIZE + /* Region Overhead */
+ NAME_PTR_SIZE + /* Partition Overhead */
+ NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */
+ NAME_PTR_SIZE + /* Rate Monotonic Overhead */
+ NAME_PTR_SIZE + /* Extension Overhead */
+ PER_NODE; /* Extra Gobject Table */
+
+uninitialized =
+/*address.h*/ 0 +
+
+/*apiext.h*/ (sizeof _API_extensions_List) +
+
+/*asr.h*/ 0 +
+
+/*attr.h*/ 0 +
+
+/*bitfield.h*/ 0 +
+
+/*chain.h*/ 0 +
+
+/*clock.h*/ 0 +
+
+/*config.h*/ (sizeof _Configuration_Table) +
+ (sizeof _Configuration_MP_table) +
+
+/*context.h*/ (sizeof _Context_Switch_necessary) +
+
+/*copyrt.h*/ 0 +
+
+/*debug.h*/ (sizeof _Debug_Level) +
+
+/*dpmem.h*/ (sizeof _Dual_ported_memory_Information) +
+
+/*event.h*/ (sizeof _Event_Sync_state) +
+
+/*eventmp.h*/ 0 +
+
+/*eventset.h*/ 0 +
+
+/*extension.h*/ (sizeof _Extension_Information) +
+
+/*fatal.h*/ 0 +
+
+/*heap.h*/ 0 +
+
+/*init.h*/ 0 +
+
+/*interr.h*/ (sizeof Internal_errors_What_happened) +
+
+/*intr.h*/ 0 +
+
+/*io.h*/ (sizeof _IO_Number_of_drivers) +
+ (sizeof _IO_Driver_address_table) +
+ (sizeof _IO_Number_of_devices) +
+ (sizeof _IO_Driver_name_table) +
+
+/*isr.h*/ (sizeof _ISR_Nest_level) +
+ (sizeof _ISR_Vector_table) +
+ (sizeof _ISR_Signals_to_thread_executing) +
+
+/*message.h*/ (sizeof _Message_queue_Information) +
+
+/*modes.h*/ 0 +
+
+/*mp.h*/ 0 +
+
+/*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) +
+ (sizeof _MPCI_Semaphore) +
+ (sizeof _MPCI_table) +
+ (sizeof _MPCI_Receive_server_tcb) +
+ (sizeof _MPCI_Packet_processors) +
+
+/*mppkt.h*/ 0 +
+
+/*mptables.h*/ 0 +
+
+/*msgmp.h*/ 0 +
+
+/*object.h*/ (sizeof _Objects_Local_node) +
+ (sizeof _Objects_Maximum_nodes) +
+ (sizeof _Objects_Information_table) +
+
+/*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) +
+ (sizeof _Objects_MP_Inactive_global_objects) +
+
+/*options.h*/ 0 +
+
+/*part.h*/ (sizeof _Partition_Information) +
+
+/*partmp.h*/ 0 +
+
+/*priority.h*/ (sizeof _Priority_Major_bit_map) +
+ (sizeof _Priority_Bit_map) +
+
+/*ratemon.h*/ (sizeof _Rate_monotonic_Information) +
+
+/*region.h*/ (sizeof _Region_Information) +
+
+/*regionmp.h*/ 0 +
+
+/*rtems.h*/ /* Not applicable */
+
+/*sem.h*/ (sizeof _Semaphore_Information) +
+
+/*semmp.h*/ 0 +
+
+/*signal.h*/ 0 +
+
+/*signalmp.h*/ 0 +
+
+/*stack.h*/ 0 +
+
+/*states.h*/ 0 +
+
+/*status.h*/ 0 +
+
+/*sysstate.h*/ (sizeof _System_state_Is_multiprocessing) +
+ (sizeof _System_state_Current) +
+
+/*system.h*/ (sizeof _CPU_Table) +
+
+/*taskmp.h*/ 0 +
+
+/*tasks.h*/ (sizeof _RTEMS_tasks_Information) +
+ (sizeof _RTEMS_tasks_User_initialization_tasks) +
+ (sizeof _RTEMS_tasks_Number_of_initialization_tasks) +
+
+/*thread.h*/ (sizeof _Thread_BSP_context) +
+ (sizeof _Thread_Dispatch_disable_level) +
+ (sizeof _Thread_Maximum_extensions) +
+ (sizeof _Thread_Ticks_remaining_in_timeslice) +
+ (sizeof _Thread_Ticks_per_timeslice) +
+ (sizeof _Thread_Ready_chain) +
+ (sizeof _Thread_Executing) +
+ (sizeof _Thread_Heir) +
+ (sizeof _Thread_Allocated_fp) +
+ (sizeof _Thread_Internal_information) +
+ (sizeof _Thread_Idle) +
+
+/*threadmp.h*/ (sizeof _Thread_MP_Receive) +
+ (sizeof _Thread_MP_Active_proxies) +
+ (sizeof _Thread_MP_Inactive_proxies) +
+
+/*threadq.h*/ (sizeof _Thread_queue_Extract_table) +
+
+/*timer.h*/ (sizeof _Timer_Information) +
+
+/*tod.h*/ (sizeof _TOD_Current) +
+ (sizeof _TOD_Seconds_since_epoch) +
+ (sizeof _TOD_Ticks_since_boot) +
+ (sizeof _TOD_Microseconds_per_tick) +
+ (sizeof _TOD_Ticks_per_second) +
+ (sizeof _TOD_Seconds_watchdog) +
+
+/*tqdata.h*/ 0 +
+
+/*types.h*/ 0 +
+
+/*userext.h*/ (sizeof _User_extensions_Initial) +
+ (sizeof _User_extensions_List) +
+
+/*watchdog.h*/ (sizeof _Watchdog_Sync_level) +
+ (sizeof _Watchdog_Sync_count) +
+ (sizeof _Watchdog_Ticks_chain) +
+ (sizeof _Watchdog_Seconds_chain) +
+
+/*wkspace.h*/ (sizeof _Workspace_Area);
+
+uninitialized = 0;
+
+#ifndef unix /* make sure this is not a native compile */
+
+#ifdef i386
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef i960
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef hppa1_1
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+#ifndef RTEMS_UNIX
+ (sizeof _CPU_Default_gr27) +
+#endif
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+#endif
+
+#ifdef m68k
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef sparc
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Trap_Table_area);
+
+#ifdef erc32
+uninitialized += (sizeof _ERC32_MEC_Timer_Control_Mirror);
+#endif
+
+
+#endif
+
+
+#ifdef no_cpu
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_Thread_dispatch_pointer);
+
+#endif
+
+#ifdef ppc
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_IRQ_info);
+
+#endif
+#endif /* !unix */
+
+initialized +=
+/*copyrt.h*/ (strlen(_Copyright_Notice)+1) +
+
+/*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) +
+ (strlen(_RTEMS_version)+1) +
+ (sizeof _Entry_points) +
+
+
+/*tod.h*/ (sizeof _TOD_Days_per_month) +
+ (sizeof _TOD_Days_to_date) +
+ (sizeof _TOD_Days_since_last_leap_year);
+
+#ifndef unix /* make sure this is not native */
+#ifdef sparc
+
+initialized += (sizeof _CPU_Trap_slot_template);
+
+#endif
+#endif /* !unix */
+
+puts( "" );
+
+ if ( mode == 0 ) help_size();
+ else print_formula();
+
+printf( "\n" );
+printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized );
+printf( "RTEMS intialized data consumes %d bytes\n", initialized );
+
+}
+
+void help_size()
+{
+int c = '\0';
+int break_loop;
+int total_size;
+int task_stacks;
+int interrupt_stack;
+int maximum_tasks, size_tasks;
+int maximum_sems, size_sems;
+int maximum_timers, size_timers;
+int maximum_msgqs, size_msgqs;
+int maximum_msgs, size_msgs_overhead;
+int maximum_regns, size_regns;
+int maximum_parts, size_parts;
+int maximum_ports, size_ports;
+int maximum_periods, size_periods;
+int maximum_extensions, size_extensions;
+int maximum_drvs, size_drvs;
+int maximum_fps, size_fps;
+int maximum_nodes, size_nodes;
+int maximum_gobjs, size_gobjs;
+int maximum_proxies, size_proxies;
+
+total_size = sys_req; /* Fixed Overhead */
+printf( "What is maximum_tasks? " );
+maximum_tasks = getint();
+size_tasks = PER_TASK * maximum_tasks;
+total_size += size_tasks;
+
+printf( "What is maximum_semaphores? " );
+maximum_sems = getint();
+size_sems = PER_SEMAPHORE * maximum_sems;
+total_size += size_sems;
+
+printf( "What is maximum_timers? " );
+maximum_timers = getint();
+size_timers = PER_TIMER * maximum_timers;
+total_size += size_timers;
+
+printf( "What is maximum_message_queues? " );
+maximum_msgqs = getint();
+size_msgqs = PER_MSGQ * maximum_msgqs;
+total_size += size_msgqs;
+
+printf( "What is maximum_messages? XXXX " );
+maximum_msgs = getint();
+size_msgs_overhead = 0;
+total_size += size_msgs_overhead;
+
+printf( "What is maximum_regions? " );
+maximum_regns = getint();
+size_regns = PER_REGN * maximum_regns;
+total_size += size_regns;
+
+printf( "What is maximum_partitions? " );
+maximum_parts = getint();
+size_parts = PER_PART * maximum_parts;
+total_size += size_parts;
+
+printf( "What is maximum_ports? " );
+maximum_ports = getint();
+size_ports = PER_PORT * maximum_ports;
+total_size += size_ports;
+
+printf( "What is maximum_periods? " );
+maximum_periods = getint();
+size_periods = PER_PORT * maximum_periods;
+total_size += size_periods;
+
+printf( "What is maximum_extensions? " );
+maximum_extensions = getint();
+size_extensions = PER_EXTENSION * maximum_extensions;
+total_size += size_extensions;
+
+printf( "What is number_of_device_drivers? " );
+maximum_drvs = getint();
+size_drvs = PER_DRV * maximum_drvs;
+total_size += size_drvs;
+
+printf( "What will be total stack requirement for all tasks? " );
+task_stacks = getint();
+total_size += task_stacks;
+
+printf( "What is the size of the interrupt stack? " );
+interrupt_stack = getint();
+total_size += interrupt_stack;
+
+printf( "How many tasks will be created with the FP flag? " );
+maximum_fps = getint();
+size_fps = PER_FPTASK * maximum_fps;
+total_size += size_fps;
+
+printf( "Is this a single processor system? " );
+for ( break_loop=0 ; !break_loop; c = getchar() ) {
+ switch ( c ) {
+ case 'Y': case 'y':
+ case 'N': case 'n':
+ break_loop = 1;
+ break;
+ }
+}
+printf( "%c\n", c );
+if ( c == 'n' || c == 'N' ) {
+ printf( "What is maximum_nodes? " );
+ maximum_nodes = getint();
+ size_nodes = PER_NODE * maximum_nodes;
+ total_size += size_nodes;
+ printf( "What is maximum_global_objects? " );
+ maximum_gobjs = getint();
+ size_gobjs = PER_GOBJECT * maximum_gobjs;
+ total_size += size_gobjs;
+ printf( "What is maximum_proxies? " );
+ maximum_proxies = getint();
+ size_proxies = PER_PROXY * maximum_proxies;
+ total_size += size_proxies;
+} else {
+ maximum_nodes = 0;
+ size_nodes = PER_NODE * 0;
+ maximum_gobjs = 0;
+ size_gobjs = PER_GOBJECT * 0;
+ maximum_proxies = 0;
+ size_proxies = PER_PROXY * 0;
+}
+
+printf( "\n\n" );
+printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );
+printf( " Tasks - %03d * %03d = %d\n",
+ maximum_tasks, PER_TASK, size_tasks );
+printf( " Semaphores - %03d * %03d = %d\n",
+ maximum_sems, PER_SEMAPHORE, size_sems );
+printf( " Timers - %03d * %03d = %d\n",
+ maximum_timers, PER_TIMER, size_timers );
+printf( " Msg Queues - %03d * %03d = %d\n",
+ maximum_msgqs, PER_MSGQ, size_msgqs );
+printf( " Messages Overhead - %03d * %03d = %d\n",
+ maximum_msgs, 0 /* PER_MSG_OVERHEAD */, size_msgs_overhead );
+printf( " Regions - %03d * %03d = %d\n",
+ maximum_regns, PER_REGN, size_regns);
+printf( " Partitions - %03d * %03d = %d\n",
+ maximum_parts, PER_PART, size_parts );
+printf( " Periods - %03d * %03d = %d\n",
+ maximum_periods, PER_PERIOD, size_periods );
+printf( " Extensions - %03d * %03d = %d\n",
+ maximum_extensions, PER_EXTENSION, size_extensions );
+printf( " Device Drivers - %03d * %03d = %d\n",
+ maximum_drvs, PER_DRV, size_drvs );
+
+printf( " System Requirements - %04d = %d\n",
+ sys_req, sys_req );
+
+printf( " Floating Point Tasks - %03d * %03d = %d\n",
+ maximum_fps, PER_FPTASK, size_fps );
+printf( " Application Task Stacks - = %d\n",
+ task_stacks );
+printf( " Interrupt Stacks - = %d\n",
+ task_stacks );
+printf( " \n" );
+printf( " Global object tables - %03d * %03d = %d\n",
+ maximum_nodes, PER_NODE, size_nodes );
+printf( " Global objects - %03d * %03d = %d\n",
+ maximum_gobjs, PER_GOBJECT, size_gobjs );
+printf( " Proxies - %03d * %03d = %d\n",
+ maximum_proxies, PER_PROXY, size_proxies );
+printf( "\n\n" );
+printf( " TOTAL = %d bytes\n",
+ total_size );
+}
+
+void print_formula()
+{
+printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" );
+printf( " Tasks - maximum_tasks * %d\n", PER_TASK );
+printf( " Timers - maximum_timers * %d\n", PER_TIMER );
+printf( " Semaphores - maximum_semaphores * %d\n", PER_SEMAPHORE);
+printf( " Message Queues - maximum_message_queues * %d\n", PER_MSGQ );
+printf( " Messages -\n");
+printf( " Regions - maximum_regions * %d\n", PER_REGN );
+printf( " Partitions - maximum_partitions * %d\n", PER_PART );
+printf( " Ports - maximum_ports * %d\n", PER_PORT );
+printf( " Periods - maximum_periods * %d\n", PER_PORT );
+printf( " Extensions - maximum_extensions * %d\n", PER_EXTENSION );
+printf( " Device Drivers - number_of_device_drivers * %d\n", PER_DRV);
+printf( " System Requirements - %d\n", sys_req );
+printf( " Floating Point Tasks - FPMASK Tasks * %d\n", CONTEXT_FP_SIZE );
+printf( " User's Tasks' Stacks -\n" );
+printf( " Interrupt Stack -\n" );
+printf( " \n" );
+printf( " Global object tables - maximum_nodes * %d\n", PER_NODE );
+printf( " Global objects - maximum_global_objects * %d\n", PER_GOBJECT );
+printf( " Proxies - maximum_proxies * %d\n", PER_PROXY );
+}
diff --git a/c/src/tests/sptests/spsize/system.h b/c/src/tests/sptests/spsize/system.h
new file mode 100644
index 0000000000..f55ddf99aa
--- /dev/null
+++ b/c/src/tests/sptests/spsize/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+int getint( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/support/include/tmacros.h b/c/src/tests/support/include/tmacros.h
new file mode 100644
index 0000000000..f5c5e8bfbf
--- /dev/null
+++ b/c/src/tests/support/include/tmacros.h
@@ -0,0 +1,127 @@
+/* tmacros.h
+ *
+ * This include file contains macros which are useful in the RTEMS
+ * test suites.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TMACROS_h
+#define __TMACROS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bsp.h> /* includes <rtems.h> */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FOREVER 1 /* infinite loop */
+
+#ifdef TEST_INIT
+#define TEST_EXTERN
+#define CONFIGURE_INIT
+#else
+#define TEST_EXTERN extern
+#endif
+
+#define directive_failed( dirstat, failmsg ) \
+ fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg )
+
+#define fatal_directive_status( stat, desired, msg ) \
+ do { \
+ if ( (stat) != (desired) ) { \
+ printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
+ (msg), (desired), (stat) ); \
+ fflush(stdout); \
+ exit( stat ); \
+ } \
+ } while ( 0 )
+
+#define sprint_time(str,s1,tb,s2) \
+ do { \
+ sprintf( (str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 ); \
+ } while ( 0 )
+
+#define print_time(s1,tb,s2) \
+ do { \
+ printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 ); \
+ fflush(stdout); \
+ } while ( 0 )
+
+#define put_dot( c ) putchar( c ); fflush( stdout )
+
+#define new_line puts( "" )
+
+#define puts_nocr printf
+
+#define rtems_test_pause() \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause>" ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define rtems_test_pause_and_screen_number( _screen ) \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause - screen %d>", (_screen) ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define put_name( name, crlf ) \
+{ rtems_unsigned32 c0, c1, c2, c3; \
+ c0 = (name >> 24) & 0xff; \
+ c1 = (name >> 16) & 0xff; \
+ c2 = (name >> 8) & 0xff; \
+ c3 = name & 0xff; \
+ putchar( (char)c0 ); \
+ if ( c1 ) putchar( (char)c1 ); \
+ if ( c2 ) putchar( (char)c2 ); \
+ if ( c3 ) putchar( (char)c3 ); \
+ if ( crlf ) \
+ putchar( '\n' ); \
+}
+
+#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \
+ { (TB)->year = YR; \
+ (TB)->month = MON; \
+ (TB)->day = DAY; \
+ (TB)->hour = HR; \
+ (TB)->minute = MIN; \
+ (TB)->second = SEC; \
+ (TB)->ticks = TK; }
+
+#define task_number( tid ) \
+ ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks )
+
+static inline rtems_unsigned32 get_ticks_per_second( void )
+{
+ rtems_interval ticks_per_second;
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
+ return ticks_per_second;
+}
+
+#define TICKS_PER_SECOND get_ticks_per_second()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/tests/support/stubdr/close.c b/c/src/tests/support/stubdr/close.c
new file mode 100644
index 0000000000..02cd37f0a8
--- /dev/null
+++ b/c/src/tests/support/stubdr/close.c
@@ -0,0 +1,34 @@
+/* Stub_close
+ *
+ * This routine is the terminal driver close routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to close parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/cntrl.c b/c/src/tests/support/stubdr/cntrl.c
new file mode 100644
index 0000000000..0d21af5f4f
--- /dev/null
+++ b/c/src/tests/support/stubdr/cntrl.c
@@ -0,0 +1,34 @@
+/* Stub_control
+ *
+ * This routine is the terminal driver control routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to cntrl parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/init.c b/c/src/tests/support/stubdr/init.c
new file mode 100644
index 0000000000..bf6ee998cf
--- /dev/null
+++ b/c/src/tests/support/stubdr/init.c
@@ -0,0 +1,37 @@
+/* Stub_initialize
+ *
+ * This routine is the terminal driver init routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_unsigned32 STUB_major;
+
+rtems_device_driver Stub_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ STUB_major = major;
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/open.c b/c/src/tests/support/stubdr/open.c
new file mode 100644
index 0000000000..01bc414f56
--- /dev/null
+++ b/c/src/tests/support/stubdr/open.c
@@ -0,0 +1,34 @@
+/* Stub_open
+ *
+ * This routine is the terminal driver open routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to open parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/read.c b/c/src/tests/support/stubdr/read.c
new file mode 100644
index 0000000000..ccf508acf1
--- /dev/null
+++ b/c/src/tests/support/stubdr/read.c
@@ -0,0 +1,34 @@
+/* Stub_read
+ *
+ * This routine is the terminal driver read routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to read parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/stubdrv.h b/c/src/tests/support/stubdr/stubdrv.h
new file mode 100644
index 0000000000..2ca201c3a8
--- /dev/null
+++ b/c/src/tests/support/stubdr/stubdrv.h
@@ -0,0 +1,69 @@
+/* stubdrv.h
+ *
+ * This file describes the Stub Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STUB_DRIVER_h
+#define __STUB_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define STUB_DRIVER_TABLE_ENTRY \
+ { Stub_initialize, NULL, NULL, NULL, NULL, NULL }
+
+#define STUB_SUCCESSFUL RTEMS_SUCCESSFUL
+
+rtems_device_driver Stub_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Stub_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Stub_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Stub_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Stub_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Stub_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/tests/support/stubdr/write.c b/c/src/tests/support/stubdr/write.c
new file mode 100644
index 0000000000..bc57a2a0cf
--- /dev/null
+++ b/c/src/tests/support/stubdr/write.c
@@ -0,0 +1,34 @@
+/* Stub_write
+ *
+ * This routine is the terminal driver write routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to write parameter block
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+)
+{
+ return STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/tmtests/README b/c/src/tests/tmtests/README
new file mode 100644
index 0000000000..c27617d5a3
--- /dev/null
+++ b/c/src/tests/tmtests/README
@@ -0,0 +1,21 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Timing Test Suite.
+The tests in this directory are used to measure the execution
+time of RTEMS directive and some critical internal functions.
+The results of these test are reported in the Fact Sheets
+and Supplental Manuals.
+
+These tests attempt to benchmark RTEMS as the user would. They measure
+the execution time for a directive (under various circumstances)
+from the time RTEMS is entered until it is executed. Where possible,
+the time is the average of at least 100 invocations of the directive.
+
+The accuracy of the times reported by these benchmarks is very dependent
+on the resolution of the timer being used. It is also important to
+insure that all sources of hardware interrupts are disabled during
+execution of the tests. This insures that the directive time reported
+does not include any interrupt time.
+
diff --git a/c/src/tests/tmtests/include/timesys.h b/c/src/tests/tmtests/include/timesys.h
new file mode 100644
index 0000000000..22034a2797
--- /dev/null
+++ b/c/src/tests/tmtests/include/timesys.h
@@ -0,0 +1,58 @@
+/* timesys.h
+ *
+ * This header file contains the global variables for the Time
+ * suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/*
+ * How many times a particular operation is performed while timed.
+ */
+
+#define OPERATION_COUNT 100
+#define IT_COUNT 100
+
+/* functions */
+
+#define put_time( _message, _total_time, \
+ _iterations, _loop_overhead, _overhead ) \
+ printf( \
+ "%s %d\n", \
+ (_message), \
+ (((_total_time) - (_loop_overhead)) / (_iterations)) - (_overhead) \
+ )
+
+#if defined(STACK_CHECKER_ON) || defined(RTEMS_DEBUG)
+#define Print_Warning() \
+ do { \
+ puts( \
+ "\n" \
+ "THE TIMES REPORTED BY THIS TEST INCLUDE DEBUG CODE!\n" \
+ "\n" \
+ ); \
+ } while (0)
+
+#else
+#define Print_Warning()
+#endif
+
+/* variables */
+
+TEST_EXTERN volatile rtems_unsigned32 end_time; /* ending time variable */
+TEST_EXTERN volatile rtems_unsigned32 overhead; /* loop overhead variable */
+
+TEST_EXTERN rtems_id Task_id[ OPERATION_COUNT+1 ]; /* array of task ids */
+TEST_EXTERN rtems_id Task_name[ OPERATION_COUNT+1 ]; /* array of task names */
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm01/system.h b/c/src/tests/tmtests/tm01/system.h
new file mode 100644
index 0000000000..190361f77c
--- /dev/null
+++ b/c/src/tests/tmtests/tm01/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm01/task1.c b/c/src/tests/tmtests/tm01/task1.c
new file mode 100644
index 0000000000..4e7dae89cd
--- /dev/null
+++ b/c/src/tests/tmtests/tm01/task1.c
@@ -0,0 +1,189 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 1 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 semaphore_obtain_time;
+ rtems_unsigned32 semaphore_release_time;
+ rtems_unsigned32 semaphore_obtain_no_wait_time;
+ rtems_unsigned32 semaphore_obtain_loop_time;
+ rtems_unsigned32 semaphore_release_loop_time;
+ rtems_unsigned32 index;
+ rtems_unsigned32 iterations;
+ rtems_name name;
+ rtems_id smid;
+ rtems_status_code status;
+
+ name = rtems_build_name( 'S', 'M', '1', ' ' );
+
+ semaphore_obtain_time = 0;
+ semaphore_release_time = 0;
+ semaphore_obtain_no_wait_time = 0;
+ semaphore_obtain_loop_time = 0;
+ semaphore_release_loop_time = 0;
+
+
+ /* Time one invocation of rtems_semaphore_create */
+
+ Timer_initialize();
+ (void) rtems_semaphore_create(
+ name,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_NO_PRIORITY,
+ &smid
+ );
+ end_time = Read_timer();
+ put_time(
+ "rtems_semaphore_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_CREATE
+ );
+
+ /* Time one invocation of rtems_semaphore_delete */
+
+ Timer_initialize();
+ (void) rtems_semaphore_delete( smid );
+ end_time = Read_timer();
+ put_time(
+ "rtems_semaphore_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_CREATE
+ );
+
+ status = rtems_semaphore_create(
+ name,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &smid
+ );
+
+ for ( iterations=OPERATION_COUNT ; iterations ; iterations-- ) {
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ semaphore_obtain_loop_time += end_time;
+ semaphore_release_loop_time += end_time;
+
+ /* rtems_semaphore_obtain (available) */
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_obtain(
+ smid,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ end_time = Read_timer();
+
+ semaphore_obtain_time += end_time;
+
+ /* rtems_semaphore_release */
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_release( smid );
+ end_time = Read_timer();
+
+ semaphore_release_time += end_time;
+
+ /* semaphore obtain (RTEMS_NO_WAIT) */
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ rtems_semaphore_obtain( smid, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT );
+ semaphore_obtain_no_wait_time += Read_timer();
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ rtems_semaphore_release( smid );
+ end_time = Read_timer();
+
+ semaphore_release_time += end_time;
+ }
+
+ put_time(
+ "rtems_semaphore_obtain: available",
+ semaphore_obtain_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ semaphore_obtain_loop_time,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ put_time(
+ "rtems_semaphore_obtain: not available -- NO_WAIT",
+ semaphore_obtain_no_wait_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ semaphore_obtain_loop_time,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ put_time(
+ "rtems_semaphore_release: no waiting tasks",
+ semaphore_release_time,
+ OPERATION_COUNT * OPERATION_COUNT * 2,
+ semaphore_release_loop_time * 2,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ puts( "*** END OF TEST 1 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm01/tm01.doc b/c/src/tests/tmtests/tm01/tm01.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm01/tm01.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm02/system.h b/c/src/tests/tmtests/tm02/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm02/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm02/task1.c b/c/src/tests/tmtests/tm02/task1.c
new file mode 100644
index 0000000000..fed5e63b12
--- /dev/null
+++ b/c/src/tests/tmtests/tm02/task1.c
@@ -0,0 +1,158 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id High_id;
+rtems_id Low_id;
+rtems_id Semaphore_id;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 2 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_priority priority;
+
+ priority = 5;
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &High_id
+ );
+ directive_failed( status, "rtems_task_create of high task" );
+
+ priority++;
+
+ status = rtems_task_start( High_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of high task" );
+
+ for ( index=2 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Low_id
+ );
+ directive_failed( status, "rtems_task_create middle" );
+
+ priority++;
+
+ status = rtems_task_start( Low_id, Middle_tasks, 0 );
+ directive_failed( status, "rtems_task_start middle" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Low_id
+ );
+ directive_failed( status, "rtems_task_create low" );
+
+ status = rtems_task_start( Low_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start low" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' '),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Timer_initialize(); /* start blocking rtems_semaphore_obtain time */
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_obtain: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm02/tm02.doc b/c/src/tests/tmtests/tm02/tm02.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm02/tm02.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm03/system.h b/c/src/tests/tmtests/tm03/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm03/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm03/task1.c b/c/src/tests/tmtests/tm03/task1.c
new file mode 100644
index 0000000000..f0ad2559bd
--- /dev/null
+++ b/c/src/tests/tmtests/tm03/task1.c
@@ -0,0 +1,151 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id task_id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 3 ***" );
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 252,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of test_init" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start of test_init" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_id task_id;
+ rtems_task_priority priority;
+
+ priority = 250;
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', '\0'),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ for ( index = 2 ; index <= OPERATION_COUNT ; index ++ ) {
+ rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create middle" );
+
+ priority--;
+
+ rtems_task_start( task_id, Middle_tasks, 0 );
+ directive_failed( status, "rtems_task_start middle" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of high task" );
+
+ status = rtems_task_start( task_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of high task" );
+
+ Timer_initialize(); /* start the timer */
+ status = rtems_semaphore_release( Semaphore_id );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ status = rtems_semaphore_release( Semaphore_id );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ puts( "*** END OF TEST 3 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm03/tm03.doc b/c/src/tests/tmtests/tm03/tm03.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm03/tm03.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm04/system.h b/c/src/tests/tmtests/tm04/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/c/src/tests/tmtests/tm04/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm04/task1.c b/c/src/tests/tmtests/tm04/task1.c
new file mode 100644
index 0000000000..0b10c92bf0
--- /dev/null
+++ b/c/src/tests/tmtests/tm04/task1.c
@@ -0,0 +1,388 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+rtems_id Task_id[OPERATION_COUNT+1];
+rtems_unsigned32 task_count;
+rtems_id Highest_id;
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Restart_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 4 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ task_count = OPERATION_COUNT;
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_task_start( Task_id[ index ], Low_tasks, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' ' ),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+}
+
+rtems_task Highest_task(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority old_priority;
+ rtems_status_code status;
+
+ if ( argument == 1 ) {
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: blocked task -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ status = rtems_task_set_priority(
+ RTEMS_CURRENT_PRIORITY,
+ 254,
+ &old_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ } else if ( argument == 2 ) {
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: ready task -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+
+ } else
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_name name;
+ rtems_task_priority old_priority;
+
+ Timer_initialize();
+ (void) rtems_task_restart( Highest_id, 1 );
+ /* preempted by Higher_task */
+
+ Timer_initialize();
+ (void) rtems_task_restart( Highest_id, 2 );
+ /* preempted by Higher_task */
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_semaphore_release( Semaphore_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ name = rtems_build_name( 'T', 'I', 'M', 'E' );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_delete( Task_id[index] );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_task_create(
+ name,
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_task_start( Task_id[ index ], Low_tasks, 0 );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_start",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_START
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_delete( Task_id[ index ] );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ name,
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], Restart_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ status = rtems_task_suspend( Task_id[ index ] );
+ directive_failed( status, "rtems_task_suspend LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: suspended task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_suspend( Task_id[ index ] );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: suspended task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ name,
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], Restart_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: ready task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_set_priority( Task_id[ index ], 5, &old_priority );
+ directive_failed( status, "rtems_task_set_priority loop" );
+ }
+
+ /* yield processor -- tasks block */
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: blocked task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ /* yield processor -- tasks block */
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: blocked task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ task_count--;
+
+ if ( task_count == 0 ) {
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', ' ', ' ' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create HI" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_start HI" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Highest_id
+ );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ status = rtems_task_start( Highest_id, Highest_task, 0 );
+ directive_failed( status, "rtems_task_start HIGH" );
+
+ }
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Restart_task(
+ rtems_task_argument argument
+)
+{
+ if ( argument == 1 )
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/c/src/tests/tmtests/tm04/tm04.doc b/c/src/tests/tmtests/tm04/tm04.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm04/tm04.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm05/system.h b/c/src/tests/tmtests/tm05/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm05/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm05/task1.c b/c/src/tests/tmtests/tm05/task1.c
new file mode 100644
index 0000000000..c531bf347b
--- /dev/null
+++ b/c/src/tests/tmtests/tm05/task1.c
@@ -0,0 +1,132 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[OPERATION_COUNT+1];
+rtems_unsigned32 Task_index;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 5 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_unsigned32 index;
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ priority--;
+
+ if ( index==0 ) task_entry = Low_task;
+ else if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ puts( "*** END OF TEST 5 ***" );
+ exit( 0 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ Task_index++;
+ (void) rtems_task_resume( Task_id[ Task_index ] );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend: calling task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_SUSPEND
+ );
+
+ Task_index = 1;
+ Timer_initialize();
+ (void) rtems_task_resume( Task_id[ Task_index ] );
+}
diff --git a/c/src/tests/tmtests/tm05/tm05.doc b/c/src/tests/tmtests/tm05/tm05.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm05/tm05.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm06/system.h b/c/src/tests/tmtests/tm06/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm06/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm06/task1.c b/c/src/tests/tmtests/tm06/task1.c
new file mode 100644
index 0000000000..0eb0f2aa3c
--- /dev/null
+++ b/c/src/tests/tmtests/tm06/task1.c
@@ -0,0 +1,162 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[ OPERATION_COUNT + 1 ];
+
+rtems_unsigned32 Task_restarted;
+
+rtems_task null_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+void test_init( void );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 6 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init( void )
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Task_restarted = OPERATION_COUNT;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ if ( Task_restarted == OPERATION_COUNT )
+ Timer_initialize();
+
+ Task_restarted--;
+
+ if ( Task_restarted != 0 )
+ (void) rtems_task_restart( RTEMS_SELF, 0 );
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_task_restart: calling task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_task_start( Task_id[ index ], null_task, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_suspend( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend: returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_SUSPEND
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_resume( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: ready task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+}
+
+rtems_task null_task(
+ rtems_task_argument argument
+)
+{
+ while ( FOREVER )
+ ;
+}
diff --git a/c/src/tests/tmtests/tm06/tm06.doc b/c/src/tests/tmtests/tm06/tm06.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm06/tm06.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm07/system.h b/c/src/tests/tmtests/tm07/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm07/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm07/task1.c b/c/src/tests/tmtests/tm07/task1.c
new file mode 100644
index 0000000000..975a1cbf1a
--- /dev/null
+++ b/c/src/tests/tmtests/tm07/task1.c
@@ -0,0 +1,120 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[ OPERATION_COUNT+1 ], task_index;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 7 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+
+ priority = 250;
+
+ for( index=0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[index]
+ );
+ directive_failed( status, "rtems_task_create" );
+ priority--;
+
+ if ( index == 0 ) task_entry = Low_task;
+ else if ( index == OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[index], task_entry, 0 );
+ directive_failed( status, "rtems_task_start" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ if ( argument != 0 ) {
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: suspended task -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+ } else
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ puts( "*** END OF TEST 7 ***" );
+ exit( 0 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ task_index++;
+
+ if ( argument != 0 )
+ (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
+ else
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ task_index = 1;
+
+ Timer_initialize();
+ (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
+}
diff --git a/c/src/tests/tmtests/tm07/tm07.doc b/c/src/tests/tmtests/tm07/tm07.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm07/tm07.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm08/system.h b/c/src/tests/tmtests/tm08/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/c/src/tests/tmtests/tm08/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm08/task1.c b/c/src/tests/tmtests/tm08/task1.c
new file mode 100644
index 0000000000..698317edae
--- /dev/null
+++ b/c/src/tests/tmtests/tm08/task1.c
@@ -0,0 +1,255 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Test_task_id;
+
+rtems_task test_task(
+ rtems_task_argument argument
+);
+rtems_task test_task1(
+ rtems_task_argument argument
+);
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 8 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+
+ status = rtems_task_create(
+ 1,
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Test_task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Test_task_id, test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_create(
+ 1,
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Test_task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Test_task_id, test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+}
+
+rtems_task test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_priority old_priority;
+ rtems_time_of_day time;
+ rtems_unsigned32 old_note;
+ rtems_unsigned32 old_mode;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_priority(
+ Test_task_id,
+ RTEMS_CURRENT_PRIORITY,
+ &old_priority
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: obtain current priority",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_priority( Test_task_id, 253, &old_priority );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_mode(
+ RTEMS_CURRENT_MODE,
+ RTEMS_CURRENT_MODE,
+ &old_mode
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: obtain current mode",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ (void) rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(1),
+ RTEMS_INTERRUPT_MASK,
+ &old_mode
+ );
+ (void) rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_INTERRUPT_MASK,
+ &old_mode
+ );
+ }
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: no reschedule",
+ end_time,
+ OPERATION_COUNT * 2,
+ overhead,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ Timer_initialize(); /* must be one host */
+ (void) rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &old_mode );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: reschedule -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_task_set_priority( Test_task_id, 1, &old_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ /* preempted by test_task1 */
+ Timer_initialize();
+ (void) rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_note( Test_task_id, 8, 10 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_NOTE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_get_note( Test_task_id, 8, &old_note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_get_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_GET_NOTE
+ );
+
+ build_time( &time, 1, 1, 1988, 0, 0, 0, 0 );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_clock_set( &time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_set",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_CLOCK_SET
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_get",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_CLOCK_GET
+ );
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+}
+
+rtems_task test_task1(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: reschedule -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
diff --git a/c/src/tests/tmtests/tm08/tm08.doc b/c/src/tests/tmtests/tm08/tm08.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm08/tm08.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm09/system.h b/c/src/tests/tmtests/tm09/system.h
new file mode 100644
index 0000000000..992484e777
--- /dev/null
+++ b/c/src/tests/tmtests/tm09/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm09/task1.c b/c/src/tests/tmtests/tm09/task1.c
new file mode 100644
index 0000000000..4dbc0e14e7
--- /dev/null
+++ b/c/src/tests/tmtests/tm09/task1.c
@@ -0,0 +1,226 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+void queue_test();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 9 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Test_task (
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+ rtems_message_queue_create(
+ 1,
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE
+ );
+
+ queue_test();
+
+ Timer_initialize();
+ rtems_message_queue_delete( Queue_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE
+ );
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
+
+void queue_test()
+{
+ rtems_unsigned32 send_loop_time;
+ rtems_unsigned32 urgent_loop_time;
+ rtems_unsigned32 receive_loop_time;
+ rtems_unsigned32 send_time;
+ rtems_unsigned32 urgent_time;
+ rtems_unsigned32 receive_time;
+ rtems_unsigned32 empty_flush_time;
+ rtems_unsigned32 flush_time;
+ rtems_unsigned32 empty_flush_count;
+ rtems_unsigned32 flush_count;
+ rtems_unsigned32 index;
+ rtems_unsigned32 iterations;
+ long buffer[4];
+ rtems_status_code status;
+ rtems_unsigned32 size;
+
+ send_loop_time = 0;
+ urgent_loop_time = 0;
+ receive_loop_time = 0;
+ send_time = 0;
+ urgent_time = 0;
+ receive_time = 0;
+ empty_flush_time = 0;
+ flush_time = 0;
+ flush_count = 0;
+ empty_flush_count = 0;
+
+ for ( iterations = 1 ; iterations <= OPERATION_COUNT ; iterations++ ) {
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ send_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ urgent_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ receive_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4])buffer, 16 );
+ send_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ receive_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4])buffer, 16 );
+ urgent_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ receive_time += Read_timer();
+
+ Timer_initialize();
+ rtems_message_queue_flush( Queue_id, &empty_flush_count );
+ empty_flush_time += Read_timer();
+
+ /* send one message to flush */
+ status = rtems_message_queue_send(
+ Queue_id,
+ (long (*)[4])buffer,
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Timer_initialize();
+ rtems_message_queue_flush( Queue_id, &flush_count );
+ flush_time += Read_timer();
+ }
+
+ put_time(
+ "rtems_message_queue_send: no waiting tasks",
+ send_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ send_loop_time,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ put_time(
+ "rtems_message_queue_urgent: no waiting tasks",
+ urgent_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ urgent_loop_time,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ put_time(
+ "rtems_message_queue_receive: available",
+ receive_time,
+ OPERATION_COUNT * OPERATION_COUNT * 2,
+ receive_loop_time * 2,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+ put_time(
+ "rtems_message_queue_flush: no messages flushed",
+ empty_flush_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
+ );
+
+ put_time(
+ "rtems_message_queue_flush: messages flushed",
+ flush_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
+ );
+
+}
diff --git a/c/src/tests/tmtests/tm09/tm09.doc b/c/src/tests/tmtests/tm09/tm09.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm09/tm09.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm10/system.h b/c/src/tests/tmtests/tm10/system.h
new file mode 100644
index 0000000000..45ec4003bf
--- /dev/null
+++ b/c/src/tests/tmtests/tm10/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 110
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm10/task1.c b/c/src/tests/tmtests/tm10/task1.c
new file mode 100644
index 0000000000..a49e61e1ab
--- /dev/null
+++ b/c/src/tests/tmtests/tm10/task1.c
@@ -0,0 +1,165 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+long Buffer[4];
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 10 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_unsigned32 index;
+ rtems_unsigned32 size;
+ rtems_task_entry task_entry;
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_id task_id;
+
+ priority = 5;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority++;
+
+ if ( index==0 ) task_entry = High_task;
+ else if ( index==OPERATION_COUNT ) task_entry = Low_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_message_queue_create(
+ 1,
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive: not available -- NO_WAIT",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ Timer_initialize();
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+ puts( "*** END OF TEST 10 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm10/tm10.doc b/c/src/tests/tmtests/tm10/tm10.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm10/tm10.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm11/system.h b/c/src/tests/tmtests/tm11/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm11/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm11/task1.c b/c/src/tests/tmtests/tm11/task1.c
new file mode 100644
index 0000000000..296b742aea
--- /dev/null
+++ b/c/src/tests/tmtests/tm11/task1.c
@@ -0,0 +1,155 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+void Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 11 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_message_queue_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index < OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT-1 ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, 16 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, size );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm11/tm11.doc b/c/src/tests/tmtests/tm11/tm11.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm11/tm11.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm12/system.h b/c/src/tests/tmtests/tm12/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm12/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm12/task1.c b/c/src/tests/tmtests/tm12/task1.c
new file mode 100644
index 0000000000..84640165d3
--- /dev/null
+++ b/c/src/tests/tmtests/tm12/task1.c
@@ -0,0 +1,146 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 12 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Low_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, 16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/c/src/tests/tmtests/tm12/tm12.doc b/c/src/tests/tmtests/tm12/tm12.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm12/tm12.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm13/system.h b/c/src/tests/tmtests/tm13/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm13/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm13/task1.c b/c/src/tests/tmtests/tm13/task1.c
new file mode 100644
index 0000000000..0499817149
--- /dev/null
+++ b/c/src/tests/tmtests/tm13/task1.c
@@ -0,0 +1,154 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+void Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 13 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_message_queue_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index < OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT-1 ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, 16 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, size );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm13/tm13.doc b/c/src/tests/tmtests/tm13/tm13.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm13/tm13.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm14/system.h b/c/src/tests/tmtests/tm14/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm14/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm14/task1.c b/c/src/tests/tmtests/tm14/task1.c
new file mode 100644
index 0000000000..24c40c13b3
--- /dev/null
+++ b/c/src/tests/tmtests/tm14/task1.c
@@ -0,0 +1,146 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 14 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Low_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, 16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ puts( "*** END OF TEST 14 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/c/src/tests/tmtests/tm14/tm14.doc b/c/src/tests/tmtests/tm14/tm14.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm14/tm14.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm15/system.h b/c/src/tests/tmtests/tm15/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm15/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm15/task1.c b/c/src/tests/tmtests/tm15/task1.c
new file mode 100644
index 0000000000..1cfc554fe8
--- /dev/null
+++ b/c/src/tests/tmtests/tm15/task1.c
@@ -0,0 +1,222 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 time_set, eventout;
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 15 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_event_set event_out;
+ rtems_status_code status;
+
+ time_set = FALSE;
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], High_tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ {
+ (void) rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ }
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: obtain current events",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ {
+ (void) rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ }
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: not available -- NO_WAIT",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_event_set event_out;
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_event_send( RTEMS_SELF, RTEMS_EVENT_16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: no task readied",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ Timer_initialize();
+ (void) rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_event_send( Task_id[ index ], RTEMS_EVENT_16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ puts( "*** END OF TEST 15 ***" );
+ exit( 0 );
+}
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ if ( time_set )
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ else {
+ time_set = 1;
+ Timer_initialize(); /* start blocking rtems_event_receive time */
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ }
+}
diff --git a/c/src/tests/tmtests/tm15/tm15.doc b/c/src/tests/tmtests/tm15/tm15.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm15/tm15.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm16/system.h b/c/src/tests/tmtests/tm16/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm16/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm16/task1.c b/c/src/tests/tmtests/tm16/task1.c
new file mode 100644
index 0000000000..e73d3ea12b
--- /dev/null
+++ b/c/src/tests/tmtests/tm16/task1.c
@@ -0,0 +1,148 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 16 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of test_init" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start of test_init" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority priority;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_event_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ priority = 250;
+
+ for( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ if ( index == OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ priority--;
+ }
+
+ Task_count = 0;
+
+ Timer_initialize();
+ (void) rtems_event_send( Task_id[ Task_count ], RTEMS_EVENT_16 );
+ /* preempts task */
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set event_out;
+
+ (void) rtems_event_receive( /* task blocks */
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+
+ Task_count++;
+
+ (void) rtems_event_send( /* preempts task */
+ Task_id[ Task_count ],
+ RTEMS_EVENT_16
+ );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set event_out;
+
+ (void) rtems_event_receive( /* task blocks */
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ puts( "*** END OF TEST 16 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm16/tm16.doc b/c/src/tests/tmtests/tm16/tm16.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm16/tm16.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm17/system.h b/c/src/tests/tmtests/tm17/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm17/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm17/task1.c b/c/src/tests/tmtests/tm17/task1.c
new file mode 100644
index 0000000000..fd7b0780c2
--- /dev/null
+++ b/c/src/tests/tmtests/tm17/task1.c
@@ -0,0 +1,127 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+rtems_task_priority Task_priority;
+
+rtems_task First_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Last_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 17 ***" );
+
+ Task_priority = 254;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ Task_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ if ( index == OPERATION_COUNT ) task_entry = Last_task;
+ else if ( index == 0 ) task_entry = First_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Task_count = 1;
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task First_task(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority previous_priority;
+
+ Timer_initialize();
+
+ Task_priority--;
+ Task_count++;
+
+ (void) rtems_task_set_priority(
+ Task_id[ Task_count ],
+ Task_priority,
+ &previous_priority
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority previous_priority;
+
+ Task_priority--;
+ Task_count++;
+
+ (void) rtems_task_set_priority(
+ Task_id[ Task_count ],
+ Task_priority,
+ &previous_priority
+ );
+}
+
+rtems_task Last_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ puts( "*** END OF TEST 17 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm17/tm17.doc b/c/src/tests/tmtests/tm17/tm17.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm17/tm17.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm18/system.h b/c/src/tests/tmtests/tm18/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm18/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm18/task1.c b/c/src/tests/tmtests/tm18/task1.c
new file mode 100644
index 0000000000..ba5ae84a6f
--- /dev/null
+++ b/c/src/tests/tmtests/tm18/task1.c
@@ -0,0 +1,112 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 taskcount;
+rtems_task_priority taskpri;
+
+rtems_task First_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Last_task(
+ rtems_task_argument argument
+);
+
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 18 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_id id;
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ for ( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ if ( index == OPERATION_COUNT ) task_entry = Last_task;
+ else if ( index == 0 ) task_entry = First_task;
+ else task_entry = Middle_tasks;
+
+
+ status = rtems_task_start( id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+}
+
+rtems_task First_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+
+ (void) rtems_task_delete( RTEMS_SELF );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_delete( RTEMS_SELF );
+}
+
+rtems_task Last_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: calling task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ puts( "*** END OF TEST 18 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm18/tm18.doc b/c/src/tests/tmtests/tm18/tm18.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm18/tm18.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm19/system.h b/c/src/tests/tmtests/tm19/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/c/src/tests/tmtests/tm19/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm19/task1.c b/c/src/tests/tmtests/tm19/task1.c
new file mode 100644
index 0000000000..af25ff9cb2
--- /dev/null
+++ b/c/src/tests/tmtests/tm19/task1.c
@@ -0,0 +1,208 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_asr Process_asr_for_pass_1(
+ rtems_signal_set signals
+);
+
+rtems_asr Process_asr_for_pass_2(
+ rtems_signal_set signals
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 19 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 127,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TASK2" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 126,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK3" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TASK3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_asr Process_asr_for_pass_1(
+ rtems_signal_set signals
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send: signal to self",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_SEND
+ );
+
+ Timer_initialize();
+}
+
+rtems_asr Process_asr_for_pass_2(
+ rtems_signal_set signals
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_resume" );
+
+ Timer_initialize();
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Timer_initialize();
+ (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_catch",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_CATCH
+ );
+
+ Timer_initialize();
+ rtems_signal_send( Task_id[ 2 ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send: returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_SEND
+ );
+
+ Timer_initialize();
+ (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+
+ /* end time is done is RTEMS_ASR */
+
+ end_time = Read_timer();
+
+ put_time(
+ "exit ASR overhead: returns to calling task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ Timer_initialize();
+ (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+}
+
+rtems_asr Process_asr_for_task_2(
+ rtems_signal_set signals
+)
+{
+ ;
+}
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
+ directive_failed( status, "rtems_signal_catch" );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ end_time = Read_timer();
+
+ put_time(
+ "exit ASR overhead: returns to preempting task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TEST 19 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm19/tm19.doc b/c/src/tests/tmtests/tm19/tm19.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm19/tm19.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm20/system.h b/c/src/tests/tmtests/tm20/system.h
new file mode 100644
index 0000000000..f172828ad2
--- /dev/null
+++ b/c/src/tests/tmtests/tm20/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+#define CONFIGURE_TEST_NEEDS_STUB_DRIVER
+
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_REGIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm20/task1.c b/c/src/tests/tmtests/tm20/task1.c
new file mode 100644
index 0000000000..7eb8506f49
--- /dev/null
+++ b/c/src/tests/tmtests/tm20/task1.c
@@ -0,0 +1,466 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_device_major_number _STUB_major = 1;
+
+rtems_id Region_id;
+rtems_name Region_name;
+rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_id Partition_id;
+rtems_name Partition_name;
+rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+void *Buffer_address_1;
+void *Buffer_address_2;
+void *Buffer_address_3;
+void *Buffer_address_4;
+
+rtems_unsigned32 buffer_count;
+
+void *Buffer_addresses[ OPERATION_COUNT+1 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 20 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', '1' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', '2' ),
+ 129,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TASK2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_mode previous_mode;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ Partition_name = rtems_build_name( 'P', 'A', 'R', 'T' );
+
+ Timer_initialize();
+ rtems_partition_create(
+ Partition_name,
+ Partition_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_CREATE
+ );
+
+ Region_name = rtems_build_name( 'R', 'E', 'G', 'N' );
+
+ Timer_initialize();
+ rtems_region_create(
+ Region_name,
+ Region_area,
+ 2048,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_CREATE
+ );
+
+ Timer_initialize();
+ (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_GET_BUFFER
+ );
+
+ buffer_count = 0;
+ while ( FOREVER ) {
+
+ status = rtems_partition_get_buffer(
+ Partition_id,
+ &Buffer_addresses[ buffer_count ]
+ );
+
+ if ( status == RTEMS_UNSATISFIED ) break;
+
+ buffer_count++;
+ }
+
+ Timer_initialize();
+ (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_2 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer: not available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_GET_BUFFER
+ );
+
+ Timer_initialize();
+ (void) rtems_partition_return_buffer( Partition_id, Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_return_buffer",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_RETURN_BUFFER
+ );
+
+ for ( index = 0 ; index < buffer_count ; index++ ) {
+
+ status = rtems_partition_return_buffer(
+ Partition_id,
+ Buffer_addresses[ index ]
+ );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ }
+
+ Timer_initialize();
+ (void) rtems_partition_delete( Partition_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_DELETE
+ );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+ directive_failed( status, "region_get_semgent" );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_3
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_4
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: not available -- NO_WAIT",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_2 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: no waiting tasks",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+
+ /* execute Task_2 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: task readied -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 254, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_1
+ );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ /* execute Task_2 */
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_delete( Region_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_DELETE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_initialize( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_initialize",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_INITIALIZE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_open( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_open",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_OPEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_close( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_close",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_CLOSE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_read( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_read",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_READ
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_write( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_write",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_WRITE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_control( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_control",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_CONTROL
+ );
+
+ puts( "*** END OF TEST 20 ***" );
+ exit( 0 );
+}
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: not available -- caller blocks",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_1 );
+
+ /* preempt back to Task_1 */
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: task readied -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/tmtests/tm20/tm20.doc b/c/src/tests/tmtests/tm20/tm20.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm20/tm20.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm21/system.h b/c/src/tests/tmtests/tm21/system.h
new file mode 100644
index 0000000000..f2831954e6
--- /dev/null
+++ b/c/src/tests/tmtests/tm21/system.h
@@ -0,0 +1,48 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 102
+#define CONFIGURE_MAXIMUM_TIMERS 100
+#define CONFIGURE_MAXIMUM_SEMAPHORES 100
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100
+#define CONFIGURE_MAXIMUM_PARTITIONS 100
+#define CONFIGURE_MAXIMUM_REGIONS 100
+#define CONFIGURE_MAXIMUM_PORTS 100
+#define CONFIGURE_MAXIMUM_PERIODS 100
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm21/task1.c b/c/src/tests/tmtests/tm21/task1.c
new file mode 100644
index 0000000000..79703ea0d1
--- /dev/null
+++ b/c/src/tests/tmtests/tm21/task1.c
@@ -0,0 +1,236 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 21 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_id id;
+ rtems_status_code status;
+
+ for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create (
+ index,
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_message_queue_create(
+ index,
+ 1, /* only going to ident this queue */
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ status = rtems_semaphore_create(
+ index,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &id
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_region_create(
+ index,
+ Region_area,
+ 2048,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_region_create" );
+
+ status = rtems_partition_create(
+ index,
+ Partition_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_partition_create" );
+
+ status = rtems_port_create(
+ index,
+ Partition_area,
+ Region_area,
+ 0xff,
+ &id
+ );
+ directive_failed( status, "rtems_port_create" );
+
+ status = rtems_timer_create( index, &id );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_rate_monotonic_create( index, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_SEMAPHORE_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PARTITION_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_region_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_REGION_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_rate_monotonic_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_RATE_MONOTONIC_IDENT
+ );
+
+ puts( "*** END OF TEST 21 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm21/tm21.doc b/c/src/tests/tmtests/tm21/tm21.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm21/tm21.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm22/system.h b/c/src/tests/tmtests/tm22/system.h
new file mode 100644
index 0000000000..a7d66a30cc
--- /dev/null
+++ b/c/src/tests/tmtests/tm22/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 103
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm22/task1.c b/c/src/tests/tmtests/tm22/task1.c
new file mode 100644
index 0000000000..e0bab9217b
--- /dev/null
+++ b/c/src/tests/tmtests/tm22/task1.c
@@ -0,0 +1,200 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 22 ***" );
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' '),
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ status = rtems_task_create(
+ 1,
+ 11,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create RTEMS_PREEMPT" );
+
+ status = rtems_task_start( id, Preempt_task, 0 );
+ directive_failed( status, "rtems_task_start RTEMS_PREEMPT" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ Timer_initialize();
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: task readied -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ status = rtems_task_suspend(RTEMS_SELF);
+ directive_failed( status, "rtems_task_suspend" );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_unsigned32 count;
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_start HIGH" );
+
+ status = rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "message_queu_receive" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: no waiting tasks",
+ end_time,
+ OPERATION_COUNT,
+ 1,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ /* should go to Preempt_task here */
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: task readied -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ puts( "*** END OF TEST 22 ***" );
+ exit( 0 );
+}
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+
+ Timer_initialize();
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+
+ /* should be preempted by low task */
+}
diff --git a/c/src/tests/tmtests/tm22/tm22.doc b/c/src/tests/tmtests/tm22/tm22.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm22/tm22.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm23/system.h b/c/src/tests/tmtests/tm23/system.h
new file mode 100644
index 0000000000..877649e397
--- /dev/null
+++ b/c/src/tests/tmtests/tm23/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm23/task1.c b/c/src/tests/tmtests/tm23/task1.c
new file mode 100644
index 0000000000..d503244779
--- /dev/null
+++ b/c/src/tests/tmtests/tm23/task1.c
@@ -0,0 +1,302 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Timer_id[ OPERATION_COUNT+1 ];
+
+rtems_time_of_day time_of_day;
+
+void null_delay(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+
+ rtems_task_priority priority;
+ rtems_unsigned32 index;
+ rtems_id id;
+ rtems_task_entry task_entry;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 23 ***" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ priority = 5;
+
+ for( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ if ( index == 1 ) task_entry = High_task;
+ else if ( index == OPERATION_COUNT ) task_entry = Low_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ priority++;
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void null_delay(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_status_code status;
+ int i;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_create( index, &Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_AFTER
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_AFTER
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_cancel( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CANCEL
+ );
+
+ for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_cancel( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CANCEL
+ );
+
+ for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_RESET
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_RESET
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+
+ build_time( &time_of_day, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time_of_day );
+ directive_failed( status, "rtems_clock_set" );
+
+ time_of_day.year = 1989;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_when(
+ Timer_id[ index ], &time_of_day, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_WHEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_when(
+ Timer_id[ index ], &time_of_day, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_WHEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_delete( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_DELETE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_timer_create( index, &Timer_id[ index ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ status = rtems_timer_cancel( Timer_id[ index ] );
+ directive_failed( status, "rtems_timer_cancel" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_delete( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_DELETE
+ );
+
+ Timer_initialize();
+ (void) rtems_task_wake_when( &time_of_day );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_wake_when( &time_of_day );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_when",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_WAKE_WHEN
+ );
+
+ puts( "*** END OF TEST 23 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm23/tm23.doc b/c/src/tests/tmtests/tm23/tm23.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm23/tm23.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm24/system.h b/c/src/tests/tmtests/tm24/system.h
new file mode 100644
index 0000000000..6b2f2c420b
--- /dev/null
+++ b/c/src/tests/tmtests/tm24/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm24/task1.c b/c/src/tests/tmtests/tm24/task1.c
new file mode 100644
index 0000000000..58e6eba6b8
--- /dev/null
+++ b/c/src/tests/tmtests/tm24/task1.c
@@ -0,0 +1,124 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+
+rtems_task Tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 24 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'R', 'E', 'S', 'T' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( id, Tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after: yield -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_WAKE_AFTER
+ );
+
+ Task_count = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Tasks(
+ rtems_task_argument argument
+)
+{
+ Task_count++;
+
+ if ( Task_count == 1 )
+ Timer_initialize();
+ else if ( Task_count == OPERATION_COUNT ) {
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after: yields -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_WAKE_AFTER
+ );
+
+ puts( "*** END OF TEST 24 ***" );
+ exit( 0 );
+ }
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+}
diff --git a/c/src/tests/tmtests/tm24/tm24.doc b/c/src/tests/tmtests/tm24/tm24.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm24/tm24.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm25/system.h b/c/src/tests/tmtests/tm25/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/c/src/tests/tmtests/tm25/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm25/task1.c b/c/src/tests/tmtests/tm25/task1.c
new file mode 100644
index 0000000000..fc24318938
--- /dev/null
+++ b/c/src/tests/tmtests/tm25/task1.c
@@ -0,0 +1,109 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 25 ***" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' ') ,
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( task_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( task_id, High_tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ 0xffffffff
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+ (void) rtems_clock_tick();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_tick",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_CLOCK_TICK
+ );
+
+ puts( "*** END OF TEST 25 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm25/tm25.doc b/c/src/tests/tmtests/tm25/tm25.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm25/tm25.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm26/fptest.h b/c/src/tests/tmtests/tm26/fptest.h
new file mode 100644
index 0000000000..39b8438ef9
--- /dev/null
+++ b/c/src/tests/tmtests/tm26/fptest.h
@@ -0,0 +1,165 @@
+/* fptest.h
+ *
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * FP_load( &context )
+ * FP_check( &context )
+ *
+ * FP_load - loads the specified floating point context
+ * FP_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * fptest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __FPTEST_h
+#define __FPTEST_h
+
+#include <stdio.h>
+
+#ifndef CPU_HARDWARE_FP
+#error "This CPU does not have CPU_HARDWARE_FP defined"
+#endif
+
+#if ( CPU_HARDWARE_FP == FALSE )
+
+#define FP_DECLARE
+#define FP_LOAD( _factor )
+#define FP_CHECK( _factor ) 0
+
+#else
+
+#define FP_DECLARE \
+ double fp01 = 1.0; \
+ double fp02 = 2.0; \
+ double fp03 = 3.0; \
+ double fp04 = 4.0; \
+ double fp05 = 5.0; \
+ double fp06 = 6.0; \
+ double fp07 = 7.0; \
+ double fp08 = 8.0; \
+ double fp09 = 9.0; \
+ double fp10 = 10.0; \
+ double fp11 = 11.0; \
+ double fp12 = 12.0; \
+ double fp13 = 13.0; \
+ double fp14 = 14.0; \
+ double fp15 = 15.0; \
+ double fp16 = 16.0; \
+ double fp17 = 17.0; \
+ double fp18 = 18.0; \
+ double fp19 = 19.0; \
+ double fp20 = 20.0; \
+ double fp21 = 21.0; \
+ double fp22 = 22.0; \
+ double fp23 = 23.0; \
+ double fp24 = 24.0; \
+ double fp25 = 25.0; \
+ double fp26 = 26.0; \
+ double fp27 = 27.0; \
+ double fp28 = 28.0; \
+ double fp29 = 29.0; \
+ double fp30 = 30.0; \
+ double fp31 = 31.0; \
+ double fp32 = 32.0
+
+#define FP_LOAD( _factor ) \
+ do { \
+ fp01 += _factor; \
+ fp02 += _factor; \
+ fp03 += _factor; \
+ fp04 += _factor; \
+ fp05 += _factor; \
+ fp06 += _factor; \
+ fp07 += _factor; \
+ fp08 += _factor; \
+ fp09 += _factor; \
+ fp10 += _factor; \
+ fp11 += _factor; \
+ fp12 += _factor; \
+ fp13 += _factor; \
+ fp14 += _factor; \
+ fp15 += _factor; \
+ fp16 += _factor; \
+ fp17 += _factor; \
+ fp18 += _factor; \
+ fp19 += _factor; \
+ fp20 += _factor; \
+ fp21 += _factor; \
+ fp22 += _factor; \
+ fp23 += _factor; \
+ fp24 += _factor; \
+ fp25 += _factor; \
+ fp26 += _factor; \
+ fp27 += _factor; \
+ fp28 += _factor; \
+ fp29 += _factor; \
+ fp30 += _factor; \
+ fp31 += _factor; \
+ fp32 += _factor; \
+ } while (0)
+
+#define EPSILON (0.0005)
+#define FPABS(d) (((d) < 0.0) ? -(d) : (d))
+#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON)
+
+#define FP_CHECK_ONE( _v, _base, _factor ) \
+ if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \
+ printf("%d: " #_v " wrong -- (%g not %g)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define FP_CHECK( _factor ) \
+ do { \
+ FP_CHECK_ONE( fp01, 1.0, (_factor) ); \
+ FP_CHECK_ONE( fp02, 2.0, (_factor) ); \
+ FP_CHECK_ONE( fp03, 3.0, (_factor) ); \
+ FP_CHECK_ONE( fp04, 4.0, (_factor) ); \
+ FP_CHECK_ONE( fp05, 5.0, (_factor) ); \
+ FP_CHECK_ONE( fp06, 6.0, (_factor) ); \
+ FP_CHECK_ONE( fp07, 7.0, (_factor) ); \
+ FP_CHECK_ONE( fp08, 8.0, (_factor) ); \
+ FP_CHECK_ONE( fp09, 9.0, (_factor) ); \
+ FP_CHECK_ONE( fp10, 10.0, (_factor) ); \
+ FP_CHECK_ONE( fp11, 11.0, (_factor) ); \
+ FP_CHECK_ONE( fp12, 12.0, (_factor) ); \
+ FP_CHECK_ONE( fp13, 13.0, (_factor) ); \
+ FP_CHECK_ONE( fp14, 14.0, (_factor) ); \
+ FP_CHECK_ONE( fp15, 15.0, (_factor) ); \
+ FP_CHECK_ONE( fp16, 16.0, (_factor) ); \
+ FP_CHECK_ONE( fp17, 17.0, (_factor) ); \
+ FP_CHECK_ONE( fp18, 18.0, (_factor) ); \
+ FP_CHECK_ONE( fp19, 19.0, (_factor) ); \
+ FP_CHECK_ONE( fp20, 20.0, (_factor) ); \
+ FP_CHECK_ONE( fp21, 21.0, (_factor) ); \
+ FP_CHECK_ONE( fp22, 22.0, (_factor) ); \
+ FP_CHECK_ONE( fp23, 23.0, (_factor) ); \
+ FP_CHECK_ONE( fp24, 24.0, (_factor) ); \
+ FP_CHECK_ONE( fp25, 25.0, (_factor) ); \
+ FP_CHECK_ONE( fp26, 26.0, (_factor) ); \
+ FP_CHECK_ONE( fp27, 27.0, (_factor) ); \
+ FP_CHECK_ONE( fp28, 28.0, (_factor) ); \
+ FP_CHECK_ONE( fp29, 29.0, (_factor) ); \
+ FP_CHECK_ONE( fp30, 30.0, (_factor) ); \
+ FP_CHECK_ONE( fp31, 31.0, (_factor) ); \
+ FP_CHECK_ONE( fp32, 32.0, (_factor) ); \
+ } while (0)
+
+#endif
+
+#endif
diff --git a/c/src/tests/tmtests/tm26/system.h b/c/src/tests/tmtests/tm26/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/c/src/tests/tmtests/tm26/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm26/task1.c b/c/src/tests/tmtests/tm26/task1.c
new file mode 100644
index 0000000000..c55c9098ed
--- /dev/null
+++ b/c/src/tests/tmtests/tm26/task1.c
@@ -0,0 +1,550 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "system.h"
+#include "fptest.h"
+#include <coverhd.h>
+#include <tmacros.h>
+#include <timesys.h>
+
+
+/* TEST DATA */
+rtems_id Semaphore_id;
+
+Objects_Locations location; /* uses internal RTEMS type */
+
+Thread_Control *Middle_tcb; /* uses internal RTEMS type */
+
+Thread_Control *Low_tcb; /* uses internal RTEMS type */
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Floating_point_task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Floating_point_task_2(
+ rtems_task_argument argument
+);
+
+void complete_test( void );
+
+rtems_task null_task(
+ rtems_task_argument argument
+)
+{
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 26 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'F', 'P', '1', ' ' ),
+ 201,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of FP1" );
+
+ status = rtems_task_start( task_id, Floating_point_task_1, 0 );
+ directive_failed( status, "rtems_task_start of FP1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'F', 'P', '2', ' ' ),
+ 202,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of FP2" );
+
+ status = rtems_task_start( task_id, Floating_point_task_2, 0 );
+ directive_failed( status, "rtems_task_start of FP2" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 200,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of LOW" );
+
+ status = rtems_task_start( task_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start of LOW" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of MIDDLE" );
+
+ status = rtems_task_start( task_id, Middle_task, 0 );
+ directive_failed( status, "rtems_task_start of MIDDLE" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of HIGH" );
+
+ status = rtems_task_start( task_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of HIGH" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'E', 'M', '1' ),
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'N', 'U', 'L', 'L' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( task_id, null_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_interrupt_level level;
+
+ Timer_initialize();
+ rtems_interrupt_disable( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Disable",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ rtems_interrupt_flash( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Flash",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ rtems_interrupt_enable( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Enable",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Disable_dispatch();
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Disable_dispatch",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Enable_dispatch();
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Enable_dispatch",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Set_state",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Context_Switch_necessary = TRUE;
+
+ Timer_initialize();
+ _Thread_Dispatch(); /* dispatches Middle_task */
+}
+
+rtems_task Middle_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Disptach (NO FP)",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+
+ Middle_tcb = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[200].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers );
+
+ Timer_initialize();
+ _Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: no floating point contexts",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ Low_tcb = executing;
+
+ Timer_initialize();
+ _Context_Switch( &executing->Registers, &executing->Registers );
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: self",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Context_Switch(&executing->Registers, &Middle_tcb->Registers);
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: to another task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[201].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+}
+
+rtems_task Floating_point_task_1(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+ FP_DECLARE;
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: restore 1st FP task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[202].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_2 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save idle, restore initialized",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ FP_LOAD( 1.0 );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[202].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_2 */
+}
+
+rtems_task Floating_point_task_2(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+ FP_DECLARE;
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save idle, restore idle",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[201].first;
+
+ FP_LOAD( 1.0 );
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_1 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save initialized, restore initialized",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ complete_test();
+}
+
+void complete_test( void )
+{
+ rtems_unsigned32 index;
+ rtems_id task_id;
+
+ Timer_initialize();
+ _Thread_Resume( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Resume",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
+
+ Timer_initialize();
+ _Thread_Unblock( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Unblock",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
+
+ Timer_initialize();
+ _Thread_Ready( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Ready",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ task_id = Middle_tcb->Object.id;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Thread_Get( task_id, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Get",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Semaphore_Get( Semaphore_id, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Semaphore_Get",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Thread_Get( 0x3, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Get: invalid id",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TEST 26 ***" );
+ exit( 0 );
+}
+
diff --git a/c/src/tests/tmtests/tm26/tm26.doc b/c/src/tests/tmtests/tm26/tm26.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm26/tm26.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm27/system.h b/c/src/tests/tmtests/tm27/system.h
new file mode 100644
index 0000000000..6b2f2c420b
--- /dev/null
+++ b/c/src/tests/tmtests/tm27/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm27/task1.c b/c/src/tests/tmtests/tm27/task1.c
new file mode 100644
index 0000000000..aa346fb29e
--- /dev/null
+++ b/c/src/tests/tmtests/tm27/task1.c
@@ -0,0 +1,272 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * WARNING!!!!!!!!!
+ *
+ * THIS TEST USES INTERNAL RTEMS VARIABLES!!!
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+#include <bsp.h>
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+volatile rtems_unsigned32 Interrupt_occurred;
+volatile rtems_unsigned32 Interrupt_enter_time, Interrupt_enter_nested_time;
+volatile rtems_unsigned32 Interrupt_return_time, Interrupt_return_nested_time;
+rtems_unsigned32 Interrupt_nest;
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 27 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create Task_1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start Task_1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '2', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of Task_2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of Task_2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ Install_tm27_vector( Isr_handler );
+
+ /*
+ * No preempt .. no nesting
+ */
+
+ Interrupt_nest = 0;
+
+ _Thread_Dispatch_disable_level = 0;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to Isr_handler */
+
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to interrupted task",
+ Interrupt_enter_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to interrupted task",
+ Interrupt_return_time,
+ 1,
+ 0,
+ 0
+ );
+
+ /*
+ * No preempt .. nested
+ */
+
+ _Thread_Dispatch_disable_level = 1;
+
+ Interrupt_nest = 1;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to Isr_handler */
+
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to nested interrupt",
+ Interrupt_enter_nested_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to nested interrupt",
+ Interrupt_return_nested_time,
+ 1,
+ 0,
+ 0
+ );
+
+ /*
+ * Does a preempt .. not nested
+ */
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].last;
+
+ _Context_Switch_necessary = 1;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+
+ /*
+ * goes to Isr_handler and then returns
+ */
+
+ puts( "*** END OF TEST 27 ***" );
+ exit( 0 );
+}
+
+/*
+ * NOTE: When this task is executing, some of the assumptions made
+ * regarding the placement of the currently executing task's TCB
+ * on the ready chains have been violated. At least the assumption
+ * that this task is at the head of the chain for its priority
+ * has been violated.
+ */
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ end_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to preempting task",
+ Interrupt_enter_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to preempting task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ fflush( stdout );
+
+ /*
+ * Switch back to the other task to exit the test.
+ */
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].first;
+
+ _Context_Switch_necessary = 1;
+
+ _Thread_Dispatch();
+
+}
+
+/* The Isr_handler() and Isr_handler_inner() routines are structured
+ * so that there will be as little entry overhead as possible included
+ * in the interrupt entry time.
+ */
+
+void Isr_handler_inner( void );
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+)
+{
+ end_time = Read_timer();
+
+ Interrupt_occurred = 1;
+ Isr_handler_inner();
+}
+
+void Isr_handler_inner( void )
+{
+
+ /*enable_tracing();*/
+ Clear_tm27_intr();
+ switch ( Interrupt_nest ) {
+ case 0:
+ Interrupt_enter_time = end_time;
+ break;
+ case 1:
+ Interrupt_enter_time = end_time;
+ Interrupt_nest = 2;
+ Interrupt_occurred = 0;
+ Lower_tm27_intr();
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to a nested copy of Isr_handler */
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_nested_time = Read_timer();
+ break;
+ case 2:
+ Interrupt_enter_nested_time = end_time;
+ break;
+ }
+
+ Timer_initialize();
+}
diff --git a/c/src/tests/tmtests/tm27/tm27.doc b/c/src/tests/tmtests/tm27/tm27.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm27/tm27.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm28/system.h b/c/src/tests/tmtests/tm28/system.h
new file mode 100644
index 0000000000..4fa010796f
--- /dev/null
+++ b/c/src/tests/tmtests/tm28/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_PORTS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm28/task1.c b/c/src/tests/tmtests/tm28/task1.c
new file mode 100644
index 0000000000..26728953fa
--- /dev/null
+++ b/c/src/tests/tmtests/tm28/task1.c
@@ -0,0 +1,134 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Port_id;
+
+rtems_unsigned8 Internal_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
+rtems_unsigned8 External_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 28 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Test_task (
+ rtems_task_argument argument
+)
+{
+ rtems_name name;
+ rtems_unsigned32 index;
+ void *converted;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ name = rtems_build_name( 'P', 'O', 'R', 'T' ),
+
+ Timer_initialize();
+ rtems_port_create(
+ name,
+ Internal_area,
+ External_area,
+ 0xff,
+ &Port_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PORT_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_external_to_internal(
+ Port_id,
+ &External_area[ 0xf ],
+ &converted
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_external_to_internal",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_internal_to_external(
+ Port_id,
+ &Internal_area[ 0xf ],
+ &converted
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_internal_to_external",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL
+ );
+
+ Timer_initialize();
+ rtems_port_delete( Port_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PORT_DELETE
+ );
+
+ puts( "*** END OF TEST 28 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm28/tm28.doc b/c/src/tests/tmtests/tm28/tm28.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm28/tm28.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tm29/system.h b/c/src/tests/tmtests/tm29/system.h
new file mode 100644
index 0000000000..d2fa07c5f4
--- /dev/null
+++ b/c/src/tests/tmtests/tm29/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_PERIODS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tm29/task1.c b/c/src/tests/tmtests/tm29/task1.c
new file mode 100644
index 0000000000..9600942b6d
--- /dev/null
+++ b/c/src/tests/tmtests/tm29/task1.c
@@ -0,0 +1,207 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_name Period_name;
+
+rtems_task Tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_unsigned32 Task_count;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 29 ***" );
+
+ Period_name = rtems_build_name( 'P', 'R', 'D', ' ' );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_create( Period_name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_CREATE
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_period( id, 10 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: initiate period -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_period( id, RTEMS_PERIOD_STATUS );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: obtain status",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_cancel",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete: inactive",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
+ );
+
+ status = rtems_rate_monotonic_create( Period_name, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+
+ status = rtems_rate_monotonic_period( id, 10 );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+
+ Timer_initialize();
+ rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete: active",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( id, Tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 200,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ Task_count = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( 1, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+
+ status = rtems_rate_monotonic_period( id, 100 );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+
+ /*
+ * Give up the processor to allow all tasks to actually
+ * create and start their period timer before the benchmark
+ * timer is initialized.
+ */
+
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ Task_count++;
+
+ if ( Task_count == 1 )
+ Timer_initialize();
+
+ (void) rtems_rate_monotonic_period( id, 100 );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: conclude periods -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ puts( "*** END OF TEST 29 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tm29/tm29.doc b/c/src/tests/tmtests/tm29/tm29.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tm29/tm29.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tmtests/tmck/system.h b/c/src/tests/tmtests/tmck/system.h
new file mode 100644
index 0000000000..ddbfd9ca0a
--- /dev/null
+++ b/c/src/tests/tmtests/tmck/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tmck/task1.c b/c/src/tests/tmtests/tmck/task1.c
new file mode 100644
index 0000000000..80a64f5326
--- /dev/null
+++ b/c/src/tests/tmtests/tmck/task1.c
@@ -0,0 +1,180 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#define TEST_INIT
+#include "system.h"
+
+#define MAXIMUM_DISTRIBUTION 10000
+
+#undef OPERATION_COUNT
+#define OPERATION_COUNT 100000
+
+int Distribution[ MAXIMUM_DISTRIBUTION + 1 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+void check_read_timer( void );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ /*
+ * Tell the Timer Driver what we are doing
+ */
+
+ Set_find_average_overhead( 1 );
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME CHECKER ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ),
+
+ status = rtems_task_create(
+ 1,
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ check_read_timer();
+rtems_test_pause();
+
+ Timer_initialize();
+ end_time = Read_timer();
+
+ put_time(
+ "NULL timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 1000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (1000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 10000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (10000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 50000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (50000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 100000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (100000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TIME CHECKER ***" );
+ exit( 0 );
+}
+
+void check_read_timer()
+{
+ rtems_unsigned32 index;
+ rtems_unsigned32 time;
+
+ for ( index = 1 ; index <= MAXIMUM_DISTRIBUTION ; index++ )
+ Distribution[ index ] = 0;
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ Timer_initialize();
+ end_time = Read_timer();
+ if ( end_time > MAXIMUM_DISTRIBUTION ) {
+ /*
+ * Under UNIX a simple process swap takes longer than we
+ * consider valid for our testing purposes.
+ */
+ printf( "TOO LONG (%d) at index %d!!!\n", end_time, index );
+#if defined(unix) || defined(go32)
+ index--;
+ continue;
+#else
+ exit( 1 );
+#endif
+ }
+ else
+ Distribution[ end_time ]++;
+ }
+
+ printf( "Units may not be in microseconds for this test!!!\n" );
+ time = 0;
+ for ( index = 0 ; index <= MAXIMUM_DISTRIBUTION ; index++ ) {
+ time += (Distribution[ index ] * index);
+ if ( Distribution[ index ] != 0 )
+ printf( "%d %d\n", index, Distribution[ index ] );
+ }
+ printf( "Total time = %d\n", time );
+ printf( "Average time = %d\n", time / OPERATION_COUNT );
+}
diff --git a/c/src/tests/tmtests/tmck/tmck.doc b/c/src/tests/tmtests/tmck/tmck.doc
new file mode 100644
index 0000000000..9ef6a57d99
--- /dev/null
+++ b/c/src/tests/tmtests/tmck/tmck.doc
@@ -0,0 +1,20 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives timed by this test.
+
+benchmark name: timecheck
+
+This becnchmark is used to calibrate the timer. It is only used to
+when initial timing begins on a particular processor board.
+
diff --git a/c/src/tests/tmtests/tmoverhd/dumrtems.h b/c/src/tests/tmtests/tmoverhd/dumrtems.h
new file mode 100644
index 0000000000..161ab1c7fa
--- /dev/null
+++ b/c/src/tests/tmtests/tmoverhd/dumrtems.h
@@ -0,0 +1,255 @@
+/* dumrtems.h
+ *
+ * This include file contains phony macros to map
+ * executive calls to Empty_directive().
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __DUMRTEMS_h
+#define __DUMRTEMS_h
+
+/* RTEMS call redefinition macros */
+
+#undef rtems_signal_catch
+#undef rtems_signal_send
+#undef rtems_io_close
+#undef rtems_io_control
+#undef rtems_io_initialize
+#undef rtems_io_open
+#undef rtems_io_read
+#undef rtems_io_write
+#undef rtems_port_internal_to_external
+#undef rtems_port_external_to_internal
+#undef rtems_port_create
+#undef rtems_port_delete
+#undef rtems_port_ident
+#undef rtems_event_receive
+#undef rtems_event_send
+#undef rtems_initialize_executive
+#undef rtems_shutdown_executive
+#undef rtems_interrupt_catch
+#undef rtems_partition_create
+#undef rtems_partition_delete
+#undef rtems_partition_get_buffer
+#undef rtems_partition_ident
+#undef rtems_partition_return_buffer
+#undef rtems_message_queue_broadcast
+#undef rtems_message_queue_create
+#undef rtems_message_queue_delete
+#undef rtems_message_queue_flush
+#undef rtems_message_queue_ident
+#undef rtems_message_queue_receive
+#undef rtems_message_queue_send
+#undef rtems_message_queue_urgent
+#undef rtems_region_create
+#undef rtems_region_delete
+#undef rtems_region_get_segment
+#undef rtems_region_ident
+#undef rtems_region_return_segment
+#undef rtems_semaphore_create
+#undef rtems_semaphore_delete
+#undef rtems_semaphore_ident
+#undef rtems_semaphore_obtain
+#undef rtems_semaphore_release
+#undef rtems_task_create
+#undef rtems_task_delete
+#undef rtems_task_get_note
+#undef rtems_task_ident
+#undef rtems_task_mode
+#undef rtems_task_restart
+#undef rtems_task_resume
+#undef rtems_task_set_note
+#undef rtems_task_set_priority
+#undef rtems_task_start
+#undef rtems_task_suspend
+#undef rtems_clock_get
+#undef rtems_clock_set
+#undef rtems_clock_tick
+#undef rtems_task_wake_after
+#undef rtems_task_wake_when
+#undef rtems_fatal_error_occurred
+#undef rtems_rate_monotonic_create
+#undef rtems_rate_monotonic_ident
+#undef rtems_rate_monotonic_delete
+#undef rtems_rate_monotonic_cancel
+#undef rtems_rate_monotonic_period
+#undef rtems_multiprocessing_announce
+#undef rtems_timer_create
+#undef rtems_timer_ident
+#undef rtems_timer_delete
+#undef rtems_timer_cancel
+#undef rtems_timer_fire_after
+#undef rtems_timer_fire_when
+#undef rtems_timer_reset
+
+#define rtems_signal_catch( asraddr, mode ) \
+ Empty_directive( asraddr, mode )
+#define rtems_signal_send( tid, signal ) \
+ Empty_directive( tid, signal )
+
+#define rtems_io_close( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_control( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_initialize( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_open( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_read( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_write( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+
+#define rtems_port_internal_to_external( dpid, internal, external ) \
+ Empty_directive( dpid, internal, external )
+#define rtems_port_external_to_internal( dpid, external, internal ) \
+ Empty_directive( dpid, external, internal )
+#define rtems_port_create( name, intaddr, extaddr, length, dpid ) \
+ Empty_directive( name, intaddr, extaddr, length, dpid )
+#define rtems_port_delete( dpid ) \
+ Empty_directive( dpid )
+#define rtems_port_ident( name, dpid ) \
+ Empty_directive( name, dpid )
+
+#define rtems_event_receive( eventin, options, timeout, eventout ) \
+ Empty_directive( eventin, options, timeout, eventout )
+#define rtems_event_send( tid, event ) \
+ Empty_directive( tid, event )
+
+#define rtems_initialize_executive( conftbl, cputbl ) \
+ Empty_directive( conftbl, cputbl )
+#define rtems_shutdown_executive( the_error ) \
+ Empty_directive( the_error )
+
+#define rtems_interrupt_catch( israddr, vector, oldisr ) \
+ Empty_directive( israddr, vector, oldisr )
+
+#define rtems_partition_create( name, paddr, length, bsize, attr, ptid ) \
+ Empty_directive( name, paddr, length, bsize, attr, ptid )
+#define rtems_partition_delete( ptid ) \
+ Empty_directive( ptid )
+#define rtems_partition_get_buffer( ptid, bufaddr ) \
+ Empty_directive( ptid, bufaddr )
+#define rtems_partition_ident( name, node, ptid ) \
+ Empty_directive( name, node, ptid )
+#define rtems_partition_return_buffer( ptid, bufaddr ) \
+ Empty_directive( ptid, bufaddr )
+
+#define rtems_message_queue_broadcast( qid, buffer, count ) \
+ Empty_directive( qid, buffer, count )
+#define rtems_message_queue_create( name, count, attr, qid ) \
+ Empty_directive( name, count, attr, qid )
+#define rtems_message_queue_delete( qid ) \
+ Empty_directive( qid )
+#define rtems_message_queue_flush( qid, count ) \
+ Empty_directive( qid, count )
+#define rtems_message_queue_ident( name, node, qid ) \
+ Empty_directive( name, node, qid )
+#define rtems_message_queue_receive( qid, buffer, options, timeout ) \
+ Empty_directive( qid, buffer, options, timeout )
+#define rtems_message_queue_send( qid, buffer ) \
+ Empty_directive( qid, buffer )
+#define rtems_message_queue_urgent( qid, buffer ) \
+ Empty_directive( qid, buffer )
+
+#define rtems_region_create( name, paddr, length, pagesize, attr, rnid ) \
+ Empty_directive( name, paddr, length, pagesize, attr, rnid )
+#define rtems_region_delete( rnid ) \
+ Empty_directive( rnid )
+#define rtems_region_get_segment( rnid, size, options, timeout, segaddr ) \
+ Empty_directive( rnid, size, options, timeout, segaddr )
+#define rtems_region_ident( name, rnid ) \
+ Empty_directive( name, rnid )
+#define rtems_region_return_segment( rnid, segaddr ) \
+ Empty_directive( rnid, segaddr )
+
+#define rtems_semaphore_create( name, count, attr, priceil, smid ) \
+ Empty_directive( name, count, attr, priceil, smid )
+#define rtems_semaphore_delete( smid ) \
+ Empty_directive( smid )
+#define rtems_semaphore_ident( name, node, smid ) \
+ Empty_directive( name, node, smid )
+#define rtems_semaphore_obtain( smid, options, timeout ) \
+ Empty_directive( smid, options, timeout )
+#define rtems_semaphore_release( smid ) \
+ Empty_directive( smid )
+
+#define rtems_task_create( name, priority, stack_size, mode, attr, tid ) \
+ Empty_directive( name, priority, stack_size, mode, attr, tid )
+#define rtems_task_delete( tid ) \
+ Empty_directive( tid )
+#define rtems_task_get_note( tid, notepad, note ) \
+ Empty_directive( tid, notepad, note )
+#define rtems_task_ident( name, node, tid ) \
+ Empty_directive( name, node, tid )
+#define rtems_task_mode( mode, mask, pmode ) \
+ Empty_directive( mode, mask, pmode )
+#define rtems_task_restart( tid, arg ) \
+ Empty_directive( tid, arg )
+#define rtems_task_resume( tid ) \
+ Empty_directive( tid )
+#define rtems_task_set_note( tid, notepad, note ) \
+ Empty_directive( tid, notepad, note )
+#define rtems_task_set_priority( tid, priority, ppriority ) \
+ Empty_directive( tid, priority, ppriority )
+#define rtems_task_start( tid, saddr, arg ) \
+ Empty_directive( tid, saddr, arg )
+#define rtems_task_suspend( tid ) \
+ Empty_directive( tid )
+
+#define rtems_clock_get( options, time ) \
+ Empty_directive( options, time )
+#define rtems_clock_set( time ) \
+ Empty_directive( time )
+#define rtems_clock_tick() \
+ Empty_directive()
+#define rtems_task_wake_after( ticks ) \
+ Empty_directive( ticks )
+#define rtems_task_wake_when( time ) \
+ Empty_directive( time )
+
+#define rtems_fatal_error_occurred( errcode ) \
+ Empty_directive( errcode )
+
+#define rtems_rate_monotonic_create( name, id ) \
+ Empty_directive( name, id )
+#define rtems_rate_monotonic_ident( name, id ) \
+ Empty_directive( name, id )
+#define rtems_rate_monotonic_delete( id ) \
+ Empty_directive( id )
+#define rtems_rate_monotonic_cancel( id ) \
+ Empty_directive( id )
+#define rtems_rate_monotonic_period( id, period ) \
+ Empty_directive( id, period )
+
+#define rtems_multiprocessing_announce() \
+ Empty_directive()
+
+#define rtems_timer_create( name, tmid ) \
+ Empty_directive( name, tmid )
+#define rtems_timer_delete( tmid ) \
+ Empty_directive( tmid )
+#define rtems_timer_cancel( tmid ) \
+ Empty_directive( tmid )
+#define rtems_timer_ident( name, tmid ) \
+ Empty_directive( name, tmid )
+#define rtems_timer_fire_after( tmid, ticks, routine, user_data ) \
+ Empty_directive( tmid, ticks, routine, user_data )
+#define rtems_timer_fire_when( tmid, time, routine, user_data ) \
+ Empty_directive( tmid, time, routine, user_data )
+#define rtems_timer_reset( tmid ) \
+ Empty_directive( tmid )
+
+rtems_status_code Empty_directive();
+
+#endif
+/* end of include file */
diff --git a/c/src/tests/tmtests/tmoverhd/empty.c b/c/src/tests/tmtests/tmoverhd/empty.c
new file mode 100644
index 0000000000..dcfa33d1ed
--- /dev/null
+++ b/c/src/tests/tmtests/tmoverhd/empty.c
@@ -0,0 +1,41 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Timer_handler(
+ rtems_id argument
+)
+{
+}
+
+rtems_asr Isr_handler(
+ rtems_signal_set signals
+)
+{
+}
+
+rtems_asr Asr_handler(
+ rtems_signal_set signals
+)
+{
+}
+
+rtems_task task_func() {}
+
+void null_func() {}
+
+rtems_status_code Empty_directive()
+{
+ return( RTEMS_SUCCESSFUL );
+}
diff --git a/c/src/tests/tmtests/tmoverhd/system.h b/c/src/tests/tmtests/tmoverhd/system.h
new file mode 100644
index 0000000000..9fbbf116dd
--- /dev/null
+++ b/c/src/tests/tmtests/tmoverhd/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Timer_handler(
+ rtems_id argument
+);
+
+rtems_asr Isr_handler(
+ rtems_signal_set signals
+);
+
+rtems_asr Asr_handler(
+ rtems_signal_set signals
+);
+
+rtems_task task_func();
+
+void null_func();
+
+rtems_status_code Empty_directive();
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/tmtests/tmoverhd/testtask.c b/c/src/tests/tmtests/tmoverhd/testtask.c
new file mode 100644
index 0000000000..e8710c45bc
--- /dev/null
+++ b/c/src/tests/tmtests/tmoverhd/testtask.c
@@ -0,0 +1,1279 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Memory_area[ 2048 ];
+rtems_unsigned8 Internal_port_area[ 256 ];
+rtems_unsigned8 External_port_area[ 256 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{ rtems_id id;
+ rtems_status_code status;
+
+ Set_find_average_overhead( TRUE );
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST OVERHEAD ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+/* comment out the following include to verify type are correct */
+#include "dumrtems.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_name name;
+ rtems_unsigned32 index;
+ rtems_cpu_table cpu_table;
+ rtems_id id;
+ rtems_task_priority in_priority;
+ rtems_task_priority out_priority;
+ rtems_mode in_mode;
+ rtems_mode mask;
+ rtems_mode out_mode;
+ rtems_unsigned32 note;
+ rtems_time_of_day time;
+ rtems_interval timeout;
+ rtems_signal_set signals;
+ void *address_1;
+ rtems_event_set events;
+ long buffer[ 4 ];
+ rtems_unsigned32 count;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+ rtems_unsigned32 io_result;
+ rtems_unsigned32 error;
+ rtems_clock_get_options options;
+
+ name = rtems_build_name( 'N', 'A', 'M', 'E' );
+ in_priority = 250;
+ in_mode = RTEMS_NO_PREEMPT;
+ mask = RTEMS_PREEMPT_MASK;
+ note = 8;
+ timeout = 100;
+ signals = RTEMS_SIGNAL_1 | RTEMS_SIGNAL_3;
+ major = 10;
+ minor = 0;
+ error = 100;
+ options = 0;
+
+/* rtems_initialize_executive */
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_initialize_executive( &BSP_Configuration, &cpu_table );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_initialize_executive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_shutdown_executive */
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_shutdown_executive( error );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_shutdown_executive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_create(
+ name,
+ in_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_start */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_start( id, Task_1, 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_start",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_restart */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_restart( id, 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_suspend */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_suspend( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_resume */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_resume( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_set_priority */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_set_priority( id, in_priority, &out_priority );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_mode */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_mode( in_mode, mask, &out_mode );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_get_note */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_get_note( id, 1, note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_get_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_set_note */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_set_note( id, 1, note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_wake_when */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_wake_when( time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_when",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_wake_after */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_wake_after( timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_interrupt_catch */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_interrupt_catch( Isr_handler, 5, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_interrupt_catch",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_get */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_get( options, time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_get",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_set */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_set( time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_set",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_tick */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_tick();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_tick",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_timer_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_create( name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_fire_after */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_fire_after(
+ id,
+ timeout,
+ Timer_handler,
+ NULL
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_fire_when */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_fire_when(
+ id,
+ time,
+ Timer_handler,
+ NULL
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_reset */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_reset( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_cancel */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_create(
+ name,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_obtain */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_obtain",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_release */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_release( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_create(
+ name,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_ident(
+ name,
+ RTEMS_SEARCH_ALL_NODES,
+ id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_send( id, (long (*)[4])buffer );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_urgent */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_urgent( id, (long (*)[4])buffer );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_broadcast */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_broadcast(
+ id,
+ (long (*)[4])buffer,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_receive */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_receive(
+ id,
+ (long (*)[4])buffer,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_flush */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_flush( id, &count );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_flush",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_event_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_event_send( id, events );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_event_receive */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &events
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_signal_catch */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_signal_catch( Asr_handler, RTEMS_DEFAULT_MODES );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_catch",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_signal_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_signal_send( id, signals );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_create(
+ name,
+ Memory_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_get_buffer */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_get_buffer( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_return_buffer */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_return_buffer( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_return_buffer",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_create(
+ name,
+ Memory_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_get_segment */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_get_segment(
+ id,
+ 243,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_return_segment */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_return_segment( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_create(
+ name,
+ Internal_port_area,
+ External_port_area,
+ 0xff,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_external_to_internal */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_external_to_internal(
+ id,
+ &External_port_area[ 7 ],
+ address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_external_to_internal",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_internal_to_external */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_internal_to_external(
+ id,
+ &Internal_port_area[ 7 ],
+ address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_internal_to_external",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_io_initialize */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_initialize(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_initialize",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_open */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_open(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_open",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_close */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_close(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_close",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_read */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_read(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_read",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_write */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_write(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_write",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_control */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_control(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_control",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_fatal_error_occurred */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_fatal_error_occurred( error );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_fatal_error_occurred",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_create( name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_cancel */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_cancel",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_period */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_period( id, timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_multiprocessing_announce */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_multiprocessing_announce();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_multiprocessing_announce",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+ puts( "*** END OF TIME OVERHEAD ***" );
+
+ exit( 0 );
+}
diff --git a/c/src/tests/tmtests/tmoverhd/tmoverhd.doc b/c/src/tests/tmtests/tmoverhd/tmoverhd.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/c/src/tests/tmtests/tmoverhd/tmoverhd.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/c/src/tests/tools/generic/difftest b/c/src/tests/tools/generic/difftest
new file mode 100644
index 0000000000..11d9ba9e2f
--- /dev/null
+++ b/c/src/tests/tools/generic/difftest
@@ -0,0 +1,110 @@
+#!KSHELL -p
+#
+# Check test results against official output in the src tree
+#
+# $Id$
+#
+
+# XXX: do not run size.exe with this; it asks questions we don't answer
+
+# how to do arith in bash
+# i=$((i * 2))
+# b=$((b + 1))
+
+# progname=`basename $0`
+progname=${0##*/} # fast basename hack for ksh, bash
+
+USAGE=\
+"usage: $progname [ -opts ] test [ test ... ]
+ -v -- verbose
+ -l logdir -- specify log directory (default is 'logdir')
+"
+
+# log an error to stderr
+prerr()
+{
+ echo "$*" >&2
+}
+
+fatal() {
+ [ "$1" ] && prerr $*
+ prerr "$USAGE"
+ exit 1
+}
+
+warn() {
+ [ "$1" ] && prerr $*
+}
+
+#
+# process the options
+#
+# defaults for getopt vars
+#
+
+verbose=""
+logdir=log
+
+while getopts v12o:l: OPT
+do
+ case "$OPT" in
+ v)
+ verbose="yes";;
+ l)
+ logdir="$OPTARG";;
+ *)
+ fatal;;
+ esac
+done
+shiftcount=`expr $OPTIND - 1`
+shift $shiftcount
+
+args=$*
+
+#
+# Run the tests
+#
+
+cd $RTEMS_HOME/tests/$logdir || fatal "No log directory: $RTEMS_HOME/tests/$logdir"
+
+tests="$args"
+if [ ! "$tests" ]
+then
+ set -- `echo sp?? mp??_?`
+ tests="$*"
+fi
+
+for t in $tests
+do
+ logfile=$t
+
+ if [ ! -f $logfile ]
+ then
+ continue
+ fi
+
+ echo $logfile
+ echo
+
+ case $t in
+ mp*)
+ mptest=`echo $t | sed 's/_.//'`
+ node=`echo $t | sed 's/...._//'`
+ scn_file=$RTEMS_ROOT/c/src/tests/mptests/$mptest/node$node/$mptest.scn;;
+ sp*)
+ scn_file=$RTEMS_ROOT/c/src/tests/sptests/$t/$t.scn;;
+ *)
+ fatal "unknown test $t";;
+ esac
+
+ sed -e '/^$/d' < $logfile | diff -b $scn_file -
+ echo
+ echo
+done
+
+exit 0
+
+# Local Variables: ***
+# mode:ksh ***
+# End: ***
+
diff --git a/c/src/tests/tools/generic/sorttimes b/c/src/tests/tools/generic/sorttimes
new file mode 100644
index 0000000000..161f5e30b0
--- /dev/null
+++ b/c/src/tests/tools/generic/sorttimes
@@ -0,0 +1,192 @@
+#!KSHELL -p
+#
+# This script takes the output from the Timing Test Suite, reorders
+# it, and adds headers so it is in the same order as is printed in
+# the supplement.
+#
+
+usage()
+{
+ echo "${progname} file [more files]"
+}
+
+header()
+{
+ echo
+ echo $*
+ echo
+}
+
+lookup()
+{
+ grep "$*" $files
+
+}
+
+progname=$0
+
+if [ $# -eq 0 ] ; then
+ usage
+ exit 0
+fi
+
+files=$*
+
+header Context Switch
+lookup context switch: self
+lookup context switch: to another task
+lookup context switch: no floating point contexts
+lookup fp context switch: restore 1st FP task
+lookup fp context switch: save initialized, restore initialized
+lookup fp context switch: save idle, restore initialized
+lookup fp context switch: save idle, restore idle
+
+header Task Manager
+lookup rtems_task_create
+lookup rtems_task_ident
+lookup rtems_task_start
+lookup rtems_task_restart: calling task
+lookup rtems_task_restart: suspended task -- returns to caller
+lookup rtems_task_restart: blocked task -- returns to caller
+lookup rtems_task_restart: ready task -- returns to caller
+lookup rtems_task_restart: suspended task -- preempts caller
+lookup rtems_task_restart: blocked task -- preempts caller
+lookup rtems_task_restart: ready task -- preempts caller
+lookup rtems_task_delete: calling task
+lookup rtems_task_delete: suspended task
+lookup rtems_task_delete: blocked task
+lookup rtems_task_delete: ready task
+lookup rtems_task_suspend: calling task
+lookup rtems_task_suspend: returns to caller
+lookup rtems_task_resume: task readied -- returns to caller
+lookup rtems_task_resume: task readied -- preempts caller
+lookup rtems_task_set_priority: obtain current priority
+lookup rtems_task_set_priority: returns to caller
+lookup rtems_task_set_priority: preempts caller
+lookup rtems_task_mode: obtain current mode
+lookup rtems_task_mode: no reschedule
+lookup rtems_task_mode: reschedule -- returns to caller
+lookup rtems_task_mode: reschedule -- preempts caller
+lookup rtems_task_get_note
+lookup rtems_task_set_note
+lookup rtems_task_wake_after: yield -- returns to caller
+lookup rtems_task_wake_after: yields -- preempts caller
+lookup rtems_task_wake_when
+
+header Interrupt Manager
+lookup interrupt entry overhead: returns to nested interrupt
+lookup interrupt entry overhead: returns to interrupted task
+lookup interrupt entry overhead: returns to preempting task
+lookup interrupt exit overhead: returns to nested interrupt
+lookup interrupt exit overhead: returns to interrupted task
+lookup interrupt exit overhead: returns to preempting task
+
+header Clock Manager
+lookup rtems_clock_set
+lookup rtems_clock_get
+lookup rtems_clock_tick
+
+header Timer Manager
+lookup rtems_timer_create
+lookup rtems_timer_ident
+lookup rtems_timer_delete: inactive
+lookup rtems_timer_delete: active
+lookup rtems_timer_fire_after: inactive
+lookup rtems_timer_fire_after: active
+lookup rtems_timer_fire_when: inactive
+lookup rtems_timer_fire_when: active
+lookup rtems_timer_reset: inactive
+lookup rtems_timer_reset: active
+lookup rtems_timer_cancel: inactive
+lookup rtems_timer_cancel: active
+
+header Semaphore Manager
+lookup rtems_semaphore_create
+lookup rtems_semaphore_ident
+lookup rtems_semaphore_delete
+lookup rtems_semaphore_obtain: available
+lookup rtems_semaphore_obtain: not available -- NO_WAIT
+lookup rtems_semaphore_obtain: not available -- caller blocks
+lookup rtems_semaphore_release: no waiting tasks
+lookup rtems_semaphore_release: task readied -- returns to caller
+lookup rtems_semaphore_release: task readied -- preempts caller
+
+header Message Queue Manager
+lookup rtems_message_queue_create
+lookup rtems_message_queue_ident
+lookup rtems_message_queue_delete
+lookup rtems_message_queue_send: no waiting tasks
+lookup rtems_message_queue_send: task readied -- returns to caller
+lookup rtems_message_queue_send: task readied -- preempts caller
+lookup rtems_message_queue_urgent: no waiting tasks
+lookup rtems_message_queue_urgent: task readied -- returns to caller
+lookup rtems_message_queue_urgent: task readied -- preempts caller
+lookup rtems_message_queue_broadcast: no waiting tasks
+lookup rtems_message_queue_broadcast: task readied -- returns to caller
+lookup rtems_message_queue_broadcast: task readied -- preempts caller
+lookup rtems_message_queue_receive: available
+lookup rtems_message_queue_receive: not available -- NO_WAIT
+lookup rtems_message_queue_receive: not available -- caller blocks
+lookup rtems_message_queue_flush: no messages flushed
+lookup rtems_message_queue_flush: messages flushed
+
+header Event Manager
+lookup rtems_event_send: no task readied
+lookup rtems_event_send: task readied -- returns to caller
+lookup rtems_event_send: task readied -- preempts caller
+lookup rtems_event_receive: obtain current events
+lookup rtems_event_receive: available
+lookup rtems_event_receive: not available -- NO_WAIT
+lookup rtems_event_receive: not available -- caller blocks
+
+header Signal Manager
+lookup rtems_signal_catch
+lookup rtems_signal_send: returns to caller
+lookup rtems_signal_send: signal to self
+lookup exit ASR overhead: returns to calling task
+lookup exit ASR overhead: returns to preempting task
+
+header Partition Manager
+lookup rtems_partition_create
+lookup rtems_partition_ident
+lookup rtems_partition_delete
+lookup rtems_partition_get_buffer: available
+lookup rtems_partition_get_buffer: not available
+lookup rtems_partition_return_buffer
+
+header Region Manager
+lookup rtems_region_create
+lookup rtems_region_ident
+lookup rtems_region_delete
+lookup rtems_region_get_segment: available
+lookup rtems_region_get_segment: not available -- NO_WAIT
+lookup rtems_region_get_segment: not available -- caller blocks
+lookup rtems_region_return_segment: no waiting tasks
+lookup rtems_region_return_segment: task readied -- returns to caller
+lookup rtems_region_return_segment: task readied -- preempts caller
+
+header Dual-Ported Memory Manager
+lookup rtems_port_create
+lookup rtems_port_ident
+lookup rtems_port_delete
+lookup rtems_port_internal_to_external
+lookup rtems_port_external_to_internal
+
+header IO Manager
+lookup rtems_io_initialize
+lookup rtems_io_open
+lookup rtems_io_close
+lookup rtems_io_read
+lookup rtems_io_write
+lookup rtems_io_control
+
+header Rate Monotonic Manager
+lookup rtems_rate_monotonic_create
+lookup rtems_rate_monotonic_ident
+lookup rtems_rate_monotonic_cancel
+lookup rtems_rate_monotonic_delete: active
+lookup rtems_rate_monotonic_delete: inactive
+lookup rtems_rate_monotonic_period: obtain status
+lookup rtems_rate_monotonic_period: initiate period -- returns to caller
+lookup rtems_rate_monotonic_period: conclude periods -- caller blocks
+exit 0
diff --git a/c/update-tools/310_to_320_list b/c/update-tools/310_to_320_list
new file mode 100644
index 0000000000..b4add28685
--- /dev/null
+++ b/c/update-tools/310_to_320_list
@@ -0,0 +1,543 @@
+#
+# External API name
+#
+initialize_executive rtems_initialize_executive
+initialize_executive_early rtems_initialize_executive_early
+initialize_executive_late rtems_initialize_executive_late
+shutdown_executive rtems_shutdown_executive
+task_create rtems_task_create
+task_ident rtems_task_ident
+task_start rtems_task_start
+task_restart rtems_task_restart
+task_delete rtems_task_delete
+task_suspend rtems_task_suspend
+task_resume rtems_task_resume
+task_set_priority rtems_task_set_priority
+task_mode rtems_task_mode
+task_get_note rtems_task_get_note
+task_set_note rtems_task_set_note
+task_wake_after rtems_task_wake_after
+task_wake_when rtems_task_wake_when
+interrupt_catch rtems_interrupt_catch
+clock_set rtems_clock_set
+clock_get rtems_clock_get
+clock_tick rtems_clock_tick
+extension_create rtems_extension_create
+extension_ident rtems_extension_ident
+extension_delete rtems_extension_delete
+timer_create rtems_timer_create
+timer_ident rtems_timer_ident
+timer_cancel rtems_timer_cancel
+timer_delete rtems_timer_delete
+timer_fire_after rtems_timer_fire_after
+timer_fire_when rtems_timer_fire_when
+timer_reset rtems_timer_reset
+semaphore_create rtems_semaphore_create
+semaphore_ident rtems_semaphore_ident
+semaphore_delete rtems_semaphore_delete
+semaphore_obtain rtems_semaphore_obtain
+semaphore_release rtems_semaphore_release
+message_queue_create rtems_message_queue_create
+message_queue_ident rtems_message_queue_ident
+message_queue_delete rtems_message_queue_delete
+message_queue_send rtems_message_queue_send
+message_queue_urgent rtems_message_queue_urgent
+message_queue_broadcast rtems_message_queue_broadcast
+message_queue_receive rtems_message_queue_receive
+message_queue_flush rtems_message_queue_flush
+event_send rtems_event_send
+event_receive rtems_event_receive
+signal_catch rtems_signal_catch
+signal_send rtems_signal_send
+partition_create rtems_partition_create
+partition_ident rtems_partition_ident
+partition_delete rtems_partition_delete
+partition_get_buffer rtems_partition_get_buffer
+partition_return_buffer rtems_partition_return_buffer
+region_create rtems_region_create
+region_extend rtems_region_extend
+region_ident rtems_region_ident
+region_delete rtems_region_delete
+region_get_segment rtems_region_get_segment
+region_get_segment_size rtems_region_get_segment_size
+region_return_segment rtems_region_return_segment
+port_create rtems_port_create
+port_ident rtems_port_ident
+port_delete rtems_port_delete
+port_external_to_internal rtems_port_external_to_internal
+port_internal_to_external rtems_port_internal_to_external
+io_initialize rtems_io_initialize
+io_open rtems_io_open
+io_close rtems_io_close
+io_read rtems_io_read
+io_write rtems_io_write
+io_control rtems_io_control
+fatal_error_occurred rtems_fatal_error_occurred
+rate_monotonic_create rtems_rate_monotonic_create
+rate_monotonic_ident rtems_rate_monotonic_ident
+rate_monotonic_delete rtems_rate_monotonic_delete
+rate_monotonic_cancel rtems_rate_monotonic_cancel
+rate_monotonic_period rtems_rate_monotonic_period
+multiprocessing_announce rtems_multiprocessing_announce
+#
+# Internal Names for API
+#
+_Initialize_Executive rtems_initialize_executive
+_Initialize_Executive_early rtems_initialize_executive_early
+_Initialize_Executive_late rtems_initialize_executive_late
+_Shutdown_Executive rtems_shutdown_executive
+_RTEMS_tasks_Create rtems_task_create
+_RTEMS_tasks_Name_to_id rtems_task_ident
+_RTEMS_tasks_Start rtems_task_start
+_RTEMS_tasks_Restart rtems_task_restart
+_RTEMS_tasks_Delete rtems_task_delete
+_RTEMS_tasks_Suspend rtems_task_suspend
+_RTEMS_tasks_Resume rtems_task_resume
+_RTEMS_tasks_Set_priority rtems_task_set_priority
+_RTEMS_tasks_Mode rtems_task_mode
+_RTEMS_tasks_Get_note rtems_task_get_note
+_RTEMS_tasks_Set_note rtems_task_set_note
+_RTEMS_tasks_Wake_after rtems_task_wake_after
+_RTEMS_tasks_Wake_when rtems_task_wake_when
+_Interrupt_Catch rtems_interrupt_catch
+_Clock_Set rtems_clock_set
+_Clock_Get rtems_clock_get
+_Clock_Tick rtems_clock_tick
+_Extension_Create rtems_extension_create
+_Extension_Name_to_id rtems_extension_ident
+_Extension_Delete rtems_extension_delete
+_Timer_Create rtems_timer_create
+_Timer_Name_to_id rtems_timer_ident
+_Timer_Cancel rtems_timer_cancel
+_Timer_Delete rtems_timer_delete
+_Timer_Fire_after rtems_timer_fire_after
+_Timer_Fire_when rtems_timer_fire_when
+_Timer_Reset rtems_timer_reset
+_Semaphore_Create rtems_semaphore_create
+_Semaphore_Name_to_id rtems_semaphore_ident
+_Semaphore_Delete rtems_semaphore_delete
+_Semaphore_Obtain rtems_semaphore_obtain
+_Semaphore_Release rtems_semaphore_release
+_Message_queue_Create rtems_message_queue_create
+_Message_queue_Name_to_id rtems_message_queue_ident
+_Message_queue_Delete rtems_message_queue_delete
+_Message_queue_Send rtems_message_queue_send
+_Message_queue_Urgent rtems_message_queue_urgent
+_Message_queue_Broadcast rtems_message_queue_broadcast
+_Message_queue_Receive rtems_message_queue_receive
+_Message_queue_Flush rtems_message_queue_flush
+_Event_Send rtems_event_send
+_Event_Receive rtems_event_receive
+_Signal_Catch rtems_signal_catch
+_Signal_Send rtems_signal_send
+_Partition_Create rtems_partition_create
+_Partition_Name_to_id rtems_partition_ident
+_Partition_Delete rtems_partition_delete
+_Partition_Get_buffer rtems_partition_get_buffer
+_Partition_Return_buffer rtems_partition_return_buffer
+_Region_Create rtems_region_create
+_Region_Extend rtems_region_extend
+_Region_Name_to_id rtems_region_ident
+_Region_Delete rtems_region_delete
+_Region_Get_segment rtems_region_get_segment
+_Region_Get_segment_size rtems_region_get_segment_size
+_Region_Return_segment rtems_region_return_segment
+_Dual_ported_memory_Create rtems_port_create
+_Dual_ported_memory_Name_to_id rtems_port_ident
+_Dual_ported_memory_Delete rtems_port_delete
+_Dual_ported_memory_External_to_internal rtems_port_external_to_internal
+_Dual_ported_memory_Internal_to_external rtems_port_internal_to_external
+_IO_Initialize rtems_io_initialize
+_IO_Open rtems_io_open
+_IO_Close rtems_io_close
+_IO_Read rtems_io_read
+_IO_Write rtems_io_write
+_IO_Control rtems_io_control
+_Fatal_Error_occurred rtems_fatal_error_occurred
+_Rate_monotonic_Create rtems_rate_monotonic_create
+_Rate_monotonic_Name_to_id rtems_rate_monotonic_ident
+_Rate_monotonic_Delete rtems_rate_monotonic_delete
+_Rate_monotonic_Cancel rtems_rate_monotonic_cancel
+_Rate_monotonic_Period rtems_rate_monotonic_period
+_Multiprocessing_Announce rtems_multiprocessing_announce
+#
+# Status (API names)
+#
+SUCCESSFUL RTEMS_SUCCESSFUL
+TASK_EXITTED RTEMS_TASK_EXITTED
+MP_NOT_CONFIGURED RTEMS_MP_NOT_CONFIGURED
+INVALID_NAME RTEMS_INVALID_NAME
+INVALID_ID RTEMS_INVALID_ID
+TOO_MANY RTEMS_TOO_MANY
+TIMEOUT RTEMS_TIMEOUT
+OBJECT_WAS_DELETED RTEMS_OBJECT_WAS_DELETED
+INVALID_SIZE RTEMS_INVALID_SIZE
+INVALID_ADDRESS RTEMS_INVALID_ADDRESS
+INVALID_NUMBER RTEMS_INVALID_NUMBER
+NOT_DEFINED RTEMS_NOT_DEFINED
+RESOURCE_IN_USE RTEMS_RESOURCE_IN_USE
+UNSATISFIED RTEMS_UNSATISFIED
+INCORRECT_STATE RTEMS_INCORRECT_STATE
+ALREADY_SUSPENDED RTEMS_ALREADY_SUSPENDED
+ILLEGAL_ON_SELF RTEMS_ILLEGAL_ON_SELF
+ILLEGAL_ON_REMOTE_OBJECT RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+CALLED_FROM_ISR RTEMS_CALLED_FROM_ISR
+INVALID_PRIORITY RTEMS_INVALID_PRIORITY
+INVALID_CLOCK RTEMS_INVALID_CLOCK
+INVALID_NODE RTEMS_INVALID_NODE
+NOT_CONFIGURED RTEMS_NOT_CONFIGURED
+NOT_OWNER_OF_RESOURCE RTEMS_NOT_OWNER_OF_RESOURCE
+NOT_IMPLEMENTED RTEMS_NOT_IMPLEMENTED
+INTERNAL_ERROR RTEMS_INTERNAL_ERROR
+PROXY_BLOCKING RTEMS_PROXY_BLOCKING
+NO_MEMORY RTEMS_NO_MEMORY
+STATUS_CODES_FIRST RTEMS_STATUS_CODES_FIRST
+STATUS_CODES_LAST RTEMS_STATUS_CODES_LAST
+#
+# Status (Internal names)
+#
+STATUS_SUCCESSFUL RTEMS_SUCCESSFUL
+STATUS_TASK_EXITTED RTEMS_TASK_EXITTED
+STATUS_MP_NOT_CONFIGURED RTEMS_MP_NOT_CONFIGURED
+STATUS_INVALID_NAME RTEMS_INVALID_NAME
+STATUS_INVALID_ID RTEMS_INVALID_ID
+STATUS_TOO_MANY RTEMS_TOO_MANY
+STATUS_TIMEOUT RTEMS_TIMEOUT
+STATUS_OBJECT_WAS_DELETED RTEMS_OBJECT_WAS_DELETED
+STATUS_INVALID_SIZE RTEMS_INVALID_SIZE
+STATUS_INVALID_ADDRESS RTEMS_INVALID_ADDRESS
+STATUS_INVALID_NUMBER RTEMS_INVALID_NUMBER
+STATUS_NOT_DEFINED RTEMS_NOT_DEFINED
+STATUS_RESOURCE_IN_USE RTEMS_RESOURCE_IN_USE
+STATUS_UNSATISFIED RTEMS_UNSATISFIED
+STATUS_INCORRECT_STATE RTEMS_INCORRECT_STATE
+STATUS_ALREADY_SUSPENDED RTEMS_ALREADY_SUSPENDED
+STATUS_ILLEGAL_ON_SELF RTEMS_ILLEGAL_ON_SELF
+STATUS_ILLEGAL_ON_REMOTE_OBJECT RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+STATUS_CALLED_FROM_ISR RTEMS_CALLED_FROM_ISR
+STATUS_INVALID_PRIORITY RTEMS_INVALID_PRIORITY
+STATUS_INVALID_CLOCK RTEMS_INVALID_CLOCK
+STATUS_INVALID_NODE RTEMS_INVALID_NODE
+STATUS_NOT_CONFIGURED RTEMS_NOT_CONFIGURED
+STATUS_NOT_OWNER_OF_RESOURCE RTEMS_NOT_OWNER_OF_RESOURCE
+STATUS_NOT_IMPLEMENTED RTEMS_NOT_IMPLEMENTED
+STATUS_INTERNAL_ERROR RTEMS_INTERNAL_ERROR
+STATUS_PROXY_BLOCKING RTEMS_PROXY_BLOCKING
+STATUS_NO_MEMORY RTEMS_NO_MEMORY
+#
+# Attributes (External)
+#
+DEFAULT_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+NO_FLOATING_POINT RTEMS_NO_FLOATING_POINT
+FLOATING_POINT RTEMS_FLOATING_POINT
+LOCAL RTEMS_LOCAL
+GLOBAL RTEMS_GLOBAL
+FIFO RTEMS_FIFO
+PRIORITY RTEMS_PRIORITY
+NO_LIMIT RTEMS_NO_LIMIT
+LIMIT RTEMS_LIMIT
+COUNTING_SEMAPHORE RTEMS_COUNTING_SEMAPHORE
+BINARY_SEMAPHORE RTEMS_BINARY_SEMAPHORE
+NO_INHERIT_PRIORITY RTEMS_NO_INHERIT_PRIORITY
+INHERIT_PRIORITY RTEMS_INHERIT_PRIORITY
+#
+# Attributes (Internal)
+#
+ATTRIBUTES_DEFAULTS RTEMS_DEFAULT_ATTRIBUTES
+ATTRIBUTES_NO_FLOATING_POINT RTEMS_NO_FLOATING_POINT
+ATTRIBUTES_FLOATING_POINT RTEMS_FLOATING_POINT
+ATTRIBUTES_LOCAL RTEMS_LOCAL
+ATTRIBUTES_GLOBAL RTEMS_GLOBAL
+ATTRIBUTES_FIFO RTEMS_FIFO
+ATTRIBUTES_PRIORITY RTEMS_PRIORITY
+ATTRIBUTES_NO_LIMIT RTEMS_NO_LIMIT
+ATTRIBUTES_LIMIT RTEMS_LIMIT
+ATTRIBUTES_COUNTING_SEMAPHORE RTEMS_COUNTING_SEMAPHORE
+ATTRIBUTES_BINARY_SEMAPHORE RTEMS_BINARY_SEMAPHORE
+ATTRIBUTES_NO_INHERIT_PRIORITY RTEMS_NO_INHERIT_PRIORITY
+ATTRIBUTES_INHERIT_PRIORITY RTEMS_INHERIT_PRIORITY
+#
+# Options (External)
+#
+DEFAULT_OPTIONS RTEMS_DEFAULT_OPTIONS
+WAIT RTEMS_WAIT
+NO_WAIT RTEMS_NO_WAIT
+EVENT_ALL RTEMS_EVENT_ALL
+EVENT_ANY RTEMS_EVENT_ANY
+#
+# Options (Internal)
+#
+OPTIONS_DEFAULT RTEMS_DEFAULT_OPTIONS
+OPTIONS_WAIT RTEMS_WAIT
+OPTIONS_NO_WAIT RTEMS_NO_WAIT
+OPTIONS_EVENT_ALL RTEMS_EVENT_ALL
+OPTIONS_EVENT_ANY RTEMS_EVENT_ANY
+#
+# Masks (External)
+#
+ALL_MODE_MASKS RTEMS_ALL_MODE_MASKS
+PREEMPT_MASK RTEMS_PREEMPT_MASK
+TIMESLICE_MASK RTEMS_TIMESLICE_MASK
+ASR_MASK RTEMS_ASR_MASK
+INTERRUPT_MASK RTEMS_INTERRUPT_MASK
+#
+# Masks (Internal)
+#
+MODES_ALL_MASK RTEMS_ALL_MODE_MASKS
+MODES_PREEMPT_MASK RTEMS_PREEMPT_MASK
+MODES_TIMESLICE_MASK RTEMS_TIMESLICE_MASK
+MODES_ASR_MASK RTEMS_ASR_MASK
+MODES_INTERRUPT_MASK RTEMS_INTERRUPT_MASK
+#
+# Modes (Internal)
+#
+MODES_DEFAULTS RTEMS_DEFAULT_MODES
+MODES_PREEMPT RTEMS_PREEMPT
+MODES_NO_PREEMPT RTEMS_NO_PREEMPT
+MODES_NO_TIMESLICE RTEMS_NO_TIMESLICE
+MODES_TIMESLICE RTEMS_TIMESLICE
+MODES_ASR RTEMS_ASR
+MODES_NO_ASR RTEMS_NO_ASR
+_Modes_Interrupt_level RTEMS_INTERRUPT_LEVEL
+#
+# Modes (External)
+#
+DEFAULT_MODES RTEMS_DEFAULT_MODES
+PREEMPT RTEMS_PREEMPT
+NO_PREEMPT RTEMS_NO_PREEMPT
+NO_TIMESLICE RTEMS_NO_TIMESLICE
+TIMESLICE RTEMS_TIMESLICE
+ASR RTEMS_ASR
+NO_ASR RTEMS_NO_ASR
+INTERRUPT_LEVEL RTEMS_INTERRUPT_LEVEL
+#
+# Identification (External)
+#
+SEARCH_ALL_NODES RTEMS_SEARCH_ALL_NODES
+SEARCH_OTHER_NODES RTEMS_SEARCH_OTHER_NODES
+SEARCH_LOCAL_NODE RTEMS_SEARCH_LOCAL_NODE
+WHO_AM_I RTEMS_WHO_AM_I
+#
+# Identification (Internal)
+#
+OBJECTS_SEARCH_ALL_NODES RTEMS_SEARCH_ALL_NODES
+OBJECTS_SEARCH_OTHER_NODES RTEMS_SEARCH_OTHER_NODES
+OBJECTS_SEARCH_LOCAL_NODE RTEMS_SEARCH_LOCAL_NODE
+OBJECTS_WHO_AM_I RTEMS_WHO_AM_I
+#
+# Miscellaneous (External API)
+#
+CURRENT_MODE RTEMS_CURRENT_MODE
+CURRENT_PRIORITY RTEMS_CURRENT_PRIORITY
+PENDING_EVENTS RTEMS_PENDING_EVENTS
+NO_TIMEOUT RTEMS_NO_TIMEOUT
+SELF RTEMS_SELF
+PERIOD_STATUS RTEMS_PERIOD_STATUS
+YIELD_PROCESSOR RTEMS_YIELD_PROCESSOR
+MINIMUM_PRIORITY RTEMS_MINIMUM_PRIORITY
+MAXIMUM_PRIORITY RTEMS_MAXIMUM_PRIORITY
+MINIMUM_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE
+#
+# Miscellaneous (External API)
+#
+MODES_CURRENT RTEMS_CURRENT_MODE
+PRIORITY_CURRENT RTEMS_CURRENT_PRIORITY
+#
+# Events
+#
+ALL_EVENTS RTEMS_ALL_EVENTS
+EVENT_0 RTEMS_EVENT_0
+EVENT_1 RTEMS_EVENT_1
+EVENT_2 RTEMS_EVENT_2
+EVENT_3 RTEMS_EVENT_3
+EVENT_4 RTEMS_EVENT_4
+EVENT_5 RTEMS_EVENT_5
+EVENT_6 RTEMS_EVENT_6
+EVENT_7 RTEMS_EVENT_7
+EVENT_8 RTEMS_EVENT_8
+EVENT_9 RTEMS_EVENT_9
+EVENT_10 RTEMS_EVENT_10
+EVENT_11 RTEMS_EVENT_11
+EVENT_12 RTEMS_EVENT_12
+EVENT_13 RTEMS_EVENT_13
+EVENT_14 RTEMS_EVENT_14
+EVENT_15 RTEMS_EVENT_15
+EVENT_16 RTEMS_EVENT_16
+EVENT_17 RTEMS_EVENT_17
+EVENT_18 RTEMS_EVENT_18
+EVENT_19 RTEMS_EVENT_19
+EVENT_20 RTEMS_EVENT_20
+EVENT_21 RTEMS_EVENT_21
+EVENT_22 RTEMS_EVENT_22
+EVENT_23 RTEMS_EVENT_23
+EVENT_24 RTEMS_EVENT_24
+EVENT_25 RTEMS_EVENT_25
+EVENT_26 RTEMS_EVENT_26
+EVENT_27 RTEMS_EVENT_27
+EVENT_28 RTEMS_EVENT_28
+EVENT_29 RTEMS_EVENT_29
+EVENT_30 RTEMS_EVENT_30
+EVENT_31 RTEMS_EVENT_31
+#
+# Signals
+#
+SIGNAL_0 RTEMS_SIGNAL_0
+SIGNAL_1 RTEMS_SIGNAL_1
+SIGNAL_2 RTEMS_SIGNAL_2
+SIGNAL_3 RTEMS_SIGNAL_3
+SIGNAL_4 RTEMS_SIGNAL_4
+SIGNAL_5 RTEMS_SIGNAL_5
+SIGNAL_6 RTEMS_SIGNAL_6
+SIGNAL_7 RTEMS_SIGNAL_7
+SIGNAL_8 RTEMS_SIGNAL_8
+SIGNAL_9 RTEMS_SIGNAL_9
+SIGNAL_10 RTEMS_SIGNAL_10
+SIGNAL_11 RTEMS_SIGNAL_11
+SIGNAL_12 RTEMS_SIGNAL_12
+SIGNAL_13 RTEMS_SIGNAL_13
+SIGNAL_14 RTEMS_SIGNAL_14
+SIGNAL_15 RTEMS_SIGNAL_15
+SIGNAL_16 RTEMS_SIGNAL_16
+SIGNAL_17 RTEMS_SIGNAL_17
+SIGNAL_18 RTEMS_SIGNAL_18
+SIGNAL_19 RTEMS_SIGNAL_19
+SIGNAL_20 RTEMS_SIGNAL_20
+SIGNAL_21 RTEMS_SIGNAL_21
+SIGNAL_22 RTEMS_SIGNAL_22
+SIGNAL_23 RTEMS_SIGNAL_23
+SIGNAL_24 RTEMS_SIGNAL_24
+SIGNAL_25 RTEMS_SIGNAL_25
+SIGNAL_26 RTEMS_SIGNAL_26
+SIGNAL_27 RTEMS_SIGNAL_27
+SIGNAL_28 RTEMS_SIGNAL_28
+SIGNAL_29 RTEMS_SIGNAL_29
+SIGNAL_30 RTEMS_SIGNAL_30
+SIGNAL_31 RTEMS_SIGNAL_31
+#
+# Notepads
+#
+NOTEPAD_FIRST RTEMS_NOTEPAD_FIRST
+NOTEPAD_0 RTEMS_NOTEPAD_0
+NOTEPAD_1 RTEMS_NOTEPAD_1
+NOTEPAD_2 RTEMS_NOTEPAD_2
+NOTEPAD_3 RTEMS_NOTEPAD_3
+NOTEPAD_4 RTEMS_NOTEPAD_4
+NOTEPAD_5 RTEMS_NOTEPAD_5
+NOTEPAD_6 RTEMS_NOTEPAD_6
+NOTEPAD_7 RTEMS_NOTEPAD_7
+NOTEPAD_8 RTEMS_NOTEPAD_8
+NOTEPAD_9 RTEMS_NOTEPAD_9
+NOTEPAD_10 RTEMS_NOTEPAD_10
+NOTEPAD_11 RTEMS_NOTEPAD_11
+NOTEPAD_12 RTEMS_NOTEPAD_12
+NOTEPAD_13 RTEMS_NOTEPAD_13
+NOTEPAD_14 RTEMS_NOTEPAD_14
+NOTEPAD_15 RTEMS_NOTEPAD_15
+NOTEPAD_LAST RTEMS_NOTEPAD_LAST
+#
+# Multiprocessing
+#
+MIN_PKTSIZE RTEMS_MINIMUM_PACKET_SIZE
+MIN_HETERO_CONV RTEMS_MINIMUN_HETERO_CONVERSION
+#
+# Name and ID External
+#
+get_node rtems_get_node
+get_index rtems_get_index
+build_name rtems_build_name
+name_to_characters rtems_name_to_characters
+#
+# Name and ID Internal
+#
+_Objects_Get_node rtems_get_node
+_Objects_Get_index rtems_get_index
+_Objects_Build_name rtems_build_name
+_Objects_Name_to_characters rtems_name_to_characters
+#
+# clock_get
+#
+CLOCK_GET_TOD RTEMS_CLOCK_GET_TOD
+CLOCK_GET_SECONDS_SINCE_EPOCH RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH
+CLOCK_GET_TICKS_SINCE_BOOT RTEMS_CLOCK_GET_TICKS_SINCE_BOOT
+CLOCK_GET_TICKS_PER_SECOND RTEMS_CLOCK_GET_TICKS_PER_SECOND
+CLOCK_GET_TIME_VALUE RTEMS_CLOCK_GET_TIME_VALUE
+#
+# Status Code Support Routines (External) -- NO CHANGES
+#
+#
+# Status Code Support Routines (Internal)
+#
+_Status_Is_successful rtems_is_status_successful
+_Status_Is_equal rtems_are_statuses_equal
+#
+# Time Conversion Support Routines (External) -- NO CHANGES
+#
+#
+# Time Conversion Support Routines (Internal)
+#
+_TOD_Milliseconds_to_microseconds RTEMS_MILLISECONDS_TO_MICROSECONDS
+_TOD_Milliseconds_to_ticks RTEMS_MILLISECONDS_TO_MICROSECONDS
+#
+# MP packet
+#
+MP_PACKET_INTERNAL_THREADS RTEMS_MP_PACKET_INTERNAL_THREADS
+MP_PACKET_RTEMS_TASKS RTEMS_MP_PACKET_TASKS
+MP_PACKET_MESSAGE_QUEUE RTEMS_MP_PACKET_MESSAGE_QUEUE
+MP_PACKET_SEMAPHORE RTEMS_MP_PACKET_SEMAPHORE
+MP_PACKET_PARTITION RTEMS_MP_PACKET_PARTITION
+MP_PACKET_REGION RTEMS_MP_PACKET_REGION
+MP_PACKET_EVENT RTEMS_MP_PACKET_EVENT
+MP_PACKET_SIGNAL RTEMS_MP_PACKET_SIGNAL
+#
+#
+#
+IO_Major_control rtems_device_major_number
+IO_Minor_control rtems_device_minor_number
+#
+# Configuration Info
+#
+Configuration_Table rtems_configuration_table
+Configuration_Initialization_tasks_table rtems_initialization_tasks_table
+Configuration_Driver_address_table rtems_driver_address_table
+Configuration_Extension_table rtems_extensions_table
+rtems_tasks_create_extension rtems_task_create_extension
+rtems_tasks_start_extension rtems_task_start_extension
+rtems_tasks_restart_extension rtems_task_restart_extension
+rtems_tasks_delete_extension rtems_task_delete_extension
+rtems_tasks_switch_extension rtems_task_switch_extension
+rtems_tasks_begin_extension rtems_task_begin_extension
+rtems_tasks_exitted_extension rtems_task_exitted_extension
+rtems_fatal_extension rtems_fatal_extension
+Configuration_MPCI_table rtems_mpci_table
+Configuration_Multiprocessing_table rtems_multiprocessing_table
+CPU_Table rtems_cpu_table
+#
+Clock_Get_options rtems_clock_get_options
+Clock_Time_value rtems_clock_time_value
+MP_packet_Prefix rtems_packet_prefix
+MP_packet_Classes rtems_mp_packet_classes
+TOD_Control rtems_time_of_day
+ISR_Vector rtems_vector_number
+Watchdog_Interval rtems_interval
+Watchdog_Service rtems_timer_service_routine_entry
+Attributes_Control rtems_attribute
+Modes_Control rtems_mode
+Options_Control rtems_option
+Priority_Control rtems_task_priority
+PRIORITY_MINIMUM RTEMS_MINIMUM_PRIORITY
+PRIORITY_MAXIMUM RTEMS_MAXIMUM_PRIORITY
+Event_sets_Control rtems_event_set
+ASR_Signal_set_control rtems_signal_set
+Status_Codes rtems_status_code
+RTEMS_TASKS_YIELD_PROCESSOR RTEMS_YIELD_PROCESSOR
+RATE_MONOTONIC_PERIOD_STATUS RTEMS_PERIOD_STATUS
+WATCHDOG_FOREVER RTEMS_NO_TIMEOUT
+STACK_MINIMUM_SIZE RTEMS_MINIMUM_STACK_SIZE
+#
+ASR_Handler rtems_asr_entry
+Thread_Entry rtems_task_entry
+#
+disable_intr rtems_interrupt_disable
+enable_intr rtems_interrupt_enable
+flash_intr rtems_interrupt_flash
+
diff --git a/c/update-tools/README b/c/update-tools/README
new file mode 100644
index 0000000000..bbf99cb71d
--- /dev/null
+++ b/c/update-tools/README
@@ -0,0 +1,7 @@
+#
+# $Id$
+#
+
+This directory contains tools which aid in upgrading from RTEMS 3.1.0
+to RTEMS 3.2.0.
+
diff --git a/cpukit/libcsupport/include/clockdrv.h b/cpukit/libcsupport/include/clockdrv.h
new file mode 100644
index 0000000000..258c590e0d
--- /dev/null
+++ b/cpukit/libcsupport/include/clockdrv.h
@@ -0,0 +1,51 @@
+/* clock.h
+ *
+ * This file describes the Clock Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CLOCK_DRIVER_h
+#define __CLOCK_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* variables */
+
+extern volatile rtems_unsigned32 Clock_driver_ticks;
+extern rtems_device_major_number rtems_clock_major;
+extern rtems_device_minor_number rtems_clock_minor;
+
+/* default clock driver entry */
+
+#define CLOCK_DRIVER_TABLE_ENTRY \
+ { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
+
+rtems_device_driver Clock_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver Clock_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/console.h b/cpukit/libcsupport/include/console.h
new file mode 100644
index 0000000000..02196de7a9
--- /dev/null
+++ b/cpukit/libcsupport/include/console.h
@@ -0,0 +1,69 @@
+/* console.h
+ *
+ * This file describes the Console Device Driver for all boards.
+ * This driver provides support for the standard C Library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef _CONSOLE_DRIVER_h
+#define _CONSOLE_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CONSOLE_DRIVER_TABLE_ENTRY \
+ { console_initialize, console_open, console_close, \
+ console_read, console_write, console_control }
+
+rtems_device_driver console_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver console_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/iosupp.h b/cpukit/libcsupport/include/iosupp.h
new file mode 100644
index 0000000000..5f4a83b8ca
--- /dev/null
+++ b/cpukit/libcsupport/include/iosupp.h
@@ -0,0 +1,44 @@
+/* iosupp.h
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __IOSUPP_h
+#define __IOSUPP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* character constants */
+
+#define BS 0x08 /* backspace */
+#define LF 0x0a /* line feed */
+#define CR 0x0d /* carriage return */
+#define XON 0x11 /* control-Q */
+#define XOFF 0x13 /* control-S */
+
+/* structures */
+
+#ifdef IOSUPP_INIT
+#define IOSUPP_EXTERN
+#else
+#undef IOSUPP_EXTERN
+#define IOSUPP_EXTERN extern
+#endif
+
+/* functions */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/cpukit/libcsupport/include/ringbuf.h b/cpukit/libcsupport/include/ringbuf.h
new file mode 100644
index 0000000000..8c80aaf9c8
--- /dev/null
+++ b/cpukit/libcsupport/include/ringbuf.h
@@ -0,0 +1,53 @@
+/*
+ * ringbuf.h
+ *
+ * This file provides simple ring buffer functionality.
+ *
+ * $Id$
+ */
+
+#ifndef __RINGBUF_H__
+#define __RINGBUF_H__
+
+#ifndef RINGBUF_QUEUE_LENGTH
+#define RINGBUF_QUEUE_LENGTH 128
+#endif
+
+typedef struct {
+ char buffer[RINGBUF_QUEUE_LENGTH];
+ volatile int head;
+ volatile int tail;
+} Ring_buffer_t;
+
+#define Ring_buffer_Initialize( _buffer ) \
+ do { \
+ (_buffer)->head = (_buffer)->tail = 0; \
+ } while ( 0 )
+
+#define Ring_buffer_Is_empty( _buffer ) \
+ ( (_buffer)->head == (_buffer)->tail )
+
+#define Ring_buffer_Is_full( _buffer ) \
+ ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
+
+#define Ring_buffer_Add_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
+ (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#define Ring_buffer_Remove_character( _buffer, _ch ) \
+ do { \
+ rtems_unsigned32 isrlevel; \
+ \
+ rtems_interrupt_disable( isrlevel ); \
+ (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
+ (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
+ rtems_interrupt_enable( isrlevel ); \
+ } while ( 0 )
+
+#endif
diff --git a/cpukit/libcsupport/include/rtems/assoc.h b/cpukit/libcsupport/include/rtems/assoc.h
new file mode 100644
index 0000000000..1982d654ac
--- /dev/null
+++ b/cpukit/libcsupport/include/rtems/assoc.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Rtems associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and v.v)
+ *
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_ASSOC_H
+#define _INCLUDE_ASSOC_H
+
+typedef struct {
+ const char *name;
+ unsigned32 local_value;
+ unsigned32 remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
+const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
+unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
+unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
+const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
+const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
+char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
+char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
+unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
+
+
+#endif /* ! _INCLUDE_ASSOC_H */
diff --git a/cpukit/libcsupport/include/rtems/error.h b/cpukit/libcsupport/include/rtems/error.h
new file mode 100644
index 0000000000..e4d8c77200
--- /dev/null
+++ b/cpukit/libcsupport/include/rtems/error.h
@@ -0,0 +1,33 @@
+/*
+ * Defines and externs for rtems error reporting
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ERROR_h
+#define __RTEMS_ERROR_h
+
+/*
+ * rtems_error() and rtems_panic() support
+ */
+
+#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
+#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
+
+#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
+ RTEMS_ERROR_PANIC) /* all */
+
+const char *rtems_status_text(rtems_status_code);
+int rtems_error(int error_code, const char *printf_format, ...);
+#ifdef __GNUC__
+void rtems_panic(const char *printf_format, ...)
+ __attribute__ ((__noreturn__));
+#else
+void rtems_panic(const char *printf_format, ...);
+#endif
+
+extern int rtems_panic_in_progress;
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h
new file mode 100644
index 0000000000..f43cd189e1
--- /dev/null
+++ b/cpukit/libcsupport/include/rtems/libcsupport.h
@@ -0,0 +1,42 @@
+/* libcsupport.h
+ *
+ * This include file contains the information regarding the
+ * RTEMS specific support for the standard C library.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __LIBC_SUPPORT_h
+#define __LIBC_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+);
+
+extern void malloc_dump(void);
+extern void libc_init(int reentrant);
+extern int host_errno(void);
+extern void fix_syscall_errno(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
new file mode 100644
index 0000000000..07d72620b1
--- /dev/null
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -0,0 +1,98 @@
+/*
+ * General purpose communication channel for RTEMS to allow UNIX/POSIX
+ * system call behavior on top of RTEMS IO devices.
+ *
+ * TODO
+ * stat(2)
+ * unlink(2)
+ * rename(2)
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_LIBIO_H
+#define _RTEMS_LIBIO_H
+
+typedef unsigned32 rtems_libio_offset_t;
+
+/*
+ * An open file data structure, indexed by 'fd'
+ * TODO:
+ * should really have a separate per/file data structure that this
+ * points to (eg: size, offset, driver, pathname should be in that)
+ */
+
+typedef struct {
+ rtems_driver_name_t *driver;
+ rtems_libio_offset_t size; /* size of file */
+ rtems_libio_offset_t offset; /* current offset into the file */
+ unsigned32 flags;
+ char *pathname; /* opened pathname */
+ Objects_Id sem;
+ unsigned32 data0; /* private to "driver" */
+ unsigned32 data1; /* ... */
+} rtems_libio_t;
+
+
+/*
+ * param block for read/write
+ * Note: it must include 'offset' instead of using iop's offset since
+ * we can have multiple outstanding i/o's on a device.
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ rtems_libio_offset_t offset;
+ unsigned8 *buffer;
+ unsigned32 count;
+ unsigned32 flags;
+ unsigned32 bytes_moved;
+} rtems_libio_rw_args_t;
+
+/*
+ * param block for open/close
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 flags;
+ unsigned32 mode;
+} rtems_libio_open_close_args_t;
+
+/*
+ * param block for ioctl
+ */
+
+typedef struct {
+ rtems_libio_t *iop;
+ unsigned32 command;
+ void *buffer;
+ unsigned32 ioctl_return;
+} rtems_libio_ioctl_args_t;
+
+
+/*
+ * Values for 'flag'
+ */
+
+#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
+#define LIBIO_FLAGS_READ 0x0002 /* reading */
+#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
+#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
+#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
+#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
+#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
+
+#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
+
+void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
+void rtems_libio_init(void);
+
+int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
+int __close(int fd);
+int __read(int fd, void *buffer, unsigned32 count);
+int __write(int fd, const void *buffer, unsigned32 count);
+int __ioctl(int fd, unsigned32 command, void *buffer);
+int __lseek(int fd, rtems_libio_offset_t offset, int whence);
+
+#endif /* _RTEMS_LIBIO_H */
diff --git a/cpukit/libcsupport/include/spurious.h b/cpukit/libcsupport/include/spurious.h
new file mode 100644
index 0000000000..428e826164
--- /dev/null
+++ b/cpukit/libcsupport/include/spurious.h
@@ -0,0 +1,38 @@
+/* spurious.h
+ *
+ * This file describes the Spurious Interrupt Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SPURIOUS_h
+#define __SPURIOUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SPURIOUS_DRIVER_TABLE_ENTRY \
+ { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL }
+
+rtems_device_driver Spurious_Initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/sys/utsname.h b/cpukit/libcsupport/include/sys/utsname.h
new file mode 100644
index 0000000000..ca15230d40
--- /dev/null
+++ b/cpukit/libcsupport/include/sys/utsname.h
@@ -0,0 +1,49 @@
+/* sys/utsname.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SYS_UTSNAME_h
+#define __POSIX_SYS_UTSNAME_h
+
+#include <sys/times.h>
+#include <sys/types.h>
+
+/*
+ * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
+ *
+ * NOTE: The lengths of the strings in this structure are
+ * just long enough to reliably contain the RTEMS information.
+ * For example, the fields are not long enough to support
+ * Internet hostnames.
+ */
+
+struct utsname {
+ char sysname[ 32 ]; /* Name of this implementation of the operating system */
+ char nodename[ 32 ]; /* Name of this node within an implementation */
+ /* specified communication network */
+ char release[ 32 ]; /* Current release level of this implementation */
+ char version[ 32 ]; /* Current version level of this release */
+ char machine[ 32 ]; /* Name of the hardware type on which the system */
+ /* is running */
+};
+
+/*
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+);
+
+/*
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+);
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/libcsupport/include/timerdrv.h b/cpukit/libcsupport/include/timerdrv.h
new file mode 100644
index 0000000000..d091b62410
--- /dev/null
+++ b/cpukit/libcsupport/include/timerdrv.h
@@ -0,0 +1,40 @@
+/* timerdrv.h
+ *
+ * This file describes the Timer Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_DRIVER_h
+#define __TIMER_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* functions */
+
+void Timer_initialize( void );
+
+rtems_unsigned32 Read_timer( void );
+
+rtems_status_code Empty_function( void );
+
+void Set_find_average_overhead(
+ rtems_boolean find_flag
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libcsupport/include/vmeintr.h b/cpukit/libcsupport/include/vmeintr.h
new file mode 100644
index 0000000000..6148114ce8
--- /dev/null
+++ b/cpukit/libcsupport/include/vmeintr.h
@@ -0,0 +1,58 @@
+/*
+ * vmeintr.h
+ *
+ * This file is the specification for the VMEbus interface library
+ * which should be provided by all BSPs for VMEbus Single Board
+ * Computers but currently only a few do so.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __VME_INTERRUPT_h
+#define __VME_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the mask which is used to determine which
+ * interrupt levels are affected by a call to this package.
+ * The LSB corresponds to VME interrupt 0 and the MSB
+ * to VME interrupt 7.
+ *
+ */
+
+typedef rtems_unsigned8 VME_interrupt_Mask;
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Disable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+/*
+ * VME_interrupt_Disable
+ *
+ */
+
+void VME_interrupt_Enable (
+ VME_interrupt_Mask mask /* IN */
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of include file */
diff --git a/cpukit/libcsupport/src/README b/cpukit/libcsupport/src/README
new file mode 100644
index 0000000000..ee7a90501e
--- /dev/null
+++ b/cpukit/libcsupport/src/README
@@ -0,0 +1,37 @@
+--
+-- $Id$
+--
+
+Overview of newlib support (newlib is from CYGNUS)
+ Each task can have its own libc state including:
+ open stdio files
+ strtok
+ multi precision arithmetic state
+ etc.
+
+ This is implemented by a reentrancy data structure for each task.
+
+ When a task is "started" (in RTEMS sense) the reentrancy structure
+ is allocated. Its address is stored in notepad[NOTEPAD_LAST].
+
+ When task is switched to, the value of global variable _impure_ptr
+ is changed to the value of the new tasks reentrancy structure.
+
+ When a task is deleted
+ atexit() processing (for that task) happens
+ task's stdio buffers are flushed
+
+ When exit(3) is called
+ calling task's atexit processing done
+ global libc state atexit processing done
+ (this will include any atexit routines installed by drivers)
+ executive is shutdown
+ causes a context switch back to bsp land
+
+
+NOTE:
+ libc extension are installed by bsp_libc_init()
+ iff we are using clock interrupts.
+ This hack is necessary to allow the tmtests to avoid
+ timing the extensions.
+
diff --git a/cpukit/libcsupport/src/__brk.c b/cpukit/libcsupport/src/__brk.c
new file mode 100644
index 0000000000..5f256cb072
--- /dev/null
+++ b/cpukit/libcsupport/src/__brk.c
@@ -0,0 +1,44 @@
+#if !defined(RTEMS_UNIX)
+
+/*
+ * RTEMS "Broken" __brk/__sbrk Implementation
+ *
+ * NOTE: sbrk is BSP provided.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <signal.h>
+#include <errno.h>
+#include <sys/types.h>
+#ifdef RTEMS_NEWLIB
+#include <reent.h>
+#endif
+#include <unistd.h>
+
+/* we use RTEMS for memory management. We don't need sbrk */
+
+void * __sbrk(int incr)
+{
+ errno = EINVAL;
+ return (void *)0;
+}
+
+int __brk( const void *endds )
+{
+ errno = EINVAL;
+ return -1;
+}
+
+#endif
diff --git a/cpukit/libcsupport/src/__gettod.c b/cpukit/libcsupport/src/__gettod.c
new file mode 100644
index 0000000000..6c9350d41c
--- /dev/null
+++ b/cpukit/libcsupport/src/__gettod.c
@@ -0,0 +1,103 @@
+#if !defined(RTEMS_UNIX)
+/*
+ * RTEMS gettimeofday Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <time.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <assert.h>
+
+/*
+ * NOTE: The solaris gettimeofday does not have a second parameter.
+ */
+
+int gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ rtems_status_code status;
+ rtems_clock_time_value time;
+
+ if ( !tp ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ tp->tv_sec = time.seconds;
+ tp->tv_usec = time.microseconds;
+
+ /*
+ * newlib does not have timezone and daylight savings time
+ * yet. When it does this needs to be fixed.
+ */
+
+#if 0
+ if ( tzp ) {
+ tzp->tz_minuteswest = 0; /* at UTC */
+ tzp->tz_dsttime = 0; /* no daylight savings */
+ tzp->minuteswest = timezone / 60; /* from seconds to minutes */
+ tzp->dsttime = daylight;
+ }
+#endif
+ return 0;
+}
+
+#if defined(RTEMS_NEWLIB)
+
+#if 0
+/*
+ * "Reentrant" version
+ */
+
+int _gettimeofday_r(
+ struct _reent *ignored_reentrancy_stuff,
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+#endif
+
+/*
+ * "System call" version
+ */
+
+int _gettimeofday(
+ struct timeval *tp,
+ struct timezone *tzp
+)
+{
+ return gettimeofday( tp, tzp );
+}
+
+#endif /* defined(RTEMS_NEWLIB) */
+
+#endif
diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c
new file mode 100644
index 0000000000..12fd9241fe
--- /dev/null
+++ b/cpukit/libcsupport/src/__times.c
@@ -0,0 +1,65 @@
+/*
+ * RTEMS _times Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <sys/times.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <assert.h>
+
+clock_t _times(
+ struct tms *ptms
+)
+{
+ rtems_status_code status;
+ rtems_interval ticks_since_boot;
+
+ if ( !ptms ) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ /* "POSIX" does not seem to allow for not having a TOD */
+ status = rtems_clock_get(
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ &ticks_since_boot
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ assert( 0 );
+ return -1;
+ }
+
+ /*
+ * RTEMS has no notion of system versus user time and does
+ * not (as of 3.2.0) keep track of CPU usage on a per task basis.
+ */
+
+ ptms->tms_utime = ticks_since_boot;
+ ptms->tms_stime = 0;
+ ptms->tms_cutime = 0;
+ ptms->tms_cstime = 0;
+
+ return 0;
+}
+
+clock_t times(
+ struct tms *ptms
+)
+{
+ return _times( ptms );
+}
+
diff --git a/cpukit/libcsupport/src/assoc.c b/cpukit/libcsupport/src/assoc.c
new file mode 100644
index 0000000000..74387a8c5b
--- /dev/null
+++ b/cpukit/libcsupport/src/assoc.c
@@ -0,0 +1,260 @@
+/*
+ * assoc.c
+ * rtems assoc routines
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "assoc.h"
+
+#include <stdio.h> /* sprintf */
+#include <string.h> /* strcat, strcmp */
+
+#define STREQ(a,b) (strcmp((a), (b)) == 0)
+#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (strcmp(ap->name, name) == 0)
+ return ap;
+
+ return default_ap;
+}
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->local_value == local_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+const rtems_assoc_t *
+rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *default_ap = 0;
+
+ if (rtems_assoc_is_default(ap))
+ default_ap = ap++;
+
+ for ( ; ap->name; ap++)
+ if (ap->remote_value == remote_value)
+ return ap;
+
+ return default_ap;
+}
+
+
+/*
+ * Get values
+ */
+
+unsigned32
+rtems_assoc_remote_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_remote_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->remote_value;
+
+ return 0;
+}
+
+unsigned32
+rtems_assoc_local_by_name(
+ const rtems_assoc_t *ap,
+ const char *name
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_name(ap, name);
+ if (nap)
+ return nap->local_value;
+
+ return 0;
+}
+
+/*
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+
+const char *
+rtems_assoc_name_bad(
+ unsigned32 bad_value
+)
+{
+#ifdef RTEMS_DEBUG
+ static char bad_buffer[32];
+
+ sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
+#else
+ static char bad_buffer[32] = "<assoc.c: BAD NAME>";
+#endif
+ return bad_buffer;
+}
+
+
+const char *
+rtems_assoc_name_by_local(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_local(ap, local_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(local_value);
+}
+
+const char *
+rtems_assoc_name_by_remote(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ const rtems_assoc_t *nap;
+ nap = rtems_assoc_ptr_by_remote(ap, remote_value);
+ if (nap)
+ return nap->name;
+
+ return rtems_assoc_name_bad(remote_value);
+}
+
+/*
+ * Bitfield functions assume just 1 bit set in each of remote and local
+ * entries; they do not check for this.
+ */
+
+unsigned32 rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 local_value
+ )
+{
+ unsigned32 b;
+ unsigned32 remote_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & local_value)
+ remote_value |= rtems_assoc_remote_by_local(ap, b);
+
+ return remote_value;
+}
+
+
+unsigned32 rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 remote_value
+ )
+{
+ unsigned32 b;
+ unsigned32 local_value = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & remote_value)
+ local_value |= rtems_assoc_local_by_remote(ap, b);
+
+ return local_value;
+}
+
+char *
+rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_remote(ap, b));
+ }
+
+ return buffer;
+}
+
+char *
+rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *ap,
+ unsigned32 value,
+ char *buffer
+ )
+{
+ unsigned32 b;
+
+ *buffer = 0;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (*buffer)
+ strcat(buffer, " ");
+ strcat(buffer, rtems_assoc_name_by_local(ap, b));
+ }
+
+ return buffer;
+}
diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c
new file mode 100644
index 0000000000..5bd481c3e6
--- /dev/null
+++ b/cpukit/libcsupport/src/error.c
@@ -0,0 +1,209 @@
+/*
+ * report errors and panics to RTEMS' stderr.
+ * Currently just used by RTEMS monitor.
+ *
+ * $Id$
+ */
+
+
+/*
+ * These routines provide general purpose error reporting.
+ * rtems_error reports an error to stderr and allows use of
+ * printf style formatting. A newline is appended to all messages.
+ *
+ * error_flag can be specified as any of the following:
+ *
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * It can also include a rtems_status value which can be OR'd
+ * with the above flags. *
+ *
+ * EXAMPLE
+ * #include <rtems.h>
+ * #include <rtems/error.h>
+ * rtems_error(0, "stray interrupt %d", intr);
+ *
+ * EXAMPLE
+ * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
+ * {
+ * rtems_error(status | RTEMS_ERROR_ABORT,
+ * "could not create task");
+ * }
+ *
+ * EXAMPLE
+ * if ((fd = open(pathname, O_RDNLY)) < 0)
+ * {
+ * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
+ * goto failed;
+ * }
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "error.h"
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h> /* _exit() */
+
+/* bug in hpux <errno.h>: no prototypes unless you are C++ */
+#ifdef hpux9
+char *strerror(int);
+#endif
+
+extern char *rtems_progname;
+int rtems_panic_in_progress;
+
+rtems_assoc_t rtems_status_assoc[] = {
+ { "successful completion", RTEMS_SUCCESSFUL, },
+ { "returned from a thread", RTEMS_TASK_EXITTED, },
+ { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
+ { "invalid object name", RTEMS_INVALID_NAME, },
+ { "invalid object id", RTEMS_INVALID_ID, },
+ { "too many", RTEMS_TOO_MANY, },
+ { "timed out waiting", RTEMS_TIMEOUT, },
+ { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
+ { "specified size was invalid", RTEMS_INVALID_SIZE, },
+ { "address specified is invalid", RTEMS_INVALID_ADDRESS, },
+ { "number was invalid", RTEMS_INVALID_NUMBER, },
+ { "item has not been initialized", RTEMS_NOT_DEFINED, },
+ { "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
+ { "request not satisfied", RTEMS_UNSATISFIED, },
+ { "thread is in wrong state", RTEMS_INCORRECT_STATE, },
+ { "thread already in state", RTEMS_ALREADY_SUSPENDED, },
+ { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
+ { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
+ { "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
+ { "invalid thread priority", RTEMS_INVALID_PRIORITY, },
+ { "invalid date/time", RTEMS_INVALID_CLOCK, },
+ { "invalid node id", RTEMS_INVALID_NODE, },
+ { "directive not configured", RTEMS_NOT_CONFIGURED, },
+ { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
+ { "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
+ { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
+ { "could not get enough memory", RTEMS_NO_MEMORY, },
+ { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
+ { 0, 0, 0 },
+};
+
+
+const char *
+rtems_status_text(
+ rtems_status_code status
+)
+{
+ return rtems_assoc_name_by_local(rtems_status_assoc, status);
+}
+
+
+static int rtems_verror(
+ unsigned32 error_flag,
+ const char *printf_format,
+ va_list arglist
+)
+{
+ int local_errno = 0;
+ int chars_written = 0;
+ rtems_status_code status;
+
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_panic_in_progress++;
+
+ /* disable task switches */
+ _Thread_Disable_dispatch();
+
+ /* don't aggravate things */
+ if (rtems_panic_in_progress > 2)
+ return 0;
+ }
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ status = error_flag & ~RTEMS_ERROR_MASK;
+ if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
+ local_errno = errno;
+
+ if (_System_state_Is_multiprocessing)
+ fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
+
+ if (rtems_progname && *rtems_progname)
+ chars_written += fprintf(stderr, "%s: ", rtems_progname);
+ chars_written += vfprintf(stderr, printf_format, arglist);
+
+ if (status)
+ chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
+
+ if (local_errno)
+ if ((local_errno > 0) && *strerror(local_errno))
+ chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
+ else
+ chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
+
+ chars_written += fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
+ {
+ if (error_flag & RTEMS_ERROR_PANIC)
+ {
+ rtems_error(0, "fatal error, exiting");
+ _exit(local_errno);
+ }
+ else
+ {
+ rtems_error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+ return chars_written;
+}
+
+
+/*
+ * Report an error.
+ * error_flag is as above; printf_format is a normal
+ * printf(3) format string, with its concommitant arguments.
+ *
+ * Returns the number of characters written.
+ */
+
+int rtems_error(
+ int error_flag,
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+ int chars_written;
+
+ va_start(arglist, printf_format);
+ chars_written = rtems_verror(error_flag, printf_format, arglist);
+ va_end(arglist);
+
+ return chars_written;
+}
+
+/*
+ * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
+ */
+
+void rtems_panic(
+ const char *printf_format,
+ ...
+ )
+{
+ va_list arglist;
+
+ va_start(arglist, printf_format);
+ (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
+ va_end(arglist);
+}
diff --git a/cpukit/libcsupport/src/hosterr.c b/cpukit/libcsupport/src/hosterr.c
new file mode 100644
index 0000000000..7fc2ca966e
--- /dev/null
+++ b/cpukit/libcsupport/src/hosterr.c
@@ -0,0 +1,43 @@
+/*
+ * Routines to access a host errno
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <errno.h>
+
+int host_errno(void);
+
+/*
+ * copy host errno, if any to thread aware errno, if any
+ */
+
+void fix_syscall_errno(void)
+{
+ errno = host_errno();
+}
+
+/*
+ * Get the host system errno, if any
+ * When using newlib (or possibly other libc's) on top of UNIX
+ * the errno returned by system calls may be unavailable due
+ * to trickery of making errno thread aware.
+ * This provides a kludge of getting at it.
+ */
+
+#undef errno
+extern int errno;
+int host_errno(void)
+{
+ return errno;
+}
+
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
new file mode 100644
index 0000000000..a01dea7b8a
--- /dev/null
+++ b/cpukit/libcsupport/src/libio.c
@@ -0,0 +1,442 @@
+/*
+ * Provide UNIX/POSIX-like io system calls for RTEMS using the
+ * RTEMS IO manager
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
+
+#include <stdio.h> /* O_RDONLY, et.al. */
+#include <fcntl.h> /* O_RDONLY, et.al. */
+
+#if defined(solaris2)
+#define O_NDELAY O_NONBLOCK
+#elif defined(RTEMS_NEWLIB)
+#define O_NDELAY _FNBIO
+#endif
+
+#include <errno.h>
+#include <string.h> /* strcmp */
+#include <unistd.h>
+#include <stdlib.h> /* calloc() */
+
+#include "libio.h" /* libio.h not pulled in by rtems */
+
+/*
+ * Semaphore to protect the io table
+ */
+
+Objects_Id rtems_libio_semaphore;
+
+#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O')
+#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n)
+
+unsigned32 rtems_libio_number_iops;
+rtems_libio_t *rtems_libio_iops;
+rtems_libio_t *rtems_libio_last_iop;
+
+#define rtems_libio_iop(fd) ((((unsigned32)(fd)) < rtems_libio_number_iops) ? \
+ &rtems_libio_iops[fd] : 0)
+
+#define rtems_libio_check_fd(fd) \
+ do { \
+ if ((fd) >= rtems_libio_number_iops) \
+ { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_buffer(buffer) \
+ do { \
+ if ((buffer) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_count(count) \
+ do { \
+ if ((count) == 0) \
+ { \
+ return 0; \
+ } \
+ } while (0)
+
+#define rtems_libio_check_permissions(iop, flag) \
+ do { \
+ if (((iop)->flags & (flag)) == 0) \
+ { \
+ errno = EINVAL; \
+ return -1; \
+ } \
+ } while (0)
+
+
+void
+rtems_libio_config(
+ rtems_configuration_table *config,
+ unsigned32 max_fds
+ )
+{
+ rtems_libio_number_iops = max_fds;
+
+ /*
+ * tweak config to reflect # of semaphores we will need
+ */
+
+ config->maximum_semaphores += 1; /* one for iop table */
+ config->maximum_semaphores += max_fds;
+}
+
+/*
+ * Called by bsp startup code to init the libio area.
+ */
+
+void
+rtems_libio_init(void)
+{
+ rtems_status_code rc;
+
+ if (rtems_libio_number_iops > 0)
+ {
+ rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops,
+ sizeof(rtems_libio_t));
+ if (rtems_libio_iops == NULL)
+ rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
+
+ rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
+ }
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_SEM,
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &rtems_libio_semaphore
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+}
+
+/*
+ * Convert RTEMS status to a UNIX errno
+ */
+
+rtems_assoc_t errno_assoc[] = {
+ { "OK", RTEMS_SUCCESSFUL, 0 },
+ { "TIMEOUT", RTEMS_TIMEOUT, ETIME },
+ { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_errno(rtems_status_code code)
+{
+ int rc;
+
+ if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code)))
+ {
+ errno = rc;
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
+ */
+
+rtems_assoc_t access_modes_assoc[] = {
+ { "READ", LIBIO_FLAGS_READ, O_RDONLY },
+ { "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY },
+ { "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR },
+ { 0, 0, 0 },
+};
+
+rtems_assoc_t status_flags_assoc[] = {
+ { "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
+ { "APPEND", LIBIO_FLAGS_APPEND, O_APPEND },
+ { "CREATE", LIBIO_FLAGS_CREATE, O_CREAT },
+ { 0, 0, 0 },
+};
+
+static unsigned32
+rtems_libio_fcntl_flags(unsigned32 fcntl_flags)
+{
+ unsigned32 flags = 0;
+ unsigned32 access_modes;
+
+ /*
+ * Access mode is a small integer
+ */
+
+ access_modes = fcntl_flags & O_ACCMODE;
+ fcntl_flags &= ~O_ACCMODE;
+ flags = rtems_assoc_local_by_remote(access_modes_assoc, access_modes);
+
+ /*
+ * Everything else is single bits
+ */
+
+ flags |= rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
+ return flags;
+}
+
+
+static rtems_libio_t *
+rtems_libio_allocate(void)
+{
+ rtems_libio_t *iop;
+ rtems_status_code rc;
+
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ for (iop = rtems_libio_iops; iop <= rtems_libio_last_iop; iop++)
+ if ((iop->flags & LIBIO_FLAGS_OPEN) == 0)
+ {
+ /*
+ * Got one; create a semaphore for it
+ */
+
+ rc = rtems_semaphore_create(
+ RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &iop->sem
+ );
+ if (rc != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ iop->flags = LIBIO_FLAGS_OPEN;
+ goto done;
+ }
+
+failed:
+ iop = 0;
+
+done:
+ rtems_semaphore_release(rtems_libio_semaphore);
+ return iop;
+}
+
+static void
+rtems_libio_free(rtems_libio_t *iop)
+{
+ rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+
+ if (iop->sem)
+ rtems_semaphore_delete(iop->sem);
+ (void) memset(iop, 0, sizeof(*iop));
+
+ rtems_semaphore_release(rtems_libio_semaphore);
+}
+
+int
+__open(
+ const char *pathname,
+ unsigned32 flag,
+ unsigned32 mode)
+{
+ rtems_status_code rc;
+ rtems_libio_t *iop = 0;
+ rtems_driver_name_t *np;
+ rtems_libio_open_close_args_t args;
+
+ if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
+ goto done;
+
+ iop = rtems_libio_allocate();
+ if (iop == 0)
+ {
+ rc = RTEMS_TOO_MANY;
+ goto done;
+ }
+
+ iop->driver = np;
+ iop->pathname = (char *) pathname;
+ iop->flags |= rtems_libio_fcntl_flags(flag);
+
+ args.iop = iop;
+ args.flags = iop->flags;
+ args.mode = mode;
+
+ rc = rtems_io_open(np->major, np->minor, (void *) &args);
+
+done:
+ if (rc != RTEMS_SUCCESSFUL)
+ {
+ if (iop)
+ rtems_libio_free(iop);
+ return rtems_libio_errno(rc);
+ }
+
+ return iop - rtems_libio_iops;
+}
+
+int
+__close(
+ int fd
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_open_close_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.flags = 0;
+ args.mode = 0;
+
+ rc = rtems_io_close(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+ return 0;
+}
+
+int
+__read(
+ int fd,
+ void * buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_read(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__write(
+ int fd,
+ const void *buffer,
+ unsigned32 count
+ )
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_rw_args_t args;
+
+ rtems_libio_check_fd(fd);
+ rtems_libio_check_buffer(buffer);
+ rtems_libio_check_count(count);
+ rtems_libio_check_permissions(iop, LIBIO_FLAGS_WRITE);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.offset = iop->offset;
+ args.buffer = (void *) buffer;
+ args.count = count;
+ args.flags = iop->flags;
+ args.bytes_moved = 0;
+
+ rc = rtems_io_write(np->major, np->minor, (void *) &args);
+
+ iop->offset += args.bytes_moved;
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.bytes_moved;
+}
+
+int
+__ioctl(
+ int fd,
+ unsigned32 command,
+ void * buffer)
+{
+ rtems_status_code rc;
+ rtems_driver_name_t *np;
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+ rtems_libio_ioctl_args_t args;
+
+ rtems_libio_check_fd(fd);
+
+ np = iop->driver;
+
+ args.iop = iop;
+ args.command = command;
+ args.buffer = buffer;
+
+ rc = rtems_io_control(np->major, np->minor, (void *) &args);
+
+ if (rc != RTEMS_SUCCESSFUL)
+ return rtems_libio_errno(rc);
+
+ return args.ioctl_return;
+}
+
+/*
+ * internal only??
+ */
+
+
+int
+__lseek(
+ int fd,
+ rtems_libio_offset_t offset,
+ int whence
+ )
+{
+ rtems_libio_t *iop = rtems_libio_iop(fd);
+
+ rtems_libio_check_fd(fd);
+
+ switch (whence)
+ {
+ case SEEK_SET:
+ iop->offset = offset;
+ break;
+
+ case SEEK_CUR:
+ iop->offset += offset;
+ break;
+
+ case SEEK_END:
+ iop->offset = iop->size - offset;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c
new file mode 100644
index 0000000000..de63df6ea0
--- /dev/null
+++ b/cpukit/libcsupport/src/malloc.c
@@ -0,0 +1,366 @@
+/*
+ * RTEMS Malloc Family Implementation
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "libcsupport.h"
+#ifdef RTEMS_NEWLIB
+#include <sys/reent.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h> /* sbrk(2) */
+
+rtems_id RTEMS_Malloc_Heap;
+size_t RTEMS_Malloc_Sbrk_amount;
+
+#ifdef RTEMS_DEBUG
+#define MALLOC_STATS
+#define MALLOC_DIRTY
+#endif
+
+#ifdef MALLOC_STATS
+#define MSBUMP(f,n) malloc_stats.f += (n)
+
+struct {
+ unsigned32 space_available; /* current size of malloc area */
+ unsigned32 malloc_calls; /* # calls to malloc */
+ unsigned32 free_calls;
+ unsigned32 realloc_calls;
+ unsigned32 calloc_calls;
+ unsigned32 max_depth; /* most ever malloc'd at 1 time */
+ unsigned64 lifetime_allocated;
+ unsigned64 lifetime_freed;
+} malloc_stats;
+
+#else /* No malloc_stats */
+#define MSBUMP(f,n)
+#endif
+
+void RTEMS_Malloc_Initialize(
+ void *start,
+ size_t length,
+ size_t sbrk_amount
+)
+{
+ rtems_status_code status;
+ void *starting_address;
+ rtems_unsigned32 old_address;
+ rtems_unsigned32 u32_address;
+
+ /*
+ * If the starting address is 0 then we are to attempt to
+ * get length worth of memory using sbrk. Make sure we
+ * align the address that we get back.
+ */
+
+ starting_address = start;
+ RTEMS_Malloc_Sbrk_amount = sbrk_amount;
+
+ if (!starting_address) {
+ u32_address = (unsigned int)sbrk(length);
+
+ if (u32_address == -1) {
+ rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
+ /* DOES NOT RETURN!!! */
+ }
+
+ if (u32_address & (CPU_ALIGNMENT-1)) {
+ old_address = u32_address;
+ u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * adjust the length by whatever we aligned by
+ */
+
+ length -= u32_address - old_address;
+ }
+
+ starting_address = (void *)u32_address;
+ }
+
+ /*
+ * Unfortunately we cannot use assert if this fails because if this
+ * has failed we do not have a heap and if we do not have a heap
+ * STDIO cannot work because there will be no buffers.
+ */
+
+ status = rtems_region_create(
+ rtems_build_name( 'H', 'E', 'A', 'P' ),
+ starting_address,
+ length,
+ CPU_ALIGNMENT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &RTEMS_Malloc_Heap
+ );
+ if ( status != RTEMS_SUCCESSFUL )
+ rtems_fatal_error_occurred( status );
+
+#ifdef MALLOC_STATS
+ /* zero all the stats */
+ (void) memset(&malloc_stats, 0, sizeof(malloc_stats));
+#endif
+
+ MSBUMP(space_available, length);
+}
+
+void *malloc(
+ size_t size
+)
+{
+ void *return_this;
+ void *starting_address;
+ rtems_unsigned32 the_size;
+ rtems_unsigned32 sbrk_amount;
+ rtems_status_code status;
+
+ MSBUMP(malloc_calls, 1);
+
+ if ( !size )
+ return (void *) 0;
+
+ /*
+ * Try to give a segment in the current region if there is not
+ * enough space then try to grow the region using rtems_region_extend().
+ * If this fails then return a NULL pointer.
+ */
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+
+ if ( status != RTEMS_SUCCESSFUL ) {
+ /*
+ * Round to the "requested sbrk amount" so hopefully we won't have
+ * to grow again for a while. This effectively does sbrk() calls
+ * in "page" amounts.
+ */
+
+ sbrk_amount = RTEMS_Malloc_Sbrk_amount;
+
+ if ( sbrk_amount == 0 )
+ return (void *) 0;
+
+ the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
+
+ if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
+ return (void *) 0;
+
+ status = rtems_region_extend(
+ RTEMS_Malloc_Heap,
+ starting_address,
+ the_size
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ sbrk(-the_size);
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+
+ MSBUMP(space_available, the_size);
+
+ status = rtems_region_get_segment(
+ RTEMS_Malloc_Heap,
+ size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &return_this
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = ENOMEM;
+ return (void *) 0;
+ }
+ }
+
+#ifdef MALLOC_STATS
+ if (return_this)
+ {
+ unsigned32 actual_size;
+ unsigned32 current_depth;
+ status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size);
+ MSBUMP(lifetime_allocated, actual_size);
+ current_depth = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+ if (current_depth > malloc_stats.max_depth)
+ malloc_stats.max_depth = current_depth;
+ }
+#endif
+
+#ifdef MALLOC_DIRTY
+ (void) memset(return_this, 0xCF, size);
+#endif
+
+ return return_this;
+}
+
+void *calloc(
+ size_t nelem,
+ size_t elsize
+)
+{
+ register char *cptr;
+ int length;
+
+ MSBUMP(calloc_calls, 1);
+
+ length = nelem * elsize;
+ cptr = malloc( length );
+ if ( cptr )
+ memset( cptr, '\0', length );
+
+ MSBUMP(malloc_calls, -1); /* subtract off the malloc */
+
+ return cptr;
+}
+
+void *realloc(
+ void *ptr,
+ size_t size
+)
+{
+ rtems_unsigned32 old_size;
+ rtems_status_code status;
+ char *new_area;
+
+ MSBUMP(realloc_calls, 1);
+
+ if ( !ptr )
+ return malloc( size );
+
+ if ( !size ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ new_area = malloc( size );
+ if ( !new_area ) {
+ free( ptr );
+ return (void *) 0;
+ }
+
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ return (void *) 0;
+ }
+
+ memcpy( new_area, ptr, (size < old_size) ? size : old_size );
+ free( ptr );
+
+ return new_area;
+
+}
+
+void free(
+ void *ptr
+)
+{
+ rtems_status_code status;
+
+ MSBUMP(free_calls, 1);
+
+ if ( !ptr )
+ return;
+
+#ifdef MALLOC_STATS
+ {
+ unsigned32 size;
+ status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ MSBUMP(lifetime_freed, size);
+ }
+ }
+#endif
+
+ status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ errno = EINVAL;
+ assert( 0 );
+ }
+}
+
+#ifdef MALLOC_STATS
+/*
+ * Dump the malloc statistics
+ * May be called via atexit() (installable by our bsp) or
+ * at any time by user
+ */
+
+void malloc_dump(void)
+{
+ unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+
+ printf("Malloc stats\n");
+ printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
+ (unsigned int) malloc_stats.space_available / 1024,
+ (unsigned int) allocated / 1024,
+ /* avoid float! */
+ (allocated * 100) / malloc_stats.space_available,
+ (unsigned int) malloc_stats.max_depth / 1024,
+ (malloc_stats.max_depth * 100) / malloc_stats.space_available,
+ (unsigned long long) malloc_stats.lifetime_allocated / 1024,
+ (unsigned long long) malloc_stats.lifetime_freed / 1024);
+ printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n",
+ malloc_stats.malloc_calls,
+ malloc_stats.free_calls,
+ malloc_stats.realloc_calls,
+ malloc_stats.calloc_calls);
+}
+#endif
+
+/*
+ * "Reentrant" versions of the above routines implemented above.
+ */
+
+#ifdef RTEMS_NEWLIB
+void *malloc_r(
+ struct _reent *ignored,
+ size_t size
+)
+{
+ return malloc( size );
+}
+
+void *calloc_r(
+ size_t nelem,
+ size_t elsize
+)
+{
+ return calloc( nelem, elsize );
+}
+
+void *realloc_r(
+ void *ptr,
+ size_t size
+)
+{
+ return realloc_r( ptr, size );
+}
+
+void free_r(
+ void *ptr
+)
+{
+ free( ptr );
+}
+#endif
+
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
new file mode 100644
index 0000000000..8c9ed2e1a8
--- /dev/null
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -0,0 +1,336 @@
+#if defined(RTEMS_NEWLIB)
+
+/*
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * Description:
+ * Implementation of hooks for the CYGNUS newlib libc
+ * These hooks set things up so that:
+ * '_REENT' is switched at task switch time.
+ *
+ *
+ * TODO:
+ *
+ * NOTE:
+ *
+ * $Id$
+ *
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <libcsupport.h>
+#include <stdlib.h> /* for free() */
+#include <string.h> /* for memset() */
+
+#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
+
+/*
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ * NOTE:
+ * There is some problem with doing this on the hpux version
+ * of the UNIX simulator (symptom is printf core dumps), so
+ * we just don't for now.
+ * Not sure if this is a problem with hpux, newlib, or something else.
+ */
+
+#if defined(RTEMS_UNIX) && !defined(hpux)
+#define NEED_SETVBUF
+#endif
+
+#ifdef NEED_SETVBUF
+#include <stdio.h>
+#endif
+
+#include "internal.h"
+
+#define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST
+
+
+int libc_reentrant; /* do we think we are reentrant? */
+struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);;
+
+/*
+ * CYGNUS newlib routine that does atexit() processing and flushes
+ * stdio streams
+ * undocumented
+ */
+
+extern void _wrapup_reent(struct _reent *);
+extern void _reclaim_reent(struct _reent *);
+
+void
+libc_wrapup(void)
+{
+ _wrapup_reent(0);
+ if (_REENT != &libc_global_reent)
+ {
+ _wrapup_reent(&libc_global_reent);
+#if 0
+ /* don't reclaim this one, just in case we do printfs */
+ /* on our way out to ROM */
+ _reclaim_reent(&libc_global_reent);
+#endif
+ _REENT = &libc_global_reent;
+ }
+}
+
+
+rtems_boolean
+libc_create_hook(rtems_tcb *current_task,
+ rtems_tcb *creating_task)
+{
+ MY_task_set_note(creating_task, LIBC_NOTEPAD, 0);
+ return TRUE;
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ */
+
+rtems_extension
+libc_start_hook(rtems_tcb *current_task,
+ rtems_tcb *starting_task)
+{
+ struct _reent *ptr;
+
+ /* NOTE: our malloc is reentrant without a reent ptr since
+ * it is based on region manager
+ */
+
+ ptr = (struct _reent *) malloc(sizeof(struct _reent));
+
+ /* GCC extension: structure constants */
+ *ptr = (struct _reent) _REENT_INIT((*ptr));
+
+ MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
+}
+
+/*
+ * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
+ *
+ * NOTE: When using RTEMS fake stat, fstat, and isatty, all output
+ * is line buffered so this setvbuf is not necessary. This
+ * setvbuf insures that we can redirect the output of a test
+ * on the UNIX simulator and it is in the same order as for a
+ * real target.
+ */
+
+#ifdef RTEMS_UNIX
+rtems_extension
+libc_begin_hook(rtems_tcb *current_task)
+{
+ setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
+}
+#endif
+
+rtems_extension
+libc_switch_hook(rtems_tcb *current_task,
+ rtems_tcb *heir_task)
+{
+ rtems_unsigned32 impure_value;
+
+ /* XXX We can't use rtems_task_set_note() here since SYSI task has a
+ * tid of 0, which is treated specially (optimized, actually)
+ * by rtems_task_set_note
+ *
+ * NOTE: The above comment is no longer true and we need to use
+ * the extension data areas added about the same time.
+ */
+
+ /*
+ * Don't touch the outgoing task if it has been deleted.
+ */
+
+ if ( !_States_Is_transient( current_task->current_state ) ) {
+ impure_value = (rtems_unsigned32) _REENT;
+ MY_task_set_note(current_task, LIBC_NOTEPAD, impure_value);
+ }
+
+ _REENT = (struct _reent *) MY_task_get_note(heir_task, LIBC_NOTEPAD);
+
+}
+
+/*
+ * Function: libc_delete_hook
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called when a task is deleted.
+ * Must restore the new lib reentrancy state for the new current
+ * task.
+ *
+ * Parameters:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+rtems_extension
+libc_delete_hook(rtems_tcb *current_task,
+ rtems_tcb *deleted_task)
+{
+ struct _reent *ptr;
+
+ /*
+ * The reentrancy structure was allocated by newlib using malloc()
+ */
+
+ if (current_task == deleted_task)
+ {
+ ptr = _REENT;
+ }
+ else
+ {
+ ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
+ }
+
+ /* if (ptr) */
+ if (ptr && ptr != &libc_global_reent)
+ {
+ _wrapup_reent(ptr);
+ _reclaim_reent(ptr);
+ free(ptr);
+ }
+
+ MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
+
+ /*
+ * Require the switch back to another task to install its own
+ */
+
+ if (current_task == deleted_task)
+ {
+ _REENT = 0;
+ }
+}
+
+/*
+ * Function: libc_init
+ * Created: 94/12/10
+ *
+ * Description:
+ * Init libc for CYGNUS newlib
+ * Set up _REENT to use our global libc_global_reent.
+ * (newlib provides a global of its own, but we prefer our
+ * own name for it)
+ *
+ * If reentrancy is desired (which it should be), then
+ * we install the task extension hooks to maintain the
+ * newlib reentrancy global variable _REENT on task
+ * create, delete, switch, exit, etc.
+ *
+ * Parameters:
+ * reentrant non-zero if reentrant library desired.
+ *
+ * Returns:
+ *
+ * Side Effects:
+ * installs libc extensions if reentrant.
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ */
+
+void
+libc_init(int reentrant)
+{
+ rtems_extensions_table libc_extension;
+ rtems_id extension_id;
+ rtems_status_code rc;
+
+ _REENT = &libc_global_reent;
+
+ if (reentrant)
+ {
+ memset(&libc_extension, 0, sizeof(libc_extension));
+
+ libc_extension.thread_create = libc_create_hook;
+ libc_extension.thread_start = libc_start_hook;
+#ifdef RTEMS_UNIX
+ libc_extension.thread_begin = libc_begin_hook;
+#endif
+ libc_extension.thread_switch = libc_switch_hook;
+ libc_extension.thread_delete = libc_delete_hook;
+
+ rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
+ &libc_extension, &extension_id);
+ if (rc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(rc);
+
+ libc_reentrant = reentrant;
+ }
+}
+
+
+void
+exit(int status)
+{
+ libc_wrapup();
+ rtems_shutdown_executive(status);
+}
+
+
+/*
+ * Function: _exit
+ * Created: 94/12/10
+ *
+ * Description:
+ * Called from exit() after it does atexit() processing and stdio fflush's
+ *
+ * called from bottom of exit() to really delete the task.
+ * If we are using reentrant libc, then let the delete extension
+ * do all the work, otherwise if a shutdown is in progress,
+ * then just do it.
+ *
+ * Parameters:
+ * exit status
+ *
+ * Returns:
+ * does not return
+ *
+ * Side Effects:
+ *
+ * Notes:
+ *
+ *
+ * Deficiencies/ToDo:
+ *
+ *
+ */
+
+#if !defined(RTEMS_UNIX) && !defined(__GO32__)
+void _exit(int status)
+{
+ rtems_shutdown_executive(status);
+}
+#endif
+
+#endif
diff --git a/cpukit/libcsupport/src/no_libc.c b/cpukit/libcsupport/src/no_libc.c
new file mode 100644
index 0000000000..9bb65f4df6
--- /dev/null
+++ b/cpukit/libcsupport/src/no_libc.c
@@ -0,0 +1,45 @@
+#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
+
+/* no_libc.h
+ *
+ * This file contains stubs for the reentrancy hooks when
+ * an unknown C library is used.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+
+#include "libcsupport.h"
+#include "internal.h"
+
+#include <stdlib.h> /* for free() */
+
+void
+libc_init(int reentrant)
+{
+}
+
+void libc_suspend_main(void)
+{
+}
+
+
+void libc_global_exit(rtems_unsigned32 code)
+{
+}
+
+void _exit(int status)
+{
+}
+
+#endif
diff --git a/cpukit/libcsupport/src/unixlibc.c b/cpukit/libcsupport/src/unixlibc.c
new file mode 100644
index 0000000000..2acd4fba8e
--- /dev/null
+++ b/cpukit/libcsupport/src/unixlibc.c
@@ -0,0 +1,11 @@
+/*
+ * $Id$
+ */
+
+#if defined(RTEMS_UNIXLIB)
+
+void libc_init(int reentrant)
+{
+}
+
+#endif
diff --git a/cpukit/libcsupport/src/utsname.c b/cpukit/libcsupport/src/utsname.c
new file mode 100644
index 0000000000..98b105023e
--- /dev/null
+++ b/cpukit/libcsupport/src/utsname.c
@@ -0,0 +1,61 @@
+/* utsname.c
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/utsname.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * 4.4.1 Get System Name, P1003.1b-1993, p. 90
+ */
+
+int uname(
+ struct utsname *name
+)
+{
+ /* XXX: Here is what Solaris returns...
+ sysname = SunOS
+ nodename = node_name
+ release = 5.3
+ version = Generic_101318-12
+ machine = sun4m
+ */
+
+ strcpy( name->sysname, "RTEMS" );
+
+ sprintf( name->nodename, "Node %d\n", _Objects_Local_node );
+
+ /* XXX release string is in BAD format for this routine!!! */
+ strcpy( name->release, "3.2.0" );
+
+ /* XXX does this have any meaning for RTEMS */
+
+ strcpy( name->release, "" );
+
+ sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME );
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.5.2 Get Process Times, P1003.1b-1993, p. 92
+ */
+
+clock_t times(
+ struct tms *buffer
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/cpukit/libmisc/README b/cpukit/libmisc/README
new file mode 100644
index 0000000000..6825898121
--- /dev/null
+++ b/cpukit/libmisc/README
@@ -0,0 +1,16 @@
+#
+# $Id$
+#
+
+This directory contains for the "miscellaneous" library. Currently
+the only item in this library is a user extension set which checks
+for a task "blowing" it's stack.
+
+The following ideas have been mentioned for items which could go
+in this library, but this list is not all inclusive:
+
+ + Workspace Consistency Checker
+ + Task Execution Time Monitor
+
+The intent of this library is to provide a home for useful utility routines
+which are dependent upon RTEMS.
diff --git a/cpukit/libmisc/monitor/README b/cpukit/libmisc/monitor/README
new file mode 100644
index 0000000000..d5a73da140
--- /dev/null
+++ b/cpukit/libmisc/monitor/README
@@ -0,0 +1,97 @@
+#
+# $Id$
+#
+
+monitor task
+
+The monitor task is an optional task that knows about RTEMS
+data structures and can print out information about them.
+It is a work-in-progress and needs many more commands, but
+is useful now.
+
+The monitor works best when it is the highest priority task,
+so all your other tasks should ideally be at some priority
+greater than 1.
+
+To use the monitor:
+-------------------
+
+ #include <rtems/monitor.h>
+
+ ...
+
+ rtems_monitor_init(0);
+
+ The parameter to rtems_monitor_init() tells the monitor whether
+ to suspend itself on startup. A value of 0 causes the monitor
+ to immediately enter command mode; a non-zero value causes the
+ monitor to suspend itself after creation and wait for explicit
+ wakeup.
+
+
+ rtems_monitor_wakeup();
+
+ wakes up a suspended monitor and causes it to reenter command mode.
+
+Monitor commands
+----------------
+
+ The monitor prompt is 'rtems> '.
+ Can abbreviate commands to "uniquity"
+ There is a 'help' command. Here is the output from various
+ help commands:
+
+ Commands (may be abbreviated)
+
+ help -- get this message or command specific help
+ task -- show task information
+ queue -- show message queue information
+ symbol -- show entries from symbol table
+ pause -- pause monitor for a specified number of ticks
+ fatal -- invoke a fatal RTEMS error
+
+ task [id [id ...] ]
+ display information about the specified tasks.
+ Default is to display information about all tasks on this node
+
+ queue [id [id ... ] ]
+ display information about the specified message queues
+ Default is to display information about all queues on this node
+
+ symbol [ symbolname [symbolname ... ] ]
+ display value associated with specified symbol.
+ Defaults to displaying all known symbols.
+
+ pause [ticks]
+ monitor goes to "sleep" for specified ticks (default is 1)
+ monitor will resume at end of period or if explicitly awakened
+
+ fatal [status]
+ Invoke 'rtems_fatal_error_occurred' with 'status'
+ (default is RTEMS_INTERNAL_ERROR)
+
+ continue
+ put the monitor to sleep waiting for an explicit wakeup from the
+ program running.
+
+
+Sample output from 'task' command
+---------------------------------
+
+ rtems> task
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES
+ ------------------------------------------------------------------------
+ 00010001 UI1 2 READY P:T:nA NONE15: 0x40606348
+ 00010002 RMON 1 READY nP NONE15: 0x40604110
+
+ 'RMON' is the monitor itself, so we have 1 "user" task.
+ Its modes are P:T:nA which translate to:
+
+ preemptable
+ timesliced
+ no ASRS
+
+ It has no events.
+ It has a notepad value for notepad 15 which is 0x40606348
+ (this is the libc thread state)
+
diff --git a/cpukit/libmisc/monitor/mon-command.c b/cpukit/libmisc/monitor/mon-command.c
new file mode 100644
index 0000000000..87d31dfa2a
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-command.c
@@ -0,0 +1,187 @@
+/*
+ * Command parsing routines for RTEMS monitor
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * make_argv(cp): token-count
+ * Break up the command line in 'cp' into global argv[] and argc (return
+ * value).
+ */
+
+int
+rtems_monitor_make_argv(
+ char *cp,
+ int *argc_p,
+ char **argv)
+{
+ int argc = 0;
+
+ while ((cp = strtok(cp, " \t\n\r")))
+ {
+ argv[argc++] = cp;
+ cp = (char *) NULL;
+ }
+ argv[argc] = (char *) NULL; /* end of argv */
+
+ return *argc_p = argc;
+}
+
+
+/*
+ * Read and break up a monitor command
+ *
+ * We have to loop on the gets call, since it will return NULL under UNIX
+ * RTEMS when we get a signal (eg: SIGALRM).
+ */
+
+int
+rtems_monitor_command_read(char *command,
+ int *argc,
+ char **argv)
+{
+ extern rtems_configuration_table BSP_Configuration;
+ static char monitor_prompt[32];
+
+ /*
+ * put node number in the prompt if we are multiprocessing
+ */
+
+ if (BSP_Configuration.User_multiprocessing_table == 0)
+ sprintf(monitor_prompt, "%s", MONITOR_PROMPT);
+ else if (rtems_monitor_default_node != rtems_monitor_node)
+ sprintf(monitor_prompt, "%d-%s-%d", rtems_monitor_node, MONITOR_PROMPT, rtems_monitor_default_node);
+ else
+ sprintf(monitor_prompt, "%d-%s", rtems_monitor_node, MONITOR_PROMPT);
+
+#ifdef RTEMS_UNIX
+ /* RTEMS on unix gets so many interrupt system calls this is hosed */
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ while (gets(command) == (char *) 0)
+ ;
+#else
+ do
+ {
+ printf("%s> ", monitor_prompt);
+ fflush(stdout);
+ } while (gets(command) == (char *) 0);
+#endif
+
+ return rtems_monitor_make_argv(command, argc, argv);
+}
+
+/*
+ * Look up a command in a command table
+ *
+ */
+
+rtems_monitor_command_entry_t *
+rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t *table,
+ int argc,
+ char **argv
+)
+{
+ rtems_monitor_command_entry_t *p;
+ rtems_monitor_command_entry_t *abbreviated_match = 0;
+ int abbreviated_matches = 0;
+ char *command;
+ int command_length;
+
+ command = argv[0];
+
+ if ((table == 0) || (command == 0))
+ goto failed;
+
+ command_length = strlen(command);
+
+ for (p = table; p->command; p++)
+ if (STREQ(command, p->command)) /* exact match */
+ goto done;
+ else if (STRNEQ(command, p->command, command_length))
+ {
+ abbreviated_matches++;
+ abbreviated_match = p;
+ }
+
+ /* no perfect match; is there a non-ambigous abbreviated match? */
+ if ( ! abbreviated_match)
+ {
+ printf("Unrecognized command '%s'; try 'help'\n", command);
+ goto failed;
+ }
+
+ if (abbreviated_matches > 1)
+ {
+ printf("Command '%s' is ambiguous; try 'help'\n", command);
+ goto failed;
+ }
+
+ p = abbreviated_match;
+
+done:
+ if (p->command_function == 0)
+ goto failed;
+ return p;
+
+failed:
+ return 0;
+}
+
+void
+rtems_monitor_command_usage(rtems_monitor_command_entry_t *table,
+ char *command_string)
+{
+ rtems_monitor_command_entry_t *help = 0;
+ char *help_command_argv[2];
+
+ /* if first entry in table is a usage, then print it out */
+ if (command_string == 0)
+ {
+ if (STREQ(table->command, "--usage--") && table->usage)
+ help = table;
+ }
+ else
+ {
+ help_command_argv[0] = command_string;
+ help_command_argv[1] = 0;
+ help = rtems_monitor_command_lookup(table, 1, help_command_argv);
+ }
+
+ if (help)
+ printf("%s\n", help->usage);
+}
+
+
+void
+rtems_monitor_help_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_command_entry_t *command;
+
+ command = (rtems_monitor_command_entry_t *) command_arg;
+
+ if (argc == 1)
+ rtems_monitor_command_usage(command, 0);
+ else
+ {
+ for (arg=1; argv[arg]; arg++)
+ rtems_monitor_command_usage(command, argv[arg]);
+ }
+}
diff --git a/cpukit/libmisc/monitor/mon-config.c b/cpukit/libmisc/monitor/mon-config.c
new file mode 100644
index 0000000000..f5c9f6f093
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-config.c
@@ -0,0 +1,130 @@
+/*
+ * RTEMS Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_config_canonical(
+ rtems_monitor_config_t *canonical_config,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = (rtems_configuration_table *) config_void;
+
+ canonical_config->work_space_start = c->work_space_start;
+ canonical_config->work_space_size = c->work_space_size;
+ canonical_config->maximum_tasks = c->maximum_tasks;
+ canonical_config->maximum_timers = c->maximum_timers;
+ canonical_config->maximum_semaphores = c->maximum_semaphores;
+ canonical_config->maximum_message_queues = c->maximum_message_queues;
+ canonical_config->maximum_partitions = c->maximum_partitions;
+ canonical_config->maximum_regions = c->maximum_regions;
+ canonical_config->maximum_ports = c->maximum_ports;
+ canonical_config->maximum_periods = c->maximum_periods;
+ canonical_config->maximum_extensions = c->maximum_extensions;
+ canonical_config->microseconds_per_tick = c->microseconds_per_tick;
+ canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
+ canonical_config->number_of_initialization_tasks = c->number_of_initialization_tasks;
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_config_next(
+ void *object_info,
+ rtems_monitor_config_t *canonical_config,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_config_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+INITIAL (startup) Configuration Info\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_config_dump(
+ rtems_monitor_config_t *monitor_config,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length = 0;
+ length += printf("WORKSPACE");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("start: 0x%x; size: 0x%x\n",
+ (unsigned32) monitor_config->work_space_start,
+ monitor_config->work_space_size);
+
+ length = 0;
+ length += printf("TIME");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n",
+ monitor_config->microseconds_per_tick,
+ monitor_config->ticks_per_timeslice,
+ 1000000 / monitor_config->microseconds_per_tick);
+
+ length = 0;
+ length += printf("MAXIMUMS");
+ length += rtems_monitor_pad(DATACOL, length);
+ length += printf("tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n",
+ monitor_config->maximum_tasks,
+ monitor_config->maximum_timers,
+ monitor_config->maximum_semaphores,
+ monitor_config->maximum_message_queues,
+ monitor_config->maximum_extensions);
+ length = 0;
+ length += rtems_monitor_pad(CONTCOL, length);
+ length += printf("partitions: %d; regions: %d; ports: %d; periods: %d\n",
+ monitor_config->maximum_partitions,
+ monitor_config->maximum_regions,
+ monitor_config->maximum_ports,
+ monitor_config->maximum_periods);
+}
diff --git a/cpukit/libmisc/monitor/mon-dname.c b/cpukit/libmisc/monitor/mon-dname.c
new file mode 100644
index 0000000000..e6993e18f7
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-dname.c
@@ -0,0 +1,112 @@
+/*
+ * RTEMS monitor driver names support.
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'dname' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+#include <string.h> /* strncpy() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+void
+rtems_monitor_dname_canonical(
+ rtems_monitor_dname_t *canonical_dname,
+ void *dname_void
+)
+{
+ rtems_driver_name_t *np = (rtems_driver_name_t *) dname_void;
+
+ (void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
+ canonical_dname->major = np->major;
+ canonical_dname->minor = np->minor;
+}
+
+void *
+rtems_monitor_dname_next(
+ void *object_information,
+ rtems_monitor_dname_t *canonical_dname,
+ rtems_id *next_id
+)
+{
+ int n = rtems_get_index(*next_id);
+ rtems_driver_name_t *table = _IO_Driver_name_table;
+ rtems_driver_name_t *np = 0;
+
+/* XXX should we be using _IO_Number_of_devices */
+ for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
+ if (np->device_name)
+ goto done;
+
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+
+done:
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_dname->id = n;
+ canonical_dname->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return np;
+}
+
+void
+rtems_monitor_dname_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major:Minor Name\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_dname_dump(
+ rtems_monitor_dname_t *monitor_dname,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(6, length);
+ length += rtems_monitor_dump_hex(monitor_dname->major);
+ length += printf(":");
+ length += rtems_monitor_dump_hex(monitor_dname->minor);
+
+ length += rtems_monitor_pad(16, length);
+ length += printf("%.*s",
+ (int) sizeof(monitor_dname->name_string),
+ (char *) monitor_dname->name_string);
+
+ length += printf("\n");
+ length = 0;
+}
diff --git a/cpukit/libmisc/monitor/mon-driver.c b/cpukit/libmisc/monitor/mon-driver.c
new file mode 100644
index 0000000000..d5cff24a19
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-driver.c
@@ -0,0 +1,136 @@
+/*
+ * RTEMS monitor IO (device drivers) support
+ *
+ * There are 2 "driver" things the monitor knows about.
+ *
+ * 1. Regular RTEMS drivers.
+ * This is a table indexed by major device number and
+ * containing driver entry points only.
+ *
+ * 2. Driver name table.
+ * A separate table of names for drivers.
+ * The table converts driver names to a major number
+ * as index into the driver table and a minor number
+ * for an argument to driver.
+ *
+ * Drivers are displayed with 'driver' command.
+ * Names are displayed with 'name' command.
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+#define CONTCOL DATACOL /* continued col */
+
+
+void
+rtems_monitor_driver_canonical(
+ rtems_monitor_driver_t *canonical_driver,
+ void *driver_void
+)
+{
+ rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
+ d->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
+ d->open);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
+ d->close);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
+ d->read);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
+ d->write);
+ rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
+ d->control);
+}
+
+
+void *
+rtems_monitor_driver_next(
+ void *object_info,
+ rtems_monitor_driver_t *canonical_driver,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_device_drivers)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_driver->id = n;
+ canonical_driver->name = rtems_build_name('-', '-', '-', '-');
+
+ *next_id += 1;
+ return (void *) (c->Device_driver_table + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_driver_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ Major Entry points\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+void
+rtems_monitor_driver_dump(
+ rtems_monitor_driver_t *monitor_driver,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += printf(" %d", monitor_driver->id);
+
+ length += rtems_monitor_pad(13, length);
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
+ length += printf("; control: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("open: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
+ length += printf("; close: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(13, length);
+
+ length += printf("read: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
+ length += printf("; write: ");
+ length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
+ length += printf("\n");
+ length = 0;
+}
diff --git a/cpukit/libmisc/monitor/mon-extension.c b/cpukit/libmisc/monitor/mon-extension.c
new file mode 100644
index 0000000000..4afecaa617
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-extension.c
@@ -0,0 +1,98 @@
+/*
+ * RTEMS Monitor extension support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_extension_canonical(
+ rtems_monitor_extension_t *canonical_extension,
+ void *extension_void
+)
+{
+ Extension_Control *rtems_extension = (Extension_Control *) extension_void;
+ rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
+ e->thread_create);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_start,
+ e->thread_start);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_restart,
+ e->thread_restart);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_delete,
+ e->thread_delete);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_tswitch,
+ e->thread_switch);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_begin,
+ e->thread_begin);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_exitted,
+ e->thread_exitted);
+ rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_fatal,
+ e->fatal);
+}
+
+void
+rtems_monitor_extension_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the canonical form
+ */
+
+void
+rtems_monitor_extension_dump(
+ rtems_monitor_extension_t *monitor_extension,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_extension->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_extension->name);
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("create: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
+ length += printf("; start: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
+ length += printf("; restart: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("delete: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
+ length += printf("; switch: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
+ length += printf("; begin: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
+ length += printf("\n");
+ length = 0;
+
+ length += rtems_monitor_pad(18, length);
+ length += printf("exitted: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
+ length += printf("; fatal: ");
+ length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
+ length += printf("\n");
+ length = 0;
+ printf("\n");
+}
diff --git a/cpukit/libmisc/monitor/mon-itask.c b/cpukit/libmisc/monitor/mon-itask.c
new file mode 100644
index 0000000000..5ce4b55270
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-itask.c
@@ -0,0 +1,115 @@
+/*
+ * RTEMS Monitor init task support
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+/*
+ * As above, but just for init tasks
+ */
+void
+rtems_monitor_init_task_canonical(
+ rtems_monitor_init_task_t *canonical_itask,
+ void *itask_void
+)
+{
+ rtems_initialization_tasks_table *rtems_itask = itask_void;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
+ rtems_itask->entry_point);
+
+ canonical_itask->argument = rtems_itask->argument;
+ canonical_itask->stack_size = rtems_itask->stack_size;
+ canonical_itask->priority = rtems_itask->initial_priority;
+ canonical_itask->modes = rtems_itask->mode_set;
+ canonical_itask->attributes = rtems_itask->attribute_set;
+}
+
+void *
+rtems_monitor_init_task_next(
+ void *object_info,
+ rtems_monitor_init_task_t *canonical_init_task,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_initialization_tasks_table *itask;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= c->number_of_initialization_tasks)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ itask = c->User_initialization_tasks_table + n;
+
+ /*
+ * dummy up a fake id and name for this item
+ */
+
+ canonical_init_task->id = n;
+ canonical_init_task->name = itask->name;
+
+ *next_id += 1;
+ return (void *) itask;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_init_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ # NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_init_task_dump(
+ rtems_monitor_init_task_t *monitor_itask,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_decimal(monitor_itask->id);
+
+ length += rtems_monitor_pad(7, length);
+ length += rtems_monitor_dump_name(monitor_itask->name);
+
+ length += rtems_monitor_pad(14, length);
+ length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
+
+ length += rtems_monitor_pad(25, length);
+ length += printf("%d [0x%x]", monitor_itask->argument, monitor_itask->argument);
+
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_priority(monitor_itask->priority);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_modes(monitor_itask->modes);
+
+ length += rtems_monitor_pad(54, length);
+ length += rtems_monitor_dump_attributes(monitor_itask->attributes);
+
+ length += rtems_monitor_pad(66, length);
+ length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);
+
+ printf("\n");
+}
diff --git a/cpukit/libmisc/monitor/mon-manager.c b/cpukit/libmisc/monitor/mon-manager.c
new file mode 100644
index 0000000000..af8d530d3b
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-manager.c
@@ -0,0 +1,50 @@
+/*
+ * RTEMS Monitor "manager" support.
+ * Used to traverse object (chain) lists and print them out.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+#include <monitor.h>
+
+/*
+ * "next" routine for all objects that are RTEMS manager objects
+ */
+
+void *
+rtems_monitor_manager_next(
+ void *table_void,
+ void *canonical,
+ rtems_id *next_id
+)
+{
+ Objects_Information *table = table_void;
+ rtems_monitor_generic_t *copy;
+ Objects_Control *object = 0;
+ unsigned32 location;
+
+ /*
+ * When we are called, it must be local
+ */
+
+ if ( ! _Objects_Is_local_id(*next_id))
+ goto done;
+
+ object = _Objects_Get_next(table, *next_id, &location, next_id);
+
+ if (object)
+ {
+ copy = (rtems_monitor_generic_t *) canonical;
+ copy->id = object->id;
+ _Objects_Copy_name_raw(object->name, &copy->name, sizeof(copy->name));
+ }
+
+done:
+ return object;
+}
+
diff --git a/cpukit/libmisc/monitor/mon-monitor.c b/cpukit/libmisc/monitor/mon-monitor.c
new file mode 100644
index 0000000000..a5a3fab131
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-monitor.c
@@ -0,0 +1,517 @@
+/*
+ * RTEMS monitor main body
+ *
+ * TODO:
+ * add stuff to RTEMS api
+ * rtems_get_name(id)
+ * rtems_get_type(id)
+ * rtems_build_id(node, type, num)
+ * Add a command to dump out info about an arbitrary id when
+ * types are added to id's
+ * rtems> id idnum
+ * idnum: node n, object: whatever, id: whatever
+ * allow id's to be specified as n:t:id, where 'n:t' is optional
+ * should have a separate monitor FILE stream (ala the debugger)
+ * remote request/response stuff should be cleaned up
+ * maybe we can use real rpc??
+ * 'info' command to print out:
+ * interrupt stack location, direction and size
+ * floating point config stuff
+ * interrupt config stuff
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/* set by trap handler */
+extern rtems_tcb *debugger_interrupted_task;
+extern rtems_context *debugger_interrupted_task_context;
+extern rtems_unsigned32 debugger_trap;
+
+/*
+ * Various id's for the monitor
+ * They need to be public variables for access by other agencies
+ * such as debugger and remote servers'
+ */
+
+rtems_id rtems_monitor_task_id;
+
+unsigned32 rtems_monitor_node; /* our node number */
+unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * The rtems symbol table
+ */
+
+rtems_symbol_table_t *rtems_monitor_symbols;
+
+/*
+ * The top-level commands
+ */
+
+rtems_monitor_command_entry_t rtems_monitor_commands[] = {
+ { "--usage--",
+ "\n"
+ "RTEMS monitor\n"
+ "\n"
+ "Commands (may be abbreviated)\n"
+ "\n"
+ " help -- get this message or command specific help\n"
+ " pause -- pause monitor for a specified number of ticks\n"
+ " exit -- invoke a fatal RTEMS error\n"
+ " symbol -- show entries from symbol table\n"
+ " continue -- put monitor to sleep waiting for explicit wakeup\n"
+ " config -- show system configuration\n"
+ " itask -- list init tasks\n"
+ " mpci -- list mpci config\n"
+ " task -- show task information\n"
+ " queue -- show message queue information\n"
+ " extension -- user extensions\n"
+ " driver -- show information about named drivers\n"
+ " dname -- show information about named drivers\n"
+ " object -- generic object information\n"
+ " node -- specify default node for commands that take id's\n"
+#ifdef CPU_INVOKE_DEBUGGER
+ " debugger -- invoke system debugger\n"
+#endif
+ ,
+ 0,
+ 0,
+ (unsigned32) rtems_monitor_commands,
+ },
+ { "config",
+ "config\n"
+ " Show the system configuration.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ },
+ { "itask",
+ "itask\n"
+ " List init tasks for the system\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ },
+ { "mpci",
+ "mpci\n"
+ " Show the MPCI system configuration, if configured.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ },
+ { "pause",
+ "pause [ticks]\n"
+ " monitor goes to \"sleep\" for specified ticks (default is 1)\n"
+ " monitor will resume at end of period or if explicitly awakened\n",
+ 0,
+ rtems_monitor_pause_cmd,
+ 0,
+ },
+ { "continue",
+ "continue\n"
+ " put the monitor to sleep waiting for an explicit wakeup from the\n"
+ " program running.\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "go",
+ "go\n"
+ " Alias for 'continue'\n",
+ 0,
+ rtems_monitor_continue_cmd,
+ 0,
+ },
+ { "node",
+ "node [ node number ]\n"
+ " Specify default node number for commands that take id's\n",
+ 0,
+ rtems_monitor_node_cmd,
+ 0,
+ },
+ { "symbol",
+ "symbol [ symbolname [symbolname ... ] ]\n"
+ " display value associated with specified symbol.\n"
+ " Defaults to displaying all known symbols.\n",
+ 0,
+ rtems_monitor_symbol_cmd,
+ (unsigned32) &rtems_monitor_symbols,
+ },
+ { "extension",
+ "extension [id [id ...] ]\n"
+ " display information about specified extensions.\n"
+ " Default is to display information about all extensions on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_EXTENSION,
+ },
+ { "task",
+ "task [id [id ...] ]\n"
+ " display information about the specified tasks.\n"
+ " Default is to display information about all tasks on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_TASK,
+ },
+ { "queue",
+ "queue [id [id ... ] ]\n"
+ " display information about the specified message queues\n"
+ " Default is to display information about all queues on this node\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_QUEUE,
+ },
+ { "object",
+ "object [id [id ...] ]\n"
+ " display information about specified RTEMS objects.\n"
+ " Object id's must include 'type' information.\n"
+ " (which may normally be defaulted)\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_INVALID,
+ },
+ { "driver",
+ "driver [ major [ major ... ] ]\n"
+ " Display the RTEMS device driver table.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DRIVER,
+ },
+ { "dname",
+ "dname\n"
+ " Displays information about named drivers.\n",
+ 0,
+ rtems_monitor_object_cmd,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ },
+ { "exit",
+ "exit [status]\n"
+ " Invoke 'rtems_fatal_error_occurred' with 'status'\n"
+ " (default is RTEMS_SUCCESSFUL)\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL,
+ },
+ { "fatal",
+ "fatal [status]\n"
+ " 'exit' with fatal error; default error is RTEMS_TASK_EXITTED\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_TASK_EXITTED, /* exit value */
+ },
+ { "quit",
+ "quit [status]\n"
+ " Alias for 'exit'\n",
+ 0,
+ rtems_monitor_fatal_cmd,
+ RTEMS_SUCCESSFUL, /* exit value */
+ },
+ { "help",
+ "help [ command [ command ] ]\n"
+ " provide information about commands\n"
+ " Default is show basic command summary.\n",
+ 0,
+ rtems_monitor_help_cmd,
+ (unsigned32) rtems_monitor_commands,
+ },
+#ifdef CPU_INVOKE_DEBUGGER
+ { "debugger",
+ "debugger\n"
+ " Enter the debugger, if possible.\n"
+ " A continue from the debugger will return to the monitor.\n",
+ 0,
+ rtems_monitor_debugger_cmd,
+ 0,
+ },
+#endif
+ { 0, 0, 0, 0, 0 },
+};
+
+
+rtems_status_code
+rtems_monitor_suspend(rtems_interval timeout)
+{
+ rtems_event_set event_set;
+ rtems_status_code status;
+
+ status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &event_set);
+ return status;
+}
+
+void
+rtems_monitor_wakeup(void)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT);
+}
+
+void
+rtems_monitor_debugger_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+#ifdef CPU_INVOKE_DEBUGGER
+ CPU_INVOKE_DEBUGGER;
+#endif
+}
+
+void
+rtems_monitor_pause_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_monitor_suspend(1);
+ else
+ rtems_monitor_suspend(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_fatal_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ if (argc == 1)
+ rtems_fatal_error_occurred(command_arg);
+ else
+ rtems_fatal_error_occurred(strtoul(argv[1], 0, 0));
+}
+
+void
+rtems_monitor_continue_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+}
+
+void
+rtems_monitor_node_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ unsigned32 new_node = rtems_monitor_default_node;
+
+ switch (argc)
+ {
+ case 1: /* no node, just set back to ours */
+ new_node = rtems_monitor_node;
+ break;
+
+ case 2:
+ new_node = strtoul(argv[1], 0, 0);
+ break;
+
+ default:
+ printf("invalid syntax, try 'help node'\n");
+ break;
+ }
+
+ if ((new_node >= 1) &&
+ _Configuration_MP_table &&
+ (new_node <= _Configuration_MP_table->maximum_nodes))
+ rtems_monitor_default_node = new_node;
+}
+
+
+/*
+ * Function: rtems_monitor_symbols_loadup
+ *
+ * Description:
+ * Create and load the monitor's symbol table.
+ * We are reading the output format of 'gnm' which looks like this:
+ *
+ * 400a7068 ? _Rate_monotonic_Information
+ * 400a708c ? _Thread_Dispatch_disable_level
+ * 400a7090 ? _Configuration_Table
+ *
+ * We ignore the type field.
+ *
+ * Side Effects:
+ * Creates and fills in 'rtems_monitor_symbols' table
+ *
+ * TODO
+ * there should be a BSP #define or something like that
+ * to do this; Assuming stdio is crazy.
+ * Someday this should know BFD
+ * Maybe we could get objcopy to just copy the symbol areas
+ * and copy that down.
+ *
+ */
+
+void
+rtems_monitor_symbols_loadup(void)
+{
+ FILE *fp;
+ char buffer[128];
+
+ if (rtems_monitor_symbols)
+ rtems_symbol_table_destroy(rtems_monitor_symbols);
+
+ rtems_monitor_symbols = rtems_symbol_table_create(10);
+ if (rtems_monitor_symbols == 0)
+ return;
+
+ fp = fopen("symbols", "r");
+
+ if (fp == 0)
+ return;
+
+ while (fgets(buffer, sizeof(buffer) - 1, fp))
+ {
+ char *symbol;
+ char *value;
+ char *ignored_type;
+
+ value = strtok(buffer, " \t\n");
+ ignored_type = strtok(0, " \t\n");
+ symbol = strtok(0, " \t\n");
+
+ if (symbol && ignored_type && value)
+ {
+ rtems_symbol_t *sp;
+ sp = rtems_symbol_create(rtems_monitor_symbols,
+ symbol,
+ (rtems_unsigned32) strtoul(value, 0, 16));
+ if (sp == 0)
+ {
+ printf("could not define symbol '%s'\n", symbol);
+ goto done;
+ }
+ }
+ else
+ {
+ printf("parsing error on '%s'\n", buffer);
+ goto done;
+ }
+ }
+
+done:
+}
+
+
+/*
+ * Main monitor command loop
+ */
+
+void
+rtems_monitor_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_tcb *debugee = 0;
+ rtems_context *rp;
+ rtems_context_fp *fp;
+ char command_buffer[513];
+ int argc;
+ char *argv[64];
+ boolean verbose = FALSE;
+
+ if (monitor_flags & RTEMS_MONITOR_SUSPEND)
+ (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
+
+ for (;;)
+ {
+ extern rtems_tcb * _Thread_Executing;
+ rtems_monitor_command_entry_t *command;
+
+ debugee = _Thread_Executing;
+ rp = &debugee->Registers;
+ fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */
+
+ if (0 == rtems_monitor_command_read(command_buffer, &argc, argv))
+ continue;
+ if ((command = rtems_monitor_command_lookup(rtems_monitor_commands,
+ argc,
+ argv)) == 0)
+ continue;
+
+ command->command_function(argc, argv, command->command_arg, verbose);
+
+ fflush(stdout);
+ }
+}
+
+
+void
+rtems_monitor_kill(void)
+{
+ if (rtems_monitor_task_id)
+ rtems_task_delete(rtems_monitor_task_id);
+ rtems_monitor_task_id = 0;
+
+ rtems_monitor_server_kill();
+}
+
+void
+rtems_monitor_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ rtems_monitor_kill();
+
+ status = rtems_task_create(RTEMS_MONITOR_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor task");
+ goto done;
+ }
+
+ rtems_monitor_node = rtems_get_node(rtems_monitor_task_id);
+ rtems_monitor_default_node = rtems_monitor_node;
+
+ rtems_monitor_symbols_loadup();
+
+ if (monitor_flags & RTEMS_MONITOR_GLOBAL)
+ rtems_monitor_server_init(monitor_flags);
+
+ /*
+ * Start the monitor task itself
+ */
+
+ status = rtems_task_start(rtems_monitor_task_id,
+ rtems_monitor_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor");
+ goto done;
+ }
+
+done:
+}
diff --git a/cpukit/libmisc/monitor/mon-mpci.c b/cpukit/libmisc/monitor/mon-mpci.c
new file mode 100644
index 0000000000..5c4d2c2cb3
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-mpci.c
@@ -0,0 +1,159 @@
+/*
+ * RTEMS MPCI Config display support
+ *
+ * TODO
+ *
+ * $Id$
+ */
+
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#define DATACOL 15
+
+/*
+ * Fill in entire monitor config table
+ * for sending to a remote monitor or printing on the local system
+ */
+
+void
+rtems_monitor_mpci_canonical(
+ rtems_monitor_mpci_t *canonical_mpci,
+ void *config_void
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ rtems_multiprocessing_table *m;
+ rtems_mpci_table *mt;
+
+ m = c->User_multiprocessing_table;
+ if (m == 0)
+ return;
+ mt = m->User_mpci_table;
+
+ canonical_mpci->node = m->node;
+ canonical_mpci->maximum_nodes = m->maximum_nodes;
+ canonical_mpci->maximum_global_objects = m->maximum_global_objects;
+ canonical_mpci->maximum_proxies = m->maximum_proxies;
+
+ canonical_mpci->default_timeout = mt->default_timeout;
+ canonical_mpci->maximum_packet_size = mt->maximum_packet_size;
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->initialization,
+ mt->initialization);
+
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->get_packet,
+ mt->get_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->return_packet,
+ mt->return_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->send_packet,
+ mt->send_packet);
+ rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet,
+ mt->receive_packet);
+}
+
+/*
+ * This is easy, since there is only 1 (altho we could get them from
+ * other nodes...)
+ */
+
+void *
+rtems_monitor_mpci_next(
+ void *object_info,
+ rtems_monitor_mpci_t *canonical_mpci,
+ rtems_id *next_id
+)
+{
+ rtems_configuration_table *c = _Configuration_Table;
+ int n = rtems_get_index(*next_id);
+
+ if (n >= 1)
+ goto failed;
+
+ if ( ! c->User_multiprocessing_table)
+ goto failed;
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) c;
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+
+void
+rtems_monitor_mpci_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ max max max default max\n\
+ node nodes globals proxies timeout pktsize\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+
+void
+rtems_monitor_mpci_dump(
+ rtems_monitor_mpci_t *monitor_mpci,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_pad(2, length);
+ length += printf(" %d", monitor_mpci->node);
+ length += rtems_monitor_pad(11, length);
+ length += printf("%d", monitor_mpci->maximum_nodes);
+
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
+
+ length += rtems_monitor_pad(28, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies);
+
+ length += rtems_monitor_pad(37, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->default_timeout);
+
+ length += rtems_monitor_pad(46, length);
+ length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("init: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("get: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose);
+ length += printf("; return: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose);
+
+ printf("\n");
+ length = 0;
+ length += rtems_monitor_pad(DATACOL, length);
+
+ length += printf("send: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose);
+ length += printf("; receive: ");
+ length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose);
+
+ printf("\n");
+ length = 0;
+}
diff --git a/cpukit/libmisc/monitor/mon-object.c b/cpukit/libmisc/monitor/mon-object.c
new file mode 100644
index 0000000000..0dfc6513d2
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-object.c
@@ -0,0 +1,374 @@
+/*
+ * RTEMS Monitor "object" support.
+ *
+ * Used to traverse object lists and print them out.
+ * An object can be an RTEMS object (chain based stuff) or
+ * a "misc" object such as a device driver.
+ *
+ * Each object has its own file in this directory (eg: extension.c)
+ * That file provides routines to convert a "native" structure
+ * to its canonical form, print a canonical structure, etc.
+ *
+ * TODO:
+ * should allow for non-numeric id's???
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+#include <stdlib.h> /* strtoul() */
+
+#include <monitor.h>
+
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * add:
+ * next
+ */
+
+rtems_monitor_object_info_t rtems_monitor_object_info[] =
+{
+ { RTEMS_MONITOR_OBJECT_CONFIG,
+ (void *) 0,
+ sizeof(rtems_monitor_config_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_config_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_config_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_config_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_config_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_MPCI,
+ (void *) 0,
+ sizeof(rtems_monitor_mpci_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_mpci_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_mpci_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_mpci_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_mpci_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_INIT_TASK,
+ (void *) 0,
+ sizeof(rtems_monitor_init_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_init_task_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_init_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_init_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_init_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_TASK,
+ (void *) &_RTEMS_tasks_Information,
+ sizeof(rtems_monitor_task_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_task_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_task_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_task_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_QUEUE,
+ (void *) &_Message_queue_Information,
+ sizeof(rtems_monitor_queue_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_queue_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_queue_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_queue_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_EXTENSION,
+ (void *) &_Extension_Information,
+ sizeof(rtems_monitor_extension_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_manager_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_extension_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_extension_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_extension_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DRIVER,
+ (void *) 0,
+ sizeof(rtems_monitor_driver_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_driver_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_driver_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_driver_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_driver_dump,
+ },
+ { RTEMS_MONITOR_OBJECT_DNAME,
+ /* XXX now that the driver name table is allocated from the */
+ /* XXX Workspace, this does not work */
+ (void *) 0,
+ /* (void *) _IO_Driver_name_table, */
+ sizeof(rtems_monitor_dname_t),
+ (rtems_monitor_object_next_fn) rtems_monitor_dname_next,
+ (rtems_monitor_object_canonical_fn) rtems_monitor_dname_canonical,
+ (rtems_monitor_object_dump_header_fn) rtems_monitor_dname_dump_header,
+ (rtems_monitor_object_dump_fn) rtems_monitor_dname_dump,
+ },
+};
+
+/*
+ * Allow id's to be specified without the node number or
+ * type for convenience.
+ */
+
+rtems_id
+rtems_monitor_id_fixup(
+ rtems_id id,
+ unsigned32 default_node,
+ rtems_monitor_object_type_t type
+)
+{
+ unsigned32 node;
+
+ node = rtems_get_node(id);
+ if (node == 0)
+ {
+ if (rtems_get_class(id) != OBJECTS_NO_CLASS)
+ type = rtems_get_class(id);
+
+ id = _Objects_Build_id(type, default_node, rtems_get_index(id));
+ }
+ return id;
+}
+
+
+rtems_monitor_object_info_t *
+rtems_monitor_object_lookup(
+ rtems_monitor_object_type_t type
+)
+{
+ rtems_monitor_object_info_t *p;
+ for (p = &rtems_monitor_object_info[0];
+ p < &rtems_monitor_object_info[NUMELEMS(rtems_monitor_object_info)];
+ p++)
+ {
+ if (p->type == type)
+ return p;
+ }
+ return 0;
+}
+
+rtems_id
+rtems_monitor_object_canonical_next_remote(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ rtems_status_code status;
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+
+ /*
+ * Send request
+ */
+
+ request.command = RTEMS_MONITOR_SERVER_CANONICAL;
+ request.argument0 = (unsigned32) type;
+ request.argument1 = (unsigned32) id;
+
+ status = rtems_monitor_server_request(rtems_get_node(id), &request, &response);
+ if (status != RTEMS_SUCCESSFUL)
+ goto failed;
+
+ /*
+ * process response
+ */
+
+ next_id = (rtems_id) response.result0;
+ if (next_id != RTEMS_OBJECT_ID_FINAL)
+ (void) memcpy(canonical, &response.payload, response.result1);
+
+ return next_id;
+
+failed:
+ return RTEMS_OBJECT_ID_FINAL;
+
+}
+
+
+rtems_id
+rtems_monitor_object_canonical_next(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ void *canonical
+)
+{
+ rtems_id next_id;
+ void *raw_item;
+
+ if ( ! _Objects_Is_local_id(id))
+ next_id = rtems_monitor_object_canonical_next_remote(info->type,
+ id,
+ canonical);
+ else
+ {
+ next_id = id;
+
+ raw_item = (void *) info->next(info->object_information,
+ canonical,
+ &next_id);
+
+ if (raw_item)
+ {
+ info->canonical(canonical, raw_item);
+ _Thread_Enable_dispatch();
+ }
+ }
+ return next_id;
+}
+
+
+/*
+ * this is routine server invokes locally to get the type
+ */
+
+rtems_id
+rtems_monitor_object_canonical_get(
+ rtems_monitor_object_type_t type,
+ rtems_id id,
+ void *canonical,
+ unsigned32 *size_p
+)
+{
+ rtems_monitor_object_info_t *info;
+ rtems_id next_id;
+
+ *size_p = 0;
+
+ info = rtems_monitor_object_lookup(type);
+
+ if (info == 0)
+ return RTEMS_OBJECT_ID_FINAL;
+
+ next_id = rtems_monitor_object_canonical_next(info, id, canonical);
+ *size_p = info->size;
+
+ return next_id;
+}
+
+
+void
+rtems_monitor_object_dump_1(
+ rtems_monitor_object_info_t *info,
+ rtems_id id,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ if ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ /*
+ * If the one we actually got is the one we wanted, then
+ * print it out.
+ * For ones that have an id field, this works fine,
+ * for all others, always dump it out.
+ *
+ * HACK: the way we determine whether there is an id is a hack.
+ *
+ * by the way: the reason we try to not have an id, is that some
+ * of the canonical structures are almost too big for shared
+ * memory driver (eg: mpci)
+ */
+
+ if ((info->next != rtems_monitor_manager_next) ||
+ (id == canonical.generic.id))
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_dump_all(
+ rtems_monitor_object_info_t *info,
+ boolean verbose
+)
+{
+ rtems_id next_id;
+ rtems_monitor_union_t canonical;
+
+ next_id = RTEMS_OBJECT_ID_INITIAL(info->type, rtems_monitor_default_node);
+
+ while ((next_id = rtems_monitor_object_canonical_next(
+ info,
+ next_id,
+ &canonical)) != RTEMS_OBJECT_ID_FINAL)
+ {
+ info->dump(&canonical, verbose);
+ }
+}
+
+void
+rtems_monitor_object_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_monitor_object_info_t *info = 0;
+ rtems_monitor_object_type_t type = (rtems_monitor_object_type_t) command_arg;
+
+ /* what is the default type? */
+ type = (rtems_monitor_object_type_t) command_arg;
+
+ if (argc == 1)
+ {
+ if (type == RTEMS_MONITOR_OBJECT_INVALID)
+ {
+ printf("A type must be specified to \"dump all\"\n");
+ goto done;
+ }
+
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ rtems_monitor_object_dump_all(info, verbose);
+ }
+ else
+ {
+ unsigned32 default_node = rtems_monitor_default_node;
+ rtems_monitor_object_type_t last_type = RTEMS_MONITOR_OBJECT_INVALID;
+ rtems_id id;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ id = (rtems_id) strtoul(argv[arg], 0, 16);
+ id = rtems_monitor_id_fixup(id, default_node, type);
+ type = (rtems_monitor_object_type_t) rtems_get_class(id);
+
+ /*
+ * Allow the item type to change in the middle
+ * of the command. If the type changes, then
+ * just dump out a new header and keep on going.
+ */
+ if (type != last_type)
+ {
+ info = rtems_monitor_object_lookup(type);
+ if (info == 0)
+ goto not_found;
+
+ if (info->dump_header)
+ info->dump_header(verbose);
+ }
+
+ if (info == 0)
+ {
+not_found: printf("Invalid or unsupported type %d\n", type);
+ goto done;
+ }
+
+ rtems_monitor_object_dump_1(info, id, verbose);
+
+ default_node = rtems_get_node(id);
+
+ last_type = type;
+ }
+ }
+done:
+}
diff --git a/cpukit/libmisc/monitor/mon-prmisc.c b/cpukit/libmisc/monitor/mon-prmisc.c
new file mode 100644
index 0000000000..030bd020da
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-prmisc.c
@@ -0,0 +1,254 @@
+/*
+ * Print misc stuff for the monitor dump routines
+ * Each routine returns the number of characters it output.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <rtems/assoc.h>
+
+#include <stdio.h>
+#include <ctype.h>
+
+void
+rtems_monitor_separator(void)
+{
+ printf("------------------------------------------------------------------------------\n");
+}
+
+unsigned32
+rtems_monitor_pad(
+ unsigned32 destination_column,
+ unsigned32 current_column
+)
+{
+ int pad_length;
+
+ if (destination_column <= current_column)
+ pad_length = 1;
+ else
+ pad_length = destination_column - current_column;
+
+ return printf("%*s", pad_length, "");
+}
+
+unsigned32
+rtems_monitor_dump_char(rtems_unsigned8 ch)
+{
+ if (isprint(ch))
+ return printf("%c", ch);
+ else
+ return printf("%02x", ch);
+}
+
+unsigned32
+rtems_monitor_dump_decimal(unsigned32 num)
+{
+ return printf("%4d", num);
+}
+
+unsigned32
+rtems_monitor_dump_hex(unsigned32 num)
+{
+ return printf("0x%x", num);
+}
+
+unsigned32
+rtems_monitor_dump_assoc_bitfield(
+ rtems_assoc_t *ap,
+ char *separator,
+ unsigned32 value
+ )
+{
+ unsigned32 b;
+ unsigned32 length = 0;
+ const char *name;
+
+ for (b = 1; b; b <<= 1)
+ if (b & value)
+ {
+ if (length)
+ length += printf("%s", separator);
+
+ name = rtems_assoc_name_by_local(ap, b);
+
+ if (name)
+ length += printf("%s", name);
+ else
+ length += printf("0x%x", b);
+ }
+
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_id(rtems_id id)
+{
+ return printf("%08x", id);
+}
+
+unsigned32
+rtems_monitor_dump_name(rtems_name name)
+{
+ int i;
+ unsigned32 length = 0;
+ union {
+ unsigned32 ui;
+ char c[4];
+ } u;
+
+ u.ui = (rtems_unsigned32) name;
+
+ for (i=0; i<sizeof(u.c); i++)
+ length += rtems_monitor_dump_char(u.c[i]);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_priority(rtems_task_priority priority)
+{
+ return printf("%3d", priority);
+}
+
+
+rtems_assoc_t rtems_monitor_state_assoc[] = {
+ { "DORM", STATES_DORMANT },
+ { "SUSP", STATES_SUSPENDED },
+ { "TRANS", STATES_TRANSIENT },
+ { "DELAY", STATES_DELAYING },
+ { "Wbuf", STATES_WAITING_FOR_BUFFER },
+ { "Wseg", STATES_WAITING_FOR_SEGMENT },
+ { "Wmsg" , STATES_WAITING_FOR_MESSAGE },
+ { "Wevnt", STATES_WAITING_FOR_EVENT },
+ { "Wsem", STATES_WAITING_FOR_SEMAPHORE },
+ { "Wtime", STATES_WAITING_FOR_TIME },
+ { "Wrpc", STATES_WAITING_FOR_RPC_REPLY },
+ { "WRATE", STATES_WAITING_FOR_PERIOD },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_state(States_Control state)
+{
+ unsigned32 length = 0;
+
+ if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */
+ length += printf("READY");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
+ ":",
+ state);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_attribute_assoc[] = {
+ { "FL", RTEMS_FLOATING_POINT },
+ { "GL", RTEMS_GLOBAL },
+ { "PR", RTEMS_PRIORITY },
+ { "BI", RTEMS_BINARY_SEMAPHORE },
+ { "IN", RTEMS_INHERIT_PRIORITY },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_attributes(rtems_attribute attributes)
+{
+ unsigned32 length = 0;
+
+ if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */
+ length += printf("DEFAULT");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
+ ":",
+ attributes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_modes_assoc[] = {
+ { "nP", RTEMS_NO_PREEMPT },
+ { "T", RTEMS_TIMESLICE },
+ { "nA", RTEMS_NO_ASR },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_modes(rtems_mode modes)
+{
+ unsigned32 length = 0;
+
+ if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */
+ length += printf("P:T:nA");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
+ ":",
+ modes);
+ return length;
+}
+
+rtems_assoc_t rtems_monitor_events_assoc[] = {
+ { "0", RTEMS_EVENT_0 },
+ { "1", RTEMS_EVENT_1 },
+ { "2", RTEMS_EVENT_2 },
+ { "3", RTEMS_EVENT_3 },
+ { "4", RTEMS_EVENT_4 },
+ { "5", RTEMS_EVENT_5 },
+ { "6", RTEMS_EVENT_6 },
+ { "7", RTEMS_EVENT_7 },
+ { "8", RTEMS_EVENT_8 },
+ { "9", RTEMS_EVENT_9 },
+ { "10", RTEMS_EVENT_10 },
+ { "11", RTEMS_EVENT_11 },
+ { "12", RTEMS_EVENT_12 },
+ { "13", RTEMS_EVENT_13 },
+ { "14", RTEMS_EVENT_14 },
+ { "15", RTEMS_EVENT_15 },
+ { "16", RTEMS_EVENT_16 },
+ { "17", RTEMS_EVENT_17 },
+ { "18", RTEMS_EVENT_18 },
+ { "19", RTEMS_EVENT_19 },
+ { "20", RTEMS_EVENT_20 },
+ { "21", RTEMS_EVENT_21 },
+ { "22", RTEMS_EVENT_22 },
+ { "23", RTEMS_EVENT_23 },
+ { "24", RTEMS_EVENT_24 },
+ { "25", RTEMS_EVENT_25 },
+ { "26", RTEMS_EVENT_26 },
+ { "27", RTEMS_EVENT_27 },
+ { "28", RTEMS_EVENT_28 },
+ { "29", RTEMS_EVENT_29 },
+ { "30", RTEMS_EVENT_30 },
+ { "31", RTEMS_EVENT_31 },
+ { 0, 0, 0 },
+};
+
+unsigned32
+rtems_monitor_dump_events(rtems_event_set events)
+{
+ unsigned32 length = 0;
+
+ if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */
+ length += printf("NONE");
+
+ length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
+ ":",
+ events);
+ return length;
+}
+
+unsigned32
+rtems_monitor_dump_notepad(unsigned32 *notepad)
+{
+ unsigned32 length = 0;
+ int i;
+
+ for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++)
+ if (notepad[i])
+ length += printf("%d: 0x%x ", i, notepad[i]);
+
+ return length;
+}
diff --git a/cpukit/libmisc/monitor/mon-queue.c b/cpukit/libmisc/monitor/mon-queue.c
new file mode 100644
index 0000000000..08c1d9474e
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-queue.c
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_queue_canonical(
+ rtems_monitor_queue_t *canonical_queue,
+ void *queue_void
+)
+{
+ Message_queue_Control *rtems_queue = (Message_queue_Control *) queue_void;
+
+ canonical_queue->attributes = rtems_queue->attribute_set;
+ canonical_queue->maximum_message_size = rtems_queue->message_queue.maximum_message_size;
+ canonical_queue->maximum_pending_messages = rtems_queue->message_queue.maximum_pending_messages;
+ canonical_queue->number_of_pending_messages = rtems_queue->message_queue.number_of_pending_messages;
+}
+
+void
+rtems_monitor_queue_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME ATTRIBUTES PEND MAXPEND MAXSIZE\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+ rtems_monitor_separator();
+}
+
+
+/*
+ * Dump out the "next" queue indicated by 'id'.
+ * Returns next one to check.
+ * Returns RTEMS_OBJECT_ID_FINAL when all done
+ */
+
+void
+rtems_monitor_queue_dump(
+ rtems_monitor_queue_t *monitor_queue,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ length += rtems_monitor_dump_id(monitor_queue->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_queue->name);
+ length += rtems_monitor_pad(19, length);
+ length += rtems_monitor_dump_attributes(monitor_queue->attributes);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->number_of_pending_messages);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_pending_messages);
+ length += rtems_monitor_pad(48, length);
+ length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size);
+
+ printf("\n");
+}
diff --git a/cpukit/libmisc/monitor/mon-server.c b/cpukit/libmisc/monitor/mon-server.c
new file mode 100644
index 0000000000..cc26718c27
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-server.c
@@ -0,0 +1,302 @@
+/*
+ * RTEMS monitor server (handles requests for info from RTEMS monitors
+ * running on other nodes)
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "monitor.h"
+
+/*
+ * Various id's for the server
+ */
+
+rtems_id rtems_monitor_server_task_id;
+rtems_id rtems_monitor_server_request_queue_id; /* our server */
+rtems_id *rtems_monitor_server_request_queue_ids; /* all servers */
+rtems_id rtems_monitor_server_response_queue_id; /* our server */
+
+
+/*
+ * Send a request to a server task
+ */
+
+rtems_status_code
+rtems_monitor_server_request(
+ unsigned32 server_node,
+ rtems_monitor_server_request_t *request,
+ rtems_monitor_server_response_t *response
+)
+{
+ rtems_id server_id;
+ rtems_status_code status;
+ unsigned32 size;
+
+ /*
+ * What is id of monitor on target node?
+ * Look it up if we don't know it yet.
+ */
+
+ server_id = rtems_monitor_server_request_queue_ids[server_node];
+ if (server_id == 0)
+ {
+ status = rtems_message_queue_ident(RTEMS_MONITOR_QUEUE_NAME,
+ server_node,
+ &server_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "ident of remote server failed");
+ goto done;
+ }
+
+ rtems_monitor_server_request_queue_ids[server_node] = server_id;
+ }
+
+ request->return_id = rtems_monitor_server_response_queue_id;
+
+ status = rtems_message_queue_send(server_id, request, sizeof(*request));
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server request send failed");
+ goto done;
+ }
+
+ /*
+ * Await response, if requested
+ */
+
+ if (response)
+ {
+ status = rtems_message_queue_receive(rtems_monitor_server_response_queue_id,
+ response,
+ &size,
+ RTEMS_WAIT,
+ 100);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "server did not respond");
+
+ /* maybe server task was restarted; look it up again next time */
+ rtems_monitor_server_request_queue_ids[server_node] = 0;
+
+ goto done;
+ }
+
+ if (response->command != RTEMS_MONITOR_SERVER_RESPONSE)
+ {
+ status = RTEMS_INCORRECT_STATE;
+ goto done;
+ }
+ }
+
+done:
+ return status;
+}
+
+
+
+/*
+ * monitor server task
+ */
+
+void
+rtems_monitor_server_task(
+ rtems_task_argument monitor_flags
+)
+{
+ rtems_monitor_server_request_t request;
+ rtems_monitor_server_response_t response;
+ rtems_status_code status;
+ unsigned32 size;
+
+ for (;;)
+ {
+ status = rtems_message_queue_receive(
+ rtems_monitor_server_request_queue_id,
+ &request,
+ &size,
+ RTEMS_WAIT,
+ (rtems_interval) 0);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "monitor server msg queue receive error");
+ goto failed;
+ }
+
+ if (size != sizeof(request))
+ {
+ rtems_error(0, "monitor server bad size on receive");
+ goto failed;
+ }
+
+ switch (request.command)
+ {
+ case RTEMS_MONITOR_SERVER_CANONICAL:
+ {
+ rtems_monitor_object_type_t object_type;
+ rtems_id id;
+ rtems_id next_id;
+
+ object_type = (rtems_monitor_object_type_t) request.argument0;
+ id = (rtems_id) request.argument1;
+ next_id = rtems_monitor_object_canonical_get(object_type,
+ id,
+ &response.payload,
+ &size);
+
+ response.command = RTEMS_MONITOR_SERVER_RESPONSE;
+ response.result0 = next_id;
+ response.result1 = size;
+
+#define SERVER_OVERHEAD (RTEMS_offsetof(rtems_monitor_server_response_t, \
+ payload))
+
+ status = rtems_message_queue_send(request.return_id,
+ &response,
+ size + SERVER_OVERHEAD);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "response send failed");
+ goto failed;
+ }
+ break;
+ }
+
+ default:
+ {
+ rtems_error(0, "invalid command to monitor server: %d", request.command);
+ goto failed;
+ }
+ }
+ }
+
+failed:
+ rtems_task_delete(RTEMS_SELF);
+}
+
+
+/*
+ * Kill off any old server
+ * Not sure if this is useful, but it doesn't help
+ */
+
+void
+rtems_monitor_server_kill(void)
+{
+ if (rtems_monitor_server_task_id)
+ rtems_task_delete(rtems_monitor_server_task_id);
+ rtems_monitor_task_id = 0;
+
+ if (rtems_monitor_server_request_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_request_queue_id);
+ rtems_monitor_server_response_queue_id = 0;
+
+ if (rtems_monitor_server_response_queue_id)
+ rtems_message_queue_delete(rtems_monitor_server_response_queue_id);
+ rtems_monitor_server_request_queue_ids = 0;
+
+ if (rtems_monitor_server_request_queue_ids)
+ free(rtems_monitor_server_request_queue_ids);
+ rtems_monitor_server_request_queue_ids = 0;
+}
+
+
+void
+rtems_monitor_server_init(
+ unsigned32 monitor_flags
+)
+{
+ rtems_status_code status;
+
+ if (_System_state_Is_multiprocessing &&
+ (_Configuration_MP_table->maximum_nodes > 1))
+ {
+ unsigned32 maximum_nodes = _Configuration_MP_table->maximum_nodes;
+
+ /*
+ * create the msg que our server will listen
+ * Since we only get msgs from other RTEMS monitors, we just
+ * need reserve space for 1 msg from each node.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_QUEUE_NAME,
+ maximum_nodes,
+ sizeof(rtems_monitor_server_request_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_request_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server message queue");
+ goto done;
+ }
+
+ /*
+ * create the msg que our responses will come on
+ * Since monitor just does one thing at a time, we only need 1 item
+ * message queue.
+ */
+
+ status = rtems_message_queue_create(
+ RTEMS_MONITOR_RESPONSE_QUEUE_NAME,
+ 1, /* depth */
+ sizeof(rtems_monitor_server_response_t),
+ RTEMS_GLOBAL,
+ &rtems_monitor_server_response_queue_id);
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor response message queue");
+ goto done;
+ }
+
+ /* need an id for queue of each other server we might talk to */
+ /* indexed by node, so add 1 to maximum_nodes */
+ rtems_monitor_server_request_queue_ids =
+ (rtems_id *) malloc((maximum_nodes + 1) * sizeof(rtems_id));
+ (void) memset(rtems_monitor_server_request_queue_ids,
+ 0,
+ (maximum_nodes + 1) * sizeof(rtems_id));
+
+ rtems_monitor_server_request_queue_ids[rtems_monitor_node] =
+ rtems_monitor_server_request_queue_id;
+
+ /*
+ * create the server task
+ */
+ status = rtems_task_create(RTEMS_MONITOR_SERVER_NAME,
+ 1,
+ 0 /* default stack */,
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &rtems_monitor_server_task_id);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not create monitor server task");
+ goto done;
+ }
+
+ /*
+ * Start the server task
+ */
+ status = rtems_task_start(rtems_monitor_server_task_id,
+ rtems_monitor_server_task,
+ monitor_flags);
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ rtems_error(status, "could not start monitor server");
+ goto done;
+ }
+ }
+
+done:
+}
diff --git a/cpukit/libmisc/monitor/mon-symbols.c b/cpukit/libmisc/monitor/mon-symbols.c
new file mode 100644
index 0000000000..6c6589d38f
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-symbols.c
@@ -0,0 +1,481 @@
+/*
+ * File: symbols.c
+ *
+ * Description:
+ * Symbol table manager for the RTEMS monitor.
+ * These routines may be used by other system resources also.
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "monitor.h"
+#include "symbols.h"
+
+
+rtems_symbol_table_t *
+rtems_symbol_table_create()
+{
+ rtems_symbol_table_t *table;
+
+ table = (rtems_symbol_table_t *) malloc(sizeof(rtems_symbol_table_t));
+ memset((void *) table, 0, sizeof(*table));
+
+ table->growth_factor = 30; /* 30 percent */
+
+ return table;
+}
+
+void
+rtems_symbol_table_destroy(rtems_symbol_table_t *table)
+{
+ rtems_symbol_string_block_t *p, *pnext;
+
+ if (table)
+ {
+ if (table->addresses)
+ (void) free(table->addresses);
+ table->addresses = 0;
+ p = table->string_buffer_head;
+ while (p)
+ {
+ pnext = p->next;
+ free(p);
+ p = pnext;
+ }
+ table->string_buffer_head = 0;
+ table->string_buffer_current = 0;
+
+ free(table);
+ }
+}
+
+rtems_symbol_t *
+rtems_symbol_create(
+ rtems_symbol_table_t *table,
+ char *name,
+ rtems_unsigned32 value
+ )
+{
+ int symbol_length;
+ size_t newsize;
+ rtems_symbol_t *sp;
+
+ symbol_length = strlen(name) + 1; /* include '\000' in length */
+
+ /* need to grow the table? */
+ if (table->next >= table->size)
+ {
+ if (table->size == 0)
+ newsize = 100;
+ else
+ newsize = table->size + (table->size / (100 / table->growth_factor));
+
+ table->addresses = (rtems_symbol_t *) realloc((void *) table->addresses, newsize * sizeof(rtems_symbol_t));
+ if (table->addresses == 0) /* blew it; lost orig */
+ goto failed;
+ table->size = newsize;
+ }
+
+ sp = &table->addresses[table->next];
+ sp->value = value;
+
+ /* Have to add it to string pool */
+ /* need to grow pool? */
+
+ if ((table->string_buffer_head == 0) ||
+ (table->strings_next + symbol_length) >= SYMBOL_STRING_BLOCK_SIZE)
+ {
+ rtems_symbol_string_block_t *p;
+
+ p = (rtems_symbol_string_block_t *) malloc(sizeof(rtems_symbol_string_block_t));
+ if (p == 0)
+ goto failed;
+ p->next = 0;
+ if (table->string_buffer_head == 0)
+ table->string_buffer_head = p;
+ else
+ table->string_buffer_current->next = p;
+ table->string_buffer_current = p;
+
+ table->strings_next = 0;
+ }
+
+ sp->name = table->string_buffer_current->buffer + table->strings_next;
+ (void) strcpy(sp->name, name);
+
+ table->strings_next += symbol_length;
+ table->sorted = 0;
+ table->next++;
+
+ return sp;
+
+/* XXX Not sure what to do here. We've possibly destroyed the initial
+ symbol table due to realloc failure */
+failed:
+ return 0;
+}
+
+/*
+ * Qsort entry point for compare by address
+ */
+
+static int
+rtems_symbol_compare(const void *e1,
+ const void *e2)
+{
+ rtems_symbol_t *s1, *s2;
+ s1 = (rtems_symbol_t *) e1;
+ s2 = (rtems_symbol_t *) e2;
+
+ if (s1->value < s2->value)
+ return -1;
+ if (s1->value > s2->value)
+ return 1;
+ return 0;
+}
+
+
+/*
+ * Sort the symbol table using qsort
+ */
+
+static void
+rtems_symbol_sort(rtems_symbol_table_t *table)
+{
+ qsort((void *) table->addresses, (size_t) table->next,
+ sizeof(rtems_symbol_t), rtems_symbol_compare);
+ table->sorted = 1;
+}
+
+
+/*
+ * Search the symbol table by address
+ * This code based on CYGNUS newlib bsearch, but changed
+ * to allow for finding closest symbol <= key
+ */
+
+rtems_symbol_t *
+rtems_symbol_value_lookup(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ rtems_symbol_t *sp;
+ rtems_symbol_t *base;
+ rtems_symbol_t *best = 0;
+ rtems_unsigned32 distance;
+ rtems_unsigned32 best_distance = ~0;
+ rtems_unsigned32 elements;
+
+ if (table == 0)
+ table = rtems_monitor_symbols;
+
+ if ((table == 0) || (table->size == 0))
+ return 0;
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ base = table->addresses;
+ elements = table->next;
+
+ while (elements)
+ {
+ sp = base + (elements / 2);
+ if (value < sp->value)
+ elements /= 2;
+ else if (value > sp->value)
+ {
+ distance = value - sp->value;
+ if (distance < best_distance)
+ {
+ best_distance = distance;
+ best = sp;
+ }
+ base = sp + 1;
+ elements = (elements / 2) - (elements % 2 ? 0 : 1);
+ }
+ else
+ return sp;
+ }
+
+ if (value == base->value)
+ return base;
+
+ return best;
+}
+
+/*
+ * Search the symbol table for the exact matching address.
+ * If the symbol table has already been sorted, then
+ * call the regular symbol value lookup, however, it it
+ * has not yet been sorted, search it sequentially.
+ * This routine is primarily used for low level symbol
+ * lookups (eg. from exception handler and interrupt routines)
+ * where the penality of sorted is not wanted and where
+ * an exact match is needed such that symbol table order
+ * is not important.
+ */
+const rtems_symbol_t *
+rtems_symbol_value_lookup_exact(
+ rtems_symbol_table_t *table,
+ rtems_unsigned32 value
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ if (table->sorted)
+ {
+ sp = rtems_symbol_value_lookup(table, value);
+ if ( rtems_symbol_value(sp) == value )
+ return sp;
+ else
+ return NULL; /* not an exact match */
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( sp->value == value )
+ return sp;
+ }
+
+ return NULL;
+
+}
+
+
+/*
+ * Search the symbol table by string name (case independent)
+ */
+
+rtems_symbol_t *
+rtems_symbol_name_lookup(
+ rtems_symbol_table_t *table,
+ char *name
+ )
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return NULL;
+ }
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ if ( strcasecmp(sp->name, name) == 0 )
+ return sp;
+ }
+
+ return NULL;
+}
+
+void *
+rtems_monitor_symbol_next(
+ void *object_info,
+ rtems_monitor_symbol_t *canonical,
+ rtems_id *next_id
+)
+{
+ rtems_symbol_table_t *table;
+ int n = rtems_get_index(*next_id);
+
+ table = *(rtems_symbol_table_t **) object_info;
+ if (table == 0)
+ goto failed;
+
+ if (n >= table->next)
+ goto failed;
+
+ /* NOTE: symbols do not have id and name fields */
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ _Thread_Disable_dispatch();
+
+ *next_id += 1;
+ return (void *) (table->addresses + n);
+
+failed:
+ *next_id = RTEMS_OBJECT_ID_FINAL;
+ return 0;
+}
+
+void
+rtems_monitor_symbol_canonical(
+ rtems_monitor_symbol_t *canonical_symbol,
+ rtems_symbol_t *sp
+)
+{
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = 0;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+}
+
+
+void
+rtems_monitor_symbol_canonical_by_name(
+ rtems_monitor_symbol_t *canonical_symbol,
+ char *name
+)
+{
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_name_lookup(0, name);
+
+ canonical_symbol->value = sp ? sp->value : 0;
+
+ strncpy(canonical_symbol->name, name, sizeof(canonical_symbol->name));
+ canonical_symbol->offset = 0;
+}
+
+void
+rtems_monitor_symbol_canonical_by_value(
+ rtems_monitor_symbol_t *canonical_symbol,
+ void *value_void_p
+)
+{
+ unsigned32 value = (unsigned32) value_void_p;
+ rtems_symbol_t *sp;
+
+ sp = rtems_symbol_value_lookup(0, value);
+ if (sp)
+ {
+ canonical_symbol->value = sp->value;
+ canonical_symbol->offset = value - sp->value;
+ strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name));
+ }
+ else
+ {
+ canonical_symbol->value = value;
+ canonical_symbol->offset = 0;
+ canonical_symbol->name[0] = '\0';
+ }
+}
+
+
+unsigned32
+rtems_monitor_symbol_dump(
+ rtems_monitor_symbol_t *canonical_symbol,
+ boolean verbose
+)
+{
+ unsigned32 length = 0;
+
+ /*
+ * print the name if it exists AND if value is non-zero
+ * Ie: don't print some garbage symbol for address 0
+ */
+
+ if (canonical_symbol->name[0] && (canonical_symbol->value != 0))
+ {
+ if (canonical_symbol->offset == 0)
+ length += printf("%.*s",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name);
+ else
+ length += printf("<%.*s+0x%x>",
+ (int) sizeof(canonical_symbol->name),
+ canonical_symbol->name,
+ canonical_symbol->offset);
+ if (verbose)
+ length += printf(" [0x%x]", canonical_symbol->value);
+ }
+ else
+ length += printf("[0x%x]", canonical_symbol->value);
+
+ return length;
+}
+
+
+void
+rtems_monitor_symbol_dump_all(
+ rtems_symbol_table_t *table,
+ boolean verbose
+)
+{
+ int s;
+ rtems_symbol_t *sp;
+
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ if (table->sorted == 0)
+ rtems_symbol_sort(table);
+
+ for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ rtems_monitor_symbol_canonical(&canonical_symbol, sp);
+ rtems_monitor_symbol_dump(&canonical_symbol, TRUE);
+ printf("\n");
+ }
+}
+
+
+/*
+ * 'symbol' command
+ */
+
+void
+rtems_monitor_symbol_cmd(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+)
+{
+ int arg;
+ rtems_symbol_table_t *table;
+
+ table = *(rtems_symbol_table_t **) command_arg;
+ if (table == 0)
+ {
+ table = rtems_monitor_symbols;
+ if (table == 0)
+ return;
+ }
+
+ /*
+ * Use object command to dump out whole symbol table
+ */
+ if (argc == 1)
+ rtems_monitor_symbol_dump_all(table, verbose);
+ else
+ {
+ rtems_monitor_symbol_t canonical_symbol;
+
+ for (arg=1; argv[arg]; arg++)
+ {
+ rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]);
+ rtems_monitor_symbol_dump(&canonical_symbol, verbose);
+ printf("\n");
+ }
+ }
+}
diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c
new file mode 100644
index 0000000000..b1a7938eb5
--- /dev/null
+++ b/cpukit/libmisc/monitor/mon-task.c
@@ -0,0 +1,92 @@
+/*
+ * RTEMS Monitor task support
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "monitor.h"
+
+#include <stdio.h>
+
+void
+rtems_monitor_task_canonical(
+ rtems_monitor_task_t *canonical_task,
+ void *thread_void
+)
+{
+ Thread_Control *rtems_thread = (Thread_Control *) thread_void;
+ RTEMS_API_Control *api;
+
+ api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ canonical_task->entry = rtems_thread->Start.entry_point;
+ canonical_task->argument = rtems_thread->Start.numeric_argument;
+ canonical_task->stack = rtems_thread->Start.Initial_stack.area;
+ canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
+ canonical_task->priority = rtems_thread->current_priority;
+ canonical_task->state = rtems_thread->current_state;
+ canonical_task->wait_id = rtems_thread->Wait.id;
+ canonical_task->events = api->pending_events;
+
+/* XXX modes and attributes only exist in the RTEMS API .. */
+/* XXX not directly in the core thread.. they will have to be derived */
+/* XXX if they are important enough to include anymore. */
+ canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
+ canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
+ (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
+/* XXX more to fix */
+/*
+ (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
+*/
+}
+
+
+void
+rtems_monitor_task_dump_header(
+ boolean verbose
+)
+{
+ printf("\
+ ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n");
+/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+0 1 2 3 4 5 6 7 */
+
+ rtems_monitor_separator();
+}
+
+/*
+ */
+
+void
+rtems_monitor_task_dump(
+ rtems_monitor_task_t *monitor_task,
+ boolean verbose
+)
+{
+ int length = 0;
+
+ length += rtems_monitor_dump_id(monitor_task->id);
+ length += rtems_monitor_pad(11, length);
+ length += rtems_monitor_dump_name(monitor_task->name);
+ length += rtems_monitor_pad(18, length);
+ length += rtems_monitor_dump_priority(monitor_task->priority);
+ length += rtems_monitor_pad(24, length);
+ length += rtems_monitor_dump_state(monitor_task->state);
+ length += rtems_monitor_pad(31, length);
+ length += rtems_monitor_dump_modes(monitor_task->modes);
+ length += rtems_monitor_pad(39, length);
+ length += rtems_monitor_dump_events(monitor_task->events);
+ if (monitor_task->wait_id)
+ {
+ length += rtems_monitor_pad(47, length);
+ length += rtems_monitor_dump_id(monitor_task->wait_id);
+ length += rtems_monitor_pad(57, length);
+ length += rtems_monitor_dump_hex(monitor_task->wait_args);
+ }
+
+ length += rtems_monitor_pad(65, length);
+ length += rtems_monitor_dump_notepad(monitor_task->notepad);
+ printf("\n");
+}
+
diff --git a/cpukit/libmisc/monitor/monitor.h b/cpukit/libmisc/monitor/monitor.h
new file mode 100644
index 0000000000..8a86b2c7d0
--- /dev/null
+++ b/cpukit/libmisc/monitor/monitor.h
@@ -0,0 +1,443 @@
+/*
+ * File: monitor.h
+ *
+ * Description:
+ * The RTEMS monitor task include file.
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef __MONITOR_H
+#define __MONITOR_H
+
+#include "symbols.h"
+#include <rtems/error.h> /* rtems_error() */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Monitor types are derived from rtems object classes
+ */
+
+typedef enum {
+ RTEMS_MONITOR_OBJECT_INVALID = OBJECTS_NO_CLASS,
+ RTEMS_MONITOR_OBJECT_TASK = OBJECTS_RTEMS_TASKS,
+ RTEMS_MONITOR_OBJECT_EXTENSION = OBJECTS_RTEMS_EXTENSIONS,
+ RTEMS_MONITOR_OBJECT_QUEUE = OBJECTS_RTEMS_MESSAGE_QUEUES,
+ RTEMS_MONITOR_OBJECT_SEMAPHORE = OBJECTS_RTEMS_SEMAPHORES,
+ RTEMS_MONITOR_OBJECT_PARTITION = OBJECTS_RTEMS_PARTITIONS,
+ RTEMS_MONITOR_OBJECT_REGION = OBJECTS_RTEMS_REGIONS,
+ RTEMS_MONITOR_OBJECT_PORT = OBJECTS_RTEMS_PORTS,
+
+ /* following monitor objects are not known to RTEMS, but
+ * we like to have "types" for them anyway */
+
+ RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_CLASSES_LAST+1,
+ RTEMS_MONITOR_OBJECT_DNAME,
+ RTEMS_MONITOR_OBJECT_CONFIG,
+ RTEMS_MONITOR_OBJECT_INIT_TASK,
+ RTEMS_MONITOR_OBJECT_MPCI,
+ RTEMS_MONITOR_OBJECT_SYMBOL,
+} rtems_monitor_object_type_t;
+
+/*
+ * rtems_monitor_init() flags
+ */
+
+#define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */
+#define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */
+
+
+/*
+ * Public interfaces for RTEMS data structures monitor is aware of.
+ * These are only used by the monitor.
+ *
+ * NOTE:
+ * All the canonical objects that correspond to RTEMS managed "objects"
+ * must have an identical first portion with 'id' and 'name' fields.
+ *
+ * Others do not have that restriction, even tho we would like them to.
+ * This is because some of the canonical structures are almost too big
+ * for shared memory driver (eg: mpci) and we are nickel and diming it.
+ */
+
+/*
+ * Type of a pointer that may be a symbol
+ */
+
+#define MONITOR_SYMBOL_LEN 20
+typedef struct {
+ char name[MONITOR_SYMBOL_LEN];
+ unsigned32 value;
+ unsigned32 offset;
+} rtems_monitor_symbol_t;
+
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+} rtems_monitor_generic_t;
+
+/*
+ * Task
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ Thread_Entry entry;
+ unsigned32 argument;
+ void *stack;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ States_Control state;
+ rtems_event_set events;
+ rtems_mode modes;
+ rtems_attribute attributes;
+ unsigned32 notepad[RTEMS_NUMBER_NOTEPADS];
+ rtems_id wait_id;
+ unsigned32 wait_args;
+} rtems_monitor_task_t;
+
+/*
+ * Init task
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id */
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t entry;
+ unsigned32 argument;
+ unsigned32 stack_size;
+ rtems_task_priority priority;
+ rtems_mode modes;
+ rtems_attribute attributes;
+} rtems_monitor_init_task_t;
+
+
+/*
+ * Message queue
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_attribute attributes;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_pending_messages;
+ unsigned32 maximum_message_size;
+} rtems_monitor_queue_t;
+
+/*
+ * Extension
+ */
+typedef struct {
+ rtems_id id;
+ rtems_name name;
+ /* end of common portion */
+ rtems_monitor_symbol_t e_create;
+ rtems_monitor_symbol_t e_start;
+ rtems_monitor_symbol_t e_restart;
+ rtems_monitor_symbol_t e_delete;
+ rtems_monitor_symbol_t e_tswitch;
+ rtems_monitor_symbol_t e_begin;
+ rtems_monitor_symbol_t e_exitted;
+ rtems_monitor_symbol_t e_fatal;
+} rtems_monitor_extension_t;
+
+/*
+ * Device driver
+ */
+
+typedef struct {
+ rtems_id id; /* not really an id (should be tho) */
+ rtems_name name; /* ditto */
+ /* end of common portion */
+ rtems_monitor_symbol_t initialization; /* initialization procedure */
+ rtems_monitor_symbol_t open; /* open request procedure */
+ rtems_monitor_symbol_t close; /* close request procedure */
+ rtems_monitor_symbol_t read; /* read request procedure */
+ rtems_monitor_symbol_t write; /* write request procedure */
+ rtems_monitor_symbol_t control; /* special functions procedure */
+} rtems_monitor_driver_t;
+
+typedef struct {
+ rtems_id id; /* not used for drivers (yet) */
+ rtems_name name; /* not used for drivers (yet) */
+ /* end of common portion */
+ unsigned32 major;
+ unsigned32 minor;
+ char name_string[64];
+} rtems_monitor_dname_t;
+
+/*
+ * System config
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+} rtems_monitor_config_t;
+
+/*
+ * MPCI config
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ rtems_monitor_symbol_t initialization;
+ rtems_monitor_symbol_t get_packet;
+ rtems_monitor_symbol_t return_packet;
+ rtems_monitor_symbol_t send_packet;
+ rtems_monitor_symbol_t receive_packet;
+} rtems_monitor_mpci_t;
+
+/*
+ * The generic canonical information union
+ */
+
+typedef union {
+ rtems_monitor_generic_t generic;
+ rtems_monitor_task_t task;
+ rtems_monitor_queue_t queue;
+ rtems_monitor_extension_t extension;
+ rtems_monitor_driver_t driver;
+ rtems_monitor_dname_t dname;
+ rtems_monitor_config_t config;
+ rtems_monitor_mpci_t mpci;
+ rtems_monitor_init_task_t itask;
+} rtems_monitor_union_t;
+
+/*
+ * Support for talking to other monitors
+ */
+
+/*
+ * Names of other monitors
+ */
+
+#define RTEMS_MONITOR_NAME (rtems_build_name('R', 'M', 'O', 'N'))
+#define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V'))
+#define RTEMS_MONITOR_QUEUE_NAME (rtems_build_name('R', 'M', 'S', 'Q'))
+#define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q'))
+
+#define RTEMS_MONITOR_SERVER_RESPONSE 0x0001
+#define RTEMS_MONITOR_SERVER_CANONICAL 0x0002
+
+typedef struct
+{
+ unsigned32 command;
+ rtems_id return_id;
+ unsigned32 argument0;
+ unsigned32 argument1;
+ unsigned32 argument2;
+ unsigned32 argument3;
+ unsigned32 argument4;
+ unsigned32 argument5;
+} rtems_monitor_server_request_t;
+
+typedef struct
+{
+ unsigned32 command;
+ unsigned32 result0;
+ unsigned32 result1;
+ rtems_monitor_union_t payload;
+} rtems_monitor_server_response_t;
+
+extern rtems_id rtems_monitor_task_id;
+
+extern unsigned32 rtems_monitor_node; /* our node number */
+extern unsigned32 rtems_monitor_default_node; /* current default for commands */
+
+/*
+ * Monitor command function and table entry
+ */
+
+typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t;
+
+typedef void ( *rtems_monitor_command_function_t )(
+ int argc,
+ char **argv,
+ unsigned32 command_arg,
+ boolean verbose
+ );
+
+struct rtems_monitor_command_entry_s {
+ char *command; /* command name */
+ char *usage; /* usage string for the command */
+ unsigned32 arguments_required; /* # of required args */
+ rtems_monitor_command_function_t command_function;
+
+ /* Some argument for the command */
+ unsigned32 command_arg;
+};
+
+typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
+typedef void (*rtems_monitor_object_canonical_fn)(void *, void *);
+typedef void (*rtems_monitor_object_dump_header_fn)(boolean);
+typedef void (*rtems_monitor_object_dump_fn)(void *, boolean);
+
+typedef struct {
+ rtems_monitor_object_type_t type;
+ void *object_information;
+ int size; /* of canonical object */
+ rtems_monitor_object_next_fn next;
+ rtems_monitor_object_canonical_fn canonical;
+ rtems_monitor_object_dump_header_fn dump_header;
+ rtems_monitor_object_dump_fn dump;
+} rtems_monitor_object_info_t;
+
+
+/* monitor.c */
+void rtems_monitor_kill(void);
+void rtems_monitor_init(rtems_boolean);
+void rtems_monitor_wakeup(void);
+void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_debugger_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_node_cmd(int, char **, unsigned32, boolean);
+void rtems_monitor_symbols_loadup(void);
+void rtems_monitor_task(rtems_task_argument);
+
+/* server.c */
+void rtems_monitor_server_kill(void);
+rtems_status_code rtems_monitor_server_request(unsigned32, rtems_monitor_server_request_t *, rtems_monitor_server_response_t *);
+void rtems_monitor_server_task(rtems_task_argument);
+void rtems_monitor_server_init(unsigned32);
+
+/* command.c */
+int rtems_monitor_make_argv(char *, int *, char **);
+int rtems_monitor_command_read(char *, int *, char **);
+rtems_monitor_command_entry_t *rtems_monitor_command_lookup(
+ rtems_monitor_command_entry_t * table, int argc, char **argv);
+void rtems_monitor_command_usage(rtems_monitor_command_entry_t *, char *);
+void rtems_monitor_help_cmd(int, char **, unsigned32, boolean);
+
+/* prmisc.c */
+void rtems_monitor_separator(void);
+unsigned32 rtems_monitor_pad(unsigned32 dest_col, unsigned32 curr_col);
+unsigned32 rtems_monitor_dump_char(unsigned8 ch);
+unsigned32 rtems_monitor_dump_decimal(unsigned32 num);
+unsigned32 rtems_monitor_dump_hex(unsigned32 num);
+unsigned32 rtems_monitor_dump_id(rtems_id id);
+unsigned32 rtems_monitor_dump_name(rtems_name name);
+unsigned32 rtems_monitor_dump_priority(rtems_task_priority priority);
+unsigned32 rtems_monitor_dump_state(States_Control state);
+unsigned32 rtems_monitor_dump_modes(rtems_mode modes);
+unsigned32 rtems_monitor_dump_attributes(rtems_attribute attributes);
+unsigned32 rtems_monitor_dump_events(rtems_event_set events);
+unsigned32 rtems_monitor_dump_notepad(unsigned32 *notepad);
+
+/* object.c */
+rtems_id rtems_monitor_id_fixup(rtems_id, unsigned32, rtems_monitor_object_type_t);
+rtems_id rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, unsigned32 *size_p);
+rtems_id rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *);
+void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
+rtems_id rtems_monitor_object_canonical(rtems_id, void *);
+void rtems_monitor_object_cmd(int, char **, unsigned32, boolean);
+
+/* manager.c */
+void *rtems_monitor_manager_next(void *, void *, rtems_id *);
+
+/* config.c */
+void rtems_monitor_config_canonical(rtems_monitor_config_t *, void *);
+void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
+void rtems_monitor_config_dump_header(boolean);
+void rtems_monitor_config_dump(rtems_monitor_config_t *, boolean verbose);
+
+/* mpci.c */
+void rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *);
+void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
+void rtems_monitor_mpci_dump_header(boolean);
+void rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, boolean verbose);
+
+/* itask.c */
+void rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *);
+void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
+void rtems_monitor_init_task_dump_header(boolean);
+void rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, boolean verbose);
+
+/* extension.c */
+void rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *);
+void rtems_monitor_extension_dump_header(boolean verbose);
+void rtems_monitor_extension_dump(rtems_monitor_extension_t *, boolean);
+
+/* task.c */
+void rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
+void rtems_monitor_task_dump_header(boolean verbose);
+void rtems_monitor_task_dump(rtems_monitor_task_t *, boolean);
+
+/* queue.c */
+void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
+void rtems_monitor_queue_dump_header(boolean verbose);
+void rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean);
+
+/* driver.c */
+void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
+void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);
+void rtems_monitor_driver_dump_header(boolean);
+void rtems_monitor_driver_dump(rtems_monitor_driver_t *, boolean);
+
+/* dname.c */
+void *rtems_monitor_dname_next(void *, rtems_monitor_dname_t *, rtems_id *);
+void rtems_monitor_dname_canonical(rtems_monitor_dname_t *, void *);
+void rtems_monitor_dname_dump_header(boolean);
+void rtems_monitor_dname_dump(rtems_monitor_dname_t *, boolean);
+
+/* symbols.c */
+rtems_symbol_table_t *rtems_symbol_table_create();
+void rtems_symbol_table_destroy(rtems_symbol_table_t *table);
+
+rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, unsigned32);
+rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, unsigned32);
+const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, unsigned32);
+rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *);
+void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
+void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *);
+void rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, char *);
+void rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *);
+unsigned32 rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, boolean);
+void rtems_monitor_symbol_cmd(int, char **, unsigned32, boolean);
+
+
+extern rtems_symbol_table_t *rtems_monitor_symbols;
+
+#ifndef MONITOR_PROMPT
+#define MONITOR_PROMPT "rtems" /* will have '> ' appended */
+#endif
+
+#define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0
+
+
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define STRNEQ(a,b,n) (strncmp(a,b,n) == 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __MONITOR_H */
diff --git a/cpukit/libmisc/monitor/symbols.h b/cpukit/libmisc/monitor/symbols.h
new file mode 100644
index 0000000000..061ccdd952
--- /dev/null
+++ b/cpukit/libmisc/monitor/symbols.h
@@ -0,0 +1,64 @@
+/*
+ * RTEMS monitor symbol table functions
+ *
+ * Description:
+ * Entry points for symbol table routines.
+ *
+ *
+ *
+ * TODO:
+ *
+ * $Id$
+ */
+
+#ifndef _INCLUDE_SYMBOLS_H
+#define _INCLUDE_SYMBOLS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ rtems_unsigned32 value;
+ char *name;
+} rtems_symbol_t;
+
+#define SYMBOL_STRING_BLOCK_SIZE 4080
+typedef struct rtems_symbol_string_block_s {
+ struct rtems_symbol_string_block_s *next;
+ char buffer[SYMBOL_STRING_BLOCK_SIZE];
+} rtems_symbol_string_block_t;
+
+typedef struct {
+
+ rtems_unsigned32 sorted; /* are symbols sorted right now? */
+
+ rtems_unsigned32 growth_factor; /* % to grow by when needed */
+
+ rtems_unsigned32 next; /* next symbol slot to use when adding */
+ rtems_unsigned32 size; /* max # of symbols */
+
+ /*
+ * Symbol list -- sorted by address (when we do a lookup)
+ */
+
+ rtems_symbol_t *addresses; /* symbol array by address */
+
+ /*
+ * String pool, unsorted, a list of blocks of string data
+ */
+
+ rtems_symbol_string_block_t *string_buffer_head;
+ rtems_symbol_string_block_t *string_buffer_current;
+ rtems_unsigned32 strings_next; /* next byte to use in this block */
+
+} rtems_symbol_table_t;
+
+#define rtems_symbol_name(sp) ((sp)->name)
+#define rtems_symbol_value(sp) ((sp)->value)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! _INCLUDE_SYMBOLS_H */
diff --git a/cpukit/libmisc/stackchk/README b/cpukit/libmisc/stackchk/README
new file mode 100644
index 0000000000..20e76f07bc
--- /dev/null
+++ b/cpukit/libmisc/stackchk/README
@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+
+This directory contains a stack bounds checker. It provides two
+primary features:
+
+ + check for stack overflow at each context switch
+ + provides an educated guess at each task's stack usage
+
+The stack overflow check at context switch works by looking for
+a 16 byte pattern at the logical end of the stack to be corrupted.
+The "guesser" assumes that the entire stack was prefilled with a known
+pattern and assumes that the pattern is still in place if the memory
+has not been used as a stack.
+
+Both of these can be fooled by pushing large holes onto the stack
+and not writing to them... or (much more unlikely) writing the
+magic patterns into memory.
+
+This code has not been extensively tested. It is provided as a tool
+for RTEMS users to catch the most common mistake in multitasking
+systems ... too little stack space. Suggestions and comments are appreciated.
+
+NOTES:
+
+1. Stack usage information is questionable on CPUs which push
+ large holes on stack.
+
+2. The stack checker has a tendency to generate a fault when
+ trying to print the helpful diagnostic message. If it comes
+ out, congratulations. If not, then the variable Stack_check_Blown_task
+ contains a pointer to the TCB of the offending task. This
+ is usually enough to go on.
+
+FUTURE:
+
+1. Determine how/if gcc will generate stack probe calls and support that.
+
+2. Get accurate stack usage numbers on i960.. it pushes very large
+ holes on the stack.
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
new file mode 100644
index 0000000000..3d06d1dd12
--- /dev/null
+++ b/cpukit/libmisc/stackchk/check.c
@@ -0,0 +1,512 @@
+/*
+ * Stack Overflow Check User Extension Set
+ *
+ * NOTE: This extension set automatically determines at
+ * initialization time whether the stack for this
+ * CPU grows up or down and installs the correct
+ * extension routines for that direction.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+
+/*
+ * HACK
+ * the stack dump information should be printed by a "fatal" extension.
+ * Fatal extensions only get called via rtems_fatal_error_occurred()
+ * and not when rtems_shutdown_executive() is called.
+ * I hope/think this is changing so that fatal extensions are renamed
+ * to "shutdown" extensions.
+ * When that happens, this #define should be deleted and all the code
+ * it marks.
+ */
+#define DONT_USE_FATAL_EXTENSION
+
+
+extern rtems_configuration_table BSP_Configuration;
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stackchk.h"
+#include "internal.h"
+
+/*
+ * This variable contains the name of the task which "blew" the stack.
+ * It is NULL if the system is all right.
+ */
+
+Thread_Control *Stack_check_Blown_task;
+
+/*
+ * The extension table for the stack checker.
+ */
+
+rtems_extensions_table Stack_check_Extension_table = {
+ Stack_check_Create_extension, /* rtems_task_create */
+ 0, /* rtems_task_start */
+ 0, /* rtems_task_restart */
+ 0, /* rtems_task_delete */
+ Stack_check_Switch_extension, /* task_switch */
+ Stack_check_Begin_extension, /* task_begin */
+ 0, /* task_exitted */
+#ifdef DONT_USE_FATAL_EXTENSION
+ 0, /* fatal */
+#else
+ Stack_check_Fatal_extension, /* fatal */
+#endif
+};
+
+/*
+ * The "magic pattern" used to mark the end of the stack.
+ */
+
+Stack_check_Control Stack_check_Pattern;
+
+/*
+ * Where the pattern goes in the stack area is dependent upon
+ * whether the stack grow to the high or low area of the memory.
+ *
+ */
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) \
+ ((_the_stack)->area + (_the_stack)->size - sizeof( Stack_check_Control ) ))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water ) \
+ ((_high_water) - (_low))
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area)
+
+#else
+
+#define Stack_check_Get_pattern_area( _the_stack ) \
+ ((Stack_check_Control *) ((_the_stack)->area + HEAP_OVERHEAD))
+
+#define Stack_check_Calculate_used( _low, _size, _high_water) \
+ ( ((_low) + (_size)) - (_high_water) )
+
+#define Stack_check_usable_stack_start(_the_stack) \
+ ((_the_stack)->area + sizeof(Stack_check_Control))
+
+#endif
+
+#define Stack_check_usable_stack_size(_the_stack) \
+ ((_the_stack)->size - sizeof(Stack_check_Control))
+
+
+/*
+ * Do we have an interrupt stack?
+ * XXX it would sure be nice if the interrupt stack were also
+ * stored in a "stack" structure!
+ */
+
+
+Stack_Control stack_check_interrupt_stack;
+
+/*
+ * Prototypes necessary for forward references
+ */
+
+void Stack_check_Dump_usage( void );
+
+/*
+ * Fill an entire stack area with BYTE_PATTERN.
+ * This will be used by a Fatal extension to check for
+ * amount of actual stack used
+ */
+
+void
+stack_check_dope_stack(Stack_Control *stack)
+{
+ memset(stack->area, BYTE_PATTERN, stack->size);
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Initialize
+ */
+
+unsigned32 stack_check_initialized = 0;
+
+void Stack_check_Initialize( void )
+{
+ rtems_status_code status;
+ Objects_Id id_ignored;
+ unsigned32 *p;
+#if 0
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ Objects_Information *information;
+#endif
+
+ if (stack_check_initialized)
+ return;
+
+ /*
+ * Dope the pattern and fill areas
+ */
+
+ for ( p = Stack_check_Pattern.pattern;
+ p < &Stack_check_Pattern.pattern[PATTERN_SIZE_WORDS];
+ p += 4
+ )
+ {
+ p[0] = 0xFEEDF00D; /* FEED FOOD to BAD DOG */
+ p[1] = 0x0BAD0D06;
+ p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
+ p[3] = 0x600D0D06;
+ };
+
+ status = rtems_extension_create(
+ rtems_build_name( 'S', 'T', 'C', 'K' ),
+ &Stack_check_Extension_table,
+ &id_ignored
+ );
+ assert ( status == RTEMS_SUCCESSFUL );
+
+ Stack_check_Blown_task = 0;
+
+ /*
+ * If installed by a task, that task will not get setup properly
+ * since it missed out on the create hook. This will cause a
+ * failure on first switch out of that task.
+ * So pretend here that we actually ran create and begin extensions.
+ */
+
+ /* XXX
+ *
+ * Technically this has not been done for any task created before this
+ * happened. So just run through them and fix the situation.
+ */
+#if 0
+ if (_Thread_Executing)
+ {
+ Stack_check_Create_extension(_Thread_Executing, _Thread_Executing);
+ }
+#endif
+
+#if 0
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Create_extension( the_thread, the_thread );
+ }
+ }
+ }
+#endif
+
+ /*
+ * If appropriate, setup the interrupt stack for high water testing
+ * also.
+ */
+ if (_CPU_Interrupt_stack_low && _CPU_Interrupt_stack_high)
+ {
+ stack_check_interrupt_stack.area = _CPU_Interrupt_stack_low;
+ stack_check_interrupt_stack.size = _CPU_Interrupt_stack_high -
+ _CPU_Interrupt_stack_low;
+
+ stack_check_dope_stack(&stack_check_interrupt_stack);
+ }
+
+#ifdef DONT_USE_FATAL_EXTENSION
+#ifdef RTEMS_DEBUG
+ /*
+ * this would normally be called by a fatal extension
+ * handler, but we don't run fatal extensions unless
+ * we fatal error.
+ */
+ atexit(Stack_check_Dump_usage);
+#endif
+#endif
+
+ stack_check_initialized = 1;
+}
+
+/*PAGE
+ *
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+)
+{
+ if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
+ stack_check_dope_stack(&the_thread->Start.Initial_stack);
+
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+)
+{
+ Stack_check_Control *the_pattern;
+
+ if ( the_thread->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ the_pattern = Stack_check_Get_pattern_area(&the_thread->Start.Initial_stack);
+
+ *the_pattern = Stack_check_Pattern;
+}
+
+/*PAGE
+ *
+ * Stack_check_report_blown_task
+ * Report a blown stack. Needs to be a separate routine
+ * so that interrupt handlers can use this too.
+ *
+ * Caller must have set the Stack_check_Blown_task.
+ *
+ * NOTE: The system is in a questionable state... we may not get
+ * the following message out.
+ */
+
+void Stack_check_report_blown_task(void)
+{
+ Stack_Control *stack;
+ Thread_Control *running;
+
+ running = Stack_check_Blown_task;
+ stack = &running->Start.Initial_stack;
+
+ fprintf(
+ stderr,
+ "BLOWN STACK!!! Offending task(%p): id=0x%08x; name=0x%08x",
+ running,
+ running->Object.id,
+ *(unsigned32 *)running->Object.name
+ );
+ fflush(stderr);
+
+ if (BSP_Configuration.User_multiprocessing_table)
+ fprintf(
+ stderr,
+ "; node=%d\n",
+ BSP_Configuration.User_multiprocessing_table->node
+ );
+ else
+ fprintf(stderr, "\n");
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " stack covers range 0x%08x - 0x%08x (%d bytes)\n",
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + stack->size - 1,
+ (unsigned32) stack->size);
+ fflush(stderr);
+
+ fprintf(
+ stderr,
+ " Damaged pattern begins at 0x%08x and is %d bytes long\n",
+ (unsigned32) Stack_check_Get_pattern_area(stack), PATTERN_SIZE_BYTES);
+ fflush(stderr);
+
+ rtems_fatal_error_occurred( (unsigned32) "STACK BLOWN" );
+}
+
+/*PAGE
+ *
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+)
+{
+ if ( running->Object.id == 0 ) /* skip system tasks */
+ return;
+
+ if (0 != memcmp( (void *) Stack_check_Get_pattern_area( &running->Start.Initial_stack)->pattern,
+ (void *) Stack_check_Pattern.pattern,
+ PATTERN_SIZE_BYTES))
+ {
+ Stack_check_Blown_task = running;
+ Stack_check_report_blown_task();
+ }
+}
+
+void *Stack_check_find_high_water_mark(
+ const void *s,
+ size_t n
+)
+{
+ const unsigned32 *base, *ebase;
+ unsigned32 length;
+
+ base = s;
+ length = n/4;
+
+#if ( CPU_STACK_GROWS_UP == TRUE )
+ /*
+ * start at higher memory and find first word that does not
+ * match pattern
+ */
+
+ base += length - 1;
+ for (ebase = s; base > ebase; base--)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#else
+ /*
+ * start at lower memory and find first word that does not
+ * match pattern
+ */
+
+ base += PATTERN_SIZE_WORDS;
+ for (ebase = base + length; base < ebase; base++)
+ if (*base != U32_PATTERN)
+ return (void *) base;
+#endif
+
+ return (void *)0;
+}
+
+/*PAGE
+ *
+ * Stack_check_Dump_threads_usage
+ * Try to print out how much stack was actually used by the task.
+ *
+ */
+
+void Stack_check_Dump_threads_usage(
+ Thread_Control *the_thread
+)
+{
+ unsigned32 size, used;
+ void *low;
+ void *high_water_mark;
+ Stack_Control *stack;
+
+ if ( !the_thread )
+ return;
+
+ /*
+ * XXX HACK to get to interrupt stack
+ */
+
+ if (the_thread == (Thread_Control *) -1)
+ {
+ if (stack_check_interrupt_stack.area)
+ {
+ stack = &stack_check_interrupt_stack;
+ the_thread = 0;
+ }
+ else
+ return;
+ }
+ else
+ stack = &the_thread->Start.Initial_stack;
+
+ low = Stack_check_usable_stack_start(stack);
+ size = Stack_check_usable_stack_size(stack);
+
+ high_water_mark = Stack_check_find_high_water_mark(low, size);
+
+ if ( high_water_mark )
+ used = Stack_check_Calculate_used( low, size, high_water_mark );
+ else
+ used = 0;
+
+ printf( "0x%08x 0x%08x 0x%08x 0x%08x %8d %8d\n",
+ the_thread ? the_thread->Object.id : ~0,
+ the_thread ? *(unsigned32 *)the_thread->Object.name :
+ rtems_build_name('I', 'N', 'T', 'R'),
+ (unsigned32) stack->area,
+ (unsigned32) stack->area + (unsigned32) stack->size - 1,
+ size,
+ used
+ );
+}
+
+/*PAGE
+ *
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+)
+{
+#ifndef DONT_USE_FATAL_EXTENSION
+ if (status == 0)
+ Stack_check_Dump_usage();
+#endif
+}
+
+
+/*PAGE
+ *
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void )
+{
+ unsigned32 i;
+ unsigned32 class_index;
+ Thread_Control *the_thread;
+ unsigned32 hit_running = 0;
+ Objects_Information *information;
+
+ if (stack_check_initialized == 0)
+ return;
+
+ printf("Stack usage by thread\n");
+ printf(
+ " ID NAME LOW HIGH AVAILABLE USED\n"
+ );
+
+ for ( class_index = OBJECTS_CLASSES_FIRST ;
+ class_index <= OBJECTS_CLASSES_LAST ;
+ class_index++ ) {
+ information = _Objects_Information_table[ class_index ];
+ if ( information && information->is_thread ) {
+ for ( i=1 ; i <= information->maximum ; i++ ) {
+ the_thread = (Thread_Control *)information->local_table[ i ];
+ Stack_check_Dump_threads_usage( the_thread );
+ if ( the_thread == _Thread_Executing )
+ hit_running = 1;
+ }
+ }
+ }
+
+ if ( !hit_running )
+ Stack_check_Dump_threads_usage( _Thread_Executing );
+
+ /* dump interrupt stack info if any */
+ Stack_check_Dump_threads_usage((Thread_Control *) -1);
+}
+
diff --git a/cpukit/libmisc/stackchk/internal.h b/cpukit/libmisc/stackchk/internal.h
new file mode 100644
index 0000000000..e98ec7e92e
--- /dev/null
+++ b/cpukit/libmisc/stackchk/internal.h
@@ -0,0 +1,96 @@
+/* internal.h
+ *
+ * This include file contains internal information
+ * for the RTEMS stack checker.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INTERNAL_STACK_CHECK_h
+#define __INTERNAL_STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This structure is used to fill in and compare the "end of stack"
+ * marker pattern.
+ * pattern area must be a multiple of 4 words.
+ */
+
+#ifdef CPU_STACK_CHECK_SIZE
+#define PATTERN_SIZE_WORDS (((CPU_STACK_CHECK_SIZE / 4) + 3) & ~0x3)
+#else
+#define PATTERN_SIZE_WORDS 4
+#endif
+
+#define PATTERN_SIZE_BYTES (PATTERN_SIZE_WORDS * 4)
+
+typedef struct {
+ unsigned32 pattern[ PATTERN_SIZE_WORDS ];
+} Stack_check_Control;
+
+/*
+ * The pattern used to fill the entire stack.
+ */
+
+#define BYTE_PATTERN 0xA5
+#define U32_PATTERN 0xA5A5A5A5
+
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Stack_check_Fatal_extension
+ */
+
+void Stack_check_Fatal_extension(
+ Internal_errors_Source source,
+ boolean is_internal,
+ unsigned32 status
+);
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/libmisc/stackchk/stackchk.h b/cpukit/libmisc/stackchk/stackchk.h
new file mode 100644
index 0000000000..f3281c63fe
--- /dev/null
+++ b/cpukit/libmisc/stackchk/stackchk.h
@@ -0,0 +1,41 @@
+/* stackchk.h
+ *
+ * This include file contains information necessary to utilize
+ * and install the stack checker mechanism.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_CHECK_h
+#define __STACK_CHECK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Stack_check_Initialize
+ */
+
+void Stack_check_Initialize( void );
+
+/*
+ * Stack_check_Dump_usage
+ */
+
+void Stack_check_Dump_usage( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/aio.h b/cpukit/posix/include/aio.h
new file mode 100644
index 0000000000..504559c857
--- /dev/null
+++ b/cpukit/posix/include/aio.h
@@ -0,0 +1,137 @@
+/* aio.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_ASYNCHRONOUS_IO_h
+#define __POSIX_ASYNCHRONOUS_IO_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_ASYNCHRONOUS_IO)
+
+/*
+ * 6.7.1 Data Definitions for Asynchronous Input and Output,
+ * P1003.1b-1993, p. 151
+ */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <time.h>
+#include <fcntl.h>
+
+/*
+ * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
+ */
+
+#define AIO_CANCELED 0 /* all requested operations have been canceled */
+#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
+ /* since they are in progress */
+#define AIO_ALLDONE 0 /* none of the requested operations could be */
+ /* canceled since they are already complete */
+
+/* lio_listio() options */
+
+#define LIO_WAIT 0 /* calling process is to suspend until the */
+ /* operation is complete */
+#define LIO_NOWAIT 0 /* calling process is to continue execution while */
+ /* the operation is performed and no notification */
+ /* shall be given when the operation is completed */
+#define LIO_READ 0 /* request a read() */
+#define LIO_WRITE 0 /* request a write() */
+#define LIO_NOP 0 /* no transfer is requested */
+
+/*
+ * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
+ */
+
+struct aiocb {
+ int aio_fildes; /* File descriptor */
+ off_t aio_offset; /* File offset */
+ volatile void *aio_buf; /* Location of buffer */
+ size_t aio_nbytes; /* Length of transfer */
+ int aio_reqprio; /* Request priority offset */
+ struct sigevent aio_sigevent; /* Signal number and value */
+ int aoi_lio_opcode; /* Operation to be performed */
+};
+
+/*
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+);
+
+/*
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+);
+
+#if defined(_POSIX_SYNCHRONIZED_IO)
+
+/*
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+);
+
+#endif /* _POSIX_SYNCHRONIZED_IO */
+
+#endif /* _POSIX_ASYNCHRONOUS_IO */
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/devctl.h b/cpukit/posix/include/devctl.h
new file mode 100644
index 0000000000..5073b475ee
--- /dev/null
+++ b/cpukit/posix/include/devctl.h
@@ -0,0 +1,30 @@
+/* devctl.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_DEVICE_CONTROL_h
+#define __POSIX_DEVICE_CONTROL_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_DEVICE_CONTROL)
+
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/intr.h b/cpukit/posix/include/intr.h
new file mode 100644
index 0000000000..f07d1f9552
--- /dev/null
+++ b/cpukit/posix/include/intr.h
@@ -0,0 +1,72 @@
+/* intr.h
+ *
+ * XXX: It is unclear if the type "intr_t" should be defined when
+ * _POSIX_INTERRUPT_CONTROL is not.
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_INTERRUPTS_h
+#define __POSIX_INTERRUPTS_h
+
+#include <rtems/posix/features.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#if defined(_POSIX_INTERRUPT_CONTROL)
+
+/*
+ * 22.2 Concepts, P1003.4b/D8, p. 73
+ */
+
+typedef int intr_t;
+
+/*
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+/*
+ * Return codes from an interrupt handler
+ */
+
+#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
+ /* the thread that registered the */
+ /* ISR that the interrupt occurred. */
+#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
+ /* do NOT perform notification. */
+#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
+ /* let the next handler try. */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+);
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+);
+
+int intr_lock(
+ intr_t intr
+);
+
+int intr_unlock(
+ intr_t intr
+);
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/mqueue.h b/cpukit/posix/include/mqueue.h
new file mode 100644
index 0000000000..f1b2250e5c
--- /dev/null
+++ b/cpukit/posix/include/mqueue.h
@@ -0,0 +1,145 @@
+/* mqueue.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_MESSAGE_QUEUE_h
+#define __POSIX_MESSAGE_QUEUE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_MESSAGE_PASSING)
+
+#include <sys/types.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+
+/*
+ * 15.1.1 Data Structures, P1003.1b-1993, p. 271
+ */
+
+typedef Objects_Id mqd_t;
+
+struct mq_attr {
+ long mq_flags; /* Message queue flags */
+ long mq_maxmsg; /* Maximum number of messages */
+ long mq_msgsize; /* Maximum message size */
+ long mq_curmsgs; /* Number of messages currently queued */
+};
+
+/*
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+);
+
+/*
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+);
+
+/*
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+#include <time.h>
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/*
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+);
+
+#endif /* _POSIX_REALTIME_SIGNALS */
+
+/*
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+);
+
+/*
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+);
+
+#endif /* _POSIX_MESSAGE_PASSING */
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/rtems/posix/cancel.h b/cpukit/posix/include/rtems/posix/cancel.h
new file mode 100644
index 0000000000..e6d80275f4
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/cancel.h
@@ -0,0 +1,16 @@
+/* rtems/posix/cancel.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CANCEL_h
+#define __RTEMS_POSIX_CANCEL_h
+
+typedef struct {
+ Chain_Node Node;
+ void (*routine)( void * );
+ void *arg;
+} POSIX_Cancel_Handler_control;
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/include/rtems/posix/cond.h b/cpukit/posix/include/rtems/posix/cond.h
new file mode 100644
index 0000000000..4448e38b6c
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/cond.h
@@ -0,0 +1,123 @@
+/* rtems/posix/cond.h
+ *
+ * This include file contains all the private support information for
+ * POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * Data Structure used to manage a POSIX condition variable
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ pthread_mutex_t Mutex;
+ Thread_queue_Control Wait_queue;
+} POSIX_Condition_variables_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Condition_variables_Information;
+
+/*
+ * _POSIX_Condition_variables_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Condition_variables_Manager_initialization(
+ unsigned32 maximum_condition_variables
+);
+
+/*
+ * _POSIX_Condition_variables_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a condition variable control block from
+ * the inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *
+ _POSIX_Condition_variables_Allocate( void );
+
+/*
+ * _POSIX_Condition_variables_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a condition variable control block to the
+ * inactive chain of free condition variable control blocks.
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+/*
+ * _POSIX_Condition_variables_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps condition variable IDs to condition variable control
+ * blocks. If ID corresponds to a local condition variable, then it returns
+ * the_condition variable control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the condition variable ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_condition variable is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_condition variable is undefined.
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Condition_variables_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_condition variable is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+);
+
+#include <rtems/posix/cond.inl>
+#include <rtems/posix/condmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/condmp.h b/cpukit/posix/include/rtems/posix/condmp.h
new file mode 100644
index 0000000000..12997b68f4
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/condmp.h
@@ -0,0 +1,162 @@
+/* condmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Condition Variable Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+#define __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote condition variable operations.
+ */
+
+typedef enum {
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE = 0,
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE = 1,
+ POSIX_CONDITION_VARIABLES_MP_EXTRACT_PROXY = 2,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_REQUEST = 3,
+ POSIX_CONDITION_VARIABLES_MP_OBTAIN_RESPONSE = 4,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_REQUEST = 5,
+ POSIX_CONDITION_VARIABLES_MP_RELEASE_RESPONSE = 6,
+} POSIX_Condition_variables_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote condition variable operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Condition_variables_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Condition_variables_MP_Packet;
+
+/*
+ * _POSIX_Condition_variables_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_process_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Condition_variables_MP_Send_request_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Condition_variables_MP_Send_response_packet (
+ POSIX_Condition_variables_MP_Remote_operations operation,
+ Objects_Id condition_variables_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Condition_variables_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Condition_variables_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Condition_variables_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Condition_variables_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a condition variable mp packet.
+ */
+
+POSIX_Condition_variables_MP_Packet
+ *_POSIX_Condition_variables_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/posix/include/rtems/posix/intr.h b/cpukit/posix/include/rtems/posix/intr.h
new file mode 100644
index 0000000000..ae1690f676
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/intr.h
@@ -0,0 +1,153 @@
+/* rtems/posix/intr.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage each POSIX Interrupt Vector
+ */
+
+typedef struct {
+ int number_installed;
+ int lock_count;
+ int deferred_count;
+ Chain_Control Handlers;
+} POSIX_Interrupt_Control;
+
+/*
+ * Data Structure used to manage a POSIX Interrupt Handler
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int is_active;
+ intr_t vector;
+ Thread_Control *server;
+ int (*handler)( void *area );
+ volatile void *user_data_area;
+} POSIX_Interrupt_Handler_control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Interrupt_Handlers_Information;
+
+/*
+ * The following is an array which is used to manage the set of
+ * interrupt handlers installed on each vector.
+ */
+
+EXTERN POSIX_Interrupt_Control _POSIX_Interrupt_Information[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _POSIX_Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Interrupt_Manager_initialization(
+ unsigned32 maximum_interrupt_handlers
+);
+
+/*
+ * _POSIX_Interrupt_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a interrupt handler control block from
+ * the inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void );
+
+/*
+ * _POSIX_Interrupt_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a interrupt handler control block to the
+ * inactive chain of free interrupt handler control blocks.
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps interrupt handler IDs to interrupt handler control
+ * blocks. If ID corresponds to a local interrupt handler, then it returns
+ * the_intr control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the interrupt handler ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_intr is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_intr is undefined.
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Interrupt_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_intr is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+);
+
+/*
+ * _POSIX_Interrupt_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This function XXX.
+ */
+
+void _POSIX_Interrupt_Handler(
+ ISR_Vector_number vector
+);
+
+#include <rtems/posix/intr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/key.h b/cpukit/posix/include/rtems/posix/key.h
new file mode 100644
index 0000000000..0e690161b8
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/key.h
@@ -0,0 +1,136 @@
+/* rtems/posix/key.h
+ *
+ * This include file contains all the private support information for
+ * POSIX key.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_h
+#define __RTEMS_POSIX_KEY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX key
+ *
+ * NOTE: The Values is a table indexed by the index portion of the
+ * ID of the currently executing thread.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ boolean is_active;
+ void (*destructor)( void * );
+ void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
+} POSIX_Keys_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Keys_Information;
+
+/*
+ * _POSIX_Keys_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Key_Manager_initialization(
+ unsigned32 maximum_keys
+);
+
+/*
+ * _POSIX_Keys_Run_destructors
+ *
+ * DESCRIPTION:
+ *
+ * This function executes all the destructors associated with the thread's
+ * keys. This function will execute until all values have been set to NULL.
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ */
+
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+);
+
+/*
+ * _POSIX_Keys_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a keys control block from
+ * the inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void );
+
+/*
+ * _POSIX_Keys_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a keys control block to the
+ * inactive chain of free keys control blocks.
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+);
+
+/*
+ * _POSIX_Keys_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps key IDs to key control blocks.
+ * If ID corresponds to a local keys, then it returns
+ * the_key control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the keys ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_key is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_key is undefined.
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Keys_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_key is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+);
+
+#include <rtems/posix/key.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/mqueue.h b/cpukit/posix/include/rtems/posix/mqueue.h
new file mode 100644
index 0000000000..5d5cfee61b
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/mqueue.h
@@ -0,0 +1,186 @@
+/* rtems/posix/mqueue.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Message Queues.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coremsg.h>
+#include <rtems/score/object.h>
+
+/*
+ * Data Structure used to manage a POSIX message queue
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ int flags;
+ boolean named;
+ boolean linked;
+ boolean blocking;
+ unsigned32 open_count;
+ CORE_message_queue_Control Message_queue;
+ struct sigevent notification;
+} POSIX_Message_queue_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Message_queue_Information;
+
+/*
+ * _POSIX_Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Create_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the creation of a message queue utilizing the
+ * core message queue.
+ */
+
+int _POSIX_Message_queue_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int oflag,
+ struct mq_attr *attr,
+ POSIX_Message_queue_Control **message_queue
+);
+
+/*
+ *
+ * _POSIX_Message_queue_Send_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts a message to a specified message queue.
+ */
+
+int _POSIX_Message_queue_Send_support(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ unsigned32 msg_len,
+ Priority_Control msg_prio,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
+
+/*
+ * _POSIX_Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message queue control block to the
+ * inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control blocks.
+ * If ID corresponds to a local message queue, then it returns
+ * the_mq control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the message queue ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_message queue is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mq is undefined.
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+);
+
+/*
+ * _POSIX_Message_queue_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Message_queue_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+/*
+ * _POSIX_Message_queue_Priority_to_core
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+);
+
+#include <rtems/posix/mqueue.inl>
+#include <rtems/posix/mqueuemp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/mqueuemp.h b/cpukit/posix/include/rtems/posix/mqueuemp.h
new file mode 100644
index 0000000000..ae23f6af56
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/mqueuemp.h
@@ -0,0 +1,161 @@
+/* mqueuemp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Message Queue Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+#define __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_REQUEST = 3,
+ POSIX_MESSAGE_QUEUE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_REQUEST = 5,
+ POSIX_MESSAGE_QUEUE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Message_queue_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Message_queue_MP_Packet;
+
+/*
+ * _POSIX_Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_process_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Message_queue_MP_Send_request_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Message_queue_MP_Send_response_packet (
+ POSIX_Message_queue_MP_Remote_operations operation,
+ Objects_Id mq_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Message_queue_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+POSIX_Message_queue_MP_Packet *_POSIX_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/posix/include/rtems/posix/mutex.h b/cpukit/posix/include/rtems/posix/mutex.h
new file mode 100644
index 0000000000..5639d908d2
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/mutex.h
@@ -0,0 +1,117 @@
+/* rtems/posix/mutex.h
+ *
+ * This include file contains all the private support information for
+ * POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_h
+#define __RTEMS_POSIX_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX mutex
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ CORE_mutex_Control Mutex;
+} POSIX_Mutex_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Mutex_Information;
+
+/*
+ * _POSIX_Mutex_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Mutex_Manager_initialization(
+ unsigned32 maximum_mutexes
+);
+
+/*
+ * _POSIX_Mutex_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a mutexes control block from
+ * the inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
+
+/*
+ * _POSIX_Mutex_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a mutexes control block to the
+ * inactive chain of free mutexes control blocks.
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+);
+
+/*
+ * _POSIX_Mutex_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps mutexes IDs to mutexes control blocks.
+ * If ID corresponds to a local mutexes, then it returns
+ * the_mutex control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the mutexes ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_mutex is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_mutex is undefined.
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Mutex_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_mutex is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+);
+
+#include <rtems/posix/mutex.inl>
+#include <rtems/posix/mutexmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/mutexmp.h b/cpukit/posix/include/rtems/posix/mutexmp.h
new file mode 100644
index 0000000000..15ac5371e8
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/mutexmp.h
@@ -0,0 +1,161 @@
+/* mutexmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Mutex Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_MP_h
+#define __RTEMS_POSIX_MUTEX_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote mutex operations.
+ */
+
+typedef enum {
+ POSIX_MUTEX_MP_ANNOUNCE_CREATE = 0,
+ POSIX_MUTEX_MP_ANNOUNCE_DELETE = 1,
+ POSIX_MUTEX_MP_EXTRACT_PROXY = 2,
+ POSIX_MUTEX_MP_OBTAIN_REQUEST = 3,
+ POSIX_MUTEX_MP_OBTAIN_RESPONSE = 4,
+ POSIX_MUTEX_MP_RELEASE_REQUEST = 5,
+ POSIX_MUTEX_MP_RELEASE_RESPONSE = 6,
+} POSIX_Mutex_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote mutex operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Mutex_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Mutex_MP_Packet;
+
+/*
+ * _POSIX_Mutex_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_process_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Mutex_MP_Send_request_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Mutex_MP_Send_response_packet (
+ POSIX_Mutex_MP_Remote_operations operation,
+ Objects_Id mutex_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Mutex_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Mutex_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Mutex_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Mutex_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Mutex_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a mutex mp packet.
+ */
+
+POSIX_Mutex_MP_Packet *_POSIX_Mutex_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/posix/include/rtems/posix/priority.h b/cpukit/posix/include/rtems/posix/priority.h
new file mode 100644
index 0000000000..f4cb717b7c
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/priority.h
@@ -0,0 +1,34 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_h
+#define __RTEMS_POSIX_PRIORITY_h
+
+#include <rtems/score/priority.h>
+
+/*
+ * RTEMS Core has priorities run in the opposite sense of the POSIX API.
+ */
+
+#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (255)
+
+#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+);
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+);
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+);
+
+#include <rtems/posix/priority.inl>
+
+#endif
diff --git a/cpukit/posix/include/rtems/posix/pthread.h b/cpukit/posix/include/rtems/posix/pthread.h
new file mode 100644
index 0000000000..538e737268
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/pthread.h
@@ -0,0 +1,113 @@
+/* rtems/posix/pthread.h
+ *
+ * This include file contains all the private support information for
+ * POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_h
+#define __RTEMS_POSIX_THREADS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data Structure used to manage a POSIX thread
+ */
+
+typedef Thread_Control POSIX_Threads_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Threads_Information;
+
+/*
+ * _POSIX_Threads_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Threads_Manager_initialization(
+ unsigned32 maximum_pthreads
+);
+
+/*
+ * _POSIX_Threads_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a pthread control block from
+ * the inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void );
+
+/*
+ * _POSIX_Threads_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a pthread control block to the
+ * inactive chain of free pthread control blocks.
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+);
+
+/*
+ * _POSIX_Threads_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps pthread IDs to pthread control blocks.
+ * If ID corresponds to a local pthread, then it returns
+ * the_pthread control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the pthread ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_pthread is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_pthread is undefined.
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Threads_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_pthread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+);
+
+#include <rtems/posix/pthread.inl>
+#include <rtems/posix/pthreadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/pthreadmp.h b/cpukit/posix/include/rtems/posix/pthreadmp.h
new file mode 100644
index 0000000000..e15534136b
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/pthreadmp.h
@@ -0,0 +1,161 @@
+/* pthreadmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Threads Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_MP_h
+#define __RTEMS_POSIX_THREADS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote pthread operations.
+ */
+
+typedef enum {
+ POSIX_THREADS_MP_ANNOUNCE_CREATE = 0,
+ POSIX_THREADS_MP_ANNOUNCE_DELETE = 1,
+ POSIX_THREADS_MP_EXTRACT_PROXY = 2,
+ POSIX_THREADS_MP_OBTAIN_REQUEST = 3,
+ POSIX_THREADS_MP_OBTAIN_RESPONSE = 4,
+ POSIX_THREADS_MP_RELEASE_REQUEST = 5,
+ POSIX_THREADS_MP_RELEASE_RESPONSE = 6
+} POSIX_Threads_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote pthread operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Threads_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait;
+ Objects_Id proxy_id;
+} POSIX_Threads_MP_Packet;
+
+/*
+ * _POSIX_Threads_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_process_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Threads_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Threads_MP_Send_request_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Threads_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Threads_MP_Send_response_packet (
+ POSIX_Threads_MP_Remote_operations operation,
+ Objects_Id pthread_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Threads_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Threads_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Threads_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Threads_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Threads_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Threads_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a pthread mp packet.
+ */
+
+POSIX_Threads_MP_Packet *_POSIX_Threads_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/posix/include/rtems/posix/semaphore.h b/cpukit/posix/include/rtems/posix/semaphore.h
new file mode 100644
index 0000000000..a538663989
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/semaphore.h
@@ -0,0 +1,135 @@
+/* rtems/posix/semaphore.h
+ *
+ * This include file contains all the private support information for
+ * POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_h
+#define __RTEMS_POSIX_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/coresem.h>
+
+/*
+ * Data Structure used to manage a POSIX semaphore
+ */
+
+typedef struct {
+ Objects_Control Object;
+ int process_shared;
+ boolean named;
+ boolean linked;
+ unsigned32 open_count;
+ CORE_semaphore_Control Semaphore;
+} POSIX_Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _POSIX_Semaphore_Information;
+
+/*
+ * _POSIX_Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphorees
+);
+
+/*
+ * _POSIX_Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
+
+/*
+ * _POSIX_Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+);
+
+/*
+ * _POSIX_Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+);
+
+/*
+ * _POSIX_Semaphore_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+int _POSIX_Semaphore_Name_to_id(
+ const char *name,
+ Objects_Id *id
+);
+
+#include <rtems/posix/semaphore.inl>
+#include <rtems/posix/semaphoremp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/semaphoremp.h b/cpukit/posix/include/rtems/posix/semaphoremp.h
new file mode 100644
index 0000000000..102b3d08a6
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/semaphoremp.h
@@ -0,0 +1,161 @@
+/* semaphoremp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the POSIX Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_MP_h
+#define __RTEMS_POSIX_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ POSIX_SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ POSIX_SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ POSIX_SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ POSIX_SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ POSIX_SEMAPHORE_MP_RELEASE_RESPONSE = 6,
+} POSIX_Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ POSIX_Semaphore_MP_Remote_operations operation;
+ Objects_Name name;
+ boolean wait; /* XXX options */
+ Objects_Id proxy_id;
+} POSIX_Semaphore_MP_Packet;
+
+/*
+ * _POSIX_Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_process_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Objects_Name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+int _POSIX_Semaphore_MP_Send_request_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ boolean wait, /* XXX options */
+ Watchdog_Interval timeout
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _POSIX_Semaphore_MP_Send_response_packet (
+ POSIX_Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _POSIX_Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _POSIX_Semaphore_MP_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _POSIX_Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _POSIX_Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _POSIX_Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+POSIX_Semaphore_MP_Packet *_POSIX_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
new file mode 100644
index 0000000000..26643445b4
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -0,0 +1,30 @@
+/* threadsup.h
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
+#define __RTEMS_POSIX_THREAD_SUPPORT_h
+
+#include <rtems/score/coresem.h>
+
+typedef struct {
+ /*
+ * POSIX Interrupts
+ */
+ unsigned32 interrupts_installed;
+ CORE_semaphore_Control Interrupt_Semaphore;
+
+ /*
+ * POSIX Cancelability
+ */
+ int cancelability_state;
+ int cancelability_type;
+ int cancelation_requested;
+ Chain_Control Cancellation_Handlers;
+
+} POSIX_API_Thread_Support_Control;
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/rtems/posix/time.h b/cpukit/posix/include/rtems/posix/time.h
new file mode 100644
index 0000000000..0b11f2fa54
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/time.h
@@ -0,0 +1,14 @@
+/*
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_TIME_h
+#define __RTEMS_POSIX_TIME_h
+
+Watchdog_Interval _POSIX_Time_Spec_to_interval(
+ const struct timespec *time
+);
+
+#endif
diff --git a/cpukit/posix/include/sched.h b/cpukit/posix/include/sched.h
new file mode 100644
index 0000000000..1ea27a1634
--- /dev/null
+++ b/cpukit/posix/include/sched.h
@@ -0,0 +1,88 @@
+/* sched.h
+ *
+ * $Id$
+ */
+
+
+#ifndef __POSIX_SCHEDULING_h
+#define __POSIX_SCHEDULING_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_PRIORITY_SCHEDULING)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+#include <pthread.h>
+
+/*
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+);
+
+/*
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+);
+
+int sched_get_priority_min(
+ int policy
+);
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+);
+
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+
+#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
+
+/*
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void );
+
+#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/include/semaphore.h b/cpukit/posix/include/semaphore.h
new file mode 100644
index 0000000000..0388f91ad9
--- /dev/null
+++ b/cpukit/posix/include/semaphore.h
@@ -0,0 +1,108 @@
+/* semaphore.h
+ *
+ * $Id$
+ */
+
+#ifndef __POSIX_SEMAPHORE_h
+#define __POSIX_SEMAPHORE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_SEMAPHORES)
+
+#include <sys/time.h>
+
+/*
+ * 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
+ */
+
+typedef int sem_t;
+
+/*
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+);
+
+/*
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+);
+
+/*
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: Follows open() calling conventions.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+);
+
+/*
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+);
+
+/*
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+);
+
+int sem_trywait(
+ sem_t *sem
+);
+
+#if defined(_POSIX_TIMEOUTS)
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+);
+#endif
+
+/*
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+int sem_post(
+ sem_t *sem
+);
+
+/*
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+);
+
+#endif /* _POSIX_SEMAPHORES */
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/inline/rtems/posix/cond.inl b/cpukit/posix/inline/rtems/posix/cond.inl
new file mode 100644
index 0000000000..f6d55af7c6
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/cond.inl
@@ -0,0 +1,76 @@
+/* rtems/posix/cond.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX condition variables.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
+#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Allocate
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control
+ *_POSIX_Condition_variables_Allocate( void )
+{
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Allocate( &_POSIX_Condition_variables_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Free
+ */
+
+STATIC INLINE void _POSIX_Condition_variables_Free (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ _Objects_Free(
+ &_POSIX_Condition_variables_Information,
+ &the_condition_variable->Object
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Get
+ */
+
+STATIC INLINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+/* XXX really should validate pointer */
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Condition_variables_Is_null (
+ POSIX_Condition_variables_Control *the_condition_variable
+)
+{
+ return !the_condition_variable;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/intr.inl b/cpukit/posix/inline/rtems/posix/intr.inl
new file mode 100644
index 0000000000..56b1c9dd0b
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/intr.inl
@@ -0,0 +1,72 @@
+/* rtems/posix/intr.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Interrupt Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_INTERRUPT_inl
+#define __RTEMS_POSIX_INTERRUPT_inl
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Allocate
+ */
+
+STATIC INLINE POSIX_Interrupt_Handler_control *
+ _POSIX_Interrupt_Allocate( void )
+{
+ return (POSIX_Interrupt_Handler_control *)
+ _Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Free
+ */
+
+STATIC INLINE void _POSIX_Interrupt_Free (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ _Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Get
+ */
+
+STATIC INLINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Interrupt_Control *)
+ _Objects_Get( &_POSIX_Interrupt_Handlers_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Interrupt_Is_null (
+ POSIX_Interrupt_Handler_control *the_intr
+)
+{
+ return !the_intr;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/key.inl b/cpukit/posix/inline/rtems/posix/key.inl
new file mode 100644
index 0000000000..3b9c1e9e3c
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/key.inl
@@ -0,0 +1,70 @@
+/* rtems/posix/key.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX key's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_KEY_inl
+#define __RTEMS_POSIX_KEY_inl
+
+/*PAGE
+ *
+ * _POSIX_Keys_Allocate
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
+{
+ return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Free
+ */
+
+STATIC INLINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+)
+{
+ _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Get
+ */
+
+STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Keys_Control *)
+ _Objects_Get( &_POSIX_Keys_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Keys_Is_null (
+ POSIX_Keys_Control *the_key
+)
+{
+ return !the_key;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/mqueue.inl b/cpukit/posix/inline/rtems/posix/mqueue.inl
new file mode 100644
index 0000000000..140a37a6a6
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/mqueue.inl
@@ -0,0 +1,83 @@
+/* rtems/posix/mqueue.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Message Queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
+#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Allocate
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Allocate( &_POSIX_Message_queue_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Free
+ */
+
+STATIC INLINE void _POSIX_Message_queue_Free (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Get
+ */
+
+STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Message_queue_Control *)
+ _Objects_Get( &_POSIX_Message_queue_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Message_queue_Is_null (
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ return !the_mq;
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Priority_to_core
+ */
+
+STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
+ unsigned int priority
+)
+{
+ return priority;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/mutex.inl b/cpukit/posix/inline/rtems/posix/mutex.inl
new file mode 100644
index 0000000000..f663eb3c7d
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/mutex.inl
@@ -0,0 +1,88 @@
+/* rtems/posix/mutex.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX mutex's.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_MUTEX_inl
+#define __RTEMS_POSIX_MUTEX_inl
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Allocate
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
+{
+ return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Free
+ */
+
+STATIC INLINE void _POSIX_Mutex_Free (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Get
+ */
+
+STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ int status;
+
+ if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
+ /*
+ * Do an "auto-create" here.
+ */
+
+ status = pthread_mutex_init( id, 0 );
+ if ( status ) {
+ *location = OBJECTS_ERROR;
+ return (POSIX_Mutex_Control *) 0;
+ }
+ }
+
+ /*
+ * Now call Objects_Get()
+ */
+
+ return (POSIX_Mutex_Control *)
+ _Objects_Get( &_POSIX_Mutex_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Mutex_Is_null (
+ POSIX_Mutex_Control *the_mutex
+)
+{
+ return !the_mutex;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/priority.inl b/cpukit/posix/inline/rtems/posix/priority.inl
new file mode 100644
index 0000000000..90dfaead02
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/priority.inl
@@ -0,0 +1,29 @@
+/*
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_PRIORITY_inl
+#define __RTEMS_POSIX_PRIORITY_inl
+
+STATIC INLINE boolean _POSIX_Priority_Is_valid(
+ int priority
+)
+{
+ return (boolean) priority >= 1 && priority <= 255;
+}
+
+STATIC INLINE Priority_Control _POSIX_Priority_To_core(
+ int priority
+)
+{
+ return (Priority_Control) 256 - priority;
+}
+
+STATIC INLINE int _POSIX_Priority_From_core(
+ Priority_Control priority
+)
+{
+ return 256 - priority;
+}
+
+#endif
diff --git a/cpukit/posix/inline/rtems/posix/pthread.inl b/cpukit/posix/inline/rtems/posix/pthread.inl
new file mode 100644
index 0000000000..256372d326
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/pthread.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/pthread.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX threads.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_THREADS_inl
+#define __RTEMS_POSIX_THREADS_inl
+
+/*PAGE
+ *
+ * _POSIX_Threads_Allocate
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void )
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Allocate( &_POSIX_Threads_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Free
+ */
+
+STATIC INLINE void _POSIX_Threads_Free (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ _Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Get
+ */
+
+STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Threads_Control *)
+ _Objects_Get( &_POSIX_Threads_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Threads_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Threads_Is_null (
+ POSIX_Threads_Control *the_pthread
+)
+{
+ return !the_pthread;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/inline/rtems/posix/semaphore.inl b/cpukit/posix/inline/rtems/posix/semaphore.inl
new file mode 100644
index 0000000000..33af0bd000
--- /dev/null
+++ b/cpukit/posix/inline/rtems/posix/semaphore.inl
@@ -0,0 +1,71 @@
+/* rtems/posix/semaphore.inl
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX Semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_POSIX_SEMAPHORE_inl
+#define __RTEMS_POSIX_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Allocate
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void )
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Allocate( &_POSIX_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Free
+ */
+
+STATIC INLINE void _POSIX_Semaphore_Free (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Get
+ */
+
+STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
+ Objects_Id *id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Semaphore_Control *)
+ _Objects_Get( &_POSIX_Semaphore_Information, *id, location );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Is_null
+ */
+
+STATIC INLINE boolean _POSIX_Semaphore_Is_null (
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ return !the_semaphore;
+}
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/posix/src/aio.c b/cpukit/posix/src/aio.c
new file mode 100644
index 0000000000..491c2772cf
--- /dev/null
+++ b/cpukit/posix/src/aio.c
@@ -0,0 +1,113 @@
+/* aio.c
+ *
+ * $Id$
+ */
+
+#include <aio.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+#endif
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
new file mode 100644
index 0000000000..2ad972c626
--- /dev/null
+++ b/cpukit/posix/src/cancel.c
@@ -0,0 +1,227 @@
+/* cancel.c
+ *
+ * $Id$
+ */
+
+#include <pthread.h>
+#include <errno.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/posix/cancel.h>
+#include <rtems/posix/pthread.h>
+#include <rtems/posix/threadsup.h>
+
+/*PAGE
+ *
+ * POSIX_Thread_cancel_run
+ *
+ */
+
+void POSIX_Thread_cancel_run(
+ Thread_Control *the_thread
+)
+{
+ int old_cancel_state;
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+ ISR_Level level;
+
+ thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ old_cancel_state = thread_support->cancelability_state;
+
+ thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE;
+
+ while ( !_Chain_Is_empty( handler_stack ) ) {
+ _ISR_Disable( level );
+ handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
+ _Chain_Extract_unprotected( &handler->Node );
+ _ISR_Enable( level );
+
+ (*handler->routine)( handler->arg );
+
+ _Workspace_Free( handler );
+ }
+
+ thread_support->cancelation_requested = 0;
+
+ thread_support->cancelability_state = old_cancel_state;
+}
+
+/*PAGE
+ *
+ * 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
+ */
+
+int pthread_cancel(
+ pthread_t thread
+)
+{
+ Thread_Control *the_thread;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Objects_Locations location;
+
+ the_thread = _POSIX_Threads_Get( &thread, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED();
+ case OBJECTS_LOCAL:
+ thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
+
+ thread_support->cancelation_requested = 1;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcancelstate(
+ int state,
+ int *oldstate
+)
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !oldstate )
+ return EINVAL;
+
+ if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
+ return EINVAL;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ *oldstate = thread_support->cancelability_state;
+ thread_support->cancelability_state = state;
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcanceltype(
+ int type,
+ int *oldtype
+)
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !oldtype )
+ return EINVAL;
+
+ if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
+ return EINVAL;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ *oldtype = thread_support->cancelability_type;
+ thread_support->cancelability_type = type;
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+void pthread_testcancel( void )
+{
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelation_requested )
+ POSIX_Thread_cancel_run( _Thread_Executing );
+}
+
+/*PAGE
+ *
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_push(
+ void (*routine)( void * ),
+ void *arg
+)
+{
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ if ( !routine )
+ return; /* XXX what to do really? */
+
+ handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
+
+ if ( !handler )
+ return; /* XXX what to do really? */
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ handler->routine = routine;
+ handler->arg = arg;
+
+ _Chain_Append( handler_stack, &handler->Node );
+}
+
+/*PAGE
+ *
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_pop(
+ int execute
+)
+{
+ POSIX_Cancel_Handler_control *handler;
+ Chain_Control *handler_stack;
+ POSIX_API_Thread_Support_Control *thread_support;
+ ISR_Level level;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ handler_stack = &thread_support->Cancellation_Handlers;
+
+ if ( _Chain_Is_empty( handler_stack ) )
+ return;
+
+ _ISR_Disable( level );
+ handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
+ _Chain_Extract_unprotected( &handler->Node );
+ _ISR_Enable( level );
+
+ if ( execute )
+ (*handler->routine)( handler->arg );
+
+ _Workspace_Free( handler );
+}
diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c
new file mode 100644
index 0000000000..e20cfe5359
--- /dev/null
+++ b/cpukit/posix/src/cond.c
@@ -0,0 +1,400 @@
+/* cond.c
+ *
+ * $Id$
+ */
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/cond.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * The default condition variable attributes structure.
+ */
+
+const pthread_condattr_t _POSIX_Condition_variables_Default_attributes = {
+ TRUE, /* is_initialized */
+ PTHREAD_PROCESS_PRIVATE /* process_shared */
+};
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Manager_initialization
+ *
+ * This routine initializes all condition variable manager related data
+ * structures.
+ *
+ * Input parameters:
+ * maximum_condition_variables - maximum configured condition_variables
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Condition_variables_Manager_initialization(
+ unsigned32 maximum_condition_variables
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Condition_variables_Information,
+ OBJECTS_POSIX_CONDITION_VARIABLES,
+ TRUE,
+ maximum_condition_variables,
+ sizeof( POSIX_Condition_variables_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_init(
+ pthread_condattr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Condition_variables_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_destroy(
+ pthread_condattr_t *attr
+)
+{
+ if ( !attr || attr->is_initialized == FALSE )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_getpshared(
+ const pthread_condattr_t *attr,
+ int *pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *pshared = attr->process_shared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_setpshared(
+ pthread_condattr_t *attr,
+ int pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->process_shared = pshared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_init(
+ pthread_cond_t *cond,
+ const pthread_condattr_t *attr
+)
+{
+ POSIX_Condition_variables_Control *the_cond;
+ const pthread_condattr_t *the_attr;
+
+ if ( attr ) the_attr = attr;
+ else the_attr = &_POSIX_Condition_variables_Default_attributes;
+
+ /*
+ * XXX: Be careful about attributes when global!!!
+ */
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ return POSIX_MP_NOT_IMPLEMENTED();
+
+ if ( !the_attr->is_initialized )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_cond = _POSIX_Condition_variables_Allocate();
+
+ if ( !the_cond ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Condition_variables_Information,
+ 0, the_cond->Object.id, FALSE ) ) ) {
+ _POSIX_Condition_variables_Free( the_cond );
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_cond->process_shared = the_attr->process_shared;
+
+ the_cond->Mutex = 0;
+
+/* XXX some more initialization might need to go here */
+ _Thread_queue_Initialize(
+ &the_cond->Wait_queue,
+ OBJECTS_POSIX_CONDITION_VARIABLES,
+ THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_CONDITION_VARIABLE,
+ _POSIX_Condition_variables_MP_Send_extract_proxy,
+ ETIMEDOUT
+ );
+
+ _Objects_Open(
+ &_POSIX_Condition_variables_Information,
+ &the_cond->Object,
+ 0
+ );
+
+ *cond = the_cond->Object.id;
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Condition_variables_MP_Send_process_packet(
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE,
+ the_cond->Object.id,
+ 0, /* Name not used */
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_destroy(
+ pthread_cond_t *cond
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ _Objects_Close(
+ &_POSIX_Condition_variables_Information,
+ &the_cond->Object
+ );
+
+ if ( _Thread_queue_Get_number_waiting( &the_cond->Wait_queue ) )
+ return EBUSY;
+
+ _POSIX_Condition_variables_Free( the_cond );
+
+ if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Condition_variables_Information,
+ the_cond->Object.id
+ );
+
+ _POSIX_Condition_variables_MP_Send_process_packet(
+ POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE,
+ the_cond->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Signal_support
+ *
+ * A support routine which implements guts of the broadcast and single task
+ * wake up version of the "signal" operation.
+ */
+
+int _POSIX_Condition_variables_Signal_support(
+ pthread_cond_t *cond,
+ boolean is_broadcast
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+ Thread_Control *the_thread;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ do {
+ the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
+ } while ( is_broadcast && the_thread );
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_signal(
+ pthread_cond_t *cond
+)
+{
+ return _POSIX_Condition_variables_Signal_support( cond, FALSE );
+}
+
+/*PAGE
+ *
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_broadcast(
+ pthread_cond_t *cond
+)
+{
+ return _POSIX_Condition_variables_Signal_support( cond, TRUE );
+}
+
+/*PAGE
+ *
+ * _POSIX_Condition_variables_Wait_support
+ *
+ * A support routine which implements guts of the blocking, non-blocking, and
+ * timed wait version of condition variable wait routines.
+ */
+
+int _POSIX_Condition_variables_Wait_support(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Condition_variables_Control *the_cond;
+ Objects_Locations location;
+ int status;
+
+ the_cond = _POSIX_Condition_variables_Get( cond, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+
+ /*
+ * XXX: should be an error if cond->Mutex != mutex
+ */
+
+ status = pthread_mutex_unlock( mutex );
+ if ( !status )
+ return status;
+
+ the_cond->Mutex = *mutex;
+
+/* XXX .. enter critical section .. */
+ _Thread_queue_Enqueue( &the_cond->Wait_queue, 0 );
+
+ _Thread_Enable_dispatch();
+
+ status = pthread_mutex_lock( mutex );
+ if ( !status )
+ return status;
+
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_wait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Condition_variables_Wait_support(
+ cond,
+ mutex,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_timedwait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime
+)
+{
+ return _POSIX_Condition_variables_Wait_support(
+ cond,
+ mutex,
+ _POSIX_Time_Spec_to_interval( abstime )
+ );
+}
diff --git a/cpukit/posix/src/devctl.c b/cpukit/posix/src/devctl.c
new file mode 100644
index 0000000000..6581e0296c
--- /dev/null
+++ b/cpukit/posix/src/devctl.c
@@ -0,0 +1,25 @@
+/* devctl.c
+ *
+ * $Id$
+ */
+
+#include <devctl.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/cpukit/posix/src/intr.c b/cpukit/posix/src/intr.c
new file mode 100644
index 0000000000..11fbe6969a
--- /dev/null
+++ b/cpukit/posix/src/intr.c
@@ -0,0 +1,338 @@
+/* intr.c
+ *
+ * NOTE: Each task has an interrupt semaphore associated with it.
+ * No matter which interrupt occurs that it has registered,
+ * the same semaphore is used.
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <intr.h>
+
+#include <pthread.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/intr.h>
+#include <rtems/posix/time.h>
+#include <rtems/posix/threadsup.h>
+
+/*
+ * _POSIX_Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Interrupt_Manager_initialization(
+ unsigned32 maximum_interrupt_handlers
+)
+{
+ unsigned32 index;
+ POSIX_Interrupt_Control *the_vector;
+
+ _Objects_Initialize_information(
+ &_POSIX_Interrupt_Handlers_Information,
+ OBJECTS_POSIX_INTERRUPTS,
+ FALSE,
+ maximum_interrupt_handlers,
+ sizeof( POSIX_Interrupt_Handler_control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+
+ for ( index=0 ; index < CPU_INTERRUPT_NUMBER_OF_VECTORS ; index++ ) {
+ the_vector = &_POSIX_Interrupt_Information[ index ];
+
+ the_vector->number_installed = 0;
+ the_vector->lock_count = 0;
+ the_vector->deferred_count = 0;
+ _Chain_Initialize_empty( &the_vector->Handlers );
+ }
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+)
+{
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ proc_ptr old_handler;
+
+ if ( !_ISR_Is_vector_number_valid( intr ) ||
+ !_ISR_Is_valid_user_handler( intr_handler ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_intr = _POSIX_Interrupt_Allocate();
+
+ if ( !the_intr ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_intr->vector = intr;
+ the_intr->handler = intr_handler;
+ the_intr->user_data_area = area;
+ the_intr->server = _Thread_Executing;
+ the_intr->is_active = TRUE;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ thread_support->interrupts_installed++;
+
+/* XXX should we malloc the semaphore on the fly??? if so we probably need to
+ release it when the thread has released all interrupts and keep
+ a count of how many it has installed. CURRENTLY NO.. ALLOCATED w/TCB
+*/
+
+ /*
+ * This is sufficient to have the handlers invoked in the opposite
+ * order of installation. The loop invoking them can then go from
+ * the front of the list to the end.
+ */
+
+ _Chain_Prepend( &the_vector->Handlers, &the_intr->Object.Node );
+
+ if ( !the_vector->number_installed++ )
+ _ISR_Install_vector(
+ intr,
+ (proc_ptr) _POSIX_Interrupt_Handler,
+ &old_handler
+ );
+
+ _Objects_Open( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object, 0 );
+
+ /*
+ * Normally, an Id would be returned here.
+ */
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+)
+{
+ boolean found;
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Chain_Node *the_node;
+
+ if ( !_ISR_Is_valid_user_handler( intr_handler ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * Since interrupt handlers do not have a user visible id, there is
+ * no choice but to search the entire set of active interrupt handlers
+ * to find this one.
+ */
+
+ found = FALSE;
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_node = _Chain_Head( &the_vector->Handlers );
+
+ for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
+ the_intr = (POSIX_Interrupt_Handler_control *) the_node;
+
+ if ( the_intr->handler == intr_handler ) {
+ found = TRUE;
+ break;
+ }
+ the_node = the_node->next;
+ }
+
+ if ( !found ) {
+ _Thread_Enable_dispatch();
+ return EINVAL;
+ }
+
+ if ( !_Thread_Is_executing( the_intr->server ) ) {
+ _Thread_Enable_dispatch();
+ return EINVAL; /* XXX should be ENOISR; */
+ }
+
+ /*
+ * OK now we have found the interrupt handler and can do some work.
+ */
+
+ _Chain_Extract( &the_intr->Object.Node );
+
+ the_intr->is_active = FALSE;
+
+ the_vector->number_installed -= 1;
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ thread_support->interrupts_installed--;
+
+ /*
+ * It is unnecessary to flush the semaphore since the handler can only
+ * be "removed" by the thread which installed it. Thus it cannot be
+ * blocked on the semaphore or it would not be executing this routine.
+ */
+
+ _Objects_Close( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
+
+ _POSIX_Interrupt_Free( the_intr );
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_lock(
+ intr_t intr
+)
+{
+ POSIX_Interrupt_Control *the_vector;
+
+ _Thread_Disable_dispatch();
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ the_vector->lock_count++;
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+int intr_unlock(
+ intr_t intr
+)
+{
+ POSIX_Interrupt_Control *the_vector;
+
+ _Thread_Disable_dispatch();
+
+ the_vector = &_POSIX_Interrupt_Information[ intr ];
+
+ if ( !--the_vector->lock_count ) {
+ while ( --the_vector->deferred_count ) {
+ _POSIX_Interrupt_Handler( intr );
+ }
+ }
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+)
+{
+ Watchdog_Interval ticks;
+ POSIX_API_Thread_Support_Control *thread_support;
+
+ ticks = _POSIX_Time_Spec_to_interval( timeout );
+
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ _Thread_Disable_dispatch();
+
+ _CORE_semaphore_Seize(
+ &thread_support->Interrupt_Semaphore,
+ 0, /* XXX does id=0 hurt in this case? */
+ TRUE,
+ ticks
+ );
+ _Thread_Enable_dispatch();
+
+ return _Thread_Executing->Wait.return_code; /* XXX should be POSIX */
+}
+
+/*PAGE
+ *
+ * _POSIX_Interrupt_Handler
+ *
+ */
+
+void _POSIX_Interrupt_Handler(
+ ISR_Vector_number vector
+)
+{
+ POSIX_Interrupt_Handler_control *the_intr;
+ POSIX_Interrupt_Control *the_vector;
+ POSIX_API_Thread_Support_Control *thread_support;
+ Chain_Node *the_node;
+ int status;
+
+ the_vector = &_POSIX_Interrupt_Information[ vector ];
+
+ the_node = _Chain_Head( &the_vector->Handlers );
+
+ for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
+ the_intr = (POSIX_Interrupt_Handler_control *) the_node;
+
+ status = (*the_intr->handler)( (void *) the_intr->user_data_area );
+
+ switch ( status ) {
+ case INTR_HANDLED_NOTIFY:
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+
+ _CORE_semaphore_Surrender(
+ &thread_support->Interrupt_Semaphore,
+ 0, /* XXX is id=0 a problem */
+ 0 /* XXX is this a problem (mp support)*/
+ );
+ return;
+
+ case INTR_HANDLED_DO_NOT_NOTIFY:
+ return;
+
+ case INTR_NOT_HANDLED:
+ default: /* this should not happen */
+ break;
+ }
+ the_node = the_node->next;
+ }
+
+ /* XXX
+ *
+ * This is an unhandled interrupt!!!
+ */
+}
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
new file mode 100644
index 0000000000..3bcc1b5170
--- /dev/null
+++ b/cpukit/posix/src/key.c
@@ -0,0 +1,260 @@
+/* key.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <pthread.h>
+#include <string.h>
+
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/posix/key.h>
+
+/*
+ * _POSIX_Key_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_Key_Manager_initialization(
+ unsigned32 maximum_keys
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Keys_Information,
+ OBJECTS_POSIX_KEYS,
+ FALSE,
+ maximum_keys,
+ sizeof( POSIX_Keys_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ */
+
+int pthread_key_create(
+ pthread_key_t *key,
+ void (*destructor)( void * )
+)
+{
+ POSIX_Keys_Control *the_key;
+ void *table;
+ unsigned32 the_class;
+ unsigned32 bytes_to_allocate;
+
+
+ _Thread_Disable_dispatch();
+
+ the_key = _POSIX_Keys_Allocate();
+
+ if ( !the_key ) {
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_key->destructor = destructor;
+
+ for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
+ the_class++ ) {
+
+ bytes_to_allocate =
+ (_Objects_Information_table[ the_class ]->maximum + 1) * sizeof( void * );
+
+ table = _Workspace_Allocate( bytes_to_allocate );
+
+ if ( !table ) {
+ for ( --the_class;
+ the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class-- )
+ _Workspace_Free( the_key->Values[ the_class ] );
+
+ _POSIX_Keys_Free( the_key );
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ the_key->Values[ the_class ] = table;
+ memset( table, '\0', bytes_to_allocate );
+ }
+
+ the_key->is_active = TRUE;
+
+ _Objects_Open( &_POSIX_Keys_Information, &the_key->Object, 0 );
+
+ *key = the_key->Object.id;
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+int pthread_setspecific(
+ pthread_key_t key,
+ const void *value
+)
+{
+ register POSIX_Keys_Control *the_key;
+ unsigned32 index;
+ unsigned32 class;
+ Objects_Locations location;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return EINVAL; /* should never happen */
+ case OBJECTS_LOCAL:
+ index = _Objects_Get_index( _Thread_Executing->Object.id );
+ class = _Objects_Get_class( _Thread_Executing->Object.id );
+ the_key->Values[ class ][ index ] = (void *) value;
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+void *pthread_getspecific(
+ pthread_key_t key
+)
+{
+ register POSIX_Keys_Control *the_key;
+ unsigned32 index;
+ unsigned32 class;
+ Objects_Locations location;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return NULL;
+ case OBJECTS_REMOTE:
+ return 0; /* should never happen */
+ case OBJECTS_LOCAL:
+ index = _Objects_Get_index( _Thread_Executing->Object.id );
+ class = _Objects_Get_class( _Thread_Executing->Object.id );
+ return (void *) the_key->Values[ class ][ index ];
+ }
+ return (void *) POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
+ */
+
+int pthread_key_delete(
+ pthread_key_t key
+)
+{
+ register POSIX_Keys_Control *the_key;
+ Objects_Locations location;
+ unsigned32 the_class;
+
+ the_key = _POSIX_Keys_Get( key, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return 0; /* should never happen */
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
+
+ the_key->is_active = FALSE;
+
+ for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
+ the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
+ the_class++ )
+ _Workspace_Free( the_key->Values[ the_class ] );
+
+ /*
+ * NOTE: The destructor is not called and it is the responsibility
+ * of the application to free the memory.
+ */
+
+ _POSIX_Keys_Free( the_key );
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Keys_Run_destructors
+ *
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ *
+ * XXX: This needs to be hooked to the thread exitting -- SOMEHOW.
+ */
+
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+)
+{
+ unsigned32 index;
+ unsigned32 pthread_index;
+ unsigned32 pthread_class;
+ unsigned32 iterations;
+ boolean are_all_null;
+ POSIX_Keys_Control *the_key;
+ void *value;
+
+ pthread_index = _Objects_Get_index( thread->Object.id );
+ pthread_class = _Objects_Get_class( thread->Object.id );
+
+ iterations = 0;
+
+ for ( ; ; ) {
+
+ are_all_null = TRUE;
+
+ for ( index=1 ; index <= _POSIX_Keys_Information.maximum ; index++ ) {
+
+ the_key = (POSIX_Keys_Control *)
+ _POSIX_Keys_Information.local_table[ index ];
+
+ if ( the_key && the_key->is_active && the_key->destructor ) {
+ value = the_key->Values[ pthread_class ][ pthread_index ];
+ if ( value ) {
+ (*the_key->destructor)( value );
+ if ( the_key->Values[ pthread_class ][ pthread_index ] )
+ are_all_null = FALSE;
+ }
+ }
+ }
+
+ if ( are_all_null == TRUE )
+ return;
+
+ iterations++;
+
+ /*
+ * The standard allows one to not do this and thus go into an infinite
+ * loop. It seems rude to unnecessarily lock up a system.
+ */
+
+ if ( iterations >= PTHREAD_DESTRUCTOR_ITERATIONS )
+ return;
+ }
+}
diff --git a/cpukit/posix/src/mqueue.c b/cpukit/posix/src/mqueue.c
new file mode 100644
index 0000000000..e175300355
--- /dev/null
+++ b/cpukit/posix/src/mqueue.c
@@ -0,0 +1,715 @@
+/* mqueue.c
+ *
+ * NOTE: The structure of the routines is identical to that of POSIX
+ * Message_queues to leave the option of having unnamed message
+ * queues at a future date. They are currently not part of the
+ * POSIX standard but unnamed message_queues are. This is also
+ * the reason for the apparently unnecessary tracking of
+ * the process_shared attribute. [In addition to the fact that
+ * it would be trivial to add pshared to the mq_attr structure
+ * and have process private message queues.]
+ *
+ * This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
+ * time.
+ *
+ * $Id$
+ */
+
+#include <stdarg.h>
+
+#include <pthread.h>
+#include <limits.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <mqueue.h>
+#include <rtems/system.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/mqueue.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Manager_initialization
+ *
+ * This routine initializes all message_queue manager related data structures.
+ *
+ * Input parameters:
+ * maximum_message_queues - maximum configured message_queues
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Message_queue_Information,
+ OBJECTS_POSIX_MESSAGE_QUEUES,
+ TRUE,
+ maximum_message_queues,
+ sizeof( POSIX_Message_queue_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Create_support
+ */
+
+int _POSIX_Message_queue_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int oflag,
+ struct mq_attr *attr,
+ POSIX_Message_queue_Control **message_queue
+)
+{
+ POSIX_Message_queue_Control *the_mq;
+
+ _Thread_Disable_dispatch();
+
+ the_mq = _POSIX_Message_queue_Allocate();
+
+ if ( !the_mq ) {
+ _Thread_Enable_dispatch();
+ seterrno( ENFILE );
+ return -1;
+ }
+
+ if ( pshared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Message_queue_Information, 0,
+ the_mq->Object.id, FALSE ) ) ) {
+ _POSIX_Message_queue_Free( the_mq );
+ _Thread_Enable_dispatch();
+ seterrno( ENFILE );
+ return -1;
+ }
+
+ the_mq->process_shared = pshared;
+
+ if ( name ) {
+ the_mq->named = TRUE;
+ the_mq->open_count = 1;
+ the_mq->linked = TRUE;
+ }
+ else
+ the_mq->named = FALSE;
+
+ if ( oflag & O_NONBLOCK )
+ the_mq->blocking = FALSE;
+ else
+ the_mq->blocking = TRUE;
+
+ /* XXX
+ *
+ * Note that this should be based on the current scheduling policy.
+ */
+
+ /* XXX
+ *
+ * Message and waiting disciplines are not distinguished.
+ */
+/*
+ the_mq_attr->message_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+ the_mq_attr->waiting_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+ */
+
+ the_mq->Message_queue.Attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+
+ if ( ! _CORE_message_queue_Initialize(
+ &the_mq->Message_queue,
+ OBJECTS_POSIX_MESSAGE_QUEUES,
+ &the_mq->Message_queue.Attributes,
+ attr->mq_maxmsg,
+ attr->mq_msgsize,
+ _POSIX_Message_queue_MP_Send_extract_proxy ) ) {
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _Objects_MP_Close( &_POSIX_Message_queue_Information, the_mq->Object.id );
+
+ _POSIX_Message_queue_Free( the_mq );
+ _Thread_Enable_dispatch();
+ seterrno( ENOSPC );
+ return -1;
+ }
+
+
+ /* XXX - need Names to be a string!!! */
+ _Objects_Open(
+ &_POSIX_Message_queue_Information,
+ &the_mq->Object,
+ (char *) name
+ );
+
+ *message_queue = the_mq;
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Message_queue_MP_Send_process_packet(
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
+ the_mq->Object.id,
+ (char *) name,
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+/*PAGE
+ *
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+ /* mode_t mode, */
+ /* struct mq_attr attr */
+)
+{
+ va_list arg;
+ mode_t mode;
+ struct mq_attr *attr;
+ int status;
+ Objects_Id the_mq_id;
+ POSIX_Message_queue_Control *the_mq;
+
+ if ( oflag & O_CREAT ) {
+ va_start(arg, oflag);
+ mode = (mode_t) va_arg( arg, mode_t * );
+ attr = (struct mq_attr *) va_arg( arg, struct mq_attr ** );
+ va_end(arg);
+ }
+
+ status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
+
+ /*
+ * If the name to id translation worked, then the message queue exists
+ * and we can just return a pointer to the id. Otherwise we may
+ * need to check to see if this is a "message queue does not exist"
+ * or some other miscellaneous error on the name.
+ */
+
+ if ( status ) {
+
+ if ( status == EINVAL ) { /* name -> ID translation failed */
+ if ( !(oflag & O_CREAT) ) { /* willing to create it? */
+ seterrno( ENOENT );
+ return (mqd_t) -1;
+ }
+ /* we are willing to create it */
+ }
+ seterrno( status ); /* some type of error */
+ return (mqd_t) -1;
+
+ } else { /* name -> ID translation succeeded */
+
+ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
+ seterrno( EEXIST );
+ return (mqd_t) -1;
+ }
+
+ /*
+ * XXX In this case we need to do an ID->pointer conversion to
+ * check the mode. This is probably a good place for a subroutine.
+ */
+
+ the_mq->open_count += 1;
+
+ return (mqd_t)&the_mq->Object.id;
+
+ }
+
+ /* XXX verify this comment...
+ *
+ * At this point, the message queue does not exist and everything has been
+ * checked. We should go ahead and create a message queue.
+ */
+
+ status = _POSIX_Message_queue_Create_support(
+ name,
+ TRUE, /* shared across processes */
+ oflag,
+ attr,
+ &the_mq
+ );
+
+ if ( status == -1 )
+ return (mqd_t) -1;
+
+ return (mqd_t) &the_mq->Object.id;
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Delete
+ */
+
+void _POSIX_Message_queue_Delete(
+ POSIX_Message_queue_Control *the_mq
+)
+{
+ if ( !the_mq->linked && !the_mq->open_count ) {
+ _POSIX_Message_queue_Free( the_mq );
+
+ if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Message_queue_Information,
+ the_mq->Object.id
+ );
+
+ _POSIX_Message_queue_MP_Send_process_packet(
+ POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
+ the_mq->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ }
+}
+
+/*PAGE
+ *
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ the_mq->open_count -= 1;
+ _POSIX_Message_queue_Delete( the_mq );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+)
+{
+ int status;
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Id the_mq_id;
+ Objects_Locations location;
+
+ status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
+
+ if ( !status ) {
+ seterrno( status );
+ return -1;
+ }
+
+ the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+
+ _Objects_MP_Close(
+ &_POSIX_Message_queue_Information,
+ the_mq->Object.id
+ );
+
+ the_mq->linked = FALSE;
+
+ _POSIX_Message_queue_Delete( the_mq );
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Send_support
+ */
+
+int _POSIX_Message_queue_Send_support(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ unsigned32 msg_len,
+ Priority_Control msg_prio,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /* XXX must add support for timeout and priority */
+ _CORE_message_queue_Send(
+ &the_mq->Message_queue,
+ (void *) msg_ptr,
+ msg_len,
+ mqdes,
+ NULL /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+)
+{
+ return _POSIX_Message_queue_Send_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Message_queue_Send_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Receive_support
+ */
+
+/* XXX be careful ... watch the size going through all the layers ... */
+
+ssize_t _POSIX_Message_queue_Receive_support(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ unsigned32 status = 0;
+ unsigned32 length_out;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /* XXX need to define the options argument to this */
+ length_out = msg_len;
+ _CORE_message_queue_Seize(
+ &the_mq->Message_queue,
+ mqdes,
+ msg_ptr,
+ &length_out,
+ /* msg_prio, XXXX */
+ the_mq->blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ if ( !status )
+ return length_out;
+ /* XXX --- the return codes gotta be looked at .. fix this */
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+)
+{
+ return _POSIX_Message_queue_Receive_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ THREAD_QUEUE_WAIT_FOREVER
+ );
+}
+
+/*PAGE
+ *
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Message_queue_Receive_support(
+ mqdes,
+ msg_ptr,
+ msg_len,
+ msg_prio,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Message_queue_Notify_handler
+ *
+ */
+
+void _POSIX_Message_queue_Notify_handler(
+ void *user_data
+)
+{
+ POSIX_Message_queue_Control *the_mq;
+
+ the_mq = user_data;
+
+ /* XXX do something with signals here!!!! */
+}
+
+/*PAGE
+ *
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EBADF );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ if ( notification ) {
+ if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
+ _Thread_Enable_dispatch();
+ seterrno( EBUSY );
+ return( -1 );
+ }
+
+ _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
+
+ the_mq->notification = *notification;
+
+ _CORE_message_queue_Set_notify(
+ &the_mq->Message_queue,
+ _POSIX_Message_queue_Notify_handler,
+ the_mq
+ );
+ } else {
+
+ _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
+
+ }
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ CORE_message_queue_Attributes *the_mq_attr;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Return the old values.
+ */
+
+ /* XXX this is the same stuff as is in mq_getattr... and probably */
+ /* XXX should be in an inlined private routine */
+
+ the_mq_attr = &the_mq->Message_queue.Attributes;
+
+ omqstat->mq_flags = the_mq->flags;
+ omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
+ omqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
+ omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
+
+ /*
+ * Ignore everything except the O_NONBLOCK bit.
+ */
+
+ if ( mqstat->mq_flags & O_NONBLOCK )
+ the_mq->blocking = FALSE;
+ else
+ the_mq->blocking = TRUE;
+
+ the_mq->flags = mqstat->mq_flags;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+)
+{
+ register POSIX_Message_queue_Control *the_mq;
+ Objects_Locations location;
+ CORE_message_queue_Attributes *the_mq_attr;
+
+ the_mq = _POSIX_Message_queue_Get( mqdes, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Return the old values.
+ */
+
+ /* XXX this is the same stuff as is in mq_setattr... and probably */
+ /* XXX should be in an inlined private routine */
+
+ the_mq_attr = &the_mq->Message_queue.Attributes;
+
+ mqstat->mq_flags = the_mq->flags;
+ mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
+ mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
+ mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
new file mode 100644
index 0000000000..9ff4acff99
--- /dev/null
+++ b/cpukit/posix/src/mutex.c
@@ -0,0 +1,570 @@
+/* mutex.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <pthread.h>
+
+#include <rtems/score/system.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/mpci.h>
+
+#include <rtems/posix/mutex.h>
+#include <rtems/posix/priority.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * The default mutex attributes structure.
+ */
+
+const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
+ TRUE, /* is_initialized */
+ PTHREAD_PROCESS_PRIVATE, /* process_shared */
+ POSIX_SCHEDULER_MINIMUM_PRIORITY, /* prio_ceiling */
+ PTHREAD_PRIO_NONE, /* protocol */
+ FALSE /* recursive */
+};
+
+/*PAGE
+ *
+ * _POSIX_Mutex_Manager_initialization
+ *
+ * This routine initializes all mutex manager related data structures.
+ *
+ * Input parameters:
+ * maximum_mutexes - maximum configured mutexes
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Mutex_Manager_initialization(
+ unsigned32 maximum_mutexes
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Mutex_Information,
+ OBJECTS_POSIX_MUTEXES,
+ TRUE,
+ maximum_mutexes,
+ sizeof( POSIX_Mutex_Control ),
+ FALSE,
+ 0,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_init(
+ pthread_mutexattr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Mutex_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_destroy(
+ pthread_mutexattr_t *attr
+)
+{
+ if ( !attr || attr->is_initialized == FALSE )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_getpshared(
+ const pthread_mutexattr_t *attr,
+ int *pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *pshared = attr->process_shared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_setpshared(
+ pthread_mutexattr_t *attr,
+ int pshared
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->process_shared = pshared;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ *
+ * NOTE: XXX Could be optimized so all the attribute error checking
+ * is not performed when attr is NULL.
+ */
+
+int pthread_mutex_init(
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr
+)
+{
+ POSIX_Mutex_Control *the_mutex;
+ CORE_mutex_Attributes *the_mutex_attr;
+ const pthread_mutexattr_t *the_attr;
+ CORE_mutex_Disciplines the_discipline;
+
+ if ( attr ) the_attr = attr;
+ else the_attr = &_POSIX_Mutex_Default_attributes;
+
+ /*
+ * XXX: Be careful about attributes when global!!!
+ */
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ return POSIX_MP_NOT_IMPLEMENTED();
+
+ if ( !the_attr->is_initialized )
+ return EINVAL;
+
+ /*
+ * Determine the discipline of the mutex
+ */
+
+ switch ( the_attr->protocol ) {
+ case PTHREAD_PRIO_NONE:
+ the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
+ break;
+ case PTHREAD_PRIO_INHERIT:
+ the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+ break;
+ case PTHREAD_PRIO_PROTECT:
+ the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+ break;
+ default:
+ return EINVAL;
+ }
+
+ if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ the_mutex = _POSIX_Mutex_Allocate();
+
+ if ( !the_mutex ) {
+ _Thread_Enable_dispatch();
+ return ENOMEM;
+ }
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Mutex_Information, 0,
+ the_mutex->Object.id, FALSE ) ) ) {
+ _POSIX_Mutex_Free( the_mutex );
+ _Thread_Enable_dispatch();
+ return EAGAIN;
+ }
+
+ the_mutex->process_shared = the_attr->process_shared;
+
+ the_mutex_attr = &the_mutex->Mutex.Attributes;
+
+ the_mutex_attr->allow_nesting = the_attr->recursive;
+ the_mutex_attr->priority_ceiling =
+ _POSIX_Priority_To_core( the_attr->prio_ceiling );
+ the_mutex_attr->discipline = the_discipline;
+
+ /*
+ * Must be initialized to unlocked.
+ */
+
+ _CORE_mutex_Initialize(
+ &the_mutex->Mutex,
+ OBJECTS_POSIX_MUTEXES,
+ the_mutex_attr,
+ CORE_MUTEX_UNLOCKED,
+ 0 /* XXX proxy_extract_callout */
+ );
+
+ _Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
+
+ *mutex = the_mutex->Object.id;
+
+ if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Mutex_MP_Send_process_packet(
+ POSIX_MUTEX_MP_ANNOUNCE_CREATE,
+ the_mutex->Object.id,
+ 0, /* Name not used */
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+/*PAGE
+ *
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_mutex_destroy(
+ pthread_mutex_t *mutex
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ return EINVAL;
+ case OBJECTS_LOCAL:
+ /*
+ * XXX: There is an error for the mutex being locked
+ * or being in use by a condition variable.
+ */
+
+ if ( _CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
+ _Thread_Enable_dispatch();
+ return EBUSY;
+ }
+
+ _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
+
+ _CORE_mutex_Flush(
+ &the_mutex->Mutex,
+ _POSIX_Mutex_MP_Send_object_was_deleted,
+ EINVAL
+ );
+
+ _POSIX_Mutex_Free( the_mutex );
+
+ if ( the_mutex->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close( &_POSIX_Mutex_Information, the_mutex->Object.id );
+
+ _POSIX_Mutex_MP_Send_process_packet(
+ POSIX_MUTEX_MP_ANNOUNCE_DELETE,
+ the_mutex->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*
+ * _POSIX_Mutex_Lock_support
+ *
+ * A support routine which implements guts of the blocking, non-blocking, and
+ * timed wait version of mutex lock.
+ */
+
+int _POSIX_Mutex_Lock_support(
+ pthread_mutex_t *mutex,
+ boolean blocking,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return _POSIX_Mutex_MP_Send_request_packet(
+ POSIX_MUTEX_MP_OBTAIN_REQUEST,
+ *mutex,
+ 0, /* must define the option set */
+ WATCHDOG_NO_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ _CORE_mutex_Seize(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ break;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_lock(
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Mutex_Lock_support( mutex, TRUE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_trylock(
+ pthread_mutex_t *mutex
+)
+{
+ return _POSIX_Mutex_Lock_support( mutex, FALSE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+void POSIX_Threads_mutex_MP_support(
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ (void) POSIX_MP_NOT_IMPLEMENTED(); /* XXX: should never get here */
+}
+
+int pthread_mutex_unlock(
+ pthread_mutex_t *mutex
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return _POSIX_Mutex_MP_Send_request_packet(
+ POSIX_MUTEX_MP_RELEASE_REQUEST,
+ *mutex,
+ 0, /* Not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ _CORE_mutex_Surrender(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ POSIX_Threads_mutex_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code; /* XXX return status */
+ break;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_timedlock(
+ pthread_mutex_t *mutex,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Mutex_Lock_support(
+ mutex,
+ TRUE,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_setprotocol(
+ pthread_mutexattr_t *attr,
+ int protocol
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ attr->protocol = protocol;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_getprotocol(
+ const pthread_mutexattr_t *attr,
+ int *protocol
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *protocol = attr->protocol;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_setprioceiling(
+ pthread_mutexattr_t *attr,
+ int prioceiling
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ if ( !_POSIX_Priority_Is_valid( attr->prio_ceiling ) )
+ return EINVAL;
+
+ attr->prio_ceiling = prioceiling;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+int pthread_mutexattr_getprioceiling(
+ const pthread_mutexattr_t *attr,
+ int *prioceiling
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *prioceiling = attr->prio_ceiling;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_setprioceiling(
+ pthread_mutex_t *mutex,
+ int prioceiling,
+ int *old_ceiling
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+ Priority_Control the_priority;
+ int status;
+
+ if ( !_POSIX_Priority_Is_valid( prioceiling ) )
+ return EINVAL;
+
+ the_priority = _POSIX_Priority_To_core( prioceiling );
+
+ /*
+ * Must acquire the mutex before we can change it's ceiling
+ */
+
+ status = pthread_mutex_lock( mutex );
+ if ( status )
+ return status;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
+ return EINVAL;
+ case OBJECTS_LOCAL:
+ the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
+ _CORE_mutex_Surrender(
+ &the_mutex->Mutex,
+ the_mutex->Object.id,
+ POSIX_Threads_mutex_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_getprioceiling(
+ pthread_mutex_t *mutex,
+ int *prioceiling
+)
+{
+ register POSIX_Mutex_Control *the_mutex;
+ Objects_Locations location;
+
+ the_mutex = _POSIX_Mutex_Get( mutex, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return EINVAL;
+ case OBJECTS_REMOTE:
+ return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
+ case OBJECTS_LOCAL:
+ *prioceiling = _POSIX_Priority_From_core(
+ the_mutex->Mutex.Attributes.priority_ceiling
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
new file mode 100644
index 0000000000..9ad7406e21
--- /dev/null
+++ b/cpukit/posix/src/psignal.c
@@ -0,0 +1,258 @@
+/* signal.c
+ *
+ * $Id$
+ */
+
+#include <signal.h>
+
+#include <rtems/score/thread.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*
+ * 3.3.2 Send a Signal to a Process, P1003.1b-1993, p. 68
+ *
+ * NOTE: Behavior of kill() depends on _POSIX_SAVED_IDS.
+ */
+
+int kill(
+ int pid_t,
+ int sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigemptyset(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigfillset(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigaddset(
+ sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigdelset(
+ sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69
+ */
+
+int sigismember(
+ const sigset_t *set,
+ int signo
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.4 Examine and Change Signal Action, P1003.1b-1993, p. 70
+ */
+
+int sigaction(
+ int sig,
+ const struct sigaction *act,
+ struct sigaction *oact
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73
+ *
+ * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask().
+ */
+
+int sigprocmask(
+ int how,
+ const sigset_t *set,
+ sigset_t *oset
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73
+ *
+ * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask().
+ */
+
+int pthread_sigmask(
+ int how,
+ const sigset_t *set,
+ sigset_t *oset
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.6 Examine Pending Signals, P1003.1b-1993, p. 75
+ */
+
+int sigpending(
+ sigset_t *set
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.7 Wait for a Signal, P1003.1b-1993, p. 75
+ */
+
+int sigsuspend(
+ const sigset_t *sigmask
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigwaitinfo(
+ const sigset_t *set,
+ siginfo_t *info
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigtimedwait(
+ const sigset_t *set,
+ siginfo_t *info,
+ const struct timespec *timeout
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ *
+ * NOTE: P1003.1c/D10, p. 39 adds sigwait().
+ */
+
+int sigwait(
+ const sigset_t *set,
+ int *sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78
+ */
+
+int sigqueue(
+ pid_t pid,
+ int signo,
+ const union sigval value
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.3.10 Send a Signal to a Thread, P1003.1c/D10, p. 43
+ */
+
+int pthread_kill(
+ pthread_t thread,
+ int sig
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.4.1 Schedule Alarm, P1003.1b-1993, p. 79
+ */
+
+unsigned int alarm(
+ unsigned int seconds
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 3.4.2 Suspend Process Execution, P1003.1b-1993, p. 80
+ */
+
+int pause( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*
+ * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 73
+ */
+
+unsigned int sleep(
+ unsigned int seconds
+)
+{
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended, /* XXX may need to be POSIX specific */
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_seconds( &_Thread_Executing->Timer, seconds );
+ _Thread_Enable_dispatch();
+ return 0; /* XXX should account for signal */
+}
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
new file mode 100644
index 0000000000..7247586685
--- /dev/null
+++ b/cpukit/posix/src/pthread.c
@@ -0,0 +1,553 @@
+/* pthread.c
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+#include <pthread.h>
+#include <limits.h>
+
+#include <rtems/score/stack.h>
+#include <rtems/score/thread.h>
+#include <rtems/posix/pthread.h>
+
+/*PAGE
+ *
+ * The default pthreads attributes structure.
+ */
+
+const pthread_attr_t _POSIX_Threads_Default_attributes = {
+ TRUE, /* is_initialized */
+ 0, /* stackaddr */
+ STACK_MINIMUM_SIZE, /* stacksize */
+ PTHREAD_SCOPE_PROCESS, /* contentionscope */
+ PTHREAD_INHERIT_SCHED, /* inheritsched */
+ SCHED_FIFO, /* schedpolicy */
+ { /* schedparam */
+ 128, /* sched_priority */
+ 0, /* ss_low_priority */
+ { 0L, 0 }, /* ss_replenish_period */
+ { 0L, 0 } /* ss_initial_budget */
+ },
+ PTHREAD_CREATE_DETACHED, /* detachstate */
+ 1 /* cputime_clock_allowed */
+};
+
+/*PAGE
+ *
+ * _POSIX_Threads_Manager_initialization
+ *
+ * This routine initializes all threads manager related data structures.
+ *
+ * Input parameters:
+ * maximum_pthreads - maximum configured pthreads
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Threads_Manager_initialization(
+ unsigned32 maximum_pthreads
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Threads_Information,
+ OBJECTS_POSIX_THREADS,
+ TRUE,
+ maximum_pthreads,
+ sizeof( POSIX_Threads_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ TRUE
+ );
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
+ */
+
+int pthread_atfork(
+ void (*prepare)(void),
+ void (*parent)(void),
+ void (*child)(void)
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setscope(
+ pthread_attr_t *attr,
+ int contentionscope
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->contentionscope = contentionscope;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getscope(
+ const pthread_attr_t *attr,
+ int *contentionscope
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *contentionscope = attr->contentionscope;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setinheritsched(
+ pthread_attr_t *attr,
+ int inheritsched
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->inheritsched = inheritsched;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getinheritsched(
+ const pthread_attr_t *attr,
+ int *inheritsched
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *inheritsched = attr->inheritsched;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setschedpolicy(
+ pthread_attr_t *attr,
+ int policy
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->schedpolicy = policy;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getschedpolicy(
+ const pthread_attr_t *attr,
+ int *policy
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *policy = attr->schedpolicy;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setschedparam(
+ pthread_attr_t *attr,
+ const struct sched_param param
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->schedparam = param;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_getschedparam(
+ const pthread_attr_t *attr,
+ struct sched_param *param
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *param = attr->schedparam;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_getschedparam(
+ pthread_t thread,
+ int *policy,
+ struct sched_param *param
+)
+{
+ pthread_attr_t *attr; /* XXX: really need to get this from the thread */
+
+ if ( !policy || !param )
+ return EINVAL;
+
+ *policy = attr->schedpolicy;
+ *param = attr->schedparam;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_setschedparam(
+ pthread_t thread,
+ int policy,
+ struct sched_param *param
+)
+{
+ /* XXX need to reschedule after doing this to the thread */
+ pthread_attr_t *attr; /* XXX: really need to get this from the thread */
+
+ if ( !param )
+ return EINVAL;
+
+ attr->schedpolicy = policy;
+ attr->schedparam = *param;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_init(
+ pthread_attr_t *attr
+)
+{
+ if ( !attr )
+ return EINVAL;
+
+ *attr = _POSIX_Threads_Default_attributes;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_destroy(
+ pthread_attr_t *attr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->is_initialized = FALSE;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getstacksize(
+ const pthread_attr_t *attr,
+ size_t *stacksize
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *stacksize = attr->stacksize;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setstacksize(
+ pthread_attr_t *attr,
+ size_t stacksize
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->stacksize = stacksize;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getstackaddr(
+ const pthread_attr_t *attr,
+ void **stackaddr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *stackaddr = attr->stackaddr;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setstackaddr(
+ pthread_attr_t *attr,
+ void *stackaddr
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->stackaddr = stackaddr;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_getdetachstate(
+ const pthread_attr_t *attr,
+ int *detachstate
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *detachstate = attr->detachstate;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_setdetachstate(
+ pthread_attr_t *attr,
+ int detachstate
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->detachstate = detachstate;
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
+ */
+
+int pthread_create(
+ pthread_t *thread,
+ const pthread_attr_t *attr,
+ void (*start_routine)( void * ),
+ void *arg
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
+ */
+
+int pthread_join(
+ pthread_t thread,
+ void **value_ptr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
+ */
+
+int pthread_detach(
+ pthread_t thread
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
+ */
+
+pthread_t pthread_self( void )
+{
+ return _Thread_Executing->Object.id;
+}
+
+/*PAGE
+ *
+ * 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
+ */
+
+int pthread_equal(
+ pthread_t t1,
+ pthread_t t2
+)
+{
+#ifdef RTEMS_DEBUG
+ /* XXX may want to do a "get" to make sure both are valid. */
+ /* XXX behavior is undefined if not valid pthread_t's */
+#endif
+ return _Objects_Are_ids_equal( t1, t1 );
+}
+
+/*PAGE
+ *
+ * 16.1.8 Dynamic Package Initialization
+ */
+
+int pthread_once(
+ pthread_once_t *once_control,
+ void (*init_routine)(void)
+)
+{
+ /* XXX: Should we implement this routine this way or make it a full */
+ /* XXX: fledged object? */
+
+ if ( !once_control || !init_routine )
+ return EINVAL;
+
+ _Thread_Disable_dispatch();
+
+ if ( !once_control->is_initialized ) {
+
+ once_control->is_initialized = TRUE;
+ once_control->init_executed = TRUE;
+ (*init_routine)();
+
+ } if ( !once_control->init_executed ) {
+
+ once_control->init_executed = TRUE;
+ (*init_routine)();
+
+ }
+
+ _Thread_Enable_dispatch();
+
+ return 0;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
+ */
+
+int pthread_getcpuclockid(
+ pthread_t pid,
+ clockid_t *clock_id
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_setcputime(
+ pthread_attr_t *attr,
+ int clock_allowed
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ attr->cputime_clock_allowed = clock_allowed;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_getcputime(
+ pthread_attr_t *attr,
+ int *clock_allowed
+)
+{
+ if ( !attr || !attr->is_initialized )
+ return EINVAL;
+
+ *clock_allowed = attr->cputime_clock_allowed;
+ return 0;
+}
diff --git a/cpukit/posix/src/sched.c b/cpukit/posix/src/sched.c
new file mode 100644
index 0000000000..b131b52397
--- /dev/null
+++ b/cpukit/posix/src/sched.c
@@ -0,0 +1,127 @@
+/* sched.c
+ *
+ * $Id$
+ */
+
+#include <sched.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/thread.h>
+#include <rtems/posix/priority.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+)
+{
+ /* XXX error check the policy */
+ return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
+}
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_min(
+ int policy
+)
+{
+ /* XXX error check the policy */
+ return POSIX_SCHEDULER_MINIMUM_PRIORITY;
+}
+
+/*PAGE
+ *
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+)
+{
+ time_t us_per_quantum;
+
+ /* XXX eventually should support different time quantums per thread */
+
+ /* XXX should get for errors? (bad pid) */
+
+ us_per_quantum = _TOD_Microseconds_per_tick * _Thread_Ticks_per_timeslice;
+
+ interval->tv_sec = us_per_quantum / TOD_MICROSECONDS_PER_SECOND;
+ interval->tv_nsec = (us_per_quantum % TOD_MICROSECONDS_PER_SECOND) * 1000;
+ return 0;
+}
+
+/*PAGE
+ *
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void )
+{
+ _Thread_Yield_processor();
+ return 0;
+}
diff --git a/cpukit/posix/src/semaphore.c b/cpukit/posix/src/semaphore.c
new file mode 100644
index 0000000000..e17124152c
--- /dev/null
+++ b/cpukit/posix/src/semaphore.c
@@ -0,0 +1,576 @@
+/* semaphore.c
+ *
+ * $Id$
+ */
+
+#include <stdarg.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <limits.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/posix/semaphore.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Manager_initialization
+ *
+ * This routine initializes all semaphore manager related data structures.
+ *
+ * Input parameters:
+ * maximum_semaphores - maximum configured semaphores
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+ _Objects_Initialize_information(
+ &_POSIX_Semaphore_Information,
+ OBJECTS_POSIX_SEMAPHORES,
+ TRUE,
+ maximum_semaphores,
+ sizeof( POSIX_Semaphore_Control ),
+ TRUE,
+ _POSIX_PATH_MAX,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Create_support
+ */
+
+int _POSIX_Semaphore_Create_support(
+ const char *name,
+ int pshared,
+ unsigned int value,
+ POSIX_Semaphore_Control **the_sem
+)
+{
+ POSIX_Semaphore_Control *the_semaphore;
+ CORE_semaphore_Attributes *the_sem_attr;
+
+ _Thread_Disable_dispatch();
+
+ the_semaphore = _POSIX_Semaphore_Allocate();
+
+ if ( !the_semaphore ) {
+ _Thread_Enable_dispatch();
+ seterrno( ENOMEM );
+ return -1;
+ }
+
+ if ( pshared == PTHREAD_PROCESS_SHARED &&
+ !( _Objects_MP_Allocate_and_open( &_POSIX_Semaphore_Information, 0,
+ the_semaphore->Object.id, FALSE ) ) ) {
+ _POSIX_Semaphore_Free( the_semaphore );
+ _Thread_Enable_dispatch();
+ seterrno( EAGAIN );
+ return -1;
+ }
+
+ the_semaphore->process_shared = pshared;
+
+ if ( name ) {
+ the_semaphore->named = TRUE;
+ the_semaphore->open_count = 1;
+ the_semaphore->linked = TRUE;
+ }
+ else
+ the_semaphore->named = FALSE;
+
+ the_sem_attr = &the_semaphore->Semaphore.Attributes;
+
+ /* XXX
+ *
+ * Note should this be based on the current scheduling policy?
+ */
+
+ the_sem_attr->discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
+
+ _CORE_semaphore_Initialize(
+ &the_semaphore->Semaphore,
+ OBJECTS_POSIX_SEMAPHORES,
+ the_sem_attr,
+ value,
+ 0 /* XXX - proxy_extract_callout is unused */
+ );
+
+ /* XXX - need Names to be a string!!! */
+ _Objects_Open(
+ &_POSIX_Semaphore_Information,
+ &the_semaphore->Object,
+ (char *) name
+ );
+
+ *the_sem = the_semaphore;
+
+ if ( pshared == PTHREAD_PROCESS_SHARED )
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE,
+ the_semaphore->Object.id,
+ (char *) name,
+ 0 /* proxy id - Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return 0;
+}
+
+
+/*PAGE
+ *
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+)
+{
+ int status;
+ POSIX_Semaphore_Control *the_semaphore;
+
+ status = _POSIX_Semaphore_Create_support(
+ NULL,
+ pshared,
+ value,
+ &the_semaphore
+ );
+
+ if ( status != -1 )
+ *sem = the_semaphore->Object.id;
+
+ return status;
+}
+
+/*PAGE
+ *
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ /*
+ * Undefined operation on a named semaphore.
+ */
+
+ if ( the_semaphore->named == TRUE ) {
+ seterrno( EINVAL );
+ return( -1 );
+ }
+
+ _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+
+ _CORE_semaphore_Flush(
+ &the_semaphore->Semaphore,
+ _POSIX_Semaphore_MP_Send_object_was_deleted,
+ -1 /* XXX should also seterrno -> EINVAL */
+ );
+
+ _POSIX_Semaphore_Free( the_semaphore );
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: When oflag is O_CREAT, then optional third and fourth
+ * parameters must be present.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+ /* mode_t mode, */
+ /* unsigned int value */
+)
+{
+ va_list arg;
+ mode_t mode;
+ unsigned int value;
+ int status;
+ Objects_Id the_semaphore_id;
+ POSIX_Semaphore_Control *the_semaphore;
+
+
+ if ( oflag & O_CREAT ) {
+ va_start(arg, oflag);
+ mode = (mode_t) va_arg( arg, mode_t * );
+ value = (unsigned int) va_arg( arg, unsigned int * );
+ va_end(arg);
+ }
+
+ status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
+
+ /*
+ * If the name to id translation worked, then the semaphore exists
+ * and we can just return a pointer to the id. Otherwise we may
+ * need to check to see if this is a "semaphore does not exist"
+ * or some other miscellaneous error on the name.
+ */
+
+ if ( status ) {
+
+ if ( status == EINVAL ) { /* name -> ID translation failed */
+ if ( !(oflag & O_CREAT) ) { /* willing to create it? */
+ seterrno( ENOENT );
+ return (sem_t *) -1;
+ }
+ /* we are willing to create it */
+ }
+ seterrno( status ); /* some type of error */
+ return (sem_t *) -1;
+
+ } else { /* name -> ID translation succeeded */
+
+ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
+ seterrno( EEXIST );
+ return (sem_t *) -1;
+ }
+
+ /*
+ * XXX In this case we need to do an ID->pointer conversion to
+ * check the mode. This is probably a good place for a subroutine.
+ */
+
+ the_semaphore->open_count += 1;
+
+ return (sem_t *)&the_semaphore->Object.id;
+
+ }
+
+ /* XXX verify this comment...
+ *
+ * At this point, the semaphore does not exist and everything has been
+ * checked. We should go ahead and create a semaphore.
+ */
+
+ status = _POSIX_Semaphore_Create_support(
+ name,
+ TRUE, /* shared across processes */
+ value,
+ &the_semaphore
+ );
+
+ if ( status == -1 )
+ return (sem_t *) -1;
+
+ return (sem_t *) &the_semaphore->Object.id;
+
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Delete
+ */
+
+void _POSIX_Semaphore_Delete(
+ POSIX_Semaphore_Control *the_semaphore
+)
+{
+ if ( !the_semaphore->linked && !the_semaphore->open_count ) {
+ _POSIX_Semaphore_Free( the_semaphore );
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+
+ _POSIX_Semaphore_MP_Send_process_packet(
+ POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ }
+}
+
+/*PAGE
+ *
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ the_semaphore->open_count -= 1;
+ _POSIX_Semaphore_Delete( the_semaphore );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+)
+{
+ int status;
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Id the_semaphore_id;
+ Objects_Locations location;
+
+ status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
+
+ if ( !status ) {
+ seterrno( status );
+ return -1;
+ }
+
+ the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+
+ if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
+ _Objects_MP_Close(
+ &_POSIX_Semaphore_Information,
+ the_semaphore->Object.id
+ );
+ }
+
+ the_semaphore->linked = FALSE;
+
+ _POSIX_Semaphore_Delete( the_semaphore );
+
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * _POSIX_Semaphore_Wait_support
+ */
+
+int _POSIX_Semaphore_Wait_support(
+ sem_t *sem,
+ boolean blocking,
+ Watchdog_Interval timeout
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ _CORE_semaphore_Seize(
+ &the_semaphore->Semaphore,
+ the_semaphore->Object.id,
+ blocking,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Thread_Executing->Wait.return_code;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+)
+{
+ return _POSIX_Semaphore_Wait_support( sem, TRUE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_trywait(
+ sem_t *sem
+)
+{
+ return _POSIX_Semaphore_Wait_support( sem, FALSE, THREAD_QUEUE_WAIT_FOREVER );
+}
+
+/*PAGE
+ *
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+)
+{
+ return _POSIX_Semaphore_Wait_support(
+ sem,
+ TRUE,
+ _POSIX_Time_Spec_to_interval( timeout )
+ );
+}
+
+/*PAGE
+ *
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+void POSIX_Semaphore_MP_support(
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ (void) POSIX_MP_NOT_IMPLEMENTED();
+}
+
+
+int sem_post(
+ sem_t *sem
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ _CORE_semaphore_Surrender(
+ &the_semaphore->Semaphore,
+ the_semaphore->Object.id,
+ POSIX_Semaphore_MP_support
+ );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
+
+/*PAGE
+ *
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+)
+{
+ register POSIX_Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return POSIX_MP_NOT_IMPLEMENTED();
+ seterrno( EINVAL );
+ return( -1 );
+ case OBJECTS_LOCAL:
+ *sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
+ _Thread_Enable_dispatch();
+ return 0;
+ }
+ return POSIX_BOTTOM_REACHED();
+}
diff --git a/cpukit/posix/src/time.c b/cpukit/posix/src/time.c
new file mode 100644
index 0000000000..cfe980793a
--- /dev/null
+++ b/cpukit/posix/src/time.c
@@ -0,0 +1,193 @@
+/* time.c
+ *
+ * $Id$
+ */
+
+#include <time.h>
+#include <rtems/score/tod.h>
+
+/*
+ * Seconds from January 1, 1970 to January 1, 1988. Used to account for
+ * differences between POSIX API and RTEMS core.
+ */
+
+#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \
+ (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
+ (4 * TOD_SECONDS_PER_DAY))
+
+/*
+ * 4.5.1 Get System Time, P1003.1b-1993, p. 91
+ */
+
+time_t time(
+ time_t *tloc
+)
+{
+ time_t seconds_since_epoch;
+
+ if ( !_TOD_Is_set() ) {
+ /* XXX set errno */
+ return -1;
+ }
+
+ /*
+ * Internally the RTEMS epoch is 1988. This must be taken into account.
+ */
+
+ seconds_since_epoch = _TOD_Seconds_since_epoch;
+
+ seconds_since_epoch += POSIX_TIME_SECONDS_1970_THROUGH_1988;
+
+ if ( tloc )
+ *tloc = seconds_since_epoch;
+
+ return seconds_since_epoch;
+}
+
+#ifdef NOT_IMPLEMENTED_YET
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_settime(
+ clockid_t clock_id,
+ const struct timespec *tp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_gettime(
+ clockid_t clock_id,
+ struct timespec *tp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.1 Clocks, P1003.1b-1993, p. 263
+ */
+
+int clock_getres(
+ clockid_t clock_id,
+ struct timespec *res
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264
+ */
+
+int timer_create(
+ clockid_t clock_id,
+ struct sigevent *evp,
+ timer_t *timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266
+ */
+
+int timer_delete(
+ timer_t timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_settime(
+ timer_t timerid,
+ int flags,
+ const struct itimerspec *value,
+ struct itimerspec *ovalue
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_gettime(
+ timer_t timerid,
+ struct itimerspec *value
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
+ */
+
+int timer_getoverrun(
+ timer_t timerid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
+ */
+
+int nanosleep(
+ const struct timespec *rqtp,
+ struct timespec *rmtp
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
+ */
+
+int clock_getcpuclockid(
+ pid_t pid,
+ clockid_t *clock_id
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
+ */
+
+int clock_setenable_attr(
+ clockid_t clock_id,
+ int attr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*
+ * 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
+ */
+
+int clock_getenable_attr(
+ clockid_t clock_id,
+ int *attr
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/cpukit/posix/src/types.c b/cpukit/posix/src/types.c
new file mode 100644
index 0000000000..e6e743ade5
--- /dev/null
+++ b/cpukit/posix/src/types.c
@@ -0,0 +1,168 @@
+/* types.c
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+
+#ifdef NOT_IMPLEMENTED_YET
+
+/*PAGE
+ *
+ * 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
+ */
+
+pid_t getpid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
+ */
+
+pid_t getppid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+uid_t getuid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+uid_t geteuid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+gid_t getgid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
+ * P1003.1b-1993, p. 84
+ */
+
+gid_t getegid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
+ */
+
+int setuid(
+ uid_t uid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
+ */
+
+int setgid(
+ gid_t gid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.3 Get Supplementary IDs, P1003.1b-1993, p. 86
+ */
+
+int getgroups(
+ int gidsetsize,
+ gid_t grouplist[]
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.4 Get User Name, P1003.1b-1993, p. 87
+ *
+ * NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
+ */
+
+char *getlogin( void )
+{
+ return (char *)POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.2.4 Get User Name, P1003.1b-1993, p. 87
+ *
+ * NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
+ */
+
+char *getlogin_r( void )
+{
+ return (char *)POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.1 Get Process Group IDs, P1003.1b-1993, p. 89
+ */
+
+pid_t getpgrp( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88
+ */
+
+pid_t setsid( void )
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+/*PAGE
+ *
+ * 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89
+ */
+
+int setpgid(
+ pid_t pid,
+ pid_t pgid
+)
+{
+ return POSIX_NOT_IMPLEMENTED();
+}
+
+#endif
diff --git a/cpukit/rtems/include/rtems.h b/cpukit/rtems/include/rtems.h
new file mode 100644
index 0000000000..e8826079b9
--- /dev/null
+++ b/cpukit/rtems/include/rtems.h
@@ -0,0 +1,121 @@
+/* rtems.h
+ *
+ * This include file contains information about RTEMS executive that
+ * is required by the application and is CPU independent. It includes
+ * two (2) CPU dependent files to tailor its data structures for a
+ * particular processor.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_GENERIC_h
+#define __RTEMS_RTEMS_GENERIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unless told otherwise, the RTEMS include files will hide some stuff
+ * from normal application code. Defining this crosses a boundary which
+ * is undesirable since it means your application is using RTEMS features
+ * which are not included in the formally defined and supported API.
+ * Define this at your own risk.
+ */
+
+#ifndef __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#define __RTEMS_APPLICATION__
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+#include <rtems/config.h>
+#include <rtems/init.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/extension.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/io.h>
+#include <rtems/fatal.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/mp.h>
+
+#include <rtems/rtems/support.h>
+#include <rtems/score/sysstate.h>
+
+#define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES
+#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
+#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE
+#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
+#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
+
+#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
+#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/asr.h b/cpukit/rtems/include/rtems/rtems/asr.h
new file mode 100644
index 0000000000..31758fc06b
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/asr.h
@@ -0,0 +1,112 @@
+/* asr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Asynchronous Signal Handler. This Handler provides the low-level
+ * support required by the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ASR_h
+#define __RTEMS_ASR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/modes.h>
+
+/*
+ *
+ * The following type defines the control block used to manage
+ * each signal set.
+ */
+
+typedef unsigned32 rtems_signal_set;
+
+/*
+ * Return type for ASR Handler
+ */
+
+typedef void rtems_asr;
+
+/*
+ * The following type corresponds to the applications asynchronous
+ * signal processing routine.
+ */
+
+typedef rtems_asr ( *rtems_asr_entry )(
+ rtems_signal_set
+ );
+
+/*
+ *
+ * The following defines the control structure used to manage
+ * signals. Each thread has a copy of this record.
+ */
+
+typedef struct {
+ boolean is_enabled; /* are ASRs enabled currently? */
+ rtems_asr_entry handler; /* address of RTEMS_ASR */
+ Modes_Control mode_set; /* RTEMS_ASR mode */
+ rtems_signal_set signals_posted; /* signal set */
+ rtems_signal_set signals_pending; /* pending signal set */
+ unsigned32 nest_level; /* nest level of RTEMS_ASR */
+} ASR_Information;
+
+/*
+ * The following constants define the individual signals which may
+ * be used to compose a signal set.
+ */
+
+#define RTEMS_SIGNAL_0 0x00000001
+#define RTEMS_SIGNAL_1 0x00000002
+#define RTEMS_SIGNAL_2 0x00000004
+#define RTEMS_SIGNAL_3 0x00000008
+#define RTEMS_SIGNAL_4 0x00000010
+#define RTEMS_SIGNAL_5 0x00000020
+#define RTEMS_SIGNAL_6 0x00000040
+#define RTEMS_SIGNAL_7 0x00000080
+#define RTEMS_SIGNAL_8 0x00000100
+#define RTEMS_SIGNAL_9 0x00000200
+#define RTEMS_SIGNAL_10 0x00000400
+#define RTEMS_SIGNAL_11 0x00000800
+#define RTEMS_SIGNAL_12 0x00001000
+#define RTEMS_SIGNAL_13 0x00002000
+#define RTEMS_SIGNAL_14 0x00004000
+#define RTEMS_SIGNAL_15 0x00008000
+#define RTEMS_SIGNAL_16 0x00010000
+#define RTEMS_SIGNAL_17 0x00020000
+#define RTEMS_SIGNAL_18 0x00040000
+#define RTEMS_SIGNAL_19 0x00080000
+#define RTEMS_SIGNAL_20 0x00100000
+#define RTEMS_SIGNAL_21 0x00200000
+#define RTEMS_SIGNAL_22 0x00400000
+#define RTEMS_SIGNAL_23 0x00800000
+#define RTEMS_SIGNAL_24 0x01000000
+#define RTEMS_SIGNAL_25 0x02000000
+#define RTEMS_SIGNAL_26 0x04000000
+#define RTEMS_SIGNAL_27 0x08000000
+#define RTEMS_SIGNAL_28 0x10000000
+#define RTEMS_SIGNAL_29 0x20000000
+#define RTEMS_SIGNAL_30 0x40000000
+#define RTEMS_SIGNAL_31 0x80000000
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/asr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/attr.h b/cpukit/rtems/include/rtems/rtems/attr.h
new file mode 100644
index 0000000000..8262a3a381
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/attr.h
@@ -0,0 +1,84 @@
+/* attr.h
+ *
+ * This include file contains all information about the Object Attributes
+ * Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ATTRIBUTES_h
+#define __RTEMS_ATTRIBUTES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+typedef unsigned32 rtems_attribute;
+
+/* constants */
+
+#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
+
+#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
+#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
+
+#define RTEMS_LOCAL 0x00000000 /* local resource */
+#define RTEMS_GLOBAL 0x00000002 /* global resource */
+
+#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
+#define RTEMS_PRIORITY 0x00000004 /* process by priority */
+
+#define RTEMS_COUNTING_SEMAPHORE 0x00000000
+#define RTEMS_BINARY_SEMAPHORE 0x00000010
+
+#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
+#define RTEMS_INHERIT_PRIORITY 0x00000020
+
+#define RTEMS_NO_PRIORITY_CEILING 0x00000000
+#define RTEMS_PRIORITY_CEILING 0x00000040
+
+#if ( CPU_HARDWARE_FP == TRUE )
+#define ATTRIBUTES_NOT_SUPPORTED 0
+#else
+#define ATTRIBUTES_NOT_SUPPORTED RTEMS_FLOATING_POINT
+#endif
+
+#if ( CPU_ALL_TASKS_ARE_FP == TRUE )
+#define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT
+#else
+#define ATTRIBUTES_REQUIRED 0
+#endif
+
+/*
+ * _Attributes_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs initialization for this handler.
+ *
+ * NOTE: There is no initialization required in C. Conditional compilation
+ * takes care of this in C.
+ */
+
+#define _Attributes_Handler_initialization()
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/attr.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/clock.h b/cpukit/rtems/include/rtems/rtems/clock.h
new file mode 100644
index 0000000000..d7c032a282
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/clock.h
@@ -0,0 +1,103 @@
+/* clock.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Clock Manager. This manager provides facilities to set, obtain,
+ * and continually update the current date and time.
+ *
+ * This manager provides directives to:
+ *
+ * + set the current date and time
+ * + obtain the current date and time
+ * + announce a clock tick
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CLOCK_h
+#define __RTEMS_CLOCK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tod.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * List of things which can be returned by the rtems_clock_get directive.
+ */
+
+typedef enum {
+ RTEMS_CLOCK_GET_TOD,
+ RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
+ RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
+ RTEMS_CLOCK_GET_TICKS_PER_SECOND,
+ RTEMS_CLOCK_GET_TIME_VALUE
+} rtems_clock_get_options;
+
+/*
+ * Standard flavor style to return TOD in for a rtems_clock_get option.
+ */
+
+typedef struct {
+ unsigned32 seconds;
+ unsigned32 microseconds;
+} rtems_clock_time_value;
+
+/*
+ * rtems_clock_get
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_get directive. It returns
+ * one of the following:
+ * + current time of day
+ * + seconds since epoch
+ * + ticks since boot
+ * + ticks per second
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+);
+
+/*
+ * rtems_clock_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_set directive. It sets
+ * the current time of day to that in the time_buffer record.
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_clock_tick
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_clock_tick directive. It is invoked
+ * to inform RTEMS of the occurrence of a clock tick.
+ */
+
+rtems_status_code rtems_clock_tick( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/dpmem.h b/cpukit/rtems/include/rtems/rtems/dpmem.h
new file mode 100644
index 0000000000..fc580c1a8a
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/dpmem.h
@@ -0,0 +1,157 @@
+/* dpmem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Dual Ported Memory Manager. This manager provides a mechanism
+ * for converting addresses between internal and external representations
+ * for multiple dual-ported memory areas.
+ *
+ * Directives provided are:
+ *
+ * + create a port
+ * + get ID of a port
+ * + delete a port
+ * + convert external to internal address
+ * + convert internal to external address
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DUAL_PORTED_MEMORY_h
+#define __RTEMS_DUAL_PORTED_MEMORY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following structure defines the port control block. Each port
+ * has a control block associated with it. This control block contains
+ * all information required to support the port related operations.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *internal_base; /* base internal address */
+ void *external_base; /* base external address */
+ unsigned32 length; /* length of dual-ported area */
+} Dual_ported_memory_Control;
+
+/*
+ * The following define the internal Dual Ported Memory information.
+ */
+
+EXTERN Objects_Information _Dual_ported_memory_Information;
+
+/*
+ * _Dual_ported_memory_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+);
+
+/*
+ * rtems_port_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_create directive. The port
+ * will have the name name. The port maps onto an area of dual ported
+ * memory of length bytes which has internal_start and external_start
+ * as the internal and external starting addresses, respectively.
+ * It returns the id of the created port in ID.
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_ident directive. This directive
+ * returns the port ID associated with name. If more than one port is
+ * named name, then the port to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_port_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_delete directive. It deletes
+ * the port associated with ID.
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_port_external_to_internal
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_port_external_to_internal directive.
+ * It returns the internal port address which maps to the provided
+ * external port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+);
+
+/*
+ * rtems_port_internal_to_external
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the Port_internal_to_external directive.
+ * It returns the external port address which maps to the provided
+ * internal port address for the specified port ID.
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/dpmem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/event.h b/cpukit/rtems/include/rtems/rtems/event.h
new file mode 100644
index 0000000000..4cd3b1cbea
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/event.h
@@ -0,0 +1,174 @@
+/* event.h
+ *
+ * This include file contains the information pertaining to the Event
+ * Manager. This manager provides a high performance method of communication
+ * and synchronization.
+ *
+ * Directives provided are:
+ *
+ * + send an event set to a task
+ * + receive event condition
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_h
+#define __RTEMS_EVENT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/eventset.h>
+
+/*
+ * This constant is passed as the event_in to the
+ * rtems_event_receive directive to determine which events are pending.
+ */
+
+#define EVENT_CURRENT 0
+
+/*
+ * The following enumerated types indicate what happened while the event
+ * manager was in the synchronization window.
+ */
+
+typedef enum {
+ EVENT_SYNC_SYNCHRONIZED,
+ EVENT_SYNC_NOTHING_HAPPENED,
+ EVENT_SYNC_TIMEOUT,
+ EVENT_SYNC_SATISFIED
+} Event_Sync_states;
+
+/*
+ * Event_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Event_Manager_initialization( void );
+
+/*
+ * rtems_event_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_send directive. It sends
+ * event_in to the task specified by ID. If the task is blocked
+ * waiting to receive events and the posting of event_in satisfies
+ * the task's event condition, then it is unblocked.
+ */
+
+rtems_status_code rtems_event_send (
+ Objects_Id id,
+ rtems_event_set event_in
+);
+
+/*
+ * rtems_event_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_event_receive directive. This
+ * directive is invoked when the calling task wishes to receive
+ * the event_in event condition. One of the fields in the option_set
+ * parameter determines whether the receive request is satisfied if
+ * any or all of the events are pending. If the event condition
+ * is not satisfied immediately, then the task may block with an
+ * optional timeout of TICKS clock ticks or return immediately.
+ * This determination is based on another field in the option_set
+ * parameter. This directive returns the events received in the
+ * event_out parameter.
+ */
+
+rtems_status_code rtems_event_receive (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition event_in is
+ * satisfied. If so or if the no_wait option is enabled in option_set,
+ * then the procedure returns immediately. If neither of these
+ * conditions is true, then the calling task is blocked with an
+ * optional timeout of ticks clock ticks.
+ */
+
+void _Event_Seize (
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+);
+
+/*
+ * _Event_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine determines if the event condition of the_thread
+ * has been satisfied. If so, it unblocks the_thread.
+ */
+
+void _Event_Surrender (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Event_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's event receive request
+ * has not been satisfied after the specified timeout interval.
+ * The task represented by ID will be unblocked and its status
+ * code will be set in it's control block to indicate that a timeout
+ * has occurred.
+ */
+
+void _Event_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * The following defines the synchronization flag used by the
+ * Event Manager to insure that signals sent to the currently
+ * executing thread are received properly.
+ */
+
+EXTERN volatile Event_Sync_states _Event_Sync_state;
+
+#include <rtems/rtems/eventmp.h>
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/event.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/eventmp.h b/cpukit/rtems/include/rtems/rtems/eventmp.h
new file mode 100644
index 0000000000..a6f5b912b0
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/eventmp.h
@@ -0,0 +1,147 @@
+/* eventmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_MP_h
+#define __RTEMS_EVENT_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/event.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote event operations.
+ */
+
+typedef enum {
+ EVENT_MP_SEND_REQUEST = 0,
+ EVENT_MP_SEND_RESPONSE = 1
+} Event_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Event_MP_Remote_operations operation;
+ rtems_event_set event_in;
+} Event_MP_Packet;
+
+/*
+ * _Event_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Event_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Event_MP_Send_request_packet (
+ Event_MP_Remote_operations operation,
+ Objects_Id event_id,
+ rtems_event_set event_in
+);
+
+/*
+ * _Event_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Event_MP_Send_response_packet (
+ Event_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Event_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Event_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Event_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Event_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a event mp packet.
+ */
+
+Event_MP_Packet *_Event_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/eventset.h b/cpukit/rtems/include/rtems/rtems/eventset.h
new file mode 100644
index 0000000000..0f3e122e5f
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/eventset.h
@@ -0,0 +1,89 @@
+/* eventset.h
+ *
+ * This include file contains the information pertaining to the
+ * Event Sets Handler. This handler provides methods for the manipulation
+ * of event sets which will be sent and received by tasks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EVENT_SET_h
+#define __RTEMS_EVENT_SET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following defines the type used to control event sets.
+ */
+
+typedef unsigned32 rtems_event_set;
+
+/*
+ * The following constants define the individual events which may
+ * be used to compose an event set.
+ */
+
+#define RTEMS_PENDING_EVENTS 0 /* receive pending events */
+#define RTEMS_ALL_EVENTS 0xFFFFFFFF
+
+#define RTEMS_EVENT_0 0x00000001
+#define RTEMS_EVENT_1 0x00000002
+#define RTEMS_EVENT_2 0x00000004
+#define RTEMS_EVENT_3 0x00000008
+#define RTEMS_EVENT_4 0x00000010
+#define RTEMS_EVENT_5 0x00000020
+#define RTEMS_EVENT_6 0x00000040
+#define RTEMS_EVENT_7 0x00000080
+#define RTEMS_EVENT_8 0x00000100
+#define RTEMS_EVENT_9 0x00000200
+#define RTEMS_EVENT_10 0x00000400
+#define RTEMS_EVENT_11 0x00000800
+#define RTEMS_EVENT_12 0x00001000
+#define RTEMS_EVENT_13 0x00002000
+#define RTEMS_EVENT_14 0x00004000
+#define RTEMS_EVENT_15 0x00008000
+#define RTEMS_EVENT_16 0x00010000
+#define RTEMS_EVENT_17 0x00020000
+#define RTEMS_EVENT_18 0x00040000
+#define RTEMS_EVENT_19 0x00080000
+#define RTEMS_EVENT_20 0x00100000
+#define RTEMS_EVENT_21 0x00200000
+#define RTEMS_EVENT_22 0x00400000
+#define RTEMS_EVENT_23 0x00800000
+#define RTEMS_EVENT_24 0x01000000
+#define RTEMS_EVENT_25 0x02000000
+#define RTEMS_EVENT_26 0x04000000
+#define RTEMS_EVENT_27 0x08000000
+#define RTEMS_EVENT_28 0x10000000
+#define RTEMS_EVENT_29 0x20000000
+#define RTEMS_EVENT_30 0x40000000
+#define RTEMS_EVENT_31 0x80000000
+
+
+/*
+ * The following constant is the value of an event set which
+ * has no events pending.
+ */
+
+#define EVENT_SETS_NONE_PENDING 0
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/eventset.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/intr.h b/cpukit/rtems/include/rtems/rtems/intr.h
new file mode 100644
index 0000000000..8681ccf9e0
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/intr.h
@@ -0,0 +1,160 @@
+/* intr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Interrupt Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERRUPT_h
+#define __RTEMS_INTERRUPT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * Interrupt level type
+ */
+
+typedef ISR_Level rtems_interrupt_level;
+
+/*
+ * The following type defines the control block used to manage
+ * the vectors.
+ */
+
+typedef ISR_Vector_number rtems_vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void rtems_isr;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef rtems_isr ( *rtems_isr_entry )(
+ rtems_vector_number
+ );
+
+/*
+ * _Interrupt_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the interrupt manager.
+ *
+ */
+
+void _Interrupt_Manager_initialization( void );
+
+/*
+ * rtems_interrupt_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_interrupt_catch directive. This
+ * directive installs new_isr_handler as the RTEMS interrupt service
+ * routine for vector. The previous RTEMS interrupt service
+ * routine is returned in old_isr_handler.
+ */
+
+rtems_status_code rtems_interrupt_catch(
+ rtems_isr_entry new_isr_handler,
+ rtems_vector_number vector,
+ rtems_isr_entry *old_isr_handler
+);
+
+/*
+ * rtems_interrupt_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all maskable interrupts and returns the
+ * previous level in _isr_cookie.
+ */
+
+#define rtems_interrupt_disable( _isr_cookie ) \
+ _ISR_Disable(_isr_cookie)
+
+/*
+ * rtems_interrupt_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables maskable interrupts to the level indicated
+ * _isr_cookie.
+ */
+
+#define rtems_interrupt_enable( _isr_cookie ) \
+ _ISR_Enable(_isr_cookie)
+
+/*
+ * rtems_interrupt_flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables maskable interrupts to the
+ * level in _isr_cookie before redisabling them.
+ */
+
+#define rtems_interrupt_flash( _isr_cookie ) \
+ _ISR_Flash(_isr_cookie)
+
+/*
+ * rtems_interrupt_is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+#define rtems_interrupt_is_in_progress() \
+ _ISR_Is_in_progress()
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine generates an interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_cause( _interrupt_to_cause )
+
+/*
+ * rtems_interrupt_cause
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the specified interrupt.
+ *
+ * NOTE: No implementation.
+ */
+
+#define rtems_interrupt_clear( _interrupt_to_clear )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/message.h b/cpukit/rtems/include/rtems/rtems/message.h
new file mode 100644
index 0000000000..0469f8ddbf
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/message.h
@@ -0,0 +1,317 @@
+/* message.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message Queue Manager. This manager provides a mechanism for
+ * communication and synchronization between tasks using messages.
+ *
+ * Directives provided are:
+ *
+ * + create a queue
+ * + get ID of a queue
+ * + delete a queue
+ * + put a message at the rear of a queue
+ * + put a message at the front of a queue
+ * + broadcast N messages to a queue
+ * + receive message from a queue
+ * + flush all messages on a queue
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_h
+#define __RTEMS_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/coremsg.h>
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_SEND_REQUEST = 0,
+ MESSAGE_QUEUE_URGENT_REQUEST = 1
+} Message_queue_Submit_types;
+
+/*
+ * The following records define the control block used to manage
+ * each message queue.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ CORE_message_queue_Control message_queue;
+} Message_queue_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Message_queue_Information;
+
+/*
+ * _Message_queue_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+);
+
+/*
+ * rtems_message_queue_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_create directive. The
+ * message queue will have the name name. If the attribute_set indicates
+ * that the message queue is to be limited in the number of messages
+ * that can be outstanding, then count indicates the maximum number of
+ * messages that will be held. It returns the id of the created
+ * message queue in ID.
+ */
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_ident directive.
+ * This directive returns the message queue ID associated with NAME.
+ * If more than one message queue is named name, then the message
+ * queue to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the message queue named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_message_queue_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_delete directive. The
+ * message queue indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_message_queue_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+);
+
+/*
+ * rtems_message_queue_broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_send directive.
+ * This directive sends the message buffer to the message queue
+ * indicated by ID. If one or more tasks is blocked waiting
+ * to receive a message from this message queue, then one will
+ * receive the message. The task selected to receive the
+ * message is based on the task queue discipline algorithm in
+ * use by this particular message queue. If no tasks are waiting,
+ * then the message buffer will be placed at the rear of the
+ * chain of pending messages for this message queue.
+ */
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+);
+
+/*
+ * rtems_message_queue_receive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_receive directive.
+ * This directive is invoked when the calling task wishes to receive
+ * a message from the message queue indicated by ID. The received
+ * message is to be placed in buffer. If no messages are outstanding
+ * and the option_set indicates that the task is willing to block,
+ * then the task will be blocked until a message arrives or until,
+ * optionally, timeout clock ticks have passed.
+ */
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_message_queue_flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_message_queue_flush directive.
+ * This directive takes all outstanding messages for the message
+ * queue indicated by ID and returns them to the inactive message
+ * chain. The number of messages flushed is returned in COUNT.
+ */
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+);
+
+/*
+ * _Message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the directives rtems_message_queue_send
+ * and rtems_message_queue_urgent. It processes a message that is
+ * to be submitted to the designated message queue. The message will
+ * either be processed as a send 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.
+ */
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+);
+
+/*
+ * _Message_queue_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message queue control block from
+ * the inactive chain of free message queue control blocks.
+ */
+
+Message_queue_Control *_Message_queue_Allocate (
+ unsigned32 count,
+ unsigned32 max_message_size
+);
+
+/*
+ * _Message_queue_Translate_core_message_queue_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the core message queue
+ * status code specified.
+ */
+
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+ unsigned32 the_message_queue_status
+);
+
+/*
+ *
+ * _Message_queue_Core_message_queue_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the message was submitted to
+ * id - id of the message queue
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Core_message_queue_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/message.inl>
+#endif
+#include <rtems/rtems/msgmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/modes.h b/cpukit/rtems/include/rtems/rtems/modes.h
new file mode 100644
index 0000000000..34a23c7b20
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/modes.h
@@ -0,0 +1,89 @@
+/* modes.h
+ *
+ * This include file contains all constants and structures associated
+ * with the RTEMS thread and RTEMS_ASR modes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MODES_h
+#define __RTEMS_MODES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * The following type defines the control block used to manage
+ * each a mode set.
+ */
+
+typedef unsigned32 Modes_Control;
+
+/*
+ * The following constants define the individual modes and masks
+ * which may be used to compose a mode set and to alter modes.
+ */
+
+#define RTEMS_ALL_MODE_MASKS 0x0000ffff
+
+#define RTEMS_DEFAULT_MODES 0x00000000
+#define RTEMS_CURRENT_MODE 0
+
+#define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */
+#define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */
+#define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */
+#define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK
+
+#define RTEMS_PREEMPT 0x00000000 /* enable preemption */
+#define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */
+
+#define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */
+#define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */
+
+#define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */
+#define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */
+
+/*
+ * The number of bits for interrupt levels is CPU dependent.
+ * RTEMS supports 0 to 256 levels in bits 0-7 of the mode.
+ */
+
+/*PAGE
+ *
+ * RTEMS_INTERRUPT_LEVEL
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the processor dependent interrupt
+ * level which corresponds to the requested interrupt level.
+ *
+ * NOTE: RTEMS supports 256 interrupt levels using the least
+ * significant eight bits of MODES.CONTROL. On any
+ * particular CPU, fewer than 256 levels may be supported.
+ */
+
+#define RTEMS_INTERRUPT_LEVEL( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/modes.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/mp.h b/cpukit/rtems/include/rtems/rtems/mp.h
new file mode 100644
index 0000000000..079f55b093
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/mp.h
@@ -0,0 +1,53 @@
+/* mp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MP_h
+#define __RTEMS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *
+ * _Multiprocessing_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Multiprocessing_Manager_initialization ( void );
+
+/*
+ *
+ * rtems_multiprocessing_announce
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the MULTIPROCESSING_ANNOUNCE directive.
+ * It is invoked by the MPCI layer to indicate that an MPCI packet
+ * has been received.
+ */
+
+void rtems_multiprocessing_announce ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/msgmp.h b/cpukit/rtems/include/rtems/rtems/msgmp.h
new file mode 100644
index 0000000000..070ed6fcaa
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/msgmp.h
@@ -0,0 +1,175 @@
+/* msgmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MESSAGE_QUEUE_MP_h
+#define __RTEMS_MESSAGE_QUEUE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/message.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote message queue operations.
+ */
+
+typedef enum {
+ MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
+ MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
+ MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
+ MESSAGE_QUEUE_MP_RECEIVE_REQUEST = 3,
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE = 4,
+ MESSAGE_QUEUE_MP_SEND_REQUEST = 5,
+ MESSAGE_QUEUE_MP_SEND_RESPONSE = 6,
+ MESSAGE_QUEUE_MP_URGENT_REQUEST = 7,
+ MESSAGE_QUEUE_MP_URGENT_RESPONSE = 8,
+ MESSAGE_QUEUE_MP_BROADCAST_REQUEST = 9,
+ MESSAGE_QUEUE_MP_BROADCAST_RESPONSE = 10,
+ MESSAGE_QUEUE_MP_FLUSH_REQUEST = 11,
+ MESSAGE_QUEUE_MP_FLUSH_RESPONSE = 12
+} Message_queue_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote message queue operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Message_queue_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+ unsigned32 count;
+ unsigned32 size;
+ unsigned32 pad0;
+ CORE_message_queue_Buffer Buffer;
+} Message_queue_MP_Packet;
+
+/*
+ * _Message_queue_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_process_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Message_queue_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Message_queue_MP_Send_request_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ void *buffer,
+ unsigned32 *size_p,
+ rtems_option option_set,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Message_queue_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Message_queue_MP_Send_response_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Message_queue_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Message_queue_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Message_queue_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Message_queue_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Message_queue_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a message queue mp packet.
+ */
+
+Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/options.h b/cpukit/rtems/include/rtems/rtems/options.h
new file mode 100644
index 0000000000..069d7721b3
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/options.h
@@ -0,0 +1,53 @@
+/* options.h
+ *
+ * This include file contains information which defines the
+ * options available on many directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OPTIONS_h
+#define __RTEMS_OPTIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * option sets.
+ */
+
+typedef unsigned32 rtems_option;
+
+/*
+ * The following constants define the individual options which may
+ * be used to compose an option set.
+ */
+
+#define RTEMS_DEFAULT_OPTIONS 0x00000000
+
+#define RTEMS_WAIT 0x00000000 /* wait on resource */
+#define RTEMS_NO_WAIT 0x00000001 /* do not wait on resource */
+
+#define RTEMS_EVENT_ALL 0x00000000 /* wait for all events */
+#define RTEMS_EVENT_ANY 0x00000002 /* wait on any event */
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/options.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/part.h b/cpukit/rtems/include/rtems/rtems/part.h
new file mode 100644
index 0000000000..e06a2e4b86
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/part.h
@@ -0,0 +1,168 @@
+/* partition.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Partition Manager. This manager provides facilities to
+ * dynamically allocate memory in fixed-sized units which are returned
+ * as buffers.
+ *
+ * Directives provided are:
+ *
+ * + create a partition
+ * + get an ID of a partition
+ * + delete a partition
+ * + get a buffer from a partition
+ * + return a buffer to a partition
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_h
+#define __RTEMS_PARTITION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following defines the control block used to manage each partition.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ void *starting_address; /* physical address */
+ unsigned32 length; /* in bytes */
+ unsigned32 buffer_size; /* in bytes */
+ rtems_attribute attribute_set; /* attributes */
+ unsigned32 number_of_used_blocks; /* or allocated buffers */
+ Chain_Control Memory; /* buffer chain */
+} Partition_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Partition_Information;
+
+/*
+ * _Partition_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+);
+
+/*
+ * rtems_partition_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_create directive. The
+ * partition will have the name name. The memory area managed by
+ * the partition is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many buffers of
+ * buffer_size bytes as possible. The attribute_set determines if
+ * the partition is global or local. It returns the id of the
+ * created partition in ID.
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_ident directive.
+ * This directive returns the partition ID associated with name.
+ * If more than one partition is named name, then the partition
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the partition named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_partition_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_delete directive. The
+ * partition indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_partition_get_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_get_buffer directive. It
+ * attempts to allocate a buffer from the partition associated with ID.
+ * If a buffer is allocated, its address is returned in buffer.
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+);
+
+/*
+ * rtems_partition_return_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_partition_return_buffer directive. It
+ * frees the buffer to the partition associated with ID. The buffer must
+ * have been previously allocated from the same partition.
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/part.inl>
+#endif
+#include <rtems/rtems/partmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/partmp.h b/cpukit/rtems/include/rtems/rtems/partmp.h
new file mode 100644
index 0000000000..fd7d442dd3
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/partmp.h
@@ -0,0 +1,161 @@
+/* partmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_PARTITION_MP_h
+#define __RTEMS_PARTITION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/part.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote partition operations.
+ */
+
+typedef enum {
+ PARTITION_MP_ANNOUNCE_CREATE = 0,
+ PARTITION_MP_ANNOUNCE_DELETE = 1,
+ PARTITION_MP_EXTRACT_PROXY = 2,
+ PARTITION_MP_GET_BUFFER_REQUEST = 3,
+ PARTITION_MP_GET_BUFFER_RESPONSE = 4,
+ PARTITION_MP_RETURN_BUFFER_REQUEST = 5,
+ PARTITION_MP_RETURN_BUFFER_RESPONSE = 6
+} Partition_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote partition operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Partition_MP_Remote_operations operation;
+ rtems_name name;
+ void *buffer;
+ Objects_Id proxy_id;
+} Partition_MP_Packet;
+
+/*
+ * _Partition_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Partition_MP_Send_process_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Partition_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Partition_MP_Send_request_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ void *buffer
+);
+
+/*
+ * _Partition_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Partition_MP_Send_response_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Partition_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Partition_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Partition_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Partition since a partition
+ * cannot be deleted when buffers are in use.
+ */
+
+/*
+ * _Partition_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Partition_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Partition_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a partition mp packet.
+ */
+
+Partition_MP_Packet *_Partition_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
new file mode 100644
index 0000000000..a85bbcdc09
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -0,0 +1,185 @@
+/* ratemon.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Rate Monotonic Manager. This manager
+ * provides facilities to implement tasks which execute in a periodic fashion.
+ *
+ * Directives provided are:
+ *
+ * + create a rate monotonic timer
+ * + cancel a period
+ * + delete a rate monotonic timer
+ * + conclude current and start the next period
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RATE_MONOTONIC_h
+#define __RTEMS_RATE_MONOTONIC_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the states in which a
+ * period may be.
+ */
+
+typedef enum {
+ RATE_MONOTONIC_INACTIVE, /* off chain, never initialized */
+ RATE_MONOTONIC_OWNER_IS_BLOCKING, /* on chain, owner is blocking on it */
+ RATE_MONOTONIC_ACTIVE, /* on chain, running continuously */
+ RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
+ /* was blocking on it */
+ RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */
+ /* rtems_rate_monotonic_period */
+} Rate_Monotonic_Period_states;
+
+/*
+ * The following constant is the interval passed to the rate_monontonic_period
+ * directive to obtain status information.
+ */
+
+#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following structure defines the control block used to manage
+ * each period.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Timer;
+ Rate_Monotonic_Period_states state;
+ Thread_Control *owner;
+} Rate_monotonic_Control;
+
+EXTERN Objects_Information _Rate_monotonic_Information;
+
+/*
+ * _Rate_monotonic_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+);
+
+/*
+ * rtems_rate_monotonic_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rate_monotonic_create directive. The
+ * period will have the name name. It returns the id of the
+ * created period in ID.
+ */
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_ident directive.
+ * This directive returns the period ID associated with name.
+ * If more than one period is named name, then the period
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_rate_monotonic_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_cancel directive. This
+ * directive stops the period associated with ID from continuing to
+ * run.
+ */
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_delete directive. The
+ * period indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_rate_monotonic_period
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_rate_monotonic_period directive. When
+ * length is non-zero, this directive initiates the period associated with
+ * ID from continuing for a period of length. If length is zero, then
+ * result is set to indicate the current state of the period.
+ */
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+);
+
+/*
+ * _Rate_monotonic_Timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the period represented
+ * by ID expires. If the task which owns this period is blocked
+ * waiting for the period to expire, then it is readied and the
+ * period is restarted. If the owning task is not waiting for the
+ * period to expire, then the period is placed in the EXPIRED
+ * state and not restarted.
+ */
+
+void _Rate_monotonic_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/ratemon.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h
new file mode 100644
index 0000000000..7ee2658cd2
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/region.h
@@ -0,0 +1,234 @@
+/* region.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Region Manager. This manager provides facilities to dynamically
+ * allocate memory in variable sized units which are returned as segments.
+ *
+ * Directives provided are:
+ *
+ * + create a region
+ * + get an ID of a region
+ * + delete a region
+ * + get a segment from a region
+ * + return a segment to a region
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_h
+#define __RTEMS_REGION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/heap.h>
+#include <rtems/debug.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * The following records define the control block used to manage
+ * each region.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Thread_queue_Control Wait_queue; /* waiting threads */
+ void *starting_address; /* physical start addr */
+ unsigned32 length; /* physical length(bytes) */
+ unsigned32 page_size; /* in bytes */
+ unsigned32 maximum_segment_size; /* in bytes */
+ rtems_attribute attribute_set;
+ unsigned32 number_of_used_blocks; /* blocks allocated */
+ Heap_Control Memory;
+} Region_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Region_Information;
+
+/*
+ * _Region_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+);
+
+/*
+ * rtems_region_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_create directive. The
+ * region will have the name name. The memory area managed by
+ * the region is of length bytes and starts at starting_address.
+ * The memory area will be divided into as many allocatable units of
+ * page_size bytes as possible. The attribute_set determines which
+ * thread queue discipline is used by the region. It returns the
+ * id of the created region in ID.
+ */
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_extend directive. The
+ * region will have the name name. The memory area managed by
+ * the region will be attempted to be grown by length bytes using
+ * the memory starting at starting_address.
+ */
+
+rtems_status_code rtems_region_extend(
+ Objects_Id id,
+ void *starting_address,
+ unsigned32 length
+);
+
+/*
+ * rtems_region_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_ident directive.
+ * This directive returns the region ID associated with name.
+ * If more than one region is named name, then the region
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_region_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_delete directive. The
+ * region indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_region_get_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment directive. It
+ * attempts to allocate a segment from the region associated with ID.
+ * If a segment of the requested size can be allocated, its address
+ * is returned in segment. If no segment is available, then the task
+ * may return immediately or block waiting for a segment with an optional
+ * timeout of timeout clock ticks. Whether the task blocks or returns
+ * immediately is based on the no_wait option in the option_set.
+ */
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+);
+
+/*
+ * rtems_region_get_segment_size
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_get_segment_size directive. It
+ * returns the size in bytes of the specified user memory area.
+ */
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+);
+
+/*
+ * rtems_region_return_segment
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_region_return_segment directive. It
+ * frees the segment to the region associated with ID. The segment must
+ * have been previously allocated from the same region. If freeing the
+ * segment results in enough memory being available to satisfy the
+ * rtems_region_get_segment of the first blocked task, then that task and as
+ * many subsequent tasks as possible will be unblocked with their requests
+ * satisfied.
+ */
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/region.inl>
+#endif
+#include <rtems/rtems/regionmp.h>
+
+/*
+ * _Region_Debug_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to verify the integrity of a heap associated
+ * with the_region.
+ */
+
+#ifdef RTEMS_DEBUG
+
+#define _Region_Debug_Walk( _the_region, _source ) \
+ do { \
+ if ( _Debug_Is_enabled( RTEMS_DEBUG_REGION ) ) \
+ _Heap_Walk( &(_the_region)->Memory, _source, FALSE ); \
+ } while ( 0 )
+
+#else
+
+#define _Region_Debug_Walk( _the_region, _source )
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/regionmp.h b/cpukit/rtems/include/rtems/rtems/regionmp.h
new file mode 100644
index 0000000000..b59fe9235e
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/regionmp.h
@@ -0,0 +1,166 @@
+/* regionmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_REGION_MP_h
+#define __RTEMS_REGION_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote region operations.
+ */
+
+typedef enum {
+ REGION_MP_ANNOUNCE_CREATE = 0,
+ REGION_MP_ANNOUNCE_DELETE = 1,
+ REGION_MP_EXTRACT_PROXY = 2,
+ REGION_MP_GET_SEGMENT_REQUEST = 3,
+ REGION_MP_GET_SEGMENT_RESPONSE = 4,
+ REGION_MP_RETURN_SEGMENT_REQUEST = 5,
+ REGION_MP_RETURN_SEGMENT_RESPONSE = 6
+} Region_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote region operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Region_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ unsigned32 size;
+ Objects_Id proxy_id;
+ void *segment;
+} Region_MP_Packet;
+
+/*
+ * _Region_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Region_MP_Send_process_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Region_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Region_MP_Send_request_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ void *segment,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Region_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Region_MP_Send_response_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Region_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Region_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Region_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by the Region since a region
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _Region_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Region_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Region_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a region mp packet.
+ */
+
+Region_MP_Packet *_Region_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/rtemsapi.h b/cpukit/rtems/include/rtems/rtems/rtemsapi.h
new file mode 100644
index 0000000000..e43de773fd
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/rtemsapi.h
@@ -0,0 +1,34 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_API_h
+#define __RTEMS_API_h
+
+#include <rtems/config.h>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+);
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/sem.h b/cpukit/rtems/include/rtems/rtems/sem.h
new file mode 100644
index 0000000000..c4f8574b17
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/sem.h
@@ -0,0 +1,248 @@
+/* semaphore.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Semaphore Manager. This manager utilizes standard Dijkstra
+ * counting semaphores to provide synchronization and mutual exclusion
+ * capabilities.
+ *
+ * Directives provided are:
+ *
+ * + create a semaphore
+ * + get an ID of a semaphore
+ * + delete a semaphore
+ * + acquire a semaphore
+ * + release a semaphore
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_h
+#define __RTEMS_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/object.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/threadq.h>
+
+/*
+ * The following defines the control block used to manage each semaphore.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ rtems_attribute attribute_set;
+ union {
+ CORE_mutex_Control mutex;
+ CORE_semaphore_Control semaphore;
+ } Core_control;
+} Semaphore_Control;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Semaphore_Information;
+
+/*
+ * _Semaphore_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+);
+
+/*
+ * rtems_semaphore_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_create directive. The
+ * semaphore will have the name name. The starting count for
+ * the semaphore is count. The attribute_set determines if
+ * the semaphore is global or local and the thread queue
+ * discipline. It returns the id of the created semaphore in ID.
+ */
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_ident directive.
+ * This directive returns the semaphore ID associated with name.
+ * If more than one semaphore is named name, then the semaphore
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the semaphore named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ rtems_id *id
+);
+
+/*
+ * rtems_semaphore_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_delete directive. The
+ * semaphore indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_semaphore_delete(
+ rtems_id id
+);
+
+/*
+ * rtems_semaphore_obtain
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_obtain directive. It
+ * attempts to obtain a unit from the semaphore associated with ID.
+ * If a unit can be allocated, the calling task will return immediately.
+ * If no unit is available, then the task may return immediately or
+ * block waiting for a unit with an optional timeout of timeout
+ * clock ticks. Whether the task blocks or returns immediately
+ * is based on the RTEMS_NO_WAIT option in the option_set.
+ */
+
+rtems_status_code rtems_semaphore_obtain(
+ rtems_id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+);
+
+/*
+ * rtems_semaphore_release
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_semaphore_release directive. It
+ * frees a unit to the semaphore associated with ID. If a task was
+ * blocked waiting for a unit from this semaphore, then that task will
+ * be readied and the unit given to that task. Otherwise, the unit
+ * will be returned to the semaphore.
+ */
+
+rtems_status_code rtems_semaphore_release(
+ rtems_id id
+);
+
+/*
+ * _Semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the RTEMS_NO_WAIT option is enabled in
+ * option_set, then the routine returns. Otherwise, the calling task
+ * is blocked until a unit becomes available.
+ */
+
+boolean _Semaphore_Seize(
+ Semaphore_Control *the_semaphore,
+ unsigned32 option_set
+);
+
+/*
+ * _Semaphore_Translate_core_mutex_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the mutex
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_mutex_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*
+ * _Semaphore_Translate_core_semaphore_return_code
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a RTEMS status code based on the semaphore
+ * status code specified.
+ */
+
+rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
+ unsigned32 the_mutex_status
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mutex_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core mutex. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_mutex_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+/*PAGE
+ *
+ * _Semaphore_Core_mp_support
+ *
+ * DESCRIPTION:
+ *
+ * This function processes the global actions necessary for remote
+ * accesses to a global semaphore based on a core semaphore. This function
+ * is called by the core.
+ */
+
+void _Semaphore_Core_semaphore_mp_support (
+ Thread_Control *the_thread,
+ rtems_id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/sem.inl>
+#endif
+#include <rtems/rtems/semmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/semmp.h b/cpukit/rtems/include/rtems/rtems/semmp.h
new file mode 100644
index 0000000000..4d9618256d
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/semmp.h
@@ -0,0 +1,163 @@
+/* semmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SEMAPHORE_MP_h
+#define __RTEMS_SEMAPHORE_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote semaphore operations.
+ */
+
+typedef enum {
+ SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
+ SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
+ SEMAPHORE_MP_EXTRACT_PROXY = 2,
+ SEMAPHORE_MP_OBTAIN_REQUEST = 3,
+ SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
+ SEMAPHORE_MP_RELEASE_REQUEST = 5,
+ SEMAPHORE_MP_RELEASE_RESPONSE = 6
+} Semaphore_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote semaphore operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Semaphore_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+} Semaphore_MP_Packet;
+
+/*
+ * _Semaphore_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_process_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/*
+ * _Semaphore_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Semaphore_MP_Send_request_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_option option_set,
+ rtems_interval timeout
+);
+
+/*
+ * _Semaphore_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Semaphore_MP_Send_response_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Semaphore_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Semaphore_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Semaphore_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/*
+ * _Semaphore_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+
+void _Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+);
+
+/*
+ * _Semaphore_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a semaphore mp packet.
+ */
+
+Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/signal.h b/cpukit/rtems/include/rtems/rtems/signal.h
new file mode 100644
index 0000000000..e72bcb2dbc
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/signal.h
@@ -0,0 +1,83 @@
+/* signal.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Signal Manager. This manager provides capabilities required
+ * for asynchronous communication between tasks via signal sets.
+ *
+ * Directives provided are:
+ *
+ * + establish an asynchronous signal routine
+ * + send a signal set to a task
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_h
+#define __RTEMS_SIGNAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * _Signal_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Signal_Manager_initialization( void );
+
+/*
+ * rtems_signal_catch
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_catch directive. This directive
+ * is used to establish asr_handler as the Asynchronous Signal Routine
+ * (RTEMS_ASR) for the calling task. The asr_handler will execute with a
+ * mode of mode_set.
+ */
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry asr_handler,
+ rtems_mode mode_set
+);
+
+/*
+ * rtems_signal_send
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_signal_send directive. This directive
+ * sends the signal_set to the task specified by ID.
+ */
+
+rtems_status_code rtems_signal_send(
+ Objects_Id id,
+ rtems_signal_set signal_set
+);
+
+#include <rtems/rtems/signalmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/signalmp.h b/cpukit/rtems/include/rtems/rtems/signalmp.h
new file mode 100644
index 0000000000..91d36b729f
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/signalmp.h
@@ -0,0 +1,147 @@
+/* signalmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Signal Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SIGNAL_MP_h
+#define __RTEMS_SIGNAL_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/asr.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote signal operations.
+ */
+
+typedef enum {
+ SIGNAL_MP_SEND_REQUEST = 0,
+ SIGNAL_MP_SEND_RESPONSE = 1
+} Signal_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote signal operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Signal_MP_Remote_operations operation;
+ rtems_signal_set signal_in;
+} Signal_MP_Packet;
+
+/*
+ * _Signal_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ *
+ * This routine is not needed since there are no process
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _Signal_MP_Send_request_packet (
+ Signal_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_signal_set signal_in
+);
+
+/*
+ * _Signal_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Signal_MP_Send_response_packet (
+ Signal_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _Signal_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _Signal_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _Signal_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _Signal_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a signal mp packet.
+ */
+
+Signal_MP_Packet *_Signal_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/status.h b/cpukit/rtems/include/rtems/rtems/status.h
new file mode 100644
index 0000000000..23c1c830c6
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/status.h
@@ -0,0 +1,82 @@
+/* status.h
+ *
+ * This include file contains the status codes returned from the
+ * executive directives.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATUS_h
+#define __RTEMS_STATUS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+typedef enum {
+ RTEMS_SUCCESSFUL = 0, /* successful completion */
+ RTEMS_TASK_EXITTED = 1, /* returned from a thread */
+ RTEMS_MP_NOT_CONFIGURED = 2, /* multiprocessing not configured */
+ RTEMS_INVALID_NAME = 3, /* invalid object name */
+ RTEMS_INVALID_ID = 4, /* invalid object id */
+ RTEMS_TOO_MANY = 5, /* too many */
+ RTEMS_TIMEOUT = 6, /* timed out waiting */
+ RTEMS_OBJECT_WAS_DELETED = 7, /* object deleted while waiting */
+ RTEMS_INVALID_SIZE = 8, /* specified size was invalid */
+ RTEMS_INVALID_ADDRESS = 9, /* address specified is invalid */
+ RTEMS_INVALID_NUMBER = 10, /* number was invalid */
+ RTEMS_NOT_DEFINED = 11, /* item has not been initialized */
+ RTEMS_RESOURCE_IN_USE = 12, /* resources still outstanding */
+ RTEMS_UNSATISFIED = 13, /* request not satisfied */
+ RTEMS_INCORRECT_STATE = 14, /* thread is in wrong state */
+ RTEMS_ALREADY_SUSPENDED = 15, /* thread already in state */
+ RTEMS_ILLEGAL_ON_SELF = 16, /* illegal on calling thread */
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17, /* illegal for remote object */
+ RTEMS_CALLED_FROM_ISR = 18, /* called from wrong environment */
+ RTEMS_INVALID_PRIORITY = 19, /* invalid thread priority */
+ RTEMS_INVALID_CLOCK = 20, /* invalid date/time */
+ RTEMS_INVALID_NODE = 21, /* invalid node id */
+ RTEMS_NOT_CONFIGURED = 22, /* directive not configured */
+ RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
+ RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
+ RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
+ RTEMS_NO_MEMORY = 26 /* could not get enough memory */
+} rtems_status_code;
+
+#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
+#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
+
+extern rtems_status_code _Status_Object_name_errors_to_status[];
+
+#ifdef INIT
+rtems_status_code _Status_Object_name_errors_to_status[] = {
+ RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */
+ RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */
+ RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */
+};
+#endif
+
+/*
+ * Applications are allowed to use the macros to compare status codes.
+ */
+
+#include <rtems/rtems/status.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/support.h b/cpukit/rtems/include/rtems/rtems/support.h
new file mode 100644
index 0000000000..3305ffd4d3
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/support.h
@@ -0,0 +1,97 @@
+/* support.h
+ *
+ * This include file contains information about support functions for
+ * the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_SUPPORT_h
+#define __RTEMS_RTEMS_SUPPORT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+
+/*
+ * rtems_build_name
+ *
+ * DESCRIPTION:
+ *
+ * This function returns an object name composed of the four characters
+ * C1, C2, C3, and C4.
+ *
+ * NOTE:
+ *
+ * This must be implemented as a macro for use in Configuration Tables.
+ *
+ */
+
+#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
+ ( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
+
+/*
+ * rtems_get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ *
+ */
+
+#define rtems_get_class( _id ) \
+ _Objects_Get_class( _id )
+
+/*
+ * rtems_get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ *
+ */
+
+#define rtems_get_node( _id ) \
+ _Objects_Get_node( _id )
+
+/*
+ * rtems_get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ *
+ */
+
+#define rtems_get_index( _id ) \
+ _Objects_Get_index( _id )
+
+/*
+ * Time related
+ */
+
+#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
+ TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
+#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
+ TOD_MILLISECONDS_TO_TICKS(_ms)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/support.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/taskmp.h b/cpukit/rtems/include/rtems/rtems/taskmp.h
new file mode 100644
index 0000000000..032d5645d1
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/taskmp.h
@@ -0,0 +1,167 @@
+/* taskmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the multiprocessing support in the task manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_MP_h
+#define __RTEMS_RTEMS_TASKS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following enumerated type defines the list of
+ * remote task operations.
+ */
+
+typedef enum {
+ RTEMS_TASKS_MP_ANNOUNCE_CREATE = 0,
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE = 1,
+ RTEMS_TASKS_MP_SUSPEND_REQUEST = 2,
+ RTEMS_TASKS_MP_SUSPEND_RESPONSE = 3,
+ RTEMS_TASKS_MP_RESUME_REQUEST = 4,
+ RTEMS_TASKS_MP_RESUME_RESPONSE = 5,
+ RTEMS_TASKS_MP_SET_PRIORITY_REQUEST = 6,
+ RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE = 7,
+ RTEMS_TASKS_MP_GET_NOTE_REQUEST = 8,
+ RTEMS_TASKS_MP_GET_NOTE_RESPONSE = 9,
+ RTEMS_TASKS_MP_SET_NOTE_REQUEST = 10,
+ RTEMS_TASKS_MP_SET_NOTE_RESPONSE = 11
+} RTEMS_tasks_MP_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote task operations.
+ */
+
+typedef struct {
+ rtems_packet_prefix Prefix;
+ RTEMS_tasks_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_task_priority the_priority;
+ unsigned32 notepad;
+ unsigned32 note;
+} RTEMS_tasks_MP_Packet;
+
+/*
+ * _RTEMS_tasks_MP_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_process_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_name name
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+
+rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_task_priority the_priority,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _RTEMS_tasks_MP_Send_response_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Thread_Control *the_thread
+);
+
+/*
+ *
+ * _RTEMS_tasks_MP_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _RTEMS_tasks_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/*
+ * _RTEMS_tasks_MP_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed by RTEMS_tasks since a task
+ * cannot be deleted when segments are in use.
+ */
+
+/*
+ * _RTEMS_tasks_MP_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*
+ * _RTEMS_tasks_MP_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to obtain a task mp packet.
+ */
+
+RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
new file mode 100644
index 0000000000..b86d85a562
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -0,0 +1,419 @@
+/* tasks.h
+ *
+ * This include file contains all constants and structures associated
+ * with RTEMS tasks. This manager provides a comprehensive set of directives
+ * to create, delete, and administer tasks.
+ *
+ * Directives provided are:
+ *
+ * + create a task
+ * + get an ID of a task
+ * + start a task
+ * + restart a task
+ * + delete a task
+ * + suspend a task
+ * + resume a task
+ * + set a task's priority
+ * + change the current task's mode
+ * + get a task notepad entry
+ * + set a task notepad entry
+ * + wake up after interval
+ * + wake up when specified
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TASKS_h
+#define __RTEMS_RTEMS_TASKS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/eventset.h>
+#include <rtems/rtems/asr.h>
+#include <rtems/rtems/attr.h>
+
+/*
+ * Constant to be used as the ID of current task
+ */
+
+#define RTEMS_SELF OBJECTS_ID_OF_SELF
+
+/*
+ * This constant is passed to the rtems_task_wake_after directive as the
+ * interval when a task wishes to yield the CPU.
+ */
+
+#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
+
+/*
+ * Define the type for an RTEMS API task priority.
+ */
+
+typedef Priority_Control rtems_task_priority;
+
+#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
+
+#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1)
+#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM
+
+/*
+ * The following constant is passed to rtems_task_set_priority when the
+ * caller wants to obtain the current priority.
+ */
+
+#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM
+
+/*
+ * Notepads constants (indices into notepad array)
+ */
+
+#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */
+#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */
+#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */
+#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */
+#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */
+#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */
+#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */
+#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */
+#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */
+#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */
+#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */
+#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */
+#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */
+#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */
+#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */
+#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */
+#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */
+#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */
+
+#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1)
+
+/*
+ * External API name for Thread_Control
+ */
+
+typedef Thread_Control rtems_tcb;
+
+/*
+ * The following defines the "return type" of an RTEMS task.
+ */
+
+typedef void rtems_task;
+
+/*
+ * The following defines the argument to an RTEMS task.
+ */
+
+typedef unsigned32 rtems_task_argument;
+
+/*
+ * The following defines the type for the entry point of an RTEMS task.
+ */
+
+typedef rtems_task ( *rtems_task_entry )(
+ rtems_task_argument
+ );
+
+/*
+ * The following records define the Initialization Tasks Table.
+ * Each entry contains the information required by RTEMS to
+ * create and start a user task automatically at executive
+ * initialization time.
+ */
+
+typedef struct {
+ rtems_name name; /* task name */
+ unsigned32 stack_size; /* task stack size */
+ rtems_task_priority initial_priority; /* task priority */
+ rtems_attribute attribute_set; /* task attributes */
+ rtems_task_entry entry_point; /* task entry point */
+ rtems_mode mode_set; /* task initial mode */
+ unsigned32 argument; /* task argument */
+} rtems_initialization_tasks_table;
+
+/*
+ * This is the API specific information required by each thread for
+ * the RTEMS API to function correctly.
+ */
+
+
+typedef struct {
+ unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
+ rtems_event_set pending_events;
+ rtems_event_set event_condition;
+ ASR_Information Signal;
+} RTEMS_API_Control;
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _RTEMS_tasks_Information;
+
+/*
+ * These are used to manage the user initialization tasks.
+ */
+
+EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks;
+EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks;
+
+/*
+ * _RTEMS_tasks_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all Task Manager related data structures.
+ */
+
+void _RTEMS_tasks_Manager_initialization(
+ unsigned32 maximum_tasks,
+ unsigned32 number_of_initialization_tasks,
+ rtems_initialization_tasks_table *user_tasks
+);
+
+/*
+ * rtems_task_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_create directive. The task
+ * will have the name name. The attribute_set can be used to indicate
+ * that the task will be globally accessible or utilize floating point.
+ * The task's stack will be stack_size bytes. The task will begin
+ * execution with initial_priority and initial_modes. It returns the
+ * id of the created task in ID.
+ */
+
+rtems_status_code rtems_task_create(
+ rtems_name name,
+ rtems_task_priority initial_priority,
+ unsigned32 stack_size,
+ rtems_mode initial_modes,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_ident directive.
+ * This directive returns the task ID associated with name.
+ * If more than one task is named name, then the task to
+ * which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the task named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ */
+
+rtems_status_code rtems_task_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * rtems_task_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_delete directive. The
+ * task indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_task_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_get_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_get_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_get_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 *note
+);
+
+/*
+ * rtems_task_set_note
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_note directive. The
+ * value of the indicated notepad for the task associated with ID
+ * is returned in note.
+ */
+
+rtems_status_code rtems_task_set_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 note
+);
+
+/*
+ * rtems_task_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_mode directive. The current
+ * values of the modes indicated by mask of the calling task are changed
+ * to that indicated in mode_set. The former mode of the task is
+ * returned in mode_set.
+ */
+
+rtems_status_code rtems_task_mode(
+ rtems_mode mode_set,
+ rtems_mode mask,
+ rtems_mode *previous_mode_set
+);
+
+/*
+ * rtems_task_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_restart directive. The
+ * task associated with ID is restarted at its initial entry
+ * point with the new argument.
+ */
+
+rtems_status_code rtems_task_restart(
+ Objects_Id id,
+ unsigned32 arg
+);
+
+/*
+ * rtems_task_suspend
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_suspend directive. The
+ * SUSPENDED state is set for task associated with ID.
+ */
+
+rtems_status_code rtems_task_suspend(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_resume Directive. The
+ * SUSPENDED state is cleared for task associated with ID.
+ */
+
+rtems_status_code rtems_task_resume(
+ Objects_Id id
+);
+
+/*
+ * rtems_task_set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_set_priority directive. The
+ * current priority of the task associated with ID is set to
+ * new_priority. The former priority of that task is returned
+ * in old_priority.
+ */
+
+rtems_status_code rtems_task_set_priority(
+ Objects_Id id,
+ rtems_task_priority new_priority,
+ rtems_task_priority *old_priority
+);
+
+/*
+ * rtems_task_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_start directive. The
+ * starting execution point of the task associated with ID is
+ * set to entry_point with the initial argument.
+ */
+
+rtems_status_code rtems_task_start(
+ Objects_Id id,
+ rtems_task_entry entry_point,
+ unsigned32 argument
+);
+
+/*
+ * rtems_task_wake_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_when directive. The
+ * calling task is blocked until the current time of day is
+ * equal to that indicated by time_buffer.
+ */
+
+rtems_status_code rtems_task_wake_when(
+ rtems_time_of_day *time_buffer
+);
+
+/*
+ * rtems_task_wake_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_task_wake_after directive. The
+ * calling task is blocked until the indicated number of clock
+ * ticks have occurred.
+ */
+
+rtems_status_code rtems_task_wake_after(
+ rtems_interval ticks
+);
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Initialize_user_tasks
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Initialize_user_tasks( void );
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/tasks.inl>
+#endif
+#include <rtems/rtems/taskmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/timer.h b/cpukit/rtems/include/rtems/rtems/timer.h
new file mode 100644
index 0000000000..d09b80d5ff
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/timer.h
@@ -0,0 +1,207 @@
+/* timer.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the Timer Manager. This manager provides
+ * facilities to configure, initiate, cancel, and delete timers which will
+ * fire at specified intervals of time.
+ *
+ * Directives provided are:
+ *
+ * + create a timer
+ * + get an ID of a timer
+ * + delete a timer
+ * + set a timer to fire after a number of ticks have passed
+ * + set a timer to fire when a specified date and time has been reached
+ * + reset a timer
+ * + cancel a time
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TIMER_h
+#define __RTEMS_TIMER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type details the classes to which a timer
+ * may belong.
+ */
+
+typedef enum {
+ TIMER_INTERVAL,
+ TIMER_TIME_OF_DAY,
+ TIMER_DORMANT
+} Timer_Classes;
+
+/*
+ * The following types define a pointer to a timer service routine.
+ */
+
+typedef void rtems_timer_service_routine;
+
+typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
+ rtems_id,
+ void *
+ );
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Timer_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each timer.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ Watchdog_Control Ticker;
+ Timer_Classes the_class;
+} Timer_Control;
+
+/*
+ * _Timer_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+);
+
+/*
+ * rtems_timer_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_create directive. The
+ * timer will have the name name. It returns the id of the
+ * created timer in ID.
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_ident directive.
+ * This directive returns the timer ID associated with name.
+ * If more than one timer is named name, then the timer
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_timer_cancel
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_cancel directive. It is used
+ * to stop the timer associated with ID from firing.
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_delete directive. The
+ * timer indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+);
+
+/*
+ * rtems_timer_fire_after
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_after directive. It
+ * initiates the timer associated with ID to fire in ticks clock
+ * ticks. When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_fire_when
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_fire_when directive. It
+ * initiates the timer associated with ID to fire at wall_time
+ * When the timer fires, the routine will be invoked.
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+);
+
+/*
+ * rtems_timer_reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_timer_reset directive. It is used
+ * to reinitialize the interval timer associated with ID just as if
+ * rtems_timer_fire_after were re-invoked with the same arguments that
+ * were used to initiate this timer.
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/timer.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/types.h b/cpukit/rtems/include/rtems/rtems/types.h
new file mode 100644
index 0000000000..1dc8cd5373
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/types.h
@@ -0,0 +1,96 @@
+/* types.h
+ *
+ * This include file defines the types used by the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_RTEMS_TYPES_h
+#define __RTEMS_RTEMS_TYPES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+
+/*
+ * RTEMS basic type definitions
+ */
+
+typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */
+typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */
+typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */
+
+typedef signed8 rtems_signed8; /* signed 8-bit value */
+typedef signed16 rtems_signed16; /* signed 16-bit value */
+typedef signed32 rtems_signed32; /* signed 32-bit value */
+
+/*
+ * some C++ compilers (eg: HP's) don't do 'long long'
+ */
+#if defined(__GNUC__)
+typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */
+typedef signed64 rtems_signed64; /* signed 64-bit value */
+#endif
+
+typedef single_precision rtems_single; /* single precision float */
+typedef double_precision rtems_double; /* double precision float */
+
+typedef boolean rtems_boolean;
+
+typedef unsigned32 rtems_name;
+typedef Objects_Id rtems_id;
+
+typedef Context_Control rtems_context;
+typedef Context_Control_fp rtems_context_fp;
+typedef CPU_Interrupt_frame rtems_interrupt_frame;
+
+/*
+ * Time related
+ */
+
+typedef Watchdog_Interval rtems_interval;
+typedef TOD_Control rtems_time_of_day;
+
+/*
+ * Define the type for an RTEMS API task mode.
+ */
+
+typedef Modes_Control rtems_mode;
+
+/*
+ * MPCI related entries
+ */
+
+typedef MP_packet_Classes rtems_mp_packet_classes;
+typedef MP_packet_Prefix rtems_packet_prefix;
+
+typedef MPCI_initialization_entry rtems_mpci_initialization_entry;
+typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry;
+typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry;
+typedef MPCI_send_entry rtems_mpci_send_packet_entry;
+typedef MPCI_receive_entry rtems_mpci_receive_packet_entry;
+
+typedef MPCI_Entry rtems_mpci_entry;
+
+typedef MPCI_Control rtems_mpci_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/asr.inl b/cpukit/rtems/inline/rtems/rtems/asr.inl
new file mode 100644
index 0000000000..fc52778875
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/asr.inl
@@ -0,0 +1,128 @@
+/* inline/asr.inl
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_inl
+#define __INLINE_ASR_inl
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the given RTEMS_ASR information record.
+ */
+
+STATIC INLINE void _ASR_Initialize (
+ ASR_Information *information
+)
+{
+ information->is_enabled = TRUE;
+ information->handler = NULL;
+ information->mode_set = RTEMS_DEFAULT_MODES;
+ information->signals_posted = 0;
+ information->signals_pending = 0;
+ information->nest_level = 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine atomically swaps the pending and posted signal
+ * sets. This is done when the thread alters its mode in such a
+ * way that the RTEMS_ASR disable/enable flag changes.
+ */
+
+STATIC INLINE void _ASR_Swap_signals (
+ ASR_Information *information
+)
+{
+ rtems_signal_set _signals;
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ _signals = information->signals_pending;
+ information->signals_pending = information->signals_posted;
+ information->signals_posted = _signals;
+ _ISR_Enable( _level );
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given asr_handler is NULL and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Is_null_handler (
+ rtems_asr_entry asr_handler
+)
+{
+ return asr_handler == NULL;
+}
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there are signals pending in the
+ * given RTEMS_ASR information record and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ASR_Are_signals_pending (
+ ASR_Information *information
+)
+{
+ return information->signals_posted != 0;
+}
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given signals into the signal_set
+ * passed in. The result is returned to the user in signal_set.
+ *
+ * NOTE: This must be implemented as a macro.
+ */
+
+STATIC INLINE void _ASR_Post_signals(
+ rtems_signal_set signals,
+ rtems_signal_set *signal_set
+)
+{
+ ISR_Level _level;
+
+ _ISR_Disable( _level );
+ *signal_set |= signals;
+ _ISR_Enable( _level );
+}
+
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/attr.inl b/cpukit/rtems/inline/rtems/rtems/attr.inl
new file mode 100644
index 0000000000..53c613382f
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/attr.inl
@@ -0,0 +1,159 @@
+/* inline/attr.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ATTRIBUTES_inl
+#define __INLINE_ATTRIBUTES_inl
+
+/*PAGE
+ *
+ * _Attributes_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Set (
+ rtems_attribute new_attributes,
+ rtems_attribute attribute_set
+)
+{
+ return attribute_set | new_attributes;
+}
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the requested new_attributes in the attribute_set
+ * passed in. The result is returned to the user.
+ */
+
+STATIC INLINE rtems_attribute _Attributes_Clear (
+ rtems_attribute attribute_set,
+ rtems_attribute mask
+)
+{
+ return attribute_set & ~mask;
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_floating_point(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_FLOATING_POINT );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the global object attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_global(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_GLOBAL );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the binary semaphore attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_binary_semaphore(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_BINARY_SEMAPHORE );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority inheritance attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_inherit_priority(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_INHERIT_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority ceiling attribute
+ * is enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Attributes_Is_priority_ceiling(
+ rtems_attribute attribute_set
+)
+{
+ return ( attribute_set & RTEMS_PRIORITY_CEILING );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/dpmem.inl b/cpukit/rtems/inline/rtems/rtems/dpmem.inl
new file mode 100644
index 0000000000..4bd13bcd80
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/dpmem.inl
@@ -0,0 +1,95 @@
+/* inline/dpmem.inl
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_DPMEM_inl
+#define __INLINE_DPMEM_inl
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a port control block from the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE Dual_ported_memory_Control
+ *_Dual_ported_memory_Allocate ( void )
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Allocate( &_Dual_ported_memory_Information );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a port control block to the inactive chain
+ * of free port control blocks.
+ */
+
+STATIC INLINE void _Dual_ported_memory_Free (
+ Dual_ported_memory_Control *the_port
+)
+{
+ _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps port IDs to port control blocks. If ID
+ * corresponds to a local port, then it returns the_port control
+ * pointer which maps to ID and location is set to OBJECTS_LOCAL.
+ * Global ports are not supported, thus if ID does not map to a
+ * local port, location is set to OBJECTS_ERROR and the_port is
+ * undefined.
+ */
+
+STATIC INLINE Dual_ported_memory_Control *_Dual_ported_memory_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Dual_ported_memory_Control *)
+ _Objects_Get( &_Dual_ported_memory_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_port is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Dual_ported_memory_Is_null(
+ Dual_ported_memory_Control *the_port
+)
+{
+ return ( the_port == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/event.inl b/cpukit/rtems/inline/rtems/rtems/event.inl
new file mode 100644
index 0000000000..1f41e0a5fc
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/event.inl
@@ -0,0 +1,21 @@
+/* inline/event.inl
+ *
+ * This include file contains the static inline implementation of
+ * macros for the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_inl
+#define __MACROS_EVENT_inl
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/eventset.inl b/cpukit/rtems/inline/rtems/rtems/eventset.inl
new file mode 100644
index 0000000000..ec0789b207
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/eventset.inl
@@ -0,0 +1,91 @@
+/* inline/eventset.inl
+ *
+ * This include file contains the information pertaining to event sets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_EVENT_SET_inl
+#define __INLINE_EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if on events are posted in the event_set,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Event_sets_Is_empty(
+ rtems_event_set the_event_set
+)
+{
+ return ( the_event_set == 0 );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Post
+ *
+ * DESCRIPTION:
+ *
+ * This routine posts the given new_events into the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE void _Event_sets_Post(
+ rtems_event_set the_new_events,
+ rtems_event_set *the_event_set
+)
+{
+ *the_event_set |= the_new_events;
+}
+
+/*PAGE
+ *
+ * _Event_sets_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the events in event_condition which are
+ * set in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Get(
+ rtems_event_set the_event_set,
+ rtems_event_set the_event_condition
+)
+{
+ return ( the_event_set & the_event_condition );
+}
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the events in mask from the event_set
+ * passed in. The result is returned to the user in event_set.
+ */
+
+STATIC INLINE rtems_event_set _Event_sets_Clear(
+ rtems_event_set the_event_set,
+ rtems_event_set the_mask
+)
+{
+ return ( the_event_set & ~(the_mask) );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/message.inl b/cpukit/rtems/inline/rtems/rtems/message.inl
new file mode 100644
index 0000000000..c34ad5082a
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/message.inl
@@ -0,0 +1,83 @@
+/* message.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+#include <rtems/score/wkspace.h>
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE boolean _Message_queue_Is_null (
+ Message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a message queue control block into
+ * the inactive chain of free message queue control blocks.
+ */
+
+STATIC INLINE void _Message_queue_Free (
+ Message_queue_Control *the_message_queue
+)
+{
+ _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
+}
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps message queue IDs to message queue control
+ * blocks. If ID corresponds to a local message queue, then it
+ * returns the_message_queue control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the message queue ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_message_queue is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_message_queue is undefined.
+ */
+
+STATIC INLINE Message_queue_Control *_Message_queue_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Message_queue_Control *)
+ _Objects_Get( &_Message_queue_Information, id, location );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/modes.inl b/cpukit/rtems/inline/rtems/rtems/modes.inl
new file mode 100644
index 0000000000..803febd49a
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/modes.inl
@@ -0,0 +1,152 @@
+/* modes.inl
+ *
+ * This include file contains the static inline implementation of the
+ * inlined routines in the Mode Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the mode flags in mask
+ * are set in mode_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Mask_changed (
+ Modes_Control mode_set,
+ Modes_Control masks
+)
+{
+ return ( mode_set & masks );
+}
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that Asynchronous
+ * Signal Processing is disabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_asr_disabled (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that preemption
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_preempt (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
+}
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if mode_set indicates that timeslicing
+ * is enabled, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Modes_Is_timeslice (
+ Modes_Control mode_set
+)
+{
+ return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
+}
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the interrupt level portion of the mode_set.
+ */
+
+STATIC INLINE ISR_Level _Modes_Get_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ return ( mode_set & RTEMS_INTERRUPT_MASK );
+}
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * in the mode_set.
+ */
+
+STATIC INLINE void _Modes_Set_interrupt_level (
+ Modes_Control mode_set
+)
+{
+ _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) );
+}
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the modes in old_mode_set indicated by
+ * mask to the requested values in new_mode_set. The resulting
+ * mode set is returned in out_mode_set and the modes that changed
+ * is returned in changed.
+ */
+
+STATIC INLINE void _Modes_Change (
+ Modes_Control old_mode_set,
+ Modes_Control new_mode_set,
+ Modes_Control mask,
+ Modes_Control *out_mode_set,
+ Modes_Control *changed
+)
+{
+ Modes_Control _out_mode;
+
+ _out_mode = old_mode_set;
+ _out_mode &= ~mask;
+ _out_mode |= new_mode_set & mask;
+ *changed = _out_mode ^ old_mode_set;
+ *out_mode_set = _out_mode;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/options.inl b/cpukit/rtems/inline/rtems/rtems/options.inl
new file mode 100644
index 0000000000..9dba30e895
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/options.inl
@@ -0,0 +1,55 @@
+/* options.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_NO_WAIT option is enabled in
+ * option_set, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_no_wait (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_NO_WAIT);
+}
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the RTEMS_EVENT_ANY option is enabled in
+ * OPTION_SET, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Options_Is_any (
+ rtems_option option_set
+)
+{
+ return (option_set & RTEMS_EVENT_ANY);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/part.inl b/cpukit/rtems/inline/rtems/rtems/part.inl
new file mode 100644
index 0000000000..9088755aa7
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/part.inl
@@ -0,0 +1,199 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a buffer from the_partition.
+ * If successful, it returns the address of the allocated buffer.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Partition_Allocate_buffer (
+ Partition_Control *the_partition
+)
+{
+ return _Chain_Get( &the_partition->Memory );
+}
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees the_buffer to the_partition.
+ */
+
+STATIC INLINE void _Partition_Free_buffer (
+ Partition_Control *the_partition,
+ Chain_Node *the_buffer
+)
+{
+ _Chain_Append( &the_partition->Memory, the_buffer );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is on a valid buffer
+ * boundary for the_partition, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_on_boundary (
+ void *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ unsigned32 offset;
+
+ offset = (unsigned32) _Addresses_Subtract(
+ the_buffer,
+ the_partition->starting_address
+ );
+
+ return ((offset % the_partition->buffer_size) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_buffer is a valid buffer from
+ * the_partition, otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_valid (
+ Chain_Node *the_buffer,
+ Partition_Control *the_partition
+)
+{
+ void *starting;
+ void *ending;
+
+ starting = the_partition->starting_address;
+ ending = _Addresses_Add_offset( starting, the_partition->length );
+
+ return (
+ _Addresses_Is_in_range( the_buffer, starting, ending ) &&
+ _Partition_Is_buffer_on_boundary( the_buffer, the_partition )
+ );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the use of the specified buffer_size
+ * will result in the allocation of buffers whose first byte is
+ * properly aligned, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_buffer_size_aligned (
+ unsigned32 buffer_size
+)
+{
+ return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
+}
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a partition control block from
+ * the inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Allocate ( void )
+{
+ return (Partition_Control *) _Objects_Allocate( &_Partition_Information );
+}
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a partition control block to the
+ * inactive chain of free partition control blocks.
+ */
+
+STATIC INLINE void _Partition_Free (
+ Partition_Control *the_partition
+)
+{
+ _Objects_Free( &_Partition_Information, &the_partition->Object );
+}
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps partition IDs to partition control blocks.
+ * If ID corresponds to a local partition, then it returns
+ * the_partition control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. If the partition ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_partition is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_partition is undefined.
+ */
+
+STATIC INLINE Partition_Control *_Partition_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Partition_Control *)
+ _Objects_Get( &_Partition_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_partition is NULL
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Partition_Is_null (
+ Partition_Control *the_partition
+)
+{
+ return ( the_partition == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/ratemon.inl b/cpukit/rtems/inline/rtems/rtems/ratemon.inl
new file mode 100644
index 0000000000..0450988329
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/ratemon.inl
@@ -0,0 +1,143 @@
+/* ratemon.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Allocate( &_Rate_monotonic_Information );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a period control block from
+ * the inactive chain of free period control blocks.
+ */
+
+STATIC INLINE void _Rate_monotonic_Free (
+ Rate_monotonic_Control *the_period
+)
+{
+ _Objects_Free( &_Rate_monotonic_Information, &the_period->Object );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps period IDs to period control blocks.
+ * If ID corresponds to a local period, then it returns
+ * the_period control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_period is undefined.
+ */
+
+STATIC INLINE Rate_monotonic_Control *_Rate_monotonic_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Rate_monotonic_Control *)
+ _Objects_Get( &_Rate_monotonic_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_active (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_ACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the ACTIVE state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_inactive (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_INACTIVE);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is in the EXPIRED state,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_expired (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period->state == RATE_MONOTONIC_EXPIRED);
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_period is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Rate_monotonic_Is_null (
+ Rate_monotonic_Control *the_period
+)
+{
+ return (the_period == NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/region.inl b/cpukit/rtems/inline/rtems/rtems/region.inl
new file mode 100644
index 0000000000..aae042bed4
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/region.inl
@@ -0,0 +1,127 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a region control block from
+ * the inactive chain of free region control blocks.
+ */
+
+STATIC INLINE Region_Control *_Region_Allocate( void )
+{
+ return (Region_Control *) _Objects_Allocate( &_Region_Information );
+}
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a region control block to the
+ * inactive chain of free region control blocks.
+ */
+
+STATIC INLINE void _Region_Free (
+ Region_Control *the_region
+)
+{
+ _Objects_Free( &_Region_Information, &the_region->Object );
+}
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps region IDs to region control blocks.
+ * If ID corresponds to a local region, then it returns
+ * the_region control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the_region is undefined.
+ */
+
+STATIC INLINE Region_Control *_Region_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Region_Control *)
+ _Objects_Get( &_Region_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a segment from the_region.
+ * If successful, it returns the address of the allocated segment.
+ * Otherwise, it returns NULL.
+ */
+
+STATIC INLINE void *_Region_Allocate_segment (
+ Region_Control *the_region,
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &the_region->Memory, size );
+}
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the_segment to the_region.
+ */
+
+STATIC INLINE boolean _Region_Free_segment (
+ Region_Control *the_region,
+ void *the_segment
+)
+{
+ return _Heap_Free( &the_region->Memory, the_segment );
+}
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_region is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Region_Is_null (
+ Region_Control *the_region
+)
+{
+ return ( the_region == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/sem.inl b/cpukit/rtems/inline/rtems/rtems/sem.inl
new file mode 100644
index 0000000000..c80431f9b1
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/sem.inl
@@ -0,0 +1,93 @@
+/* sem.inl
+ *
+ * This file contains the static inlin implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a semaphore control block from
+ * the inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Allocate( void )
+{
+ return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a semaphore control block to the
+ * inactive chain of free semaphore control blocks.
+ */
+
+STATIC INLINE void _Semaphore_Free (
+ Semaphore_Control *the_semaphore
+)
+{
+ _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps semaphore IDs to semaphore control blocks.
+ * If ID corresponds to a local semaphore, then it returns
+ * the_semaphore control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the semaphore ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_semaphore is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_semaphore is undefined.
+ */
+
+STATIC INLINE Semaphore_Control *_Semaphore_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Semaphore_Control *)
+ _Objects_Get( &_Semaphore_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Semaphore_Is_null (
+ Semaphore_Control *the_semaphore
+)
+{
+ return ( the_semaphore == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/status.inl b/cpukit/rtems/inline/rtems/rtems/status.inl
new file mode 100644
index 0000000000..f85b4c6d0b
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/status.inl
@@ -0,0 +1,56 @@
+/* inline/status.inl
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_STATUS_inl
+#define __INLINE_STATUS_inl
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_is_status_successful(
+ rtems_status_code code
+)
+{
+ return (code == RTEMS_SUCCESSFUL);
+}
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code1 is equal to code2,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean rtems_are_statuses_equal(
+ rtems_status_code code1,
+ rtems_status_code code2
+)
+{
+ return (code1 == code2);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/support.inl b/cpukit/rtems/inline/rtems/rtems/support.inl
new file mode 100644
index 0000000000..856b24e7f9
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/support.inl
@@ -0,0 +1,61 @@
+/* support.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the name is valid, and FALSE otherwise.
+ */
+
+STATIC INLINE rtems_boolean rtems_is_name_valid (
+ rtems_name name
+)
+{
+ return ( name != 0 );
+}
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ * DESCRIPTION:
+ *
+ * This function breaks the object name into the four component
+ * characters C1, C2, C3, and C4.
+ */
+
+STATIC INLINE void rtems_name_to_characters(
+ rtems_name name,
+ char *c1,
+ char *c2,
+ char *c3,
+ char *c4
+)
+{
+ *c1 = (name >> 24) & 0xff;
+ *c2 = (name >> 16) & 0xff;
+ *c3 = (name >> 8) & 0xff;
+ *c4 = name & 0xff;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/tasks.inl b/cpukit/rtems/inline/rtems/rtems/tasks.inl
new file mode 100644
index 0000000000..6caa34ea80
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/tasks.inl
@@ -0,0 +1,90 @@
+/* tasks.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a task control block from
+ * the inactive chain of free task control blocks.
+ */
+
+STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a task control block to the
+ * inactive chain of free task control blocks.
+ */
+
+STATIC INLINE void _RTEMS_tasks_Free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free(
+ _Objects_Get_information( the_task->Object.id ),
+ &the_task->Object
+ );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ *
+ * DESCRIPTION:
+ *
+ * This function converts an RTEMS API priority into a core priority.
+ */
+
+STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core(
+ rtems_task_priority priority
+)
+{
+ return (Priority_Control) priority;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority is a valid user task priority
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid (
+ rtems_task_priority the_priority
+)
+{
+ return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
+ ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/inline/rtems/rtems/timer.inl b/cpukit/rtems/inline/rtems/rtems/timer.inl
new file mode 100644
index 0000000000..dedcdffa36
--- /dev/null
+++ b/cpukit/rtems/inline/rtems/rtems/timer.inl
@@ -0,0 +1,142 @@
+/* timer.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a timer control block from
+ * the inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Allocate( void )
+{
+ return (Timer_Control *) _Objects_Allocate( &_Timer_Information );
+}
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a timer control block to the
+ * inactive chain of free timer control blocks.
+ */
+
+STATIC INLINE void _Timer_Free (
+ Timer_Control *the_timer
+)
+{
+ _Objects_Free( &_Timer_Information, &the_timer->Object );
+}
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps timer IDs to timer control blocks.
+ * If ID corresponds to a local timer, then it returns
+ * the timer control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Timer_Control *_Timer_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Timer_Control *)
+ _Objects_Get( &_Timer_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_interval_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_INTERVAL );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of an INTERVAL
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_timer_of_day_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_TIME_OF_DAY );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is that of a DORMANT
+ * timer, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_dormant_class (
+ Timer_Classes the_class
+)
+{
+ return ( the_class == TIMER_DORMANT );
+}
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_timer is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Timer_Is_null (
+ Timer_Control *the_timer
+)
+{
+ return ( the_timer == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/asr.inl b/cpukit/rtems/macros/rtems/rtems/asr.inl
new file mode 100644
index 0000000000..d6806b00f6
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/asr.inl
@@ -0,0 +1,90 @@
+/* macros/asr.h
+ *
+ * This include file contains the implemenation of all routines
+ * associated with the asynchronous signal handler which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ASR_h
+#define __INLINE_ASR_h
+
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _ASR_Initialize
+ *
+ */
+
+#define _ASR_Initialize( _information ) \
+{ \
+ (_information)->is_enabled = TRUE; \
+ (_information)->handler = NULL; \
+ (_information)->mode_set = RTEMS_DEFAULT_MODES; \
+ (_information)->signals_posted = 0; \
+ (_information)->signals_pending = 0; \
+ (_information)->nest_level = 0; \
+}
+
+/*PAGE
+ *
+ * _ASR_Swap_signals
+ *
+ */
+
+#define _ASR_Swap_signals( _information ) \
+{ \
+ rtems_signal_set _signals; \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ _signals = (_information)->signals_pending; \
+ (_information)->signals_pending = (_information)->signals_posted; \
+ (_information)->signals_posted = _signals; \
+ _ISR_Enable( _level ); \
+}
+
+/*PAGE
+ *
+ * _ASR_Is_null_handler
+ *
+ */
+
+#define _ASR_Is_null_handler( _asr_handler ) \
+ ( (_asr_handler) == NULL )
+
+/*PAGE
+ *
+ * _ASR_Are_signals_pending
+ *
+ */
+
+#define _ASR_Are_signals_pending( _information ) \
+ ( (_information)->signals_posted != 0 )
+
+/*PAGE
+ *
+ * _ASR_Post_signals
+ *
+ */
+
+#define _ASR_Post_signals( _signals, _signal_set ) \
+ do { \
+ ISR_Level _level; \
+ \
+ _ISR_Disable( _level ); \
+ *(_signal_set) |= (_signals); \
+ _ISR_Enable( _level ); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/attr.inl b/cpukit/rtems/macros/rtems/rtems/attr.inl
new file mode 100644
index 0000000000..27231871ba
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/attr.inl
@@ -0,0 +1,91 @@
+/* macros/attr.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with attributes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ATTRIBUTES_h
+#define __MACROS_ATTRIBUTES_h
+
+/*PAGE
+ *
+ * _Attributes_Set
+ */
+
+#define _Attributes_Set( _new_attributes, _attribute_set ) \
+ ( (_attribute_set) | (_new_attributes) )
+
+/*PAGE
+ *
+ * _Attributes_Clear
+ */
+
+#define _Attributes_Clear( _attribute_set, _mask ) \
+ ( (_attribute_set) & ~(_mask) )
+
+/*PAGE
+ *
+ * _Attributes_Is_floating_point
+ *
+ */
+
+#define _Attributes_Is_floating_point( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_FLOATING_POINT )
+
+/*PAGE
+ *
+ * _Attributes_Is_global
+ *
+ */
+
+#define _Attributes_Is_global( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_GLOBAL )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority
+ *
+ */
+
+#define _Attributes_Is_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_binary_semaphore
+ *
+ */
+
+#define _Attributes_Is_binary_semaphore( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_BINARY_SEMAPHORE )
+
+/*PAGE
+ *
+ * _Attributes_Is_inherit_priority
+ *
+ */
+
+#define _Attributes_Is_inherit_priority( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_INHERIT_PRIORITY )
+
+/*PAGE
+ *
+ * _Attributes_Is_priority_ceiling
+ *
+ */
+
+#define _Attributes_Is_priority_ceiling( _attribute_set ) \
+ ( (_attribute_set) & RTEMS_PRIORITY_CEILING )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/dpmem.inl b/cpukit/rtems/macros/rtems/rtems/dpmem.inl
new file mode 100644
index 0000000000..3e1d7bce95
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/dpmem.inl
@@ -0,0 +1,59 @@
+/* macros/dpmem.h
+ *
+ * This include file contains the inline routine used in conjunction
+ * with the Dual Ported Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_DPMEM_h
+#define __MACROS_DPMEM_h
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Allocate
+ *
+ */
+
+#define _Dual_ported_memory_Allocate() \
+ (Dual_ported_memory_Control *) \
+ _Objects_Allocate( &_Dual_ported_memory_Information )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Free
+ *
+ */
+
+#define _Dual_ported_memory_Free( _the_port ) \
+ _Objects_Free( &_Dual_ported_memory_Information, &(_the_port)->Object )
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Get
+ *
+ */
+
+#define _Dual_ported_memory_Get( _id, _location ) \
+ (Dual_ported_memory_Control *) \
+ _Objects_Get( &_Dual_ported_memory_Information, (_id), (_location) )
+
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Is_null
+ */
+
+#define _Dual_ported_memory_Is_null( _the_port ) \
+ ( (_the_port) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/event.inl b/cpukit/rtems/macros/rtems/rtems/event.inl
new file mode 100644
index 0000000000..e37f6813bf
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/event.inl
@@ -0,0 +1,21 @@
+/* macros/event.h
+ *
+ * This include file contains the implementation of macros for
+ * the Event Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_EVENT_h
+#define __MACROS_EVENT_h
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/eventset.inl b/cpukit/rtems/macros/rtems/rtems/eventset.inl
new file mode 100644
index 0000000000..1803d18637
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/eventset.inl
@@ -0,0 +1,53 @@
+/* eventset.inl
+ *
+ * This include file contains the macro implementation of inlined
+ * routines in the event set object.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EVENT_SET_inl
+#define __EVENT_SET_inl
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Is_empty( _the_event_set ) \
+ ((_the_event_set) == 0 )
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Post( _the_new_events, _the_event_set ) \
+ *(_the_event_set) |= (_the_new_events)
+
+/*PAGE
+ *
+ * _Event_sets_Is_empty
+ */
+
+#define _Event_sets_Get( _the_event_set, _the_event_condition ) \
+ ((_the_event_set) & (_the_event_condition))
+
+/*PAGE
+ *
+ * _Event_sets_Clear
+ */
+
+#define _Event_sets_Clear( _the_event_set, _the_mask ) \
+ ((_the_event_set) & ~(_the_mask))
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/message.inl b/cpukit/rtems/macros/rtems/rtems/message.inl
new file mode 100644
index 0000000000..62b6ac0ceb
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/message.inl
@@ -0,0 +1,49 @@
+/* message.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Message Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MESSAGE_QUEUE_inl
+#define __MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _Message_queue_Is_null
+ *
+ */
+
+#define _Message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _Message_queue_Free
+ *
+ */
+
+#define _Message_queue_Free( _the_message_queue ) \
+ _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
+
+/*PAGE
+ *
+ * _Message_queue_Get
+ *
+ */
+
+#define _Message_queue_Get( _id, _location ) \
+ (Message_queue_Control *) \
+ _Objects_Get( &_Message_queue_Information, (_id), (_location) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/modes.inl b/cpukit/rtems/macros/rtems/rtems/modes.inl
new file mode 100644
index 0000000000..a7dea6516d
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/modes.inl
@@ -0,0 +1,92 @@
+/* modes.inl
+ *
+ * This include file contains the macro implementation of the
+ * inlined routines in the Mode Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MODES_inl
+#define __MODES_inl
+
+/*PAGE
+ *
+ * _Modes_Mask_changed
+ *
+ */
+
+#define _Modes_Mask_changed( _mode_set, _masks ) \
+ ( (_mode_set) & (_masks) )
+
+/*PAGE
+ *
+ * _Modes_Is_asr_disabled
+ *
+ */
+
+#define _Modes_Is_asr_disabled( _mode_set ) \
+ (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR)
+
+/*PAGE
+ *
+ * _Modes_Is_preempt
+ *
+ */
+
+#define _Modes_Is_preempt( _mode_set ) \
+ ( ( (_mode_set) & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT )
+
+/*PAGE
+ *
+ * _Modes_Is_timeslice
+ *
+ */
+
+#define _Modes_Is_timeslice( _mode_set ) \
+ (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE)
+
+/*PAGE
+ *
+ * _Modes_Get_interrupt_level
+ *
+ */
+
+#define _Modes_Get_interrupt_level( _mode_set ) \
+ ( (_mode_set) & RTEMS_INTERRUPT_MASK )
+
+/*PAGE
+ *
+ * _Modes_Set_interrupt_level
+ *
+ */
+
+#define _Modes_Set_interrupt_level( _mode_set ) \
+ _ISR_Set_level( _Modes_Get_interrupt_level( (_mode_set) ) )
+
+/*PAGE
+ *
+ * _Modes_Change
+ *
+ */
+
+#define _Modes_Change( _old_mode_set, _new_mode_set, \
+ _mask, _out_mode_set, _changed ) \
+ { Modes_Control _out_mode; \
+ \
+ _out_mode = (_old_mode_set); \
+ _out_mode &= ~(_mask); \
+ _out_mode |= (_new_mode_set) & (_mask); \
+ *(_changed) = _out_mode ^ (_old_mode_set); \
+ *(_out_mode_set) = _out_mode; \
+ }
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/options.inl b/cpukit/rtems/macros/rtems/rtems/options.inl
new file mode 100644
index 0000000000..7c14e4fe4f
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/options.inl
@@ -0,0 +1,39 @@
+/* options.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Options Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OPTIONS_inl
+#define __OPTIONS_inl
+
+/*PAGE
+ *
+ * _Options_Is_no_wait
+ *
+ */
+
+#define _Options_Is_no_wait( _option_set ) \
+ ( (_option_set) & RTEMS_NO_WAIT )
+
+/*PAGE
+ *
+ * _Options_Is_any
+ *
+ */
+
+#define _Options_Is_any( _option_set ) \
+ ( (_option_set) & RTEMS_EVENT_ANY )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/part.inl b/cpukit/rtems/macros/rtems/rtems/part.inl
new file mode 100644
index 0000000000..55c188b210
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/part.inl
@@ -0,0 +1,117 @@
+/* part.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Partition Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PARTITION_inl
+#define __PARTITION_inl
+
+/*PAGE
+ *
+ * _Partition_Allocate_buffer
+ *
+ */
+
+#define _Partition_Allocate_buffer( _the_partition ) \
+ _Chain_Get( &(_the_partition)->Memory )
+
+/*PAGE
+ *
+ * _Partition_Free_buffer
+ *
+ */
+
+#define _Partition_Free_buffer( _the_partition, _the_buffer ) \
+ _Chain_Append( &(_the_partition)->Memory, (_the_buffer) )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_on_boundary
+ *
+ */
+
+#define _Partition_Is_buffer_on_boundary( _the_buffer, _the_partition ) \
+ ((((unsigned32) _Addresses_Subtract( \
+ (_the_buffer), \
+ (_the_partition)->starting_address ) \
+ ) % \
+ (_the_partition)->buffer_size) == 0)
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_valid
+ *
+ */
+
+#define _Partition_Is_buffer_valid( _the_buffer, _the_partition ) \
+ ( \
+ _Addresses_Is_in_range( \
+ (_the_buffer), \
+ (_the_partition)->starting_address, \
+ _Addresses_Add_offset( \
+ (_the_partition)->starting_address, \
+ (_the_partition)->length \
+ ) \
+ ) && \
+ _Partition_Is_buffer_on_boundary( (_the_buffer), (_the_partition) ) \
+ )
+
+/*PAGE
+ *
+ * _Partition_Is_buffer_size_aligned
+ *
+ */
+
+#define _Partition_Is_buffer_size_aligned( _buffer_size ) \
+ ((_buffer_size) % CPU_PARTITION_ALIGNMENT == 0)
+
+/*PAGE
+ *
+ * _Partition_Allocate
+ *
+ */
+
+#define _Partition_Allocate() \
+ (Partition_Control *) _Objects_Allocate( &_Partition_Information )
+
+/*PAGE
+ *
+ * _Partition_Free
+ *
+ */
+
+#define _Partition_Free( _the_partition ) \
+ _Objects_Free( &_Partition_Information, &(_the_partition)->Object )
+
+/*PAGE
+ *
+ * _Partition_Get
+ *
+ */
+
+#define _Partition_Get( _id, _location ) \
+ (Partition_Control *) \
+ _Objects_Get( &_Partition_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Partition_Is_null
+ *
+ */
+
+#define _Partition_Is_null( _the_partition ) \
+ ( (_the_partition) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/ratemon.inl b/cpukit/rtems/macros/rtems/rtems/ratemon.inl
new file mode 100644
index 0000000000..ebb182e6f1
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/ratemon.inl
@@ -0,0 +1,85 @@
+/* ratemon.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines in the Rate Monotonic Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RATE_MONOTONIC_inl
+#define __RATE_MONOTONIC_inl
+
+/*PAGE
+ *
+ * _Rate_monotonic_Allocate
+ *
+ */
+
+#define _Rate_monotonic_Allocate() \
+ (Rate_monotonic_Control *) \
+ _Objects_Allocate( &_Rate_monotonic_Information )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Free
+ *
+ */
+
+#define _Rate_monotonic_Free( _the_period ) \
+ _Objects_Free( &_Rate_monotonic_Information, &(_the_period)->Object )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Get
+ *
+ */
+
+#define _Rate_monotonic_Get( _id, _location ) \
+ (Rate_monotonic_Control *) \
+ _Objects_Get( &_Rate_monotonic_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_active
+ *
+ */
+
+#define _Rate_monotonic_Is_active( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_ACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_inactive
+ *
+ */
+
+#define _Rate_monotonic_Is_inactive( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_INACTIVE)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_expired
+ *
+ */
+
+#define _Rate_monotonic_Is_expired( _the_period ) \
+ ((_the_period)->state == RATE_MONOTONIC_EXPIRED)
+
+/*PAGE
+ *
+ * _Rate_monotonic_Is_null
+ *
+ */
+
+#define _Rate_monotonic_Is_null( _the_period ) ( (_the_period) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/region.inl b/cpukit/rtems/macros/rtems/rtems/region.inl
new file mode 100644
index 0000000000..667d77e307
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/region.inl
@@ -0,0 +1,75 @@
+/* region.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Region Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __REGION_inl
+#define __REGION_inl
+
+/*PAGE
+ *
+ * _Region_Allocate
+ *
+ */
+
+#define _Region_Allocate() \
+ (Region_Control *) _Objects_Allocate( &_Region_Information )
+
+/*PAGE
+ *
+ * _Region_Free
+ *
+ */
+
+#define _Region_Free( _the_region ) \
+ _Objects_Free( &_Region_Information, &(_the_region)->Object )
+
+/*PAGE
+ *
+ * _Region_Get
+ *
+ */
+
+#define _Region_Get( _id, _location ) \
+ (Region_Control *) \
+ _Objects_Get( &_Region_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Region_Allocate_segment
+ *
+ */
+
+#define _Region_Allocate_segment( _the_region, _size ) \
+ _Heap_Allocate( &(_the_region)->Memory, (_size) )
+
+/*PAGE
+ *
+ * _Region_Free_segment
+ *
+ */
+
+#define _Region_Free_segment( _the_region, _the_segment ) \
+ _Heap_Free( &(_the_region)->Memory, (_the_segment) )
+
+/*PAGE
+ *
+ * _Region_Is_null
+ *
+ */
+
+#define _Region_Is_null( _the_region ) ( (_the_region) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/sem.inl b/cpukit/rtems/macros/rtems/rtems/sem.inl
new file mode 100644
index 0000000000..7e94069009
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/sem.inl
@@ -0,0 +1,58 @@
+/* sem.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Semaphore Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SEMAPHORE_inl
+#define __SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _Semaphore_Allocate
+ *
+ */
+
+#define _Semaphore_Allocate() \
+ (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information )
+
+/*PAGE
+ *
+ * _Semaphore_Free
+ *
+ */
+
+#define _Semaphore_Free( _the_semaphore ) \
+ _Objects_Free( &_Semaphore_Information, &(_the_semaphore)->Object )
+
+/*PAGE
+ *
+ * _Semaphore_Get
+ *
+ */
+
+#define _Semaphore_Get( _id, _location ) \
+ (Semaphore_Control *) \
+ _Objects_Get( &_Semaphore_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Semaphore_Is_null
+ *
+ */
+
+#define _Semaphore_Is_null( _the_semaphore ) \
+ ( (_the_semaphore) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/status.inl b/cpukit/rtems/macros/rtems/rtems/status.inl
new file mode 100644
index 0000000000..408cb816d1
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/status.inl
@@ -0,0 +1,39 @@
+/* macros/status.h
+ *
+ * This include file contains the implementations of the inlined
+ * routines for the status package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_STATUS_h
+#define __MACROS_STATUS_h
+
+/*PAGE
+ *
+ * rtems_is_status_successful
+ *
+ */
+
+#define rtems_is_status_successful( _code ) \
+ ( (_code) == RTEMS_SUCCESSFUL )
+
+/*PAGE
+ *
+ * rtems_are_statuses_equal
+ *
+ */
+
+#define rtems_are_statuses_equal( _code1, _code2 ) \
+ ((_code1) == (_code2))
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/support.inl b/cpukit/rtems/macros/rtems/rtems/support.inl
new file mode 100644
index 0000000000..a25b445aff
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/support.inl
@@ -0,0 +1,44 @@
+/* support.inl
+ *
+ * This include file contains the macros implementation of all
+ * of the inlined routines specific to the RTEMS API.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SUPPORT_inl
+#define __RTEMS_SUPPORT_inl
+
+/*PAGE
+ *
+ * rtems_is_name_valid
+ *
+ */
+
+#define rtems_is_name_valid( _name ) \
+ ( (_name) != 0 )
+
+/*PAGE
+ *
+ * rtems_name_to_characters
+ *
+ */
+
+#define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \
+ { \
+ (*(_c1) = ((_name) >> 24) & 0xff; \
+ (*(_c2) = ((_name) >> 16) & 0xff; \
+ (*(_c3) = ((_name) >> 8) & 0xff; \
+ (*(_c4) = ((_name)) & 0xff; \
+ }
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/tasks.inl b/cpukit/rtems/macros/rtems/rtems/tasks.inl
new file mode 100644
index 0000000000..8dd6ff351b
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/tasks.inl
@@ -0,0 +1,58 @@
+/* tasks.inl
+ *
+ * This file contains the macro implementation of all inlined
+ * routines in the with RTEMS Tasks Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_TASKS_inl
+#define __RTEMS_TASKS_inl
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Allocate
+ *
+ */
+
+#define _RTEMS_tasks_Allocate() \
+ (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Free
+ *
+ */
+
+#define _RTEMS_tasks_Free( _the_task ) \
+ _Objects_Free( &_RTEMS_tasks_Information, &(_the_task)->Object )
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_to_Core
+ */
+
+#define _RTEMS_tasks_Priority_to_Core( _priority ) \
+ ((Priority_Control) (_priority))
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Priority_is_valid
+ *
+ */
+
+#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \
+ ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \
+ ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) )
+
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/macros/rtems/rtems/timer.inl b/cpukit/rtems/macros/rtems/rtems/timer.inl
new file mode 100644
index 0000000000..9026bed570
--- /dev/null
+++ b/cpukit/rtems/macros/rtems/rtems/timer.inl
@@ -0,0 +1,85 @@
+/* timer.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Timer Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIMER_inl
+#define __TIMER_inl
+
+/*PAGE
+ *
+ * _Timer_Allocate
+ *
+ */
+
+#define _Timer_Allocate() \
+ (Timer_Control *) _Objects_Allocate( &_Timer_Information )
+
+/*PAGE
+ *
+ * _Timer_Free
+ *
+ */
+
+#define _Timer_Free( _the_timer ) \
+ _Objects_Free( &_Timer_Information, &(_the_timer)->Object )
+
+/*PAGE
+ *
+ * _Timer_Get
+ *
+ */
+
+#define _Timer_Get( _id, _location ) \
+ (Timer_Control *) \
+ _Objects_Get( &_Timer_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Timer_Is_interval_class
+ *
+ */
+
+#define _Timer_Is_interval_class( _the_class ) \
+ ( (_the_class) == TIMER_INTERVAL )
+
+/*PAGE
+ *
+ * _Timer_Is_time_of_day_class
+ *
+ */
+
+#define _Timer_Is_time_of_day_class( _the_class ) \
+ ( (_the_class) == TIMER_TIME_OF_DAY )
+
+/*PAGE
+ *
+ * _Timer_Is_dormant_class
+ *
+ */
+
+#define _Timer_Is_dormant_class( _the_class ) \
+ ( (_the_class) == TIMER_DORMANT )
+
+/*PAGE
+ *
+ * _Timer_Is_null
+ *
+ */
+
+#define _Timer_Is_null( _the_timer ) \
+ ( (_the_timer) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/src/dpmem.c b/cpukit/rtems/src/dpmem.c
new file mode 100644
index 0000000000..982116d859
--- /dev/null
+++ b/cpukit/rtems/src/dpmem.c
@@ -0,0 +1,281 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * _Dual_ported_memory_Manager_initialization
+ *
+ * This routine initializes all dual-ported memory manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_ports - number of ports to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Dual_ported_memory_Manager_initialization(
+ unsigned32 maximum_ports
+)
+{
+ _Objects_Initialize_information(
+ &_Dual_ported_memory_Information,
+ OBJECTS_RTEMS_PORTS,
+ FALSE,
+ maximum_ports,
+ sizeof( Dual_ported_memory_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_port_create
+ *
+ * This directive creates a port into a dual-ported memory area.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * internal_start - internal start address of port
+ * external_start - external start address of port
+ * length - physical length in bytes
+ * id - address of port id to set
+ *
+ * Output parameters:
+ * id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+
+ if ( !rtems_is_name_valid( name) )
+ return RTEMS_INVALID_NAME;
+
+ if ( !_Addresses_Is_aligned( internal_start ) ||
+ !_Addresses_Is_aligned( external_start ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_port = _Dual_ported_memory_Allocate();
+
+ if ( !the_port ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_port->internal_base = internal_start;
+ the_port->external_base = external_start;
+ the_port->length = length - 1;
+
+ _Objects_Open(
+ &_Dual_ported_memory_Information,
+ &the_port->Object,
+ &name
+ );
+
+ *id = the_port->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_port_ident
+ *
+ * This directive returns the system ID associated with
+ * the port name.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * id - pointer to port id
+ *
+ * Output parameters:
+ * *id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Dual_ported_memory_Information,
+ &name,
+ OBJECTS_SEARCH_ALL_NODES,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_port_delete
+ *
+ * This directive allows a thread to delete a dual-ported memory area
+ * specified by the dual-ported memory identifier.
+ *
+ * Input parameters:
+ * id - dual-ported memory area id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object );
+ _Dual_ported_memory_Free( the_port );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_port_internal_to_external
+ *
+ * This directive converts an internal dual-ported memory address to an
+ * external dual-ported memory address. If the given internal address
+ * is an invalid dual-ported address, then the external address is set
+ * to the given internal address.
+ *
+ * Input parameters:
+ * id - id of dual-ported memory object
+ * internal - internal address to set
+ * external - pointer to external address
+ *
+ * Output parameters:
+ * external - external address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( internal, the_port->internal_base );
+ if ( ending > the_port->length )
+ *external = internal;
+ else
+ *external = _Addresses_Add_offset( the_port->external_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_port_external_to_internal
+ *
+ * This directive converts an external dual-ported memory address to an
+ * internal dual-ported memory address. If the given external address
+ * is an invalid dual-ported address, then the internal address is set
+ * to the given external address.
+ *
+ * Input parameters:
+ * id - id of dp memory object
+ * external - external address
+ * internal - pointer of internal address to set
+ *
+ * Output parameters:
+ * internal - internal address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( external, the_port->external_base );
+ if ( ending > the_port->length )
+ *internal = external;
+ else
+ *internal = _Addresses_Add_offset( the_port->internal_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/event.c b/cpukit/rtems/src/event.c
new file mode 100644
index 0000000000..ab00bc757e
--- /dev/null
+++ b/cpukit/rtems/src/event.c
@@ -0,0 +1,383 @@
+/*
+ * Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/tasks.h>
+
+/*PAGE
+ *
+ * _Event_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Event_Manager_initialization( void )
+{
+ _Event_Sync_state = EVENT_SYNC_SYNCHRONIZED;
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet );
+}
+
+/*PAGE
+ *
+ * rtems_event_send
+ *
+ * This directive allows a thread send an event set to another thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * event - event set
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_event_send(
+ Objects_Id id,
+ rtems_event_set event_in
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _Event_MP_Send_request_packet(
+ EVENT_MP_SEND_REQUEST,
+ id,
+ event_in
+ )
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ _Event_sets_Post( event_in, &api->pending_events );
+ _Event_Surrender( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_event_receive
+ *
+ * This directive allows a thread to receive a set of events.
+ *
+ * Input parameters:
+ * event_in - input event condition
+ * option_set - options
+ * ticks - number of ticks to wait (0 means wait forever)
+ * event_out - pointer to output event set
+ *
+ * Output parameters:
+ * event out - event set
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_event_receive(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ RTEMS_API_Control *api;
+
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+
+ if ( _Event_sets_Is_empty( event_in ) ) {
+ *event_out = api->pending_events;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ _Thread_Disable_dispatch();
+ _Event_Seize( event_in, option_set, ticks, event_out );
+ _Thread_Enable_dispatch();
+ return( _Thread_Executing->Wait.return_code );
+}
+
+
+/*PAGE
+ *
+ * _Event_Seize
+ *
+ * This routine attempts to satisfy the requested event condition
+ * for the running thread.
+ *
+ * Input parameters:
+ * event_in - the event condition to satisfy
+ * option_set - acquire event options
+ * ticks - interval to wait
+ * event_out - pointer to event set output area
+ *
+ * Output parameters: NONE
+ * *event_out - event set output area filled in
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ * check sync
+ */
+
+void _Event_Seize(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ Thread_Control *executing;
+ rtems_event_set seized_events;
+ rtems_event_set pending_events;
+ ISR_Level level;
+ RTEMS_API_Control *api;
+ Event_Sync_states sync_state;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = RTEMS_SUCCESSFUL;
+
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+
+ _ISR_Disable( level );
+ pending_events = api->pending_events;
+ seized_events = _Event_sets_Get( pending_events, event_in );
+
+ if ( !_Event_sets_Is_empty( seized_events ) &&
+ (seized_events == event_in || _Options_Is_any( option_set )) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events, seized_events );
+ _ISR_Enable( level );
+ *event_out = seized_events;
+ return;
+ }
+
+ if ( _Options_Is_no_wait( option_set ) ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = RTEMS_UNSATISFIED;
+ *event_out = seized_events;
+ return;
+ }
+
+ _Event_Sync_state = EVENT_SYNC_NOTHING_HAPPENED;
+
+ executing->Wait.option = (unsigned32) option_set;
+ executing->Wait.count = (unsigned32) event_in;
+ executing->Wait.return_argument = event_out;
+
+ _ISR_Enable( level );
+
+ if ( ticks ) {
+ _Watchdog_Initialize(
+ &executing->Timer,
+ _Event_Timeout,
+ executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &executing->Timer, ticks );
+ }
+
+ _Thread_Set_state( executing, STATES_WAITING_FOR_EVENT );
+
+ _ISR_Disable( level );
+
+ sync_state = _Event_Sync_state;
+ _Event_Sync_state = EVENT_SYNC_SYNCHRONIZED;
+
+ switch ( sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
+ /*
+ * This cannot happen. It indicates that this routine did not
+ * enter the synchronization states above.
+ */
+ return;
+
+ case EVENT_SYNC_NOTHING_HAPPENED:
+ _ISR_Enable( level );
+ return;
+
+ case EVENT_SYNC_TIMEOUT:
+ executing->Wait.return_code = RTEMS_TIMEOUT;
+ _ISR_Enable( level );
+ _Thread_Unblock( executing );
+ return;
+
+ case EVENT_SYNC_SATISFIED:
+ if ( _Watchdog_Is_active( &executing->Timer ) ) {
+ _Watchdog_Deactivate( &executing->Timer );
+ _ISR_Enable( level );
+ (void) _Watchdog_Remove( &executing->Timer );
+ } else
+ _ISR_Enable( level );
+ _Thread_Unblock( executing );
+ return;
+ }
+}
+
+/*PAGE
+ *
+ * _Event_Surrender
+ *
+ * This routines remove a thread from the specified threadq.
+ *
+ * Input parameters:
+ * the_thread - pointer to thread to be dequeued
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * before flash
+ * after flash
+ * check sync
+ */
+
+void _Event_Surrender(
+ Thread_Control *the_thread
+)
+{
+ ISR_Level level;
+ rtems_event_set pending_events;
+ rtems_event_set event_condition;
+ rtems_event_set seized_events;
+ rtems_option option_set;
+ RTEMS_API_Control *api;
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+ option_set = (rtems_option) the_thread->Wait.option;
+
+ _ISR_Disable( level );
+ pending_events = api->pending_events;
+ event_condition = (rtems_event_set) the_thread->Wait.count;
+
+ seized_events = _Event_sets_Get( pending_events, event_condition );
+
+ if ( !_Event_sets_Is_empty( seized_events ) ) {
+ if ( _States_Is_waiting_for_event( the_thread->current_state ) ) {
+ if ( seized_events == event_condition || _Options_Is_any( option_set ) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events, seized_events );
+ *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
+
+ _ISR_Flash( level );
+
+ 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 );
+ }
+ return;
+ }
+ }
+
+ switch ( _Event_Sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
+ case EVENT_SYNC_SATISFIED:
+ break;
+
+ case EVENT_SYNC_NOTHING_HAPPENED:
+ case EVENT_SYNC_TIMEOUT:
+ if ( !_Thread_Is_executing( the_thread ) )
+ break;
+
+ if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events,seized_events );
+ *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
+ _Event_Sync_state = EVENT_SYNC_SATISFIED;
+ }
+ break;
+ }
+ }
+ _ISR_Enable( level );
+}
+
+/*PAGE
+ *
+ * _Event_Timeout
+ *
+ * This routine processes a thread which timeouts while waiting to
+ * receive an event_set. It is called by the watchdog handler.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters: NONE
+ */
+
+void _Event_Timeout(
+ 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:
+
+ /*
+ * If the event manager 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 ( _Event_Sync_state != EVENT_SYNC_SYNCHRONIZED &&
+ _Thread_Is_executing( the_thread ) ) {
+ if ( _Event_Sync_state != EVENT_SYNC_SATISFIED )
+ _Event_Sync_state = EVENT_SYNC_TIMEOUT;
+ } else {
+ the_thread->Wait.return_code = RTEMS_TIMEOUT;
+ _Thread_Unblock( the_thread );
+ }
+ _Thread_Unnest_dispatch();
+ break;
+ }
+}
diff --git a/cpukit/rtems/src/eventmp.c b/cpukit/rtems/src/eventmp.c
new file mode 100644
index 0000000000..30cd1166c6
--- /dev/null
+++ b/cpukit/rtems/src/eventmp.c
@@ -0,0 +1,190 @@
+/*
+ * Multiprocessing Support for the Event Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/event.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Event_MP_Send_process_packet
+ *
+ * This subprogram is not needed since there are no process
+ * packets to be sent by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Event_MP_Send_request_packet (
+ Event_MP_Remote_operations operation,
+ Objects_Id event_id,
+ rtems_event_set event_in
+)
+{
+ Event_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case EVENT_MP_SEND_REQUEST:
+
+ the_packet = _Event_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_EVENT;
+ the_packet->Prefix.length = sizeof ( Event_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = event_id;
+ the_packet->event_in = event_in;
+
+ return
+ _MPCI_Send_request_packet(
+ rtems_get_node( event_id ),
+ &the_packet->Prefix,
+ STATES_READY
+ );
+
+ break;
+
+ case EVENT_MP_SEND_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Event_MP_Send_response_packet
+ *
+ */
+
+void _Event_MP_Send_response_packet (
+ Event_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ Event_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case EVENT_MP_SEND_RESPONSE:
+
+ the_packet = ( Event_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case EVENT_MP_SEND_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Event_MP_Process_packet
+ *
+ */
+
+void _Event_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Event_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+
+ the_packet = (Event_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case EVENT_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_event_send(
+ the_packet->Prefix.id,
+ the_packet->event_in
+ );
+
+ _Event_MP_Send_response_packet(
+ EVENT_MP_SEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case EVENT_MP_SEND_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Event_MP_Send_object_was_deleted
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Send_extract_proxy
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Event_MP_Get_packet
+ *
+ */
+
+Event_MP_Packet *_Event_MP_Get_packet ( void )
+{
+ return ( (Event_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/intr.c b/cpukit/rtems/src/intr.c
new file mode 100644
index 0000000000..8ec880ee99
--- /dev/null
+++ b/cpukit/rtems/src/intr.c
@@ -0,0 +1,65 @@
+/*
+ * Interrupt Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/intr.h>
+
+/* _Interrupt_Manager_initialization
+ *
+ * This routine initializes the interrupt manager.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Interrupt_Manager_initialization( void )
+{
+}
+
+/* rtems_interrupt_catch
+ *
+ * This directive allows a thread to specify what action to take when
+ * catching signals.
+ *
+ * Input parameters:
+ * new_isr_handler - address of interrupt service routine (isr)
+ * vector - interrupt vector number
+ * old_isr_handler - address at which to store previous ISR address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ * *old_isr_handler - previous ISR address
+ */
+
+rtems_status_code rtems_interrupt_catch(
+ rtems_isr_entry new_isr_handler,
+ rtems_vector_number vector,
+ rtems_isr_entry *old_isr_handler
+)
+{
+ if ( !_ISR_Is_vector_number_valid( vector ) )
+ return RTEMS_INVALID_NUMBER;
+
+ if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _ISR_Install_vector(
+ vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler );
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/rtems/src/mp.c b/cpukit/rtems/src/mp.c
new file mode 100644
index 0000000000..7bc39074c6
--- /dev/null
+++ b/cpukit/rtems/src/mp.c
@@ -0,0 +1,42 @@
+/*
+ * Multiprocessing Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/mpci.h>
+
+/*PAGE
+ *
+ * _Multiprocessing_Manager_initialization
+ *
+ */
+
+void _Multiprocessing_Manager_initialization ( void )
+{
+}
+
+/*PAGE
+ *
+ * rtems_multiprocessing_announce
+ *
+ */
+
+void rtems_multiprocessing_announce ( void )
+{
+ _MPCI_Announce();
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/msg.c b/cpukit/rtems/src/msg.c
new file mode 100644
index 0000000000..7d7c6e3025
--- /dev/null
+++ b/cpukit/rtems/src/msg.c
@@ -0,0 +1,714 @@
+/*
+ * Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coremsg.h>
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Message_queue_Manager_initialization
+ *
+ * This routine initializes all message queue manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_message_queues - number of message queues to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Manager_initialization(
+ unsigned32 maximum_message_queues
+)
+{
+ _Objects_Initialize_information(
+ &_Message_queue_Information,
+ OBJECTS_RTEMS_MESSAGE_QUEUES,
+ TRUE,
+ maximum_message_queues,
+ sizeof( Message_queue_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_MESSAGE_QUEUE,
+ _Message_queue_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * _Message_queue_Allocate
+ *
+ * Allocate a message queue and the space for its messages
+ *
+ * Input parameters:
+ * the_message_queue - the message queue to allocate message buffers
+ * count - maximum message and reserved buffer count
+ * max_message_size - maximum size of each message
+ *
+ * Output parameters:
+ * the_message_queue - set if successful, NULL otherwise
+ */
+
+Message_queue_Control *_Message_queue_Allocate (
+ unsigned32 count,
+ unsigned32 max_message_size
+)
+{
+ return
+ (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
+
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_create
+ *
+ * This directive creates a message queue by allocating and initializing
+ * a message queue data structure.
+ *
+ * Input parameters:
+ * name - user defined queue name
+ * count - maximum message and reserved buffer count
+ * max_message_size - maximum size of each message
+ * attribute_set - process method
+ * id - pointer to queue
+ *
+ * Output parameters:
+ * id - queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_create(
+ rtems_name name,
+ unsigned32 count,
+ unsigned32 max_message_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Message_queue_Control *the_message_queue;
+ CORE_message_queue_Attributes the_message_queue_attributes;
+ boolean is_global;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( (is_global = _Attributes_Is_global( attribute_set ) ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ if (count == 0)
+ return RTEMS_INVALID_NUMBER;
+
+ if (max_message_size == 0)
+ return RTEMS_INVALID_SIZE;
+
+#if 1
+ /*
+ * I am not 100% sure this should be an error.
+ * It seems reasonable to create a que with a large max size,
+ * and then just send smaller msgs from remote (or all) nodes.
+ */
+
+ if ( is_global && (_MPCI_table->maximum_packet_size < max_message_size) )
+ return RTEMS_INVALID_SIZE;
+
+#endif
+
+ _Thread_Disable_dispatch(); /* protects object pointer */
+
+ the_message_queue = _Message_queue_Allocate( count, max_message_size );
+
+ if ( !the_message_queue ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( is_global &&
+ !( _Objects_MP_Allocate_and_open( &_Message_queue_Information,
+ name, the_message_queue->Object.id, FALSE ) ) ) {
+ _Message_queue_Free( the_message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_message_queue->attribute_set = attribute_set;
+
+ if (_Attributes_Is_priority( attribute_set ) )
+ the_message_queue_attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
+ else
+ the_message_queue_attributes.discipline =
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+
+ if ( ! _CORE_message_queue_Initialize(
+ &the_message_queue->message_queue,
+ OBJECTS_RTEMS_MESSAGE_QUEUES,
+ &the_message_queue_attributes,
+ count,
+ max_message_size,
+ _Message_queue_MP_Send_extract_proxy ) ) {
+ if ( is_global )
+ _Objects_MP_Close(
+ &_Message_queue_Information, the_message_queue->Object.id);
+
+ _Message_queue_Free( the_message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ _Objects_Open(
+ &_Message_queue_Information,
+ &the_message_queue->Object,
+ &name
+ );
+
+ *id = the_message_queue->Object.id;
+
+ if ( is_global )
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
+ the_message_queue->Object.id,
+ name,
+ 0
+ );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_ident
+ *
+ * This directive returns the system ID associated with
+ * the message queue name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * node - node(s) to be searched
+ * id - pointer to message queue id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Message_queue_Information,
+ &name,
+ node,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_delete
+ *
+ * This directive allows a thread to delete the message queue specified
+ * by the given queue identifier.
+ *
+ * Input parameters:
+ * id - queue id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_delete(
+ Objects_Id id
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Message_queue_Information,
+ &the_message_queue->Object );
+
+ _CORE_message_queue_Close(
+ &the_message_queue->message_queue,
+ _Message_queue_MP_Send_object_was_deleted,
+ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
+ );
+
+ _Message_queue_Free( the_message_queue );
+
+ if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
+ _Objects_MP_Close(
+ &_Message_queue_Information,
+ the_message_queue->Object.id
+ );
+
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
+ the_message_queue->Object.id,
+ 0, /* Not used */
+ 0
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_send
+ *
+ * This routine implements the directives q_send. It sends a
+ * message to the specified message queue.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to sent urgently
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_send(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ return( _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST) );
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_urgent
+ *
+ * This routine implements the directives q_urgent. It urgents a
+ * message to the specified message queue.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to sent urgently
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_urgent(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size
+)
+{
+ return(_Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST));
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_broadcast
+ *
+ * This directive sends a message for every thread waiting on the queue
+ * designated by id.
+ *
+ * Input parameters:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size of message to broadcast
+ * count - pointer to area to store number of threads made ready
+ *
+ * Output parameters:
+ * count - number of threads made ready
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_broadcast(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ unsigned32 *count
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ CORE_message_queue_Status core_status;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = count;
+
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_BROADCAST_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case OBJECTS_LOCAL:
+ core_status = _CORE_message_queue_Broadcast(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support,
+ count
+ );
+
+ _Thread_Enable_dispatch();
+ return
+ _Message_queue_Translate_core_message_queue_return_code( core_status );
+
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_receive
+ *
+ * This directive dequeues a message from the designated message queue
+ * and copies it into the requesting thread's buffer.
+ *
+ * Input parameters:
+ * id - queue id
+ * buffer - pointer to message buffer
+ * size - size of message receive
+ * option_set - options on receive
+ * timeout - number of ticks to wait
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_receive(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ boolean wait;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_REMOTE:
+ return _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_REQUEST,
+ id,
+ buffer,
+ size,
+ option_set,
+ timeout
+ );
+
+ case OBJECTS_LOCAL:
+ if ( _Options_Is_no_wait( option_set ) )
+ wait = FALSE;
+ else
+ wait = TRUE;
+
+ _CORE_message_queue_Seize(
+ &the_message_queue->message_queue,
+ the_message_queue->Object.id,
+ buffer,
+ size,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return( _Message_queue_Translate_core_message_queue_return_code(
+ _Thread_Executing->Wait.return_code ) );
+
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_message_queue_flush
+ *
+ * This directive removes all pending messages from a queue and returns
+ * the number of messages removed. If no messages were present then
+ * a count of zero is returned.
+ *
+ * Input parameters:
+ * id - queue id
+ * count - return area for count
+ *
+ * Output parameters:
+ * count - number of messages removed ( 0 = empty queue )
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_message_queue_flush(
+ Objects_Id id,
+ unsigned32 *count
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = count;
+
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_FLUSH_REQUEST,
+ id,
+ 0, /* buffer not used */
+ 0, /* size */
+ 0, /* option_set not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case OBJECTS_LOCAL:
+ *count = _CORE_message_queue_Flush( &the_message_queue->message_queue );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Submit
+ *
+ * This routine implements the directives rtems_message_queue_send
+ * and rtems_message_queue_urgent. It processes a message that is
+ * to be submitted to the designated message queue. The message will
+ * either be processed as a send 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:
+ * id - pointer to message queue
+ * buffer - pointer to message buffer
+ * size - size in bytes of message to send
+ * submit_type - send or urgent message
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code _Message_queue_Submit(
+ Objects_Id id,
+ void *buffer,
+ unsigned32 size,
+ Message_queue_Submit_types submit_type
+)
+{
+ register Message_queue_Control *the_message_queue;
+ Objects_Locations location;
+ CORE_message_queue_Status core_status;
+
+ the_message_queue = _Message_queue_Get( id, &location );
+ switch ( location )
+ {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_REMOTE:
+ switch ( submit_type ) {
+ case MESSAGE_QUEUE_SEND_REQUEST:
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_SEND_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set */
+ MPCI_DEFAULT_TIMEOUT
+ );
+
+ case MESSAGE_QUEUE_URGENT_REQUEST:
+ return
+ _Message_queue_MP_Send_request_packet(
+ MESSAGE_QUEUE_MP_URGENT_REQUEST,
+ id,
+ buffer,
+ &size,
+ 0, /* option_set */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ }
+
+ case OBJECTS_LOCAL:
+ switch ( submit_type ) {
+ case MESSAGE_QUEUE_SEND_REQUEST:
+ core_status = _CORE_message_queue_Send(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support
+ );
+ break;
+ case MESSAGE_QUEUE_URGENT_REQUEST:
+ core_status = _CORE_message_queue_Urgent(
+ &the_message_queue->message_queue,
+ buffer,
+ size,
+ id,
+ _Message_queue_Core_message_queue_mp_support
+ );
+ break;
+ default:
+ core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ return RTEMS_INTERNAL_ERROR; /* should never get here */
+ }
+
+ _Thread_Enable_dispatch();
+ return _Message_queue_Translate_core_message_queue_return_code(
+ core_status );
+
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Translate_core_message_queue_return_code
+ *
+ * Input parameters:
+ * the_message_queue_status - message_queue status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+ unsigned32 the_message_queue_status
+)
+{
+ switch ( the_message_queue_status ) {
+ case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
+ return RTEMS_INVALID_SIZE;
+ case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
+ return RTEMS_TOO_MANY;
+ case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
+ return RTEMS_UNSATISFIED;
+ case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ _Internal_error_Occurred( /* XXX */
+ INTERNAL_ERROR_RTEMS_API,
+ TRUE,
+ the_message_queue_status
+ );
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Message_queue_Core_message_queue_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the message was submitted to
+ * id - id of the message queue
+ *
+ * Output parameters: NONE
+ */
+
+void _Message_queue_Core_message_queue_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ id,
+ the_thread
+ );
+}
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
new file mode 100644
index 0000000000..e43fc28aef
--- /dev/null
+++ b/cpukit/rtems/src/msgmp.c
@@ -0,0 +1,454 @@
+/*
+ * Multiprocessing Support for the Message Queue Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/message.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/msgmp.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_process_packet
+ *
+ */
+
+void _Message_queue_MP_Send_process_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Message_queue_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof ( Message_queue_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == MESSAGE_QUEUE_MP_EXTRACT_PROXY )
+ node = rtems_get_node( message_queue_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Message_queue_MP_Send_request_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ void *buffer,
+ unsigned32 *size_p,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Message_queue_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof(Message_queue_MP_Packet);
+ if ( size_p )
+ the_packet->Prefix.length += *size_p;
+ the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
+
+ /*
+ * make sure message is not too big for our MPCI driver
+ * We have to check it here instead of waiting for MPCI because
+ * we are about to slam in the payload
+ */
+
+ if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->option_set = option_set;
+
+ /*
+ * Copy the data into place if needed
+ */
+
+ if (buffer) {
+ the_packet->Buffer.size = *size_p;
+ _CORE_message_queue_Copy_buffer(
+ buffer,
+ the_packet->Buffer.buffer,
+ *size_p
+ );
+ }
+
+ return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_MESSAGE);
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+
+ the_packet = _Message_queue_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE;
+ the_packet->Prefix.length = sizeof(Message_queue_MP_Packet);
+ the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
+
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = MESSAGE_QUEUE_MP_RECEIVE_REQUEST;
+ the_packet->Prefix.id = message_queue_id;
+ the_packet->option_set = option_set;
+ the_packet->size = 0; /* just in case of an error */
+
+ _Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
+ _Thread_Executing->Wait.return_argument_1 = size_p;
+
+ return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_MESSAGE);
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+ break;
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_response_packet
+ *
+ */
+
+void _Message_queue_MP_Send_response_packet (
+ Message_queue_MP_Remote_operations operation,
+ Objects_Id message_queue_id,
+ Thread_Control *the_thread
+)
+{
+ Message_queue_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+
+ the_packet = ( Message_queue_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ *
+ * Exception: MESSAGE_QUEUE_MP_RECEIVE_RESPONSE needs payload length
+ * added to 'length'
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ if (operation == MESSAGE_QUEUE_MP_RECEIVE_RESPONSE)
+ the_packet->Prefix.length += the_packet->size;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Message_queue_MP_Process_packet
+ *
+ */
+
+void _Message_queue_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Message_queue_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Message_queue_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Message_queue_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Message_queue_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_receive(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ &the_packet->size,
+ the_packet->option_set,
+ the_packet->Prefix.timeout
+ );
+
+ if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) {
+ *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 =
+ the_packet->size;
+
+ _CORE_message_queue_Copy_buffer(
+ the_packet->Buffer.buffer,
+ the_thread->Wait.return_argument,
+ the_packet->size
+ );
+ }
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_send(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_SEND_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_SEND_RESPONSE:
+ case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_URGENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_urgent(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_URGENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_broadcast(
+ the_packet->Prefix.id,
+ the_packet->Buffer.buffer,
+ the_packet->Buffer.size,
+ &the_packet->count
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_BROADCAST_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
+ case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(unsigned32 *)the_thread->Wait.return_argument = the_packet->count;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_message_queue_flush(
+ the_packet->Prefix.id,
+ &the_packet->count
+ );
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_FLUSH_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_object_was_deleted
+ *
+ */
+
+void _Message_queue_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+)
+{
+ the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
+
+ _Message_queue_MP_Send_response_packet(
+ MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+ the_proxy->Wait.id,
+ the_proxy
+ );
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Send_extract_proxy
+ *
+ */
+
+void _Message_queue_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Message_queue_MP_Send_process_packet(
+ MESSAGE_QUEUE_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+}
+
+/*PAGE
+ *
+ * _Message_queue_MP_Get_packet
+ *
+ */
+
+Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void )
+{
+ return ( (Message_queue_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/part.c b/cpukit/rtems/src/part.c
new file mode 100644
index 0000000000..f63ab693f1
--- /dev/null
+++ b/cpukit/rtems/src/part.c
@@ -0,0 +1,341 @@
+/*
+ * Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * _Partition_Manager_initialization
+ *
+ * This routine initializes all partition manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_partitions - number of partitions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Partition_Manager_initialization(
+ unsigned32 maximum_partitions
+)
+{
+ _Objects_Initialize_information(
+ &_Partition_Information,
+ OBJECTS_RTEMS_PARTITIONS,
+ TRUE,
+ maximum_partitions,
+ sizeof( Partition_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_PARTITION,
+ _Partition_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_partition_create
+ *
+ * This directive creates a partiton of fixed sized buffers from the
+ * given contiguous memory area.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * starting_address - physical start address of partition
+ * length - physical length in bytes
+ * buffer_size - size of buffers in bytes
+ * attribute_set - partition attributes
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Partition_Control *the_partition;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( length == 0 || buffer_size == 0 || length < buffer_size ||
+ !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ return RTEMS_INVALID_SIZE;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_partition = _Partition_Allocate();
+
+ if ( !the_partition ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
+ the_partition->Object.id, FALSE ) ) ) {
+ _Partition_Free( the_partition );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+ the_partition->starting_address = starting_address;
+ the_partition->length = length;
+ the_partition->buffer_size = buffer_size;
+ the_partition->attribute_set = attribute_set;
+ the_partition->number_of_used_blocks = 0;
+
+ _Chain_Initialize( &the_partition->Memory, starting_address,
+ length / buffer_size, buffer_size );
+
+ _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
+
+ *id = the_partition->Object.id;
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_CREATE,
+ the_partition->Object.id,
+ name,
+ 0 /* Not used */
+ );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_partition_ident
+ *
+ * This directive returns the system ID associated with
+ * the partition name.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * node - node(s) to be searched
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * *id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_partition_delete
+ *
+ * This directive allows a thread to delete a partition specified by
+ * the partition identifier, provided that none of its buffers are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - partition id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( the_partition->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Partition_Information, &the_partition->Object );
+ _Partition_Free( the_partition );
+ if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+
+ _Objects_MP_Close(
+ &_Partition_Information,
+ the_partition->Object.id
+ );
+
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_DELETE,
+ the_partition->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_partition_get_buffer
+ *
+ * This directive will obtain a buffer from a buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * buffer - pointer to buffer address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+ void *the_buffer;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = buffer;
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_GET_BUFFER_REQUEST,
+ id,
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ the_buffer = _Partition_Allocate_buffer( the_partition );
+ if ( the_buffer ) {
+ the_partition->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *buffer = the_buffer;
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_partition_return_buffer
+ *
+ * This directive will return the given buffer to the specified
+ * buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_RETURN_BUFFER_REQUEST,
+ id,
+ buffer
+ )
+ );
+ case OBJECTS_LOCAL:
+ if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
+ _Partition_Free_buffer( the_partition, buffer );
+ the_partition->number_of_used_blocks -= 1;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
new file mode 100644
index 0000000000..969bf314b5
--- /dev/null
+++ b/cpukit/rtems/src/partmp.c
@@ -0,0 +1,302 @@
+/*
+ * Multiprocessing Support for the Partition Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Partition_MP_Send_process_packet
+ *
+ */
+
+void _Partition_MP_Send_process_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Partition_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+
+ the_packet = _Partition_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_PARTITION;
+ the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = partition_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == PARTITION_MP_EXTRACT_PROXY )
+ node = rtems_get_node( partition_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Partition_MP_Send_request_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ void *buffer
+)
+{
+ Partition_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+
+ the_packet = _Partition_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_PARTITION;
+ the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = partition_id;
+ the_packet->buffer = buffer;
+
+ return
+ _MPCI_Send_request_packet(
+ rtems_get_node( partition_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+
+ break;
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_response_packet
+ *
+ */
+
+void _Partition_MP_Send_response_packet (
+ Partition_MP_Remote_operations operation,
+ Objects_Id partition_id,
+ Thread_Control *the_thread
+)
+{
+ Partition_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+
+ the_packet = ( Partition_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+ case PARTITION_MP_ANNOUNCE_DELETE:
+ case PARTITION_MP_EXTRACT_PROXY:
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Partition_MP_Process_packet
+ *
+ */
+
+void _Partition_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Partition_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Partition_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case PARTITION_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Partition_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Partition_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_partition_get_buffer(
+ the_packet->Prefix.id,
+ &the_packet->buffer
+ );
+
+ _Partition_MP_Send_response_packet(
+ PARTITION_MP_GET_BUFFER_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case PARTITION_MP_GET_BUFFER_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(void **)the_thread->Wait.return_argument = the_packet->buffer;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case PARTITION_MP_RETURN_BUFFER_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_partition_return_buffer(
+ the_packet->Prefix.id,
+ the_packet->buffer
+ );
+
+ _Partition_MP_Send_response_packet(
+ PARTITION_MP_RETURN_BUFFER_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case PARTITION_MP_RETURN_BUFFER_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Send_object_was_deleted
+ *
+ * This routine is not needed by the Partition since a partition
+ * cannot be deleted when buffers are in use.
+ *
+ */
+
+/*PAGE
+ *
+ * _Partition_MP_Send_extract_proxy
+ *
+ */
+
+void _Partition_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+
+}
+
+/*PAGE
+ *
+ * _Partition_MP_Get_packet
+ *
+ */
+
+Partition_MP_Packet *_Partition_MP_Get_packet ( void )
+{
+ return ( (Partition_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/ratemon.c b/cpukit/rtems/src/ratemon.c
new file mode 100644
index 0000000000..d3524b02d6
--- /dev/null
+++ b/cpukit/rtems/src/ratemon.c
@@ -0,0 +1,385 @@
+/*
+ * Rate Monotonic Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * _Rate_monotonic_Manager_initialization
+ *
+ * This routine initializes all Rate Monotonic Manager related
+ * data structures.
+ *
+ * Input parameters:
+ * maximum_periods - number of periods timers to initialize
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: The Rate Monotonic Manager is built on top of the Watchdog
+ * Handler.
+ */
+
+void _Rate_monotonic_Manager_initialization(
+ unsigned32 maximum_periods
+)
+{
+ _Objects_Initialize_information(
+ &_Rate_monotonic_Information,
+ OBJECTS_RTEMS_PERIODS,
+ FALSE,
+ maximum_periods,
+ sizeof( Rate_monotonic_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_create
+ *
+ * This directive creates a rate monotonic timer and performs
+ * some initialization.
+ *
+ * Input parameters:
+ * name - name of period
+ * id - pointer to rate monotonic id
+ *
+ * Output parameters:
+ * id - rate monotonic id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Rate_monotonic_Control *the_period;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_period = _Rate_monotonic_Allocate();
+
+ if ( !the_period ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_period->owner = _Thread_Executing;
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+
+ _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name );
+
+ *id = the_period->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_ident
+ *
+ * This directive returns the system ID associated with
+ * the rate monotonic period name.
+ *
+ * Input parameters:
+ * name - user defined period name
+ * id - pointer to period id
+ *
+ * Output parameters:
+ * *id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Rate_monotonic_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_cancel
+ *
+ * This directive allows a thread to cancel a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_cancel(
+ Objects_Id id
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return RTEMS_INTERNAL_ERROR; /* should never return this */
+ case OBJECTS_LOCAL:
+ if ( !_Thread_Is_executing( the_period->owner ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ }
+ (void) _Watchdog_Remove( &the_period->Timer );
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_delete
+ *
+ * This directive allows a thread to delete a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_delete(
+ Objects_Id id
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Rate_monotonic_Information, &the_period->Object );
+ (void) _Watchdog_Remove( &the_period->Timer );
+ the_period->state = RATE_MONOTONIC_INACTIVE;
+ _Rate_monotonic_Free( the_period );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_period
+ *
+ * This directive allows a thread to manipulate a rate monotonic timer.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ * length - length of period (in ticks)
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_rate_monotonic_period(
+ Objects_Id id,
+ rtems_interval length
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+ rtems_status_code return_value;
+ Rate_Monotonic_Period_states local_state;
+ ISR_Level level;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( !_Thread_Is_executing( the_period->owner ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ }
+
+ if ( length == RTEMS_PERIOD_STATUS ) {
+ switch ( the_period->state ) {
+ case RATE_MONOTONIC_INACTIVE:
+ return_value = RTEMS_NOT_DEFINED;
+ break;
+ case RATE_MONOTONIC_ACTIVE:
+ return_value = RTEMS_SUCCESSFUL;
+ break;
+ case RATE_MONOTONIC_EXPIRED:
+ return_value = RTEMS_TIMEOUT;
+ break;
+ default: /* unreached -- only to remove warnings */
+ return_value = RTEMS_INTERNAL_ERROR;
+ break;
+ }
+ _Thread_Enable_dispatch();
+ return( return_value );
+ }
+
+ _ISR_Disable( level );
+ switch ( the_period->state ) {
+ case RATE_MONOTONIC_INACTIVE:
+ _ISR_Enable( level );
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _Watchdog_Initialize(
+ &the_period->Timer,
+ _Rate_monotonic_Timeout,
+ id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &the_period->Timer, length );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+
+ case RATE_MONOTONIC_ACTIVE:
+ /*
+ * This tells the _Rate_monotonic_Timeout that this task is
+ * in the process of blocking on the period.
+ */
+
+ the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING;
+ _ISR_Enable( level );
+
+ _Thread_Executing->Wait.id = the_period->Object.id;
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
+
+ /*
+ * Did the watchdog timer expire while we were actually blocking
+ * on it?
+ */
+
+ _ISR_Disable( level );
+ local_state = the_period->state;
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _ISR_Enable( level );
+
+ /*
+ * If it did, then we want to unblock ourself and continue as
+ * if nothing happen. The period was reset in the timeout routine.
+ */
+
+ if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )
+ _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ break;
+
+ case RATE_MONOTONIC_EXPIRED:
+ _ISR_Enable( level );
+ the_period->state = RATE_MONOTONIC_ACTIVE;
+ _Watchdog_Insert_ticks( &the_period->Timer, length );
+ _Thread_Enable_dispatch();
+ return RTEMS_TIMEOUT;
+
+ case RATE_MONOTONIC_OWNER_IS_BLOCKING:
+ case RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING:
+ /*
+ * These should never happen.
+ */
+ break;
+ }
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Rate_monotonic_Timeout
+ *
+ * This routine processes a period ending. If the owning thread
+ * is waiting for the period, that thread is unblocked and the
+ * period reinitiated. Otherwise, the period is expired.
+ * This routine is called by the watchdog handler.
+ *
+ * Input parameters:
+ * id - period id
+ *
+ * Output parameters: NONE
+ */
+
+void _Rate_monotonic_Timeout(
+ Objects_Id id,
+ void *ignored
+)
+{
+ Rate_monotonic_Control *the_period;
+ Objects_Locations location;
+ Thread_Control *the_thread;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ case OBJECTS_REMOTE: /* impossible */
+ break;
+ case OBJECTS_LOCAL:
+ the_thread = the_period->owner;
+ if ( _States_Is_waiting_for_period( the_thread->current_state ) &&
+ the_thread->Wait.id == the_period->Object.id ) {
+ _Thread_Unblock( the_thread );
+ _Watchdog_Reset( &the_period->Timer );
+ } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
+ the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
+ _Watchdog_Reset( &the_period->Timer );
+ } else
+ the_period->state = RATE_MONOTONIC_EXPIRED;
+ _Thread_Unnest_dispatch();
+ break;
+ }
+}
+
diff --git a/cpukit/rtems/src/region.c b/cpukit/rtems/src/region.c
new file mode 100644
index 0000000000..5a8ad26797
--- /dev/null
+++ b/cpukit/rtems/src/region.c
@@ -0,0 +1,486 @@
+/*
+ * Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * _Region_Manager_initialization
+ *
+ * This routine initializes all region manager related data structures.
+ *
+ * Input parameters:
+ * maximum_regions - number of regions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Region_Manager_initialization(
+ unsigned32 maximum_regions
+)
+{
+ _Objects_Initialize_information(
+ &_Region_Information,
+ OBJECTS_RTEMS_REGIONS,
+ FALSE,
+ maximum_regions,
+ sizeof( Region_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_REGION,
+ 0 /* XXX _Region_MP_Process_packet */
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_region_create
+ *
+ * This directive creates a region of physical contiguous memory area
+ * from which variable sized segments can be allocated.
+ *
+ * Input parameters:
+ * name - user defined region name
+ * starting_address - physical start address of region
+ * length - physical length in bytes
+ * page_size - page size in bytes
+ * attribute_set - region attributes
+ * id - address of region id to set
+ *
+ * Output parameters:
+ * id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 page_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ Region_Control *the_region;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_region = _Region_Allocate();
+
+ if ( !the_region ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_region->maximum_segment_size =
+ _Heap_Initialize(&the_region->Memory, starting_address, length, page_size);
+
+ if ( !the_region->maximum_segment_size ) {
+ _Region_Free( the_region );
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ the_region->starting_address = starting_address;
+ the_region->length = length;
+ the_region->page_size = page_size;
+ the_region->attribute_set = attribute_set;
+ the_region->number_of_used_blocks = 0;
+
+ _Thread_queue_Initialize(
+ &the_region->Wait_queue,
+ OBJECTS_RTEMS_REGIONS,
+ _Attributes_Is_priority( attribute_set ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_SEGMENT,
+ _Region_MP_Send_extract_proxy,
+ RTEMS_TIMEOUT
+ );
+
+ _Objects_Open( &_Region_Information, &the_region->Object, &name );
+
+ *id = the_region->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_region_ident
+ *
+ * This directive returns the system ID associated with
+ * the region name.
+ *
+ * Input parameters:
+ * name - user defined region name
+ * id - pointer to region id
+ *
+ * Output parameters:
+ * *id - region id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Region_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_region_delete
+ *
+ * This directive allows a thread to delete a region specified by
+ * the region identifier, provided that none of its segments are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - region id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_delete(
+ Objects_Id id
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Region_Debug_Walk( the_region, 5 );
+ if ( the_region->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Region_Information, &the_region->Object );
+ _Region_Free( the_region );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_extend
+ *
+ * This directive attempts to grow a region of physical contiguous memory area
+ * from which variable sized segments can be allocated.
+ *
+ * Input parameters:
+ * id - id of region to grow
+ * start - starting address of memory area for extension
+ * length - physical length in bytes to grow the region
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_extend(
+ Objects_Id id,
+ void *starting_address,
+ unsigned32 length
+)
+{
+ Region_Control *the_region;
+ Objects_Locations location;
+ unsigned32 amount_extended;
+ Heap_Extend_status heap_status;
+ rtems_status_code status;
+
+ status = RTEMS_SUCCESSFUL;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ heap_status = _Heap_Extend(
+ &the_region->Memory,
+ starting_address,
+ length,
+ &amount_extended
+ );
+
+ switch ( heap_status ) {
+ case HEAP_EXTEND_SUCCESSFUL:
+ the_region->length += amount_extended;
+ the_region->maximum_segment_size += amount_extended;
+ break;
+ case HEAP_EXTEND_ERROR:
+ status = RTEMS_INVALID_ADDRESS;
+ break;
+ case HEAP_EXTEND_NOT_IMPLEMENTED:
+ status = RTEMS_NOT_IMPLEMENTED;
+ break;
+ }
+ _Thread_Enable_dispatch();
+ return( status );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_get_segment
+ *
+ * This directive will obtain a segment from the given region.
+ *
+ * Input parameters:
+ * id - region id
+ * size - segment size in bytes
+ * option_set - wait option
+ * timeout - number of ticks to wait (0 means wait forever)
+ * segment - pointer to segment address
+ *
+ * Output parameters:
+ * segment - pointer to segment address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_get_segment(
+ Objects_Id id,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout,
+ void **segment
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+ Thread_Control *executing;
+ void *the_segment;
+
+ *segment = NULL;
+
+ if ( size == 0 )
+ return RTEMS_INVALID_SIZE;
+
+ executing = _Thread_Executing;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( size > the_region->maximum_segment_size ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_SIZE;
+ }
+
+ _Region_Debug_Walk( the_region, 1 );
+
+ the_segment = _Region_Allocate_segment( the_region, size );
+
+ _Region_Debug_Walk( the_region, 2 );
+
+ if ( the_segment ) {
+ the_region->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *segment = the_segment;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ if ( _Options_Is_no_wait( option_set ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ executing->Wait.queue = &the_region->Wait_queue;
+ executing->Wait.id = id;
+ executing->Wait.count = size;
+ executing->Wait.return_argument = (unsigned32 *) segment;
+
+ _Thread_queue_Enter_critical_section( &the_region->Wait_queue );
+
+ _Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
+
+ _Thread_Enable_dispatch();
+ return( executing->Wait.return_code );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+/*PAGE
+ *
+ * rtems_region_get_segment_size
+ *
+ * This directive will return the size of the segment indicated
+ *
+ * Input parameters:
+ * id - region id
+ * segment - segment address
+ * size - pointer to segment size in bytes
+ *
+ * Output parameters:
+ * size - segment size in bytes filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_get_segment_size(
+ Objects_Id id,
+ void *segment,
+ unsigned32 *size
+)
+{
+ register Region_Control *the_region;
+ Objects_Locations location;
+ Thread_Control *executing;
+
+ executing = _Thread_Executing;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_region_return_segment
+ *
+ * This directive will return a segment to its region.
+ *
+ * Input parameters:
+ * id - region id
+ * segment - pointer to segment address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_region_return_segment(
+ Objects_Id id,
+ void *segment
+)
+{
+ register Region_Control *the_region;
+ Thread_Control *the_thread;
+ Objects_Locations location;
+ void **the_segment;
+ int status;
+
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+
+ _Region_Debug_Walk( the_region, 3 );
+
+ status = _Region_Free_segment( the_region, segment );
+
+ _Region_Debug_Walk( the_region, 4 );
+
+ if ( !status ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ the_region->number_of_used_blocks -= 1;
+ for ( ; ; ) {
+ the_thread = _Thread_queue_First( &the_region->Wait_queue );
+
+ if ( the_thread == NULL )
+ break;
+
+ the_segment = _Region_Allocate_segment(
+ the_region,
+ the_thread->Wait.count
+ );
+
+ if ( the_segment == NULL )
+ break;
+
+ *(void **)the_thread->Wait.return_argument = the_segment;
+ the_region->number_of_used_blocks += 1;
+ _Thread_queue_Extract( &the_region->Wait_queue, the_thread );
+ the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/regionmp.c b/cpukit/rtems/src/regionmp.c
new file mode 100644
index 0000000000..57f307f826
--- /dev/null
+++ b/cpukit/rtems/src/regionmp.c
@@ -0,0 +1,310 @@
+/*
+ * Multiprocessing Support for the Region Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/region.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Region_MP_Send_process_packet
+ *
+ */
+
+void _Region_MP_Send_process_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Region_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+
+ the_packet = _Region_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_REGION;
+ the_packet->Prefix.length = sizeof ( Region_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = region_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == REGION_MP_EXTRACT_PROXY )
+ node = rtems_get_node( region_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Region_MP_Send_request_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ void *segment,
+ unsigned32 size,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Region_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+
+ the_packet = _Region_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_REGION;
+ the_packet->Prefix.length = sizeof ( Region_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = region_id;
+ the_packet->segment = segment;
+ the_packet->size = size;
+ the_packet->option_set = option_set;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( region_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_INTERNAL_ERROR;
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_response_packet
+ *
+ */
+
+void _Region_MP_Send_response_packet (
+ Region_MP_Remote_operations operation,
+ Objects_Id region_id,
+ Thread_Control *the_thread
+)
+{
+ Region_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+
+ the_packet = ( Region_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case REGION_MP_ANNOUNCE_CREATE:
+ case REGION_MP_ANNOUNCE_DELETE:
+ case REGION_MP_EXTRACT_PROXY:
+ case REGION_MP_GET_SEGMENT_REQUEST:
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Region_MP_Process_packet
+ *
+ */
+
+void _Region_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Region_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Region_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case REGION_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Region_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Region_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_GET_SEGMENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_region_get_segment(
+ the_packet->Prefix.id,
+ the_packet->size,
+ the_packet->option_set,
+ the_packet->Prefix.timeout,
+ &the_packet->segment
+ );
+
+ _Region_MP_Send_response_packet(
+ REGION_MP_GET_SEGMENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case REGION_MP_GET_SEGMENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(void **)the_thread->Wait.return_argument = the_packet->segment;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case REGION_MP_RETURN_SEGMENT_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_region_return_segment(
+ the_packet->Prefix.id,
+ the_packet->segment
+ );
+
+ _Region_MP_Send_response_packet(
+ REGION_MP_RETURN_SEGMENT_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case REGION_MP_RETURN_SEGMENT_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Region_MP_Send_object_was_deleted
+ *
+ * This routine is not needed by the Region since a region
+ * cannot be deleted when segments are in use.
+ *
+ */
+
+/*PAGE
+ *
+ * _Region_MP_Send_extract_proxy
+ *
+ */
+
+void _Region_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Region_MP_Send_process_packet(
+ REGION_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+}
+
+/*PAGE
+ *
+ * _Region_MP_Get_packet
+ *
+ */
+
+Region_MP_Packet *_Region_MP_Get_packet ( void )
+{
+ return ( (Region_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/rtclock.c b/cpukit/rtems/src/rtclock.c
new file mode 100644
index 0000000000..ea340ae5f4
--- /dev/null
+++ b/cpukit/rtems/src/rtclock.c
@@ -0,0 +1,151 @@
+/*
+ * Clock Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * rtems_clock_get
+ *
+ * This directive returns the current date and time. If the time has
+ * not been set by a tm_set then an error is returned.
+ *
+ * Input parameters:
+ * option - which value to return
+ * time_buffer - pointer to output buffer (a time and date structure
+ * or an interval)
+ *
+ * Output parameters:
+ * time_buffer - output filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_get(
+ rtems_clock_get_options option,
+ void *time_buffer
+)
+{
+ ISR_Level level;
+ rtems_interval tmp;
+
+ switch ( option ) {
+ case RTEMS_CLOCK_GET_TOD:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_time_of_day *)time_buffer = _TOD_Current;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TICKS_PER_SECOND:
+ *(rtems_interval *)time_buffer = _TOD_Ticks_per_second;
+ return RTEMS_SUCCESSFUL;
+
+ case RTEMS_CLOCK_GET_TIME_VALUE:
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ _ISR_Disable( level );
+ ((rtems_clock_time_value *)time_buffer)->seconds =
+ _TOD_Seconds_since_epoch;
+ tmp = _TOD_Current.ticks;
+ _ISR_Enable( level );
+
+ tmp *= _TOD_Microseconds_per_tick;
+ ((rtems_clock_time_value *)time_buffer)->microseconds = tmp;
+
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* should never get here */
+
+}
+
+/*PAGE
+ *
+ * rtems_clock_set
+ *
+ * This directive sets the date and time for this node.
+ *
+ * Input parameters:
+ * time_buffer - pointer to the time and date structure
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_clock_set(
+ rtems_time_of_day *time_buffer
+)
+{
+ rtems_interval seconds;
+
+ if ( _TOD_Validate( time_buffer ) ) {
+ seconds = _TOD_To_seconds( time_buffer );
+ _Thread_Disable_dispatch();
+ _TOD_Set( time_buffer, seconds );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_INVALID_CLOCK;
+}
+
+/*PAGE
+ *
+ * rtems_clock_tick
+ *
+ * This directive notifies the executve that a tick has occurred.
+ * When the tick occurs the time manager updates and maintains
+ * the calendar time, timeslicing, and any timeout delays.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ *
+ * NOTE: This routine only works for leap-years through 2099.
+ */
+
+rtems_status_code rtems_clock_tick( void )
+{
+ _TOD_Tickle_ticks();
+
+ _Watchdog_Tickle_ticks();
+
+ _Thread_Tickle_timeslice();
+
+ if ( _Thread_Is_context_switch_necessary() &&
+ _Thread_Is_dispatching_enabled() )
+ _Thread_Dispatch();
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/rtems/src/rtemstimer.c b/cpukit/rtems/src/rtemstimer.c
new file mode 100644
index 0000000000..6c3005ffbe
--- /dev/null
+++ b/cpukit/rtems/src/rtemstimer.c
@@ -0,0 +1,349 @@
+/*
+ * Timer Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * _Timer_Manager_initialization
+ *
+ * This routine initializes all timer manager related data structures.
+ *
+ * Input parameters:
+ * maximum_timers - number of timers to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Timer_Manager_initialization(
+ unsigned32 maximum_timers
+)
+{
+ _Objects_Initialize_information(
+ &_Timer_Information,
+ OBJECTS_RTEMS_TIMERS,
+ FALSE,
+ maximum_timers,
+ sizeof( Timer_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_timer_create
+ *
+ * This directive creates a timer and performs some initialization.
+ *
+ * Input parameters:
+ * name - timer name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * id - timer id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_create(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Timer_Control *the_timer;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_timer = _Timer_Allocate();
+
+ if ( !the_timer ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_timer->the_class = TIMER_DORMANT;
+
+ _Objects_Open( &_Timer_Information, &the_timer->Object, &name );
+
+ *id = the_timer->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_timer_ident
+ *
+ * This directive returns the system ID associated with
+ * the timer name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * id - pointer to timer id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Timer_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_timer_cancel
+ *
+ * This directive allows a thread to cancel a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_cancel(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( !_Timer_Is_dormant_class( the_timer->the_class ) )
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_delete
+ *
+ * This directive allows a thread to delete a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_delete(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Timer_Information, &the_timer->Object );
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ _Timer_Free( the_timer );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_after
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * ticks - interval until routine is fired
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_after(
+ Objects_Id id,
+ rtems_interval ticks,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ if ( ticks == 0 )
+ return RTEMS_INVALID_NUMBER;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_INTERVAL;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_ticks( &the_timer->Ticker, ticks );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_fire_when
+ *
+ * This directive allows a thread to start a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ * wall_time - time of day to fire timer
+ * routine - routine to schedule
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_fire_when(
+ Objects_Id id,
+ rtems_time_of_day *wall_time,
+ rtems_timer_service_routine_entry routine,
+ void *user_data
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+ rtems_interval seconds;
+
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ if ( !_TOD_Validate( wall_time ) )
+ return RTEMS_INVALID_CLOCK;
+
+ seconds = _TOD_To_seconds( wall_time );
+ if ( seconds <= _TOD_Seconds_since_epoch )
+ return RTEMS_INVALID_CLOCK;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ (void) _Watchdog_Remove( &the_timer->Ticker );
+ the_timer->the_class = TIMER_TIME_OF_DAY;
+ _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
+ _Watchdog_Insert_seconds(
+ &the_timer->Ticker,
+ seconds - _TOD_Seconds_since_epoch
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_timer_reset
+ *
+ * This directive allows a thread to reset a timer.
+ *
+ * Input parameters:
+ * id - timer id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_timer_reset(
+ Objects_Id id
+)
+{
+ Timer_Control *the_timer;
+ Objects_Locations location;
+
+ the_timer = _Timer_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+ case OBJECTS_LOCAL:
+ if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
+ _Watchdog_Reset( &the_timer->Ticker );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_DEFINED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/sem.c b/cpukit/rtems/src/sem.c
new file mode 100644
index 0000000000..004176f4fb
--- /dev/null
+++ b/cpukit/rtems/src/sem.c
@@ -0,0 +1,570 @@
+/*
+ * Semaphore Manager
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the Semaphore Manager.
+ * This manager utilizes standard Dijkstra counting semaphores to provide
+ * synchronization and mutual exclusion capabilities.
+ *
+ * Directives provided are:
+ *
+ * + create a semaphore
+ * + get an ID of a semaphore
+ * + delete a semaphore
+ * + acquire a semaphore
+ * + release a semaphore
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/interr.h>
+
+/*PAGE
+ *
+ * _Semaphore_Manager_initialization
+ *
+ * This routine initializes all semaphore manager related data structures.
+ *
+ * Input parameters:
+ * maximum_semaphores - maximum configured semaphores
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Manager_initialization(
+ unsigned32 maximum_semaphores
+)
+{
+ _Objects_Initialize_information(
+ &_Semaphore_Information,
+ OBJECTS_RTEMS_SEMAPHORES,
+ TRUE,
+ maximum_semaphores,
+ sizeof( Semaphore_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_SEMAPHORE,
+ _Semaphore_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_create
+ *
+ * This directive creates a semaphore and sets the initial value based
+ * on the given count. A semaphore id is returned.
+ *
+ * Input parameters:
+ * name - user defined semaphore name
+ * count - initial count of semaphore
+ * attribute_set - semaphore attributes
+ * priority_ceiling - semaphore's ceiling priority
+ * id - pointer to semaphore id
+ *
+ * Output parameters:
+ * id - semaphore id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_create(
+ rtems_name name,
+ unsigned32 count,
+ rtems_attribute attribute_set,
+ rtems_task_priority priority_ceiling,
+ Objects_Id *id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ CORE_mutex_Attributes the_mutex_attributes;
+ CORE_semaphore_Attributes the_semaphore_attributes;
+ unsigned32 lock;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( _Attributes_Is_global( attribute_set ) ) {
+
+ if ( !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ if ( _Attributes_Is_inherit_priority( attribute_set ) )
+ return RTEMS_NOT_DEFINED;
+
+ } else if ( _Attributes_Is_inherit_priority( attribute_set ) ) {
+
+ if ( ! ( _Attributes_Is_binary_semaphore( attribute_set ) &&
+ _Attributes_Is_priority( attribute_set ) ) )
+ return RTEMS_NOT_DEFINED;
+
+ }
+
+ if ( _Attributes_Is_binary_semaphore( attribute_set ) && ( count > 1 ) )
+ return RTEMS_INVALID_NUMBER;
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_semaphore = _Semaphore_Allocate();
+
+ if ( !the_semaphore ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( _Attributes_Is_global( attribute_set ) &&
+ ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,
+ the_semaphore->Object.id, FALSE ) ) ) {
+ _Semaphore_Free( the_semaphore );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_semaphore->attribute_set = attribute_set;
+
+ if ( _Attributes_Is_binary_semaphore( attribute_set ) ) {
+ if ( _Attributes_Is_inherit_priority( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+ else if (_Attributes_Is_priority_ceiling( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+ else if (_Attributes_Is_priority( attribute_set ) )
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY;
+ else
+ the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
+
+ the_mutex_attributes.allow_nesting = TRUE;
+
+ /* Add priority ceiling code here ????? */
+
+ the_mutex_attributes.priority_ceiling = priority_ceiling;
+
+ if ( count == 1 )
+ lock = CORE_MUTEX_UNLOCKED;
+ else
+ lock = CORE_MUTEX_LOCKED;
+
+ _CORE_mutex_Initialize(
+ &the_semaphore->Core_control.mutex,
+ OBJECTS_RTEMS_SEMAPHORES,
+ &the_mutex_attributes,
+ lock,
+ _Semaphore_MP_Send_extract_proxy
+ );
+ }
+ else {
+ if ( _Attributes_Is_priority( attribute_set ) )
+ the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY;
+ else
+ the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
+
+ /*
+ * The following are just to make Purify happy.
+ */
+
+ the_mutex_attributes.allow_nesting = TRUE;
+ the_mutex_attributes.priority_ceiling = PRIORITY_MINIMUM;
+
+ _CORE_semaphore_Initialize(
+ &the_semaphore->Core_control.semaphore,
+ OBJECTS_RTEMS_SEMAPHORES,
+ &the_semaphore_attributes,
+ count,
+ _Semaphore_MP_Send_extract_proxy
+ );
+ }
+
+ _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
+
+ *id = the_semaphore->Object.id;
+
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_ANNOUNCE_CREATE,
+ the_semaphore->Object.id,
+ name,
+ 0 /* Not used */
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_ident
+ *
+ * This directive returns the system ID associated with
+ * the semaphore name.
+ *
+ * Input parameters:
+ * name - user defined semaphore name
+ * node - node(s) to be searched
+ * id - pointer to semaphore id
+ *
+ * Output parameters:
+ * *id - semaphore id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_delete
+ *
+ * This directive allows a thread to delete a semaphore specified by
+ * the semaphore id. The semaphore is freed back to the inactive
+ * semaphore chain.
+ *
+ * Input parameters:
+ * id - semaphore id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_delete(
+ Objects_Id id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) {
+ if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+ else
+ _CORE_mutex_Flush(
+ &the_semaphore->Core_control.mutex,
+ _Semaphore_MP_Send_object_was_deleted,
+ CORE_MUTEX_WAS_DELETED
+ );
+ }
+ else
+ _CORE_semaphore_Flush(
+ &the_semaphore->Core_control.semaphore,
+ _Semaphore_MP_Send_object_was_deleted,
+ CORE_SEMAPHORE_WAS_DELETED
+ );
+
+ _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
+
+ _Semaphore_Free( the_semaphore );
+
+ if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) {
+
+ _Objects_MP_Close( &_Semaphore_Information, the_semaphore->Object.id );
+
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_ANNOUNCE_DELETE,
+ the_semaphore->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_obtain
+ *
+ * This directive allows a thread to acquire a semaphore.
+ *
+ * Input parameters:
+ * id - semaphore id
+ * option_set - wait option
+ * timeout - number of ticks to wait (0 means wait forever)
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_obtain(
+ Objects_Id id,
+ unsigned32 option_set,
+ rtems_interval timeout
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+ boolean wait;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Semaphore_MP_Send_request_packet(
+ SEMAPHORE_MP_OBTAIN_REQUEST,
+ id,
+ option_set,
+ timeout
+ );
+ case OBJECTS_LOCAL:
+ if ( _Options_Is_no_wait( option_set ) )
+ wait = FALSE;
+ else
+ wait = TRUE;
+
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
+ _CORE_mutex_Seize(
+ &the_semaphore->Core_control.mutex,
+ id,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_mutex_return_code(
+ _Thread_Executing->Wait.return_code );
+ } else {
+ _CORE_semaphore_Seize(
+ &the_semaphore->Core_control.semaphore,
+ id,
+ wait,
+ timeout
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_semaphore_return_code(
+ _Thread_Executing->Wait.return_code );
+ }
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_semaphore_release
+ *
+ * This directive allows a thread to release a semaphore.
+ *
+ * Input parameters:
+ * id - semaphore id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_semaphore_release(
+ Objects_Id id
+)
+{
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+ CORE_mutex_Status mutex_status;
+ CORE_semaphore_Status semaphore_status;
+
+ the_semaphore = _Semaphore_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Semaphore_MP_Send_request_packet(
+ SEMAPHORE_MP_RELEASE_REQUEST,
+ id,
+ 0, /* Not used */
+ MPCI_DEFAULT_TIMEOUT
+ );
+ case OBJECTS_LOCAL:
+ if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
+ mutex_status = _CORE_mutex_Surrender(
+ &the_semaphore->Core_control.mutex,
+ id,
+ _Semaphore_Core_mutex_mp_support
+ );
+ _Thread_Enable_dispatch();
+ return _Semaphore_Translate_core_mutex_return_code( mutex_status );
+ }
+ else
+ semaphore_status = _CORE_semaphore_Surrender(
+ &the_semaphore->Core_control.semaphore,
+ id,
+ _Semaphore_Core_semaphore_mp_support
+ );
+ _Thread_Enable_dispatch();
+ return
+ _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Translate_core_mutex_return_code
+ *
+ * Input parameters:
+ * the_mutex_status - mutex status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Semaphore_Translate_core_mutex_return_code (
+ unsigned32 the_mutex_status
+)
+{
+ switch ( the_mutex_status ) {
+ case CORE_MUTEX_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
+ return RTEMS_INTERNAL_ERROR;
+ case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
+ return RTEMS_NOT_OWNER_OF_RESOURCE;
+ case CORE_MUTEX_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_MUTEX_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Translate_core_semaphore_return_code
+ *
+ * Input parameters:
+ * the_semaphore_status - semaphore status code to translate
+ *
+ * Output parameters:
+ * rtems status code - translated RTEMS status code
+ *
+ */
+
+rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
+ unsigned32 the_semaphore_status
+)
+{
+ switch ( the_semaphore_status ) {
+ case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
+ return RTEMS_SUCCESSFUL;
+ case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
+ return RTEMS_UNSATISFIED;
+ case CORE_SEMAPHORE_WAS_DELETED:
+ return RTEMS_OBJECT_WAS_DELETED;
+ case CORE_SEMAPHORE_TIMEOUT:
+ return RTEMS_TIMEOUT;
+ case THREAD_STATUS_PROXY_BLOCKING:
+ return THREAD_STATUS_PROXY_BLOCKING;
+ }
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * _Semaphore_Core_mutex_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the semaphore was surrendered to
+ * id - id of the surrendered semaphore
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Core_mutex_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ id,
+ the_thread
+ );
+}
+
+
+/*PAGE
+ *
+ * _Semaphore_Core_semaphore_mp_support
+ *
+ * Input parameters:
+ * the_thread - the remote thread the semaphore was surrendered to
+ * id - id of the surrendered semaphore
+ *
+ * Output parameters: NONE
+ */
+
+void _Semaphore_Core_semaphore_mp_support (
+ Thread_Control *the_thread,
+ Objects_Id id
+)
+{
+ the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ id,
+ the_thread
+ );
+}
diff --git a/cpukit/rtems/src/semmp.c b/cpukit/rtems/src/semmp.c
new file mode 100644
index 0000000000..7e7d59ba8e
--- /dev/null
+++ b/cpukit/rtems/src/semmp.c
@@ -0,0 +1,308 @@
+/*
+ * Multiprocessing Support for the Semaphore Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_process_packet
+ *
+ */
+
+void _Semaphore_MP_Send_process_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_name name,
+ Objects_Id proxy_id
+)
+{
+ Semaphore_MP_Packet *the_packet;
+ unsigned32 node;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+
+ the_packet = _Semaphore_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE;
+ the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = semaphore_id;
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
+
+ if ( operation == SEMAPHORE_MP_EXTRACT_PROXY )
+ node = rtems_get_node( semaphore_id );
+ else
+ node = MPCI_ALL_NODES;
+
+ _MPCI_Send_process_packet( node, &the_packet->Prefix );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Semaphore_MP_Send_request_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ rtems_option option_set,
+ rtems_interval timeout
+)
+{
+ Semaphore_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+
+ the_packet = _Semaphore_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE;
+ the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
+ if ( ! _Options_Is_no_wait(option_set))
+ the_packet->Prefix.timeout = timeout;
+
+ the_packet->operation = operation;
+ the_packet->Prefix.id = semaphore_id;
+ the_packet->option_set = option_set;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( semaphore_id ),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_SEMAPHORE
+ );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_response_packet
+ *
+ */
+
+void _Semaphore_MP_Send_response_packet (
+ Semaphore_MP_Remote_operations operation,
+ Objects_Id semaphore_id,
+ Thread_Control *the_thread
+)
+{
+ Semaphore_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+
+ the_packet = ( Semaphore_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Semaphore_MP_Process_packet
+ *
+ */
+
+void _Semaphore_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Semaphore_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (Semaphore_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case SEMAPHORE_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_Semaphore_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_Semaphore_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_EXTRACT_PROXY:
+
+ the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
+
+ if ( ! _Thread_Is_null( the_thread ) )
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_semaphore_obtain(
+ the_packet->Prefix.id,
+ the_packet->option_set,
+ the_packet->Prefix.timeout
+ );
+
+ if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+
+ case SEMAPHORE_MP_OBTAIN_RESPONSE:
+ case SEMAPHORE_MP_RELEASE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case SEMAPHORE_MP_RELEASE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_semaphore_release(
+ the_packet->Prefix.id
+ );
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_RELEASE_RESPONSE,
+ the_packet->Prefix.id,
+ _Thread_Executing
+ );
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_object_was_deleted
+ *
+ */
+
+void _Semaphore_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+)
+{
+ the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
+
+ _Semaphore_MP_Send_response_packet(
+ SEMAPHORE_MP_OBTAIN_RESPONSE,
+ the_proxy->Wait.id,
+ the_proxy
+ );
+
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Send_extract_proxy
+ *
+ */
+
+void _Semaphore_MP_Send_extract_proxy (
+ Thread_Control *the_thread
+)
+{
+ _Semaphore_MP_Send_process_packet(
+ SEMAPHORE_MP_EXTRACT_PROXY,
+ the_thread->Wait.id,
+ (rtems_name) 0,
+ the_thread->Object.id
+ );
+
+}
+
+/*PAGE
+ *
+ * _Semaphore_MP_Get_packet
+ *
+ */
+
+Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void )
+{
+ return ( (Semaphore_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/signal.c b/cpukit/rtems/src/signal.c
new file mode 100644
index 0000000000..10aefa391c
--- /dev/null
+++ b/cpukit/rtems/src/signal.c
@@ -0,0 +1,149 @@
+/*
+ * Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/asr.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/tasks.h>
+
+/*PAGE
+ *
+ * _Signal_Manager_initialization
+ *
+ * This routine initializes all signal manager related data structures.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Signal_Manager_initialization( void )
+{
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_SIGNAL,
+ _Signal_MP_Process_packet
+ );
+}
+
+/*PAGE
+ *
+ * rtems_signal_catch
+ *
+ * This directive allows a thread to specify what action to take when
+ * catching signals.
+ *
+ * Input parameters:
+ * handler - address of asynchronous signal routine (asr)
+ * ( NULL indicates asr is invalid )
+ * mode_set - mode value for asr
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_signal_catch(
+ rtems_asr_entry asr_handler,
+ rtems_mode mode_set
+)
+{
+ Thread_Control *executing;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+/* XXX normalize mode */
+ executing = _Thread_Executing;
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ _Thread_Disable_dispatch(); /* cannot reschedule while */
+ /* the thread is inconsistent */
+
+ if ( !_ASR_Is_null_handler( asr_handler ) ) {
+ asr->mode_set = mode_set;
+ asr->handler = asr_handler;
+ }
+ else
+ _ASR_Initialize( asr );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_signal_send
+ *
+ * This directive allows a thread to send signals to a thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * signal_set - signal set
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_signal_send(
+ Objects_Id id,
+ rtems_signal_set signal_set
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _Signal_MP_Send_request_packet(
+ SIGNAL_MP_SEND_REQUEST,
+ id,
+ signal_set
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ if ( ! _ASR_Is_null_handler( asr->handler ) ) {
+ if ( asr->is_enabled ) {
+ _ASR_Post_signals( signal_set, &asr->signals_posted );
+
+ the_thread->do_post_task_switch_extension = TRUE;
+
+ if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
+ _ISR_Signals_to_thread_executing = TRUE;
+ } else {
+ _ASR_Post_signals( signal_set, &asr->signals_pending );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_NOT_DEFINED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/signalmp.c b/cpukit/rtems/src/signalmp.c
new file mode 100644
index 0000000000..b3a6ecf18c
--- /dev/null
+++ b/cpukit/rtems/src/signalmp.c
@@ -0,0 +1,189 @@
+/*
+ * Multiprocessing Support for the Signal Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _Signal_MP_Send_process_packet
+ *
+ * This subprogram is not needed since there are no process
+ * packets to be sent by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _Signal_MP_Send_request_packet (
+ Signal_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_signal_set signal_in
+)
+{
+ Signal_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SIGNAL_MP_SEND_REQUEST:
+
+ the_packet = _Signal_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_SIGNAL;
+ the_packet->Prefix.length = sizeof ( Signal_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->signal_in = signal_in;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( task_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case SIGNAL_MP_SEND_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_INTERNAL_ERROR;
+}
+
+/*PAGE
+ *
+ * _Signal_MP_Send_response_packet
+ *
+ */
+
+void _Signal_MP_Send_response_packet (
+ Signal_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ Signal_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case SIGNAL_MP_SEND_RESPONSE:
+
+ the_packet = ( Signal_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case SIGNAL_MP_SEND_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _Signal_MP_Process_packet
+ *
+ */
+
+void _Signal_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ Signal_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+
+ the_packet = (Signal_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case SIGNAL_MP_SEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_signal_send(
+ the_packet->Prefix.id,
+ the_packet->signal_in
+ );
+
+ _Signal_MP_Send_response_packet(
+ SIGNAL_MP_SEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case SIGNAL_MP_SEND_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ * _Signal_MP_Send_object_was_deleted
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Send_extract_proxy
+ *
+ * This subprogram is not needed since there are no objects
+ * deleted by this manager.
+ *
+ */
+
+/*PAGE
+ *
+ * _Signal_MP_Get_packet
+ *
+ */
+
+Signal_MP_Packet *_Signal_MP_Get_packet ( void )
+{
+ return ( (Signal_MP_Packet *) _MPCI_Get_packet() );
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/taskmp.c b/cpukit/rtems/src/taskmp.c
new file mode 100644
index 0000000000..8edccb05e9
--- /dev/null
+++ b/cpukit/rtems/src/taskmp.c
@@ -0,0 +1,340 @@
+/*
+ * Multiprocessing Support for the RTEMS Task Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/rtems/support.h>
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_process_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Send_process_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_name name
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+
+ the_packet = _RTEMS_tasks_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_TASKS;
+ the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->name = name;
+
+ _MPCI_Send_process_packet( MPCI_ALL_NODES, &the_packet->Prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_request_packet
+ *
+ */
+
+rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Objects_Id task_id,
+ rtems_task_priority new_priority,
+ unsigned32 notepad,
+ unsigned32 note
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+
+ the_packet = _RTEMS_tasks_MP_Get_packet();
+ the_packet->Prefix.the_class = MP_PACKET_TASKS;
+ the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
+ the_packet->operation = operation;
+ the_packet->Prefix.id = task_id;
+ the_packet->the_priority = new_priority;
+ the_packet->notepad = notepad;
+ the_packet->note = note;
+
+ return _MPCI_Send_request_packet(
+ rtems_get_node( task_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+ break;
+
+ }
+ /*
+ * The following line is included to satisfy compilers which
+ * produce warnings when a function does not end with a return.
+ */
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_response_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Send_response_packet (
+ RTEMS_tasks_MP_Remote_operations operation,
+ Thread_Control *the_thread
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+
+ switch ( operation ) {
+
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+
+ the_packet = (RTEMS_tasks_MP_Packet *) the_thread->receive_packet;
+
+/*
+ * The packet being returned already contains the class, length, and
+ * to_convert fields, therefore they are not set in this routine.
+ */
+ the_packet->operation = operation;
+ the_packet->Prefix.id = the_packet->Prefix.source_tid;
+
+ _MPCI_Send_response_packet(
+ rtems_get_node( the_packet->Prefix.source_tid ),
+ &the_packet->Prefix
+ );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+ break;
+
+ }
+}
+
+/*PAGE
+ *
+ *
+ * _RTEMS_tasks_MP_Process_packet
+ *
+ */
+
+void _RTEMS_tasks_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+)
+{
+ RTEMS_tasks_MP_Packet *the_packet;
+ Thread_Control *the_thread;
+ boolean ignored;
+
+ the_packet = (RTEMS_tasks_MP_Packet *) the_packet_prefix;
+
+ switch ( the_packet->operation ) {
+
+ case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
+
+ ignored = _Objects_MP_Allocate_and_open(
+ &_RTEMS_tasks_Information,
+ the_packet->name,
+ the_packet->Prefix.id,
+ TRUE
+ );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
+
+ _Objects_MP_Close( &_RTEMS_tasks_Information, the_packet->Prefix.id );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_suspend(
+ the_packet->Prefix.id
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SUSPEND_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
+ case RTEMS_TASKS_MP_RESUME_RESPONSE:
+ case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_RESUME_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_resume(
+ the_packet->Prefix.id
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_RESUME_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_set_priority(
+ the_packet->Prefix.id,
+ the_packet->the_priority,
+ &the_packet->the_priority
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(rtems_task_priority *)the_thread->Wait.return_argument =
+ the_packet->the_priority;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_get_note(
+ the_packet->Prefix.id,
+ the_packet->notepad,
+ &the_packet->note
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_GET_NOTE_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+
+ case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
+
+ the_thread = _MPCI_Process_response( the_packet_prefix );
+
+ *(unsigned32 *)the_thread->Wait.return_argument = the_packet->note;
+
+ _MPCI_Return_packet( the_packet_prefix );
+ break;
+
+ case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
+
+ the_packet->Prefix.return_code = rtems_task_set_note(
+ the_packet->Prefix.id,
+ the_packet->notepad,
+ the_packet->note
+ );
+
+ _RTEMS_tasks_MP_Send_response_packet(
+ RTEMS_TASKS_MP_SET_NOTE_RESPONSE,
+ _Thread_Executing
+ );
+ break;
+ }
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_object_was_deleted
+ *
+ * This routine is not neededby the Tasks since a task
+ * cannot be globally deleted.
+ *
+ */
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Send_extract_proxy
+ *
+ * This routine is not neededby the Tasks since a task
+ * cannot be globally deleted.
+ *
+ */
+
+/*PAGE
+ *
+ * _RTEMS_tasks_MP_Get_packet
+ *
+ */
+
+RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void )
+{
+ return (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet();
+}
+
+/* end of file */
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
new file mode 100644
index 0000000000..0b30fcce69
--- /dev/null
+++ b/cpukit/rtems/src/tasks.c
@@ -0,0 +1,1098 @@
+/*
+ * RTEMS Task Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/modes.h>
+#include <rtems/score/object.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Create_extension
+ *
+ * XXX
+ */
+
+boolean _RTEMS_tasks_Create_extension(
+ Thread_Control *executing,
+ Thread_Control *created
+)
+{
+ RTEMS_API_Control *api;
+
+ api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
+
+ if ( !api )
+ return FALSE;
+
+ created->API_Extensions[ THREAD_API_RTEMS ] = api;
+
+ api->pending_events = EVENT_SETS_NONE_PENDING;
+ _ASR_Initialize( &api->Signal );
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Start_extension
+ *
+ * XXX
+ */
+
+User_extensions_routine _RTEMS_tasks_Start_extension(
+ Thread_Control *executing,
+ Thread_Control *started
+)
+{
+ RTEMS_API_Control *api;
+
+ api = started->API_Extensions[ THREAD_API_RTEMS ];
+
+ api->pending_events = EVENT_SETS_NONE_PENDING;
+
+ _ASR_Initialize( &api->Signal );
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Delete_extension
+ *
+ * XXX
+ */
+
+User_extensions_routine _RTEMS_tasks_Delete_extension(
+ Thread_Control *executing,
+ Thread_Control *deleted
+)
+{
+ (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] );
+
+ deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Switch_extension
+ *
+ * XXX
+ */
+
+void _RTEMS_tasks_Switch_extension(
+ Thread_Control *executing
+)
+{
+ ISR_Level level;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+ rtems_signal_set signal_set;
+ Modes_Control prev_mode;
+
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ _ISR_Disable( level );
+ signal_set = asr->signals_posted;
+ asr->signals_posted = 0;
+ _ISR_Enable( level );
+
+
+ if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */
+ return;
+
+ asr->nest_level += 1;
+ rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+ (*asr->handler)( signal_set );
+
+ asr->nest_level -= 1;
+ rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+}
+
+API_extensions_Control _RTEMS_tasks_API_extensions = {
+ { NULL, NULL },
+ NULL, /* predriver */
+ _RTEMS_tasks_Initialize_user_tasks, /* postdriver */
+ _RTEMS_tasks_Switch_extension /* post switch */
+};
+
+User_extensions_Control _RTEMS_tasks_User_extensions = {
+ { NULL, NULL },
+ { _RTEMS_tasks_Create_extension, /* create */
+ _RTEMS_tasks_Start_extension, /* start */
+ _RTEMS_tasks_Start_extension, /* restart */
+ _RTEMS_tasks_Delete_extension, /* delete */
+ NULL, /* switch */
+ NULL, /* begin */
+ NULL, /* exitted */
+ NULL /* fatal */
+ }
+};
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Manager_initialization
+ *
+ * This routine initializes all Task Manager related data structures.
+ *
+ * Input parameters:
+ * maximum_tasks - number of tasks to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Manager_initialization(
+ unsigned32 maximum_tasks,
+ unsigned32 number_of_initialization_tasks,
+ rtems_initialization_tasks_table *user_tasks
+)
+{
+
+ _RTEMS_tasks_Number_of_initialization_tasks = number_of_initialization_tasks;
+ _RTEMS_tasks_User_initialization_tasks = user_tasks;
+
+ if ( user_tasks == NULL || number_of_initialization_tasks == 0 )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, RTEMS_TOO_MANY );
+
+ _Objects_Initialize_information(
+ &_RTEMS_tasks_Information,
+ OBJECTS_RTEMS_TASKS,
+ TRUE,
+ maximum_tasks,
+ sizeof( Thread_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ TRUE
+ );
+
+ /*
+ * Add all the extensions for this API
+ */
+
+ _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
+
+ _API_extensions_Add( &_RTEMS_tasks_API_extensions );
+
+ /*
+ * Register the MP Process Packet routine.
+ */
+
+ _MPCI_Register_packet_processor(
+ MP_PACKET_TASKS,
+ _RTEMS_tasks_MP_Process_packet
+ );
+
+}
+
+/*PAGE
+ *
+ * rtems_task_create
+ *
+ * This directive creates a thread by allocating and initializing a
+ * thread control block and a stack. The newly created thread is
+ * placed in the dormant state.
+ *
+ * Input parameters:
+ * name - user defined thread name
+ * initial_priority - thread priority
+ * stack_size - stack size in bytes
+ * initial_modes - initial thread mode
+ * attribute_set - thread attributes
+ * id - pointer to thread id
+ *
+ * Output parameters:
+ * id - thread id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_create(
+ rtems_name name,
+ rtems_task_priority initial_priority,
+ unsigned32 stack_size,
+ rtems_mode initial_modes,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_MP_Control *the_global_object = NULL;
+ boolean is_fp;
+ boolean is_global;
+ boolean status;
+ rtems_attribute the_attribute_set;
+ Priority_Control core_priority;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ /*
+ * Core Thread Initialize insures we get the minimum amount of
+ * stack space.
+ */
+
+#if 0
+ if ( !_Stack_Is_enough( stack_size ) )
+ return RTEMS_INVALID_SIZE;
+#endif
+
+ /*
+ * Validate the RTEMS API priority and convert it to the core priority range.
+ */
+
+ if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) )
+ return RTEMS_INVALID_PRIORITY;
+
+ core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority );
+
+ /*
+ * Fix the attribute set to match the attributes which
+ * this processor (1) requires and (2) is able to support.
+ * First add in the required flags for attribute_set
+ * Typically this might include FP if the platform
+ * or application required all tasks to be fp aware.
+ * Then turn off the requested bits which are not supported.
+ */
+
+ the_attribute_set = _Attributes_Set( attribute_set, ATTRIBUTES_REQUIRED );
+ the_attribute_set =
+ _Attributes_Clear( the_attribute_set, ATTRIBUTES_NOT_SUPPORTED );
+
+ if ( _Attributes_Is_floating_point( the_attribute_set ) )
+ is_fp = TRUE;
+ else
+ is_fp = FALSE;
+
+ if ( _Attributes_Is_global( the_attribute_set ) ) {
+
+ is_global = TRUE;
+
+ if ( !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+
+ } else
+ is_global = FALSE;
+
+ /*
+ * Make sure system is MP if this task is global
+ */
+
+ /*
+ * Disable dispatch for protection
+ */
+
+ _Thread_Disable_dispatch();
+
+ /*
+ * Allocate the thread control block and -- if the task is global --
+ * allocate a global object control block.
+ *
+ * NOTE: This routine does not use the combined allocate and open
+ * global object routine because this results in a lack of
+ * control over when memory is allocated and can be freed in
+ * the event of an error.
+ */
+
+ the_thread = _RTEMS_tasks_Allocate();
+
+ if ( !the_thread ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ if ( is_global ) {
+ the_global_object = _Objects_MP_Allocate_global_object();
+
+ if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
+ _RTEMS_tasks_Free( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+ }
+
+ /*
+ * Initialize the core thread for this task.
+ */
+
+ status = _Thread_Initialize(
+ &_RTEMS_tasks_Information,
+ the_thread,
+ NULL,
+ stack_size,
+ is_fp,
+ core_priority,
+ _Modes_Is_preempt(initial_modes) ? TRUE : FALSE,
+ _Modes_Is_timeslice(initial_modes) ? TRUE : FALSE,
+ _Modes_Get_interrupt_level(initial_modes),
+ &name
+ );
+
+ if ( !status ) {
+ if ( is_global )
+ _Objects_MP_Free_global_object( the_global_object );
+ _RTEMS_tasks_Free( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ asr->is_enabled = _Modes_Is_asr_disabled(initial_modes) ? FALSE : TRUE;
+
+ *id = the_thread->Object.id;
+
+ if ( is_global ) {
+
+ the_thread->is_global = TRUE;
+
+ _Objects_MP_Open(
+ &_RTEMS_tasks_Information,
+ the_global_object,
+ name,
+ the_thread->Object.id
+ );
+
+ _RTEMS_tasks_MP_Send_process_packet(
+ RTEMS_TASKS_MP_ANNOUNCE_CREATE,
+ the_thread->Object.id,
+ name
+ );
+
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_ident
+ *
+ * This directive returns the system ID associated with
+ * the thread name.
+ *
+ * Input parameters:
+ * name - user defined thread name
+ * node - node(s) to be searched
+ * id - pointer to thread id
+ *
+ * Output parameters:
+ * *id - thread id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ if ( name == OBJECTS_ID_OF_SELF ) {
+ *id = _Thread_Executing->Object.id;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_task_start
+ *
+ * This directive readies the thread identified by the "id"
+ * based on its current priorty, to await execution. A thread
+ * can be started only from the dormant state.
+ *
+ * Input parameters:
+ * id - thread id
+ * entry_point - start execution address of thread
+ * argument - thread argument
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_start(
+ rtems_id id,
+ rtems_task_entry entry_point,
+ unsigned32 argument
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ if ( entry_point == NULL )
+ return RTEMS_INVALID_ADDRESS;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Thread_Start(
+ the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_restart
+ *
+ * This directive readies the specified thread. It restores
+ * the thread environment to the original values established
+ * at thread creation and start time. A thread can be restarted
+ * from any state except the dormant state.
+ *
+ * Input parameters:
+ * id - thread id
+ * argument - thread argument
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_restart(
+ Objects_Id id,
+ unsigned32 argument
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ if ( _Thread_Restart( the_thread, NULL, argument ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_delete
+ *
+ * This directive allows a thread to delete itself or the thread
+ * identified in the id field. The executive halts execution
+ * of the thread and frees the thread control block.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * nothing - if id is the requesting thread (always succeeds)
+ * RTEMS_SUCCESSFUL - if successful and id is
+ * not the requesting thread
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_delete(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ case OBJECTS_LOCAL:
+ _Thread_Close( &_RTEMS_tasks_Information, the_thread );
+
+ _RTEMS_tasks_Free( the_thread );
+
+ if ( the_thread->is_global ) {
+
+ _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
+
+ _RTEMS_tasks_MP_Send_process_packet(
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE,
+ the_thread->Object.id,
+ 0 /* Not used */
+ );
+ }
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_suspend
+ *
+ * This directive will place the specified thread in the "suspended"
+ * state. Note that the suspended state can be in addition to
+ * other waiting states.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_suspend(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SUSPEND_REQUEST,
+ id,
+ 0, /* Not used */
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ case OBJECTS_LOCAL:
+ if ( !_States_Is_suspended( the_thread->current_state ) ) {
+ _Thread_Set_state( the_thread, STATES_SUSPENDED );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_ALREADY_SUSPENDED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_resume
+ *
+ * This directive will remove the specified thread
+ * from the suspended state.
+ *
+ * Input parameters:
+ * id - thread id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_resume(
+ Objects_Id id
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return(
+ _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_RESUME_REQUEST,
+ id,
+ 0, /* Not used */
+ 0, /* Not used */
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ if ( _States_Is_suspended( the_thread->current_state ) ) {
+ _Thread_Resume( the_thread );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_set_priority
+ *
+ * This directive changes the priority of the specified thread.
+ * The specified thread can be any thread in the system including
+ * the requesting thread.
+ *
+ * Input parameters:
+ * id - thread id (0 indicates requesting thread)
+ * new_priority - thread priority (0 indicates current priority)
+ * old_priority - pointer to previous priority
+ *
+ * Output parameters:
+ * old_priority - previous priority
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_set_priority(
+ Objects_Id id,
+ rtems_task_priority new_priority,
+ rtems_task_priority *old_priority
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+
+ if ( new_priority != RTEMS_CURRENT_PRIORITY &&
+ !_RTEMS_tasks_Priority_is_valid( new_priority ) )
+ return RTEMS_INVALID_PRIORITY;
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = old_priority;
+ return(
+ _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SET_PRIORITY_REQUEST,
+ id,
+ new_priority,
+ 0, /* Not used */
+ 0 /* Not used */
+ )
+ );
+ case OBJECTS_LOCAL:
+ *old_priority = the_thread->current_priority;
+ if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
+ the_thread->real_priority = new_priority;
+ if ( the_thread->resource_count == 0 ||
+ the_thread->current_priority > new_priority )
+ _Thread_Change_priority( the_thread, new_priority );
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_mode
+ *
+ * This directive enables and disables several modes of
+ * execution for the requesting thread.
+ *
+ * Input parameters:
+ * mode_set - new mode
+ * mask - mask
+ * previous_mode_set - address of previous mode set
+ *
+ * Output:
+ * *previous_mode_set - previous mode set
+ * always return RTEMS_SUCCESSFUL;
+ */
+
+rtems_status_code rtems_task_mode(
+ rtems_mode mode_set,
+ rtems_mode mask,
+ rtems_mode *previous_mode_set
+)
+{
+ Thread_Control *executing;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+ boolean is_asr_enabled = FALSE;
+ boolean needs_asr_dispatching = FALSE;
+ rtems_mode old_mode;
+
+ executing = _Thread_Executing;
+ api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ asr = &api->Signal;
+
+ old_mode = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT;
+ old_mode |= (executing->is_timeslice) ? RTEMS_TIMESLICE : RTEMS_NO_TIMESLICE;
+ old_mode |= (asr->is_enabled) ? RTEMS_ASR : RTEMS_NO_ASR;
+ old_mode |= _ISR_Get_level();
+
+ *previous_mode_set = old_mode;
+
+ /*
+ * These are generic thread scheduling characteristics.
+ */
+
+ if ( mask & RTEMS_PREEMPT_MASK )
+ executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE;
+
+ if ( mask & RTEMS_TIMESLICE_MASK )
+ executing->is_timeslice = _Modes_Is_timeslice(mode_set) ? TRUE : FALSE;
+
+ /*
+ * Set the new interrupt level
+ */
+
+ if ( mask & RTEMS_INTERRUPT_MASK )
+ _Modes_Set_interrupt_level( mode_set );
+
+ /*
+ * This is specific to the RTEMS API
+ */
+
+ is_asr_enabled = FALSE;
+ needs_asr_dispatching = FALSE;
+
+ if ( mask & RTEMS_ASR_MASK ) {
+ is_asr_enabled = _Modes_Is_asr_disabled( mode_set ) ? FALSE : TRUE;
+ if ( is_asr_enabled != asr->is_enabled ) {
+ asr->is_enabled = is_asr_enabled;
+ _ASR_Swap_signals( asr );
+ if ( _ASR_Are_signals_pending( asr ) ) {
+ needs_asr_dispatching = TRUE;
+ executing->do_post_task_switch_extension = TRUE;
+ }
+ }
+ }
+
+ if ( _Thread_Evaluate_mode() || needs_asr_dispatching )
+ _Thread_Dispatch();
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_get_note
+ *
+ * This directive obtains the note from the specified notepad
+ * of the specified thread.
+ *
+ * Input parameters:
+ * id - thread id
+ * notepad - notepad number
+ * note - pointer to note
+ *
+ * Output parameters:
+ * note - filled in if successful
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_get_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 *note
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ /*
+ * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would
+ * be checking an unsigned number for being negative.
+ */
+
+ if ( notepad > RTEMS_NOTEPAD_LAST )
+ return RTEMS_INVALID_NUMBER;
+
+ /*
+ * Optimize the most likely case to avoid the Thread_Dispatch.
+ */
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
+ _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+ *note = api->Notepads[ notepad ];
+ return RTEMS_SUCCESSFUL;
+ }
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ _Thread_Executing->Wait.return_argument = note;
+
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_GET_NOTE_REQUEST,
+ id,
+ 0, /* Not used */
+ notepad,
+ 0 /* Not used */
+ );
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ *note = api->Notepads[ notepad ];
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_set_note
+ *
+ * This directive sets the specified notepad contents to the given
+ * note.
+ *
+ * Input parameters:
+ * id - thread id
+ * notepad - notepad number
+ * note - note value
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_set_note(
+ Objects_Id id,
+ unsigned32 notepad,
+ unsigned32 note
+)
+{
+ register Thread_Control *the_thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ /*
+ * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would
+ * be checking an unsigned number for being negative.
+ */
+
+ if ( notepad > RTEMS_NOTEPAD_LAST )
+ return RTEMS_INVALID_NUMBER;
+
+ /*
+ * Optimize the most likely case to avoid the Thread_Dispatch.
+ */
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
+ _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
+ api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
+ api->Notepads[ notepad ] = note;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ the_thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+ case OBJECTS_REMOTE:
+ return _RTEMS_tasks_MP_Send_request_packet(
+ RTEMS_TASKS_MP_SET_NOTE_REQUEST,
+ id,
+ 0, /* Not used */
+ notepad,
+ note
+ );
+
+ case OBJECTS_LOCAL:
+ api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+ api->Notepads[ notepad ] = note;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ * rtems_task_wake_after
+ *
+ * This directive suspends the requesting thread for the given amount
+ * of ticks.
+ *
+ * Input parameters:
+ * ticks - number of ticks to wait
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - always successful
+ */
+
+rtems_status_code rtems_task_wake_after(
+ rtems_interval ticks
+)
+{
+ if ( ticks == 0 ) {
+ _Thread_Yield_processor();
+ _Thread_Dispatch();
+ } else {
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended,
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
+ _Thread_Enable_dispatch();
+ }
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_task_wake_when
+ *
+ * This directive blocks the requesting thread until the given date and
+ * time is reached.
+ *
+ * Input parameters:
+ * time_buffer - pointer to the time and date structure
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_task_wake_when(
+rtems_time_of_day *time_buffer
+)
+{
+ Watchdog_Interval seconds;
+
+ if ( !_TOD_Is_set() )
+ return RTEMS_NOT_DEFINED;
+
+ time_buffer->ticks = 0;
+
+ if ( !_TOD_Validate( time_buffer ) )
+ return RTEMS_INVALID_CLOCK;
+
+ seconds = _TOD_To_seconds( time_buffer );
+
+ if ( seconds <= _TOD_Seconds_since_epoch )
+ return RTEMS_INVALID_CLOCK;
+
+ _Thread_Disable_dispatch();
+ _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
+ _Watchdog_Initialize(
+ &_Thread_Executing->Timer,
+ _Thread_Delay_ended,
+ _Thread_Executing->Object.id,
+ NULL
+ );
+ _Watchdog_Insert_seconds(
+ &_Thread_Executing->Timer,
+ seconds - _TOD_Seconds_since_epoch
+ );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * _RTEMS_tasks_Initialize_user_tasks
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _RTEMS_tasks_Initialize_user_tasks( void )
+{
+ unsigned32 index;
+ unsigned32 maximum;
+ rtems_id id;
+ rtems_status_code return_value;
+ rtems_initialization_tasks_table *user_tasks;
+
+ /*
+ * NOTE: This is slightly different from the Ada implementation.
+ */
+
+ user_tasks = _RTEMS_tasks_User_initialization_tasks;
+ maximum = _RTEMS_tasks_Number_of_initialization_tasks;
+
+ for ( index=0 ; index < maximum ; index++ ) {
+ return_value = rtems_task_create(
+ user_tasks[ index ].name,
+ user_tasks[ index ].initial_priority,
+ user_tasks[ index ].stack_size,
+ user_tasks[ index ].mode_set,
+ user_tasks[ index ].attribute_set,
+ &id
+ );
+
+ if ( !rtems_is_status_successful( return_value ) )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
+
+ return_value = rtems_task_start(
+ id,
+ user_tasks[ index ].entry_point,
+ user_tasks[ index ].argument
+ );
+
+ if ( !rtems_is_status_successful( return_value ) )
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
+ }
+}
+
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
new file mode 100644
index 0000000000..83f6c3ccd1
--- /dev/null
+++ b/cpukit/sapi/include/confdefs.h
@@ -0,0 +1,377 @@
+/* confdefs.h
+ *
+ * This include file contains the configuration table template that will
+ * be used by the single processor tests to define its default configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CONFIGURATION_TEMPLATE_h
+#define __CONFIGURATION_TEMPLATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern rtems_initialization_tasks_table Initialization_tasks[];
+extern rtems_driver_address_table Device_drivers[];
+extern rtems_configuration_table Configuration;
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+/*
+ * Default User Initialization Task Table. This table guarantees that
+ * one user initialization table is defined.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
+
+#ifndef CONFIGURE_INIT_TASK_NAME
+#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'U', 'I', '1', ' ' )
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
+#define CONFIGURE_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_PRIORITY
+#define CONFIGURE_INIT_TASK_PRIORITY 1
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
+#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+#endif
+
+#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
+#define CONFIGURE_INIT_TASK_ARGUMENTS 0
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_initialization_tasks_table Initialization_tasks[] = {
+ { CONFIGURE_INIT_TASK_NAME,
+ CONFIGURE_INIT_TASK_STACK_SIZE,
+ CONFIGURE_INIT_TASK_PRIORITY,
+ CONFIGURE_INIT_TASK_ATTRIBUTES,
+ CONFIGURE_INIT_TASK_ENTRY_POINT,
+ CONFIGURE_INIT_TASK_INITIAL_MODES,
+ CONFIGURE_INIT_TASK_ARGUMENTS
+ }
+};
+#endif
+
+#endif
+
+/*
+ * Default Device Driver Table. Each driver needed by the test is explicitly
+ * choosen by that test. There is always a null driver entry.
+ */
+
+#define NULL_DRIVER_TABLE_ENTRY \
+ { NULL, NULL, NULL, NULL, NULL, NULL }
+
+#ifdef CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+#include <timerdrv.h>
+#endif
+
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+#include <stubdrv.h>
+#endif
+
+#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
+
+#ifdef CONFIGURE_INIT
+rtems_driver_address_table Device_drivers[] = {
+#ifdef CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+ CONSOLE_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+ CLOCK_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER
+ STUB_DRIVER_TABLE_ENTRY,
+#endif
+ NULL_DRIVER_TABLE_ENTRY
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
+
+/*
+ * Default the number of devices per device driver. This value may be
+ * overridden by the user.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES
+
+#ifndef CONFIGURE_MAXIMUM_DEVICES
+#define CONFIGURE_MAXIMUM_DEVICES 20
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifdef CONFIGURE_MPTEST
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#ifndef CONFIGURE_MP_NODE_NUMBER
+#define CONFIGURE_MP_NODE_NUMBER NODE_NUMBER
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_NODES
+#define CONFIGURE_MP_MAXIMUM_NODES 2
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 32
+#endif
+
+#ifndef CONFIGURE_MP_MAXIMUM_PROXIES
+#define CONFIGURE_MP_MAXIMUM_PROXIES 32
+#endif
+
+#ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
+#include <mpci.h>
+#define CONFIGURE_MP_MPCI_TABLE_POINTER &MPCI_table
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_multiprocessing_table Multiprocessing_configuration = {
+ CONFIGURE_MP_NODE_NUMBER, /* local node number */
+ CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes in system */
+ CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS, /* maximum # global objects */
+ CONFIGURE_MP_MAXIMUM_PROXIES, /* maximum # proxies */
+ CONFIGURE_MP_MPCI_TABLE_POINTER /* pointer to MPCI config table */
+};
+#endif
+
+#define CONFIGURE_MULTIPROCESSING_TABLE &Multiprocessing_configuration
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MULTIPROCESSING_TABLE NULL
+
+#endif /* CONFIGURE_MPTEST */
+
+/*
+ * Default Configuration Table. This table contains the most values set in
+ * the RTEMS Test Suite. Each value may be overridden within each test to
+ * customize the environment.
+ */
+
+#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_WORK_AREA
+#define CONFIGURE_EXECUTIVE_RAM_WORK_AREA NULL
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TASKS
+#define CONFIGURE_MAXIMUM_TASKS 10
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_TIMERS
+#define CONFIGURE_MAXIMUM_TIMERS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_SEMAPHORES
+#define CONFIGURE_MAXIMUM_SEMAPHORES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PARTITIONS
+#define CONFIGURE_MAXIMUM_PARTITIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_REGIONS
+#define CONFIGURE_MAXIMUM_REGIONS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PORTS
+#define CONFIGURE_MAXIMUM_PORTS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_PERIODS
+#define CONFIGURE_MAXIMUM_PERIODS 0
+#endif
+
+#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#endif
+
+#ifndef CONFIGURE_MICROSECONDS_PER_TICK
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
+#endif
+
+#ifndef CONFIGURE_TICKS_PER_TIMESLICE
+#define CONFIGURE_TICKS_PER_TIMESLICE 50
+#endif
+
+#ifndef CONFIGURE_INITIAL_EXTENSIONS
+#define CONFIGURE_INITIAL_EXTENSIONS NULL
+#endif
+
+/*
+ * Calculate the RAM size based on the maximum number of objects configured.
+ * The model is to estimate the memory required for each configured item,
+ * sum the memory requirements and insure that there is at least 32K greater
+ * than that for things not directly addressed such as:
+ *
+ * + stacks greater than minimum size
+ * + FP contexts
+ * + API areas (should be optional)
+ * + messages
+ * + object name and local pointer table overhead
+ * + per node memory requirements
+ * + executive fixed requirements (including at least internal threads
+ * and the Ready chains)
+ *
+ * NOTE: Eventually this should take into account some of the above.
+ * Basically, this is a "back of the envelope" estimate for
+ * memory requirements. It could be more accurate.
+ */
+
+#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
+
+#define CONFIGURE_OBJECT_TABLE_STUFF \
+ ( sizeof(Objects_Control *) + sizeof(rtems_name *) + sizeof(rtems_name) )
+
+#define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
+ ((_tasks) * \
+ ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
+ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \
+ CONFIGURE_OBJECT_TABLE_STUFF)) \
+ )
+
+#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
+ ((_timers) * ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
+ ((_semaphores) * \
+ ( sizeof(Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
+ ( (_queues) * \
+ ( sizeof(Message_queue_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
+ ( (_partitions) * \
+ ( sizeof(Partition_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
+ ( (_regions) * \
+ ( sizeof(Region_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
+ ( (_ports) * \
+ ( sizeof(Dual_ported_memory_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
+ ( (_periods) * \
+ ( sizeof(Rate_monotonic_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
+ ( (_extensions) * \
+ ( sizeof(Extension_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_DEVICES(_devices) \
+ (((_devices) + 1) * ( sizeof(rtems_driver_name_t) ) )
+
+#ifdef CONFIGURE_MPTEST
+
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
+ ( ((_proxies) + 1) * ( sizeof(Thread_Proxy_control) ) )
+
+#define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
+ ((_global_objects) * ( sizeof(Objects_MP_Control) ) )
+
+#define CONFIGURE_MEMORY_FOR_MP \
+ ( CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
+ CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) \
+ )
+
+#endif /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MEMORY_FOR_MP 0
+
+#endif
+#define CONFIGURE_EXECUTIVE_RAM_SIZE \
+(( CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS) + \
+ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
+ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
+ CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
+ CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
+ CONFIGURE_MEMORY_FOR_REGIONS(CONFIGURE_MAXIMUM_REGIONS) + \
+ CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
+ CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
+ CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) + \
+ CONFIGURE_MEMORY_FOR_DEVICES(CONFIGURE_MAXIMUM_DEVICES) + \
+ CONFIGURE_MEMORY_FOR_MP + \
+ (96*1024) \
+) & 0xffff8000)
+#endif
+
+#ifdef CONFIGURE_INIT
+rtems_configuration_table Configuration = {
+ CONFIGURE_EXECUTIVE_RAM_WORK_AREA,
+ CONFIGURE_EXECUTIVE_RAM_SIZE,
+ CONFIGURE_MAXIMUM_TASKS,
+ CONFIGURE_MAXIMUM_TIMERS,
+ CONFIGURE_MAXIMUM_SEMAPHORES,
+ CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
+ CONFIGURE_MAXIMUM_PARTITIONS,
+ CONFIGURE_MAXIMUM_REGIONS,
+ CONFIGURE_MAXIMUM_PORTS,
+ CONFIGURE_MAXIMUM_PERIODS,
+ CONFIGURE_MAXIMUM_USER_EXTENSIONS,
+ CONFIGURE_MICROSECONDS_PER_TICK,
+ CONFIGURE_TICKS_PER_TIMESLICE,
+ sizeof (Initialization_tasks)/
+ sizeof(rtems_initialization_tasks_table), /* number of init tasks */
+ Initialization_tasks, /* init task(s) table */
+ sizeof (Device_drivers)/
+ sizeof(rtems_driver_address_table), /* number of device drivers */
+ CONFIGURE_MAXIMUM_DEVICES,
+ Device_drivers, /* pointer to driver table */
+ CONFIGURE_INITIAL_EXTENSIONS, /* pointer to initial extensions */
+ CONFIGURE_MULTIPROCESSING_TABLE /* ptr to MP config table */
+};
+#endif
+
+#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
new file mode 100644
index 0000000000..29f6005f58
--- /dev/null
+++ b/cpukit/sapi/include/rtems/config.h
@@ -0,0 +1,94 @@
+/* config.h
+ *
+ * This include file contains the table of user defined configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONFIGURATION_h
+#define __RTEMS_CONFIGURATION_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+#include <rtems/extension.h>
+#include <rtems/io.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/tasks.h>
+
+/*
+ * The following records define the Multiprocessor Configuration
+ * Table. This table defines the multiprocessor system
+ * characteristics which must be known by RTEMS in a multiprocessor
+ * system.
+ */
+
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+ MPCI_Control *User_mpci_table; /* pointer to MPCI table */
+} rtems_multiprocessing_table;
+
+/*
+ * The following records define the Configuration Table. The
+ * information contained in this table is required in all
+ * RTEMS systems, whether single or multiprocessor. This
+ * table primarily defines the following:
+ *
+ * + location and size of the RTEMS Workspace
+ * + required number of each object type
+ * + microseconds per clock tick
+ * + clock ticks per task timeslice
+ */
+
+typedef struct {
+ void *work_space_start;
+ unsigned32 work_space_size;
+ unsigned32 maximum_tasks;
+ unsigned32 maximum_timers;
+ unsigned32 maximum_semaphores;
+ unsigned32 maximum_message_queues;
+ unsigned32 maximum_partitions;
+ unsigned32 maximum_regions;
+ unsigned32 maximum_ports;
+ unsigned32 maximum_periods;
+ unsigned32 maximum_extensions;
+ unsigned32 microseconds_per_tick;
+ unsigned32 ticks_per_timeslice;
+ unsigned32 number_of_initialization_tasks;
+ rtems_initialization_tasks_table *User_initialization_tasks_table;
+ unsigned32 number_of_device_drivers;
+ unsigned32 maximum_devices;
+ rtems_driver_address_table *Device_driver_table;
+ rtems_extensions_table *User_extension_table;
+ rtems_multiprocessing_table *User_multiprocessing_table;
+} rtems_configuration_table;
+
+/*
+ * The following are provided strictly for the convenience of
+ * the user. They are not used in RTEMS itself.
+ */
+
+EXTERN rtems_configuration_table *_Configuration_Table;
+EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h
new file mode 100644
index 0000000000..8f46ed80dd
--- /dev/null
+++ b/cpukit/sapi/include/rtems/extension.h
@@ -0,0 +1,136 @@
+/* extension.h
+ *
+ * This include file contains all the constants, structures, and
+ * prototypes associated with the User Extension Manager. This manager
+ * provides a mechanism for manipulating sets of user-defined extensions.
+ *
+ * Directives provided are:
+ *
+ * + create user extension set
+ * + get ID of user extension set
+ * + delete user extension set
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_EXTENSION_MANAGER_h
+#define __RTEMS_EXTENSION_MANAGER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/userext.h>
+#include <rtems/rtems/status.h> /* XXX */
+#include <rtems/rtems/types.h> /* XXX */
+
+/*
+ * Extension related types
+ */
+
+typedef User_extensions_routine rtems_extension;
+typedef User_extensions_thread_create_extension rtems_task_create_extension;
+typedef User_extensions_thread_delete_extension rtems_task_delete_extension;
+typedef User_extensions_thread_start_extension rtems_task_start_extension;
+typedef User_extensions_thread_restart_extension rtems_task_restart_extension;
+typedef User_extensions_thread_switch_extension rtems_task_switch_extension;
+typedef User_extensions_thread_begin_extension rtems_task_begin_extension;
+typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension;
+typedef User_extensions_fatal_extension rtems_fatal_extension;
+
+typedef User_extensions_Table rtems_extensions_table;
+
+/*
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+EXTERN Objects_Information _Extension_Information;
+
+/*
+ * The following records define the control block used to manage
+ * each extension.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ User_extensions_Control Extension;
+} Extension_Control;
+
+/*
+ * _Extension_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+);
+
+/*
+ * rtems_extension_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_create directive. The
+ * extension will have the name name. The entry points of the
+ * routines which constitute this extension set are in EXTENSION_TABLE.
+ * It returns the id of the created extension in ID.
+ */
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_ident
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_ident directive.
+ * This directive returns the extension ID associated with name.
+ * If more than one extension is named name, then the extension
+ * to which the ID belongs is arbitrary.
+ */
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+);
+
+/*
+ * rtems_extension_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_extension_delete directive. The
+ * extension indicated by ID is deleted.
+ */
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/extension.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h
new file mode 100644
index 0000000000..f61b4183f3
--- /dev/null
+++ b/cpukit/sapi/include/rtems/fatal.h
@@ -0,0 +1,49 @@
+/* fatal.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Fatal Error Manager. This manager processes all fatal or
+ * irrecoverable errors.
+ *
+ * This manager provides directives to:
+ *
+ * + announce a fatal error has occurred
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_FATAL_h
+#define __RTEMS_FATAL_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * rtems_fatal_error_occurred
+ *
+ * DESCRIPTION:
+ *
+ * This is the routine which implements the rtems_fatal_error_occurred
+ * directive. It is invoked when the application or RTEMS
+ * determines that a fatal error has occurred.
+ */
+
+void volatile rtems_fatal_error_occurred(
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h
new file mode 100644
index 0000000000..e008c45ebc
--- /dev/null
+++ b/cpukit/sapi/include/rtems/init.h
@@ -0,0 +1,110 @@
+/* init.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Initialization Manager. This manager is responsible for
+ * initializing RTEMS, creating and starting all configured initialization
+ * tasks, invoking the initialization routine for each user-supplied device
+ * driver, and initializing the optional multiprocessor layer.
+ *
+ * This manager provides directives to:
+ *
+ * + initialize the RTEMS executive
+ * + shutdown the RTEMS executive
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INIT_h
+#define __RTEMS_INIT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/config.h>
+#include <rtems/rtems/intr.h>
+
+/*
+ * The following defines the default Multiprocessing Configuration
+ * Table. This table is used in a single processor system.
+ */
+
+extern const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table;
+
+/*
+ * rtems_initialize_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_initialize_executive directive. This
+ * directive is invoked at system startup to initialize the RTEMS
+ * multitasking environment.
+ */
+
+void rtems_initialize_executive(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_early
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+rtems_interrupt_level rtems_initialize_executive_early(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+);
+
+/*
+ * rtems_initialize_executive_late
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+
+void rtems_initialize_executive_late(
+ rtems_interrupt_level bsp_level
+);
+
+/*
+ * rtems_shutdown_executive
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_shutdown_executive directive. The
+ * invocation of this directive results in the RTEMS environment being
+ * shutdown and multitasking halted. From the application's perspective,
+ * invocation of this directive results in the rtems_initialize_executive
+ * directive exitting to the startup code which invoked it.
+ */
+
+void rtems_shutdown_executive(
+ unsigned32 result
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h
new file mode 100644
index 0000000000..a7af4df792
--- /dev/null
+++ b/cpukit/sapi/include/rtems/io.h
@@ -0,0 +1,244 @@
+/* io.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Input/Output Manager. This manager provides a well defined
+ * mechanism for accessing device drivers and a structured methodology for
+ * organizing device drivers.
+ *
+ * Directives provided are:
+ *
+ * + initialize a device driver
+ * + open a device driver
+ * + close a device driver
+ * + read from a device driver
+ * + write to a device driver
+ * + special device services
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_IO_h
+#define __RTEMS_IO_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/status.h>
+
+/*
+ *
+ * The following defines the types for:
+ *
+ * + major and minor numbers
+ * + the return type of a device driver entry
+ * + a pointer to a device driver entry
+ * + an entry in the the Device Driver Address Table. Each entry in this
+ * table corresponds to an application provided device driver and
+ * defines the entry points for that device driver.
+ */
+
+typedef unsigned32 rtems_device_major_number;
+typedef unsigned32 rtems_device_minor_number;
+
+typedef rtems_status_code rtems_device_driver;
+
+typedef rtems_device_driver ( *rtems_device_driver_entry )(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+ );
+
+typedef struct {
+ rtems_device_driver_entry initialization; /* initialization procedure */
+ rtems_device_driver_entry open; /* open request procedure */
+ rtems_device_driver_entry close; /* close request procedure */
+ rtems_device_driver_entry read; /* read request procedure */
+ rtems_device_driver_entry write; /* write request procedure */
+ rtems_device_driver_entry control; /* special functions procedure */
+} rtems_driver_address_table;
+
+/*
+ * Table for the io device names
+ */
+
+typedef struct {
+ char *device_name;
+ unsigned32 device_name_length;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+} rtems_driver_name_t;
+
+/*
+ * This is the table of device names.
+ */
+
+/*
+ * The following declare the data required to manage the Driver
+ * Address Table and Device Name Table.
+ */
+
+EXTERN unsigned32 _IO_Number_of_drivers;
+EXTERN rtems_driver_address_table *_IO_Driver_address_table;
+EXTERN unsigned32 _IO_Number_of_devices;
+EXTERN rtems_driver_name_t *_IO_Driver_name_table;
+
+/*
+ * _IO_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+);
+
+/*
+ * rtems_io_register_name
+ *
+ * DESCRIPTION:
+ *
+ * Associate a name with a driver.
+ *
+ */
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+);
+
+
+/*
+ * rtems_io_lookup_name
+ *
+ * DESCRIPTION:
+ *
+ * Find what driver "owns" this name
+ */
+
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t **device_info
+);
+
+
+/*
+ * rtems_io_initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_initialize directive. It is invoked
+ * to initialize a device driver or an individual device.
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_open directive. It is invoked
+ * to open a device.
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_close
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_close directive. It is invoked
+ * to close a device.
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_read
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_read directive. It is invoked
+ * to read from a device.
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_write
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_write directive. It is invoked
+ * to write to a device.
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * rtems_io_control
+ *
+ * DESCRIPTION:
+ *
+ * This routine implements the rtems_io_control directive. It is invoked
+ * to perform a device specific operation on a device.
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/*
+ * _IO_Initialize_all_drivers
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes all of the device drivers configured
+ * in the Device Driver Address Table.
+ */
+
+void _IO_Initialize_all_drivers( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/mptables.h b/cpukit/sapi/include/rtems/mptables.h
new file mode 100644
index 0000000000..b8e4c6de43
--- /dev/null
+++ b/cpukit/sapi/include/rtems/mptables.h
@@ -0,0 +1,29 @@
+/* mptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used in a multiprocessor configuration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_MPTABLES_h
+#define __RTEMS_MPTABLES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/inline/rtems/extension.inl b/cpukit/sapi/inline/rtems/extension.inl
new file mode 100644
index 0000000000..c7757ff280
--- /dev/null
+++ b/cpukit/sapi/inline/rtems/extension.inl
@@ -0,0 +1,91 @@
+/* extension.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_MANAGER_inl
+#define __EXTENSION_MANAGER_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a extension control block from
+ * the inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Allocate( void )
+{
+ return (Extension_Control *) _Objects_Allocate( &_Extension_Information );
+}
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a extension control block to the
+ * inactive chain of free extension control blocks.
+ */
+
+STATIC INLINE void _Extension_Free (
+ Extension_Control *the_extension
+)
+{
+ _Objects_Free( &_Extension_Information, &the_extension->Object );
+}
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps extension IDs to extension control blocks.
+ * If ID corresponds to a local extension, then it returns
+ * the extension control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. Otherwise, location is set
+ * to OBJECTS_ERROR and the returned value is undefined.
+ */
+
+STATIC INLINE Extension_Control *_Extension_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ return (Extension_Control *)
+ _Objects_Get( &_Extension_Information, id, location );
+}
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_extension is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Extension_Is_null (
+ Extension_Control *the_extension
+)
+{
+ return ( the_extension == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/macros/rtems/extension.inl b/cpukit/sapi/macros/rtems/extension.inl
new file mode 100644
index 0000000000..96fb9d1b3e
--- /dev/null
+++ b/cpukit/sapi/macros/rtems/extension.inl
@@ -0,0 +1,58 @@
+/* extension.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Extension Manager.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __EXTENSION_inl
+#define __EXTENSION_inl
+
+/*PAGE
+ *
+ * _Extension_Allocate
+ *
+ */
+
+#define _Extension_Allocate() \
+ (Extension_Control *) _Objects_Allocate( &_Extension_Information )
+
+/*PAGE
+ *
+ * _Extension_Free
+ *
+ */
+
+#define _Extension_Free( _the_extension ) \
+ _Objects_Free( &_Extension_Information, &(_the_extension)->Object )
+
+/*PAGE
+ *
+ * _Extension_Get
+ *
+ */
+
+#define _Extension_Get( _id, _location ) \
+ (Extension_Control *) \
+ _Objects_Get( &_Extension_Information, (_id), (_location) )
+
+/*PAGE
+ *
+ * _Extension_Is_null
+ *
+ */
+
+#define _Extension_Is_null( _the_extension ) \
+ ( (_the_extension) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/src/debug.c b/cpukit/sapi/src/debug.c
new file mode 100644
index 0000000000..5c42fa92f6
--- /dev/null
+++ b/cpukit/sapi/src/debug.c
@@ -0,0 +1,62 @@
+/*
+ * Debug Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/debug.h>
+
+/*PAGE
+ *
+ * _Debug_Manager_initialization
+ */
+
+void _Debug_Manager_initialization( void )
+{
+ rtems_debug_disable( RTEMS_DEBUG_ALL_MASK );
+}
+
+/*PAGE
+ *
+ * rtems_debug_enable
+ */
+
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+)
+{
+ _Debug_Level |= to_be_enabled;
+}
+
+/*PAGE
+ *
+ * rtems_debug_disable
+ */
+
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+)
+{
+ _Debug_Level &= ~to_be_disabled;
+}
+
+/*PAGE
+ *
+ * _Debug_Is_enabled
+ */
+
+boolean _Debug_Is_enabled(
+ rtems_debug_control level
+)
+{
+ return (_Debug_Level & level);
+}
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
new file mode 100644
index 0000000000..2ffd9f4839
--- /dev/null
+++ b/cpukit/sapi/src/exinit.c
@@ -0,0 +1,285 @@
+/*
+ * Initialization Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * INIT is defined so all of the data will be included in this
+ * file.
+ */
+
+#define INIT
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/debug.h>
+#include <rtems/extension.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/apiext.h>
+#include <rtems/score/copyrt.h>
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/wkspace.h>
+
+#include <rtems/directives.h>
+#include <rtems/sptables.h>
+
+#include <rtems/rtems/rtemsapi.h>
+
+/*PAGE
+ *
+ * rtems_initialize_executive
+ *
+ * This directive initializes all the kernels data structures
+ * to the states necessary for the kernel to begin execution. All
+ * include files that contain global variable definitions should be
+ * included in this file. The system threads and initialization threads
+ * are created and started by this routine. This routine then
+ * initiates multithreading.
+ *
+ * Input parameters:
+ * configuration_table - pointer to the user's configuration table
+ * cpu_table - pointer to the user's CPU configuration table
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_initialize_executive(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+)
+{
+ rtems_interrupt_level bsp_level;
+
+ bsp_level = rtems_initialize_executive_early(configuration_table, cpu_table);
+ rtems_initialize_executive_late( bsp_level );
+}
+
+rtems_interrupt_level rtems_initialize_executive_early(
+ rtems_configuration_table *configuration_table,
+ rtems_cpu_table *cpu_table
+)
+{
+ rtems_interrupt_level bsp_level;
+ rtems_multiprocessing_table *multiprocessing_table;
+
+ /*
+ * Dispatching and interrupts are disabled until the end of the
+ * initialization sequence. This prevents an inadvertent context
+ * switch before the executive is initialized.
+ */
+
+ _ISR_Disable( bsp_level );
+
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE
+ );
+
+ /*
+ * Initialize the system state based on whether this is an MP system.
+ */
+
+ multiprocessing_table = configuration_table->User_multiprocessing_table;
+
+ _System_state_Handler_initialization(
+ (multiprocessing_table) ? TRUE : FALSE
+ );
+
+ /*
+ * Provided just for user convenience.
+ */
+
+ _Configuration_Table = configuration_table;
+ _Configuration_MP_table = multiprocessing_table;
+
+ /*
+ * Internally we view single processor systems as a very restricted
+ * multiprocessor system.
+ */
+
+ if ( multiprocessing_table == NULL )
+ multiprocessing_table =
+ (void *)&_Initialization_Default_multiprocessing_table;
+
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CPU_TABLE
+ );
+
+ _CPU_Initialize( cpu_table, _Thread_Dispatch );
+
+ /*
+ * Do this as early as possible to insure no debugging output
+ * is even attempted to be printed.
+ */
+
+ _Debug_Manager_initialization();
+
+ _API_extensions_Initialization();
+
+ _Thread_Dispatch_initialization();
+
+ _User_extensions_Handler_initialization(
+ configuration_table->User_extension_table
+ );
+
+ _Workspace_Handler_initialization(
+ (void *)configuration_table->work_space_start,
+ configuration_table->work_space_size
+ );
+
+ _ISR_Handler_initialization();
+
+ _Objects_Handler_initialization(
+ multiprocessing_table->node,
+ multiprocessing_table->maximum_nodes,
+ multiprocessing_table->maximum_global_objects
+ );
+
+ _Priority_Handler_initialization();
+
+ _Watchdog_Handler_initialization();
+
+ _TOD_Handler_initialization( configuration_table->microseconds_per_tick );
+
+ _Thread_Handler_initialization(
+ configuration_table->ticks_per_timeslice,
+ configuration_table->maximum_extensions,
+ multiprocessing_table->maximum_proxies
+ );
+
+ _MPCI_Handler_initialization(
+ multiprocessing_table->User_mpci_table,
+ RTEMS_TIMEOUT
+ );
+
+/* MANAGERS */
+
+ _Extension_Manager_initialization( configuration_table->maximum_extensions );
+
+ _IO_Manager_initialization(
+ configuration_table->Device_driver_table,
+ configuration_table->number_of_device_drivers,
+ configuration_table->maximum_devices
+ );
+
+ _RTEMS_API_Initialize( configuration_table );
+
+ _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+
+ if ( cpu_table->pretasking_hook )
+ (*cpu_table->pretasking_hook)();
+
+ /*
+ * No threads should be created before this point!!!
+ *
+ * At this point all API extensions are in place. After the call to
+ * _Thread_Create_idle() _Thread_Executing will be set.
+ * and _Thread_Heir are not set yet.
+ */
+
+ _Thread_Create_idle();
+
+ _MPCI_Create_server();
+
+ /*
+ * Run the API and BSPs predriver hook.
+ */
+
+ _API_extensions_Run_predriver();
+
+ if ( _CPU_Table.predriver_hook )
+ (*_CPU_Table.predriver_hook)();
+
+ /*
+ * Initialize all the device drivers and initialize the MPCI layer.
+ *
+ * NOTE: The MPCI may be build upon a device driver.
+ */
+
+ _IO_Initialize_all_drivers();
+
+ if ( _System_state_Is_multiprocessing ) {
+ _MPCI_Initialization();
+ _MPCI_Internal_packets_Send_process_packet(
+ MPCI_PACKETS_SYSTEM_VERIFY
+ );
+ }
+
+ /*
+ * Run the APIs and BSPs postdriver hooks.
+ *
+ * The API extensions are supposed to create user initialization tasks.
+ */
+
+ _API_extensions_Run_postdriver();
+
+ if ( _CPU_Table.postdriver_hook )
+ (*_CPU_Table.postdriver_hook)();
+
+ return bsp_level;
+}
+
+void rtems_initialize_executive_late(
+ rtems_interrupt_level bsp_level
+)
+{
+
+ _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
+
+ _Thread_Start_multitasking();
+
+ /*
+ * Restore the interrupt level to what the BSP had. Technically,
+ * this is unnecessary since the BSP should have all interrupts
+ * disabled when rtems_initialize_executive is invoked. But this keeps
+ * the ISR Disable/Enable calls paired.
+ */
+
+ _ISR_Enable( bsp_level );
+}
+
+/*PAGE
+ *
+ * rtems_shutdown_executive
+ *
+ * This kernel routine shutdowns the executive. It halts multitasking
+ * and returns control to the application execution "thread" which
+ * initialially invoked the rtems_initialize_executive directive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_shutdown_executive(
+ unsigned32 result
+)
+{
+ _Thread_Stop_multitasking();
+}
diff --git a/cpukit/sapi/src/extension.c b/cpukit/sapi/src/extension.c
new file mode 100644
index 0000000000..6df116bc69
--- /dev/null
+++ b/cpukit/sapi/src/extension.c
@@ -0,0 +1,165 @@
+/*
+ * Extension Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+/*PAGE
+ *
+ * _Extension_Manager_initialization
+ *
+ * This routine initializes all extension manager related data structures.
+ *
+ * Input parameters:
+ * maximum_extensions - number of extensions to initialize
+ *
+ * Output parameters: NONE
+ */
+
+void _Extension_Manager_initialization(
+ unsigned32 maximum_extensions
+)
+{
+ _Objects_Initialize_information(
+ &_Extension_Information,
+ OBJECTS_RTEMS_EXTENSIONS,
+ FALSE,
+ maximum_extensions,
+ sizeof( Extension_Control ),
+ FALSE,
+ RTEMS_MAXIMUM_NAME_LENGTH,
+ FALSE
+ );
+}
+
+/*PAGE
+ *
+ * rtems_extension_create
+ *
+ * This directive creates a extension and performs some initialization.
+ *
+ * Input parameters:
+ * name - extension name
+ * extension_table - pointer to extension set information
+ * id - pointer to extension id
+ *
+ * Output parameters:
+ * id - extension id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ rtems_extensions_table *extension_table,
+ Objects_Id *id
+)
+{
+ Extension_Control *the_extension;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_extension = _Extension_Allocate();
+
+ if ( !the_extension ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ _User_extensions_Add_set( &the_extension->Extension, extension_table );
+
+ _Objects_Open( &_Extension_Information, &the_extension->Object, &name );
+
+ *id = the_extension->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_extension_ident
+ *
+ * This directive returns the system ID associated with
+ * the extension name.
+ *
+ * Input parameters:
+ * name - user defined message queue name
+ * id - pointer to extension id
+ *
+ * Output parameters:
+ * *id - message queue id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Extension_Information,
+ &name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
+
+/*PAGE
+ *
+ * rtems_extension_delete
+ *
+ * This directive allows a thread to delete a extension.
+ *
+ * Input parameters:
+ * id - extension id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_extension_delete(
+ Objects_Id id
+)
+{
+ Extension_Control *the_extension;
+ Objects_Locations location;
+
+ the_extension = _Extension_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_ERROR:
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INVALID_ID;
+ case OBJECTS_LOCAL:
+ _User_extensions_Remove_set( &the_extension->Extension );
+ _Objects_Close( &_Extension_Information, &the_extension->Object );
+ _Extension_Free( the_extension );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/sapi/src/fatal.c b/cpukit/sapi/src/fatal.c
new file mode 100644
index 0000000000..b2599e3ae2
--- /dev/null
+++ b/cpukit/sapi/src/fatal.c
@@ -0,0 +1,38 @@
+/*
+ * Fatal Error Manager
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/fatal.h>
+#include <rtems/score/interr.h>
+
+/*PAGE
+ *
+ * rtems_fatal_error_occurred
+ *
+ * This directive will invoke the internal fatal error handler.
+ *
+ * Input parameters:
+ * the_error - fatal error status code
+ *
+ * Output parameters: NONE
+ */
+
+void volatile rtems_fatal_error_occurred(
+ unsigned32 the_error
+)
+{
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, FALSE, the_error );
+
+/* will not return from this routine */
+}
diff --git a/cpukit/sapi/src/io.c b/cpukit/sapi/src/io.c
new file mode 100644
index 0000000000..b326a96987
--- /dev/null
+++ b/cpukit/sapi/src/io.c
@@ -0,0 +1,345 @@
+/*
+ * Input/Output Manager
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/io.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+
+#include <string.h>
+
+/*PAGE
+ *
+ * _IO_Manager_initialization
+ *
+ */
+
+void _IO_Manager_initialization(
+ rtems_driver_address_table *driver_table,
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
+)
+{
+ void *tmp;
+ unsigned32 index;
+ rtems_driver_name_t *np;
+
+ _IO_Driver_address_table = driver_table;
+ _IO_Number_of_drivers = number_of_drivers;
+ _IO_Number_of_devices = number_of_devices;
+
+ tmp = _Workspace_Allocate_or_fatal_error(
+ sizeof( rtems_driver_name_t ) * ( number_of_devices + 1 )
+ );
+
+ _IO_Driver_name_table = (rtems_driver_name_t *) tmp;
+
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ ) {
+ np->device_name = 0;
+ np->device_name_length = 0;
+ np->major = 0;
+ np->minor = 0;
+ }
+}
+
+/*PAGE
+ *
+ * _IO_Initialize_all_drivers
+ *
+ * This routine initializes all device drivers
+ *
+ * Input Paramters: NONE
+ *
+ * Output Parameters: NONE
+ */
+
+void _IO_Initialize_all_drivers( void )
+{
+ rtems_device_major_number major;
+
+ for ( major=0 ; major < _IO_Number_of_drivers ; major ++ )
+ (void) rtems_io_initialize( major, 0, NULL);
+}
+
+/*PAGE
+ *
+ * rtems_io_register_name
+ *
+ * Associate a name with a driver
+ *
+ * Input Paramters:
+ * device_name - pointer to name string to associate with device
+ * major - device major number to receive name
+ * minor - device minor number to receive name
+ *
+ * Output Parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_io_register_name(
+ char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+ )
+{
+ rtems_driver_name_t *np;
+ unsigned32 level;
+ unsigned32 index;
+
+ /* find an empty slot */
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
+ {
+
+ _ISR_Disable(level);
+ if (np->device_name == 0)
+ {
+ np->device_name = device_name;
+ np->device_name_length = strlen(device_name);
+ np->major = major;
+ np->minor = minor;
+ _ISR_Enable(level);
+
+ return RTEMS_SUCCESSFUL;
+ }
+ _ISR_Enable(level);
+ }
+
+ return RTEMS_TOO_MANY;
+}
+
+/*PAGE
+ *
+ * rtems_io_lookup_name
+ *
+ * Find what driver "owns" this name
+ *
+ * Input Paramters:
+ * name - name to lookup the associated device
+ *
+ * Output Parameters:
+ * device_info - device associate with name
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t **device_info
+)
+{
+ rtems_driver_name_t *np;
+ unsigned32 index;
+
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
+ if (np->device_name)
+ if (strncmp(np->device_name, name, np->device_name_length) == 0)
+ {
+ *device_info = np;
+ return RTEMS_SUCCESSFUL;
+ }
+
+ *device_info = 0;
+ return RTEMS_UNSATISFIED;
+}
+
+
+/*PAGE
+ *
+ * rtems_io_initialize
+ *
+ * This routine is the initialization directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].initialization;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_open
+ *
+ * This routine is the open directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].open;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_close
+ *
+ * This routine is the close directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].close;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_read
+ *
+ * This routine is the read directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].read;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_write
+ *
+ * This routine is the write directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].write;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ * rtems_io_control
+ *
+ * This routine is the control directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].control;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
+
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
new file mode 100644
index 0000000000..b6ecb6c37c
--- /dev/null
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -0,0 +1,89 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/rtemsapi.h>
+
+#define INIT
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+)
+{
+ _Attributes_Handler_initialization();
+
+ _Interrupt_Manager_initialization();
+
+ _Multiprocessing_Manager_initialization();
+
+ _RTEMS_tasks_Manager_initialization(
+ configuration_table->maximum_tasks,
+ configuration_table->number_of_initialization_tasks,
+ configuration_table->User_initialization_tasks_table
+ );
+
+ _Timer_Manager_initialization( configuration_table->maximum_timers );
+
+ _Signal_Manager_initialization();
+
+ _Event_Manager_initialization();
+
+ _Message_queue_Manager_initialization(
+ configuration_table->maximum_message_queues
+ );
+
+ _Semaphore_Manager_initialization(
+ configuration_table->maximum_semaphores
+ );
+
+ _Partition_Manager_initialization(
+ configuration_table->maximum_partitions
+ );
+
+ _Region_Manager_initialization( configuration_table->maximum_regions );
+
+ _Dual_ported_memory_Manager_initialization(
+ configuration_table->maximum_ports
+ );
+
+ _Rate_monotonic_Manager_initialization(
+ configuration_table->maximum_periods
+ );
+}
+
+/* end of file */
diff --git a/cpukit/score/cpu/hppa1.1/cpu.c b/cpukit/score/cpu/hppa1.1/cpu.c
new file mode 100644
index 0000000000..89bb8a8447
--- /dev/null
+++ b/cpukit/score/cpu/hppa1.1/cpu.c
@@ -0,0 +1,189 @@
+/*
+ * HP PA-RISC Dependent Source
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+void hppa_cpu_halt(unsigned32 the_error);
+
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ /*
+ * This is unsupported. For HPPA this function is handled by BSP
+ */
+
+ _CPU_Fatal_halt( 0xdeaddead );
+}
+
+
+
+/*
+ * This is the default handler which is called if
+ * _CPU_ISR_install_vector() has not been called for the
+ * specified vector. It simply forwards onto the spurious
+ * handler defined in the cpu-table.
+ */
+
+static ISR_Handler
+hppa_interrupt_report_spurious(ISR_Vector_number vector,
+ void* rtems_isr_frame) /* HPPA extension */
+{
+
+ /*
+ * If the CPU table defines a spurious_handler, then
+ * call it. If the handler returns halt.
+ */
+ if ( _CPU_Table.spurious_handler )
+ _CPU_Table.spurious_handler(vector, rtems_isr_frame);
+
+ hppa_cpu_halt(vector);
+}
+
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level(void)
+{
+ int level;
+ HPPA_ASM_SSM(0, level); /* change no bits; just get copy */
+ if (level & HPPA_PSW_I)
+ return 0;
+ return 1;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector. The handler is a C callable routine.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[vector];
+
+ _ISR_Vector_table[vector] = new_handler;
+}
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ register unsigned8 *fp_context;
+ int i;
+ proc_ptr old_handler;
+
+ /*
+ * XXX; need to setup fpsr smarter perhaps
+ */
+
+ fp_context = (unsigned8*) &_CPU_Null_fp_context;
+ for (i=0 ; i<sizeof(Context_Control_fp); i++)
+ *fp_context++ = 0;
+
+ /*
+ * Set _CPU_Default_gr27 here so it will hopefully be the correct
+ * global data pointer for the entire system.
+ */
+
+ asm volatile( "stw %%r27,%0" : "=m" (_CPU_Default_gr27): );
+
+ /*
+ * Init the 2nd level interrupt handlers
+ */
+
+ for (i=0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++)
+ _CPU_ISR_install_vector(i,
+ hppa_interrupt_report_spurious,
+ &old_handler);
+
+ _CPU_Table = *cpu_table;
+
+}
+
+
+/*
+ * Halt the system.
+ * Called by the _CPU_Fatal_halt macro
+ *
+ * XXX
+ * Later on, this will allow us to return to the prom.
+ * For now, we just ignore 'type_of_halt'
+ *
+ * XXX
+ * NOTE: for gcc, this function must be at the bottom
+ * of the file, that is because if it is at the top
+ * of the file, gcc will inline it's calls. Since
+ * the function uses the HPPA_ASM_LABEL() macro, when
+ * gcc inlines it, you get two definitions of the same
+ * label name, which is an assembly error.
+ */
+
+
+void
+hppa_cpu_halt(unsigned32 the_error)
+{
+ unsigned32 isrlevel;
+
+ _CPU_ISR_Disable(isrlevel);
+
+ /*
+ * XXXXX NOTE: This label is only needed that that when
+ * the simulator stops, it shows the label name specified
+ */
+ HPPA_ASM_LABEL("_hppa_cpu_halt");
+ HPPA_ASM_BREAK(0, 0);
+}
+
diff --git a/cpukit/score/cpu/i386/asm.h b/cpukit/score/cpu/i386/asm.h
new file mode 100644
index 0000000000..e317161043
--- /dev/null
+++ b/cpukit/score/cpu/i386/asm.h
@@ -0,0 +1,140 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __i386_ASM_h
+#define __i386_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/i386.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/*
+ * Go32 suffers the same bug as __REGISTER_PREFIX__
+ */
+
+#if __GO32__
+#undef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+/*
+ * Looks like there is a bug in gcc 2.6.2 where this is not
+ * defined correctly when configured as i386-coff and
+ * i386-aout.
+ */
+
+#undef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__ %
+
+/*
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+*/
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define eax REG (eax)
+#define ebx REG (ebx)
+#define ecx REG (ecx)
+#define edx REG (edx)
+#define esi REG (esi)
+#define edi REG (edi)
+#define esp REG (esp)
+#define ebp REG (ebp)
+
+#define ax REG (ax)
+#define bx REG (bx)
+#define cx REG (cx)
+#define dx REG (dx)
+#define si REG (si)
+#define di REG (di)
+#define sp REG (sp)
+#define bp REG (bp)
+
+#define ah REG (ah)
+#define al REG (al)
+
+#define cs REG (cs)
+#define ds REG (ds)
+#define es REG (es)
+#define fs REG (fs)
+#define gs REG (gs)
+#define ss REG (ss)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
new file mode 100644
index 0000000000..ad9c56e20a
--- /dev/null
+++ b/cpukit/score/cpu/i386/cpu.c
@@ -0,0 +1,177 @@
+/*
+ * Intel i386 Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ register unsigned16 fp_status asm ("ax");
+ register void *fp_context;
+
+ _CPU_Table = *cpu_table;
+
+ /*
+ * The following code saves a NULL i387 context which is given
+ * to each task at start and restart time. The following code
+ * is based upon that provided in the i386 Programmer's
+ * Manual and should work on any coprocessor greater than
+ * the i80287.
+ *
+ * NOTE: The NO RTEMS_WAIT form of the coprocessor instructions
+ * MUST be used in case there is not a coprocessor
+ * to wait for.
+ */
+
+ fp_status = 0xa5a5;
+ asm volatile( "fninit" );
+ asm volatile( "fnstsw %0" : "=a" (fp_status) : "0" (fp_status) );
+
+ if ( fp_status == 0 ) {
+
+ fp_context = &_CPU_Null_fp_context;
+
+ asm volatile( "fsave (%0)" : "=r" (fp_context)
+ : "0" (fp_context)
+ );
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ i386_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+#if __GO32__
+#include <go32.h>
+#include <dpmi.h>
+#endif /* __GO32__ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+#if __GO32__
+ _go32_dpmi_seginfo handler_info;
+
+ /* get the address of the old handler */
+ _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info);
+
+ /* Notice how we're failing to save the pm_segment portion of the */
+ /* structure here? That means we might crash the system if we */
+ /* try to restore the ISR. Can't fix this until i386_isr is */
+ /* redefined. XXX [BHC]. */
+ *old_handler = (proc_ptr *) handler_info.pm_offset;
+
+ handler_info.pm_offset = (u_long) new_handler;
+ handler_info.pm_selector = _go32_my_cs();
+
+ /* install the IDT entry */
+ _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info );
+#else
+ i386_IDT_slot idt;
+ unsigned32 handler;
+
+ *old_handler = 0; /* XXX not supported */
+
+ handler = (unsigned32) new_handler;
+
+ /* build the IDT entry */
+ idt.offset_0_15 = handler & 0xffff;
+ idt.segment_selector = i386_get_cs();
+ idt.reserved = 0x00;
+ idt.p_dpl = 0x8e; /* present, ISR */
+ idt.offset_16_31 = handler >> 16;
+
+ /* install the IDT entry */
+ i386_Install_idt(
+ (unsigned32) &idt,
+ _CPU_Table.interrupt_table_segment,
+ (unsigned32) _CPU_Table.interrupt_table_offset + (8 * vector)
+ );
+#endif
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _ISR_Handler_0(), _ISR_Handler_1();
+
+#define PER_ISR_ENTRY \
+ (((unsigned32) _ISR_Handler_1 - (unsigned32) _ISR_Handler_0))
+
+#define _Interrupt_Handler_entry( _vector ) \
+ (((unsigned32)_ISR_Handler_0) + ((_vector) * PER_ISR_ENTRY))
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+ unsigned32 unique_handler;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /* calculate the unique entry point for this vector */
+ unique_handler = _Interrupt_Handler_entry( vector );
+
+ _CPU_ISR_install_raw_handler( vector, (void *)unique_handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
diff --git a/cpukit/score/cpu/i386/rtems/asm.h b/cpukit/score/cpu/i386/rtems/asm.h
new file mode 100644
index 0000000000..e317161043
--- /dev/null
+++ b/cpukit/score/cpu/i386/rtems/asm.h
@@ -0,0 +1,140 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __i386_ASM_h
+#define __i386_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/i386.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/*
+ * Go32 suffers the same bug as __REGISTER_PREFIX__
+ */
+
+#if __GO32__
+#undef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+/*
+ * Looks like there is a bug in gcc 2.6.2 where this is not
+ * defined correctly when configured as i386-coff and
+ * i386-aout.
+ */
+
+#undef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__ %
+
+/*
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+*/
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define eax REG (eax)
+#define ebx REG (ebx)
+#define ecx REG (ecx)
+#define edx REG (edx)
+#define esi REG (esi)
+#define edi REG (edi)
+#define esp REG (esp)
+#define ebp REG (ebp)
+
+#define ax REG (ax)
+#define bx REG (bx)
+#define cx REG (cx)
+#define dx REG (dx)
+#define si REG (si)
+#define di REG (di)
+#define sp REG (sp)
+#define bp REG (bp)
+
+#define ah REG (ah)
+#define al REG (al)
+
+#define cs REG (cs)
+#define ds REG (ds)
+#define es REG (es)
+#define fs REG (fs)
+#define gs REG (gs)
+#define ss REG (ss)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/i960/asm.h b/cpukit/score/cpu/i960/asm.h
new file mode 100644
index 0000000000..803f42f649
--- /dev/null
+++ b/cpukit/score/cpu/i960/asm.h
@@ -0,0 +1,107 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __i960_ASM_h
+#define __i960_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/i960.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define g0 REG (g0)
+#define g1 REG (g1)
+#define g2 REG (g2)
+#define g3 REG (g3)
+#define g4 REG (g4)
+#define g5 REG (g5)
+#define g6 REG (g6)
+#define g7 REG (g7)
+#define g8 REG (g8)
+#define g9 REG (g9)
+#define g10 REG (g10)
+#define g11 REG (g11)
+#define g12 REG (g12)
+#define g13 REG (g13)
+#define g14 REG (g14)
+#define g15 REG (g15)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/cpu/i960/cpu.c b/cpukit/score/cpu/i960/cpu.c
new file mode 100644
index 0000000000..e55a400c40
--- /dev/null
+++ b/cpukit/score/cpu/i960/cpu.c
@@ -0,0 +1,155 @@
+/*
+ * Intel i960CA Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
+#else
+#warning "*** ENTIRE FILE IMPLEMENTED & TESTED FOR CA ONLY ***"
+#warning "*** THIS FILE WILL NOT COMPILE ON ANOTHER FAMILY MEMBER ***"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ * OUTPUT PARAMETERS: NONE
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+
+ _CPU_Table = *cpu_table;
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ i960_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+#define _Is_vector_caching_enabled( _prcb ) \
+ ((_prcb)->control_tbl->icon & 0x2000)
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ i960ca_PRCB *prcb = _CPU_Table.Prcb;
+ proc_ptr *cached_intr_tbl = NULL;
+
+ /* The i80960CA does not support vectors 0-7. The first 9 entries
+ * in the Interrupt Table are used to manage pending interrupts.
+ * Thus vector 8, the first valid vector number, is actually in
+ * slot 9 in the table.
+ */
+
+ *old_handler = prcb->intr_tbl[ vector + 1 ];
+
+ prcb->intr_tbl[ vector + 1 ] = new_handler;
+
+ if ( _Is_vector_caching_enabled( prcb ) )
+ if ( (vector & 0xf) == 0x2 ) /* cacheable? */
+ cached_intr_tbl[ vector >> 4 ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU__ISR_install_vector
+ *
+ * Install the RTEMS vector wrapper in the CPU's interrupt table.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+#define soft_reset( prcb ) \
+ { register i960ca_PRCB *_prcb = (prcb); \
+ register unsigned32 *_next=0; \
+ register unsigned32 _cmd = 0x30000; \
+ asm volatile( "lda next,%1; \
+ sysctl %0,%1,%2; \
+ next: mov g0,g0" \
+ : "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
+ : "0" (_cmd), "1" (_next), "2" (_prcb) ); \
+ }
+
+void _CPU_Install_interrupt_stack( void )
+{
+ i960ca_PRCB *prcb = _CPU_Table.Prcb;
+ unsigned32 level;
+
+ /*
+ * Set the Interrupt Stack in the PRCB and force a reload of it.
+ * Interrupts are disabled for safety.
+ */
+
+ _CPU_ISR_Disable( level );
+
+ prcb->intr_stack = _CPU_Interrupt_stack_low;
+
+ soft_reset( prcb );
+
+ _CPU_ISR_Enable( level );
+}
diff --git a/cpukit/score/cpu/m68k/asm.h b/cpukit/score/cpu/m68k/asm.h
new file mode 100644
index 0000000000..4c53980d51
--- /dev/null
+++ b/cpukit/score/cpu/m68k/asm.h
@@ -0,0 +1,129 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __M68k_ASM_h
+#define __M68k_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/m68k.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define d0 REG (d0)
+#define d1 REG (d1)
+#define d2 REG (d2)
+#define d3 REG (d3)
+#define d4 REG (d4)
+#define d5 REG (d5)
+#define d6 REG (d6)
+#define d7 REG (d7)
+#define a0 REG (a0)
+#define a1 REG (a1)
+#define a2 REG (a2)
+#define a3 REG (a3)
+#define a4 REG (a4)
+#define a5 REG (a5)
+#define a6 REG (a6)
+#define a7 REG (a7)
+
+#define msp REG (msp)
+#define usp REG (usp)
+#define isp REG (isp)
+#define sr REG (sr)
+#define vbr REG (vbr)
+#define dfc REG (dfc)
+
+#define fp0 REG (fp0)
+#define fp1 REG (fp1)
+#define fp2 REG (fp2)
+#define fp3 REG (fp3)
+#define fp4 REG (fp4)
+#define fp5 REG (fp5)
+#define fp6 REG (fp6)
+#define fp7 REG (fp7)
+
+#define fpc REG (fpc)
+#define fpi REG (fpi)
+#define fps REG (fps)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/m68k/cpu.c b/cpukit/score/cpu/m68k/cpu.c
new file mode 100644
index 0000000000..f57fae6685
--- /dev/null
+++ b/cpukit/score/cpu/m68k/cpu.c
@@ -0,0 +1,144 @@
+/*
+ * Motorola MC68xxx Dependent Source
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - entry pointer to thread dispatcher
+ *
+ * OUTPUT PARAMETERS: NONE
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ _CPU_Table = *cpu_table;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ m68k_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr *interrupt_table = NULL;
+
+ m68k_get_vbr( interrupt_table );
+
+#if ( M68K_HAS_VBR == 1)
+ *old_handler = interrupt_table[ vector ];
+ interrupt_table[ vector ] = new_handler;
+#else
+ *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10);
+ *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler;
+#endif /* M68K_HAS_VBR */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * new_handler - replacement ISR for this vector number
+ * old_handler - former ISR for this vector number
+ *
+ * Output parameters: NONE
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ proc_ptr ignored;
+
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+#if ( M68K_HAS_SEPARATE_STACKS == 1 )
+ void *isp = _CPU_Interrupt_stack_high;
+
+ asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) );
+#else
+#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!"
+#endif
+}
+
+#if ( M68K_HAS_BFFFO != 1 )
+/*
+ * Returns table for duplication of the BFFFO instruction (16 bits only)
+ */
+const unsigned char __BFFFOtable[256] = {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
diff --git a/cpukit/score/cpu/m68k/m68302.h b/cpukit/score/cpu/m68k/m68302.h
new file mode 100644
index 0000000000..da96478cf3
--- /dev/null
+++ b/cpukit/score/cpu/m68k/m68302.h
@@ -0,0 +1,608 @@
+/*
+ *------------------------------------------------------------------
+ *
+ * m68302.h - Definitions for Motorola MC68302 processor.
+ *
+ * Section references in this file refer to revision 2 of Motorola's
+ * "MC68302 Integrated Multiprotocol Processor User's Manual".
+ * (Motorola document MC68302UM/AD REV 2.)
+ *
+ * Based on Don Meyer's cpu68302.h that was posted in comp.sys.m68k
+ * on 17 February, 1993.
+ *
+ * Copyright 1995 David W. Glessner.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *
+ * $Id$
+ *
+ *------------------------------------------------------------------
+ */
+
+#ifndef __MOTOROLA_MC68302_DEFINITIONS_h
+#define __MOTOROLA_MC68302_DEFINITIONS_h
+
+/*
+ * BAR - Base Address Register
+ * Section 2.7
+ */
+#define M302_BAR (*((volatile rtems_unsigned16 *) 0xf2))
+
+/*
+ * SCR - System Control Register
+ * Section 3.8.1
+ */
+#define M302_SCR (*((volatile rtems_unsigned32 *) 0xf4))
+/*
+ * SCR bits
+ */
+#define RBIT_SCR_IPA 0x08000000
+#define RBIT_SCR_HWT 0x04000000
+#define RBIT_SCR_WPV 0x02000000
+#define RBIT_SCR_ADC 0x01000000
+
+#define RBIT_SCR_ERRE 0x00400000
+#define RBIT_SCR_VGE 0x00200000
+#define RBIT_SCR_WPVE 0x00100000
+#define RBIT_SCR_RMCST 0x00080000
+#define RBIT_SCR_EMWS 0x00040000
+#define RBIT_SCR_ADCE 0x00020000
+#define RBIT_SCR_BCLM 0x00010000
+
+#define RBIT_SCR_FRZW 0x00008000
+#define RBIT_SCR_FRZ2 0x00004000
+#define RBIT_SCR_FRZ1 0x00002000
+#define RBIT_SCR_SAM 0x00001000
+#define RBIT_SCR_HWDEN 0x00000800
+#define RBIT_SCR_HWDCN2 0x00000400
+#define RBIT_SCR_HWDCN1 0x00000200
+#define RBIT_SCR_HWDCN0 0x00000100
+
+#define RBIT_SCR_LPREC 0x00000080
+#define RBIT_SCR_LPP16 0x00000040
+#define RBIT_SCR_LPEN 0x00000020
+#define RBIT_SCR_LPCLKDIV 0x0000001f
+
+
+/*
+ * 68000 interrupt and trap vector numbers
+ */
+#define M68K_IVEC_BUS_ERROR 2
+#define M68K_IVEC_ADDRESS_ERROR 3
+#define M68K_IVEC_ILLEGAL_OPCODE 4
+#define M68K_IVEC_ZERO_DIVIDE 5
+#define M68K_IVEC_CHK 6
+#define M68K_IVEC_TRAPV 7
+#define M68K_IVEC_PRIVILEGE 8
+#define M68K_IVEC_TRACE 9
+#define M68K_IVEC_LINE_A 10
+#define M68K_IVEC_LINE_F 11
+/* Unassigned, Reserved 12-14 */
+#define M68K_IVEC_UNINITIALIZED_INT 15
+/* Unassigned, Reserved 16-23 */
+#define M68K_IVEC_SPURIOUS_INT 24
+
+#define M68K_IVEC_LEVEL1_AUTOVECTOR 25
+#define M68K_IVEC_LEVEL2_AUTOVECTOR 26
+#define M68K_IVEC_LEVEL3_AUTOVECTOR 27
+#define M68K_IVEC_LEVEL4_AUTOVECTOR 28
+#define M68K_IVEC_LEVEL5_AUTOVECTOR 29
+#define M68K_IVEC_LEVEL6_AUTOVECTOR 30
+#define M68K_IVEC_LEVEL7_AUTOVECTOR 31
+
+#define M68K_IVEC_TRAP0 32
+#define M68K_IVEC_TRAP1 33
+#define M68K_IVEC_TRAP2 34
+#define M68K_IVEC_TRAP3 35
+#define M68K_IVEC_TRAP4 36
+#define M68K_IVEC_TRAP5 37
+#define M68K_IVEC_TRAP6 38
+#define M68K_IVEC_TRAP7 39
+#define M68K_IVEC_TRAP8 40
+#define M68K_IVEC_TRAP9 41
+#define M68K_IVEC_TRAP10 42
+#define M68K_IVEC_TRAP11 43
+#define M68K_IVEC_TRAP12 44
+#define M68K_IVEC_TRAP13 45
+#define M68K_IVEC_TRAP14 46
+#define M68K_IVEC_TRAP15 47
+/*
+ * Unassigned, Reserved 48-59
+ *
+ * Note: Vectors 60-63 are used by the MC68302 (e.g. BAR, SCR).
+ */
+
+/*
+ * MC68302 Interrupt Vectors
+ * Section 3.2
+ */
+enum m68302_ivec_e {
+ M302_IVEC_ERR =0,
+ M302_IVEC_PB8 =1, /* General-Purpose Interrupt 0 */
+ M302_IVEC_SMC2 =2,
+ M302_IVEC_SMC1 =3,
+ M302_IVEC_TIMER3 =4,
+ M302_IVEC_SCP =5,
+ M302_IVEC_TIMER2 =6,
+ M302_IVEC_PB9 =7, /* General-Purpose Interrupt 1 */
+ M302_IVEC_SCC3 =8,
+ M302_IVEC_TIMER1 =9,
+ M302_IVEC_SCC2 =10,
+ M302_IVEC_IDMA =11,
+ M302_IVEC_SDMA =12, /* SDMA Channels Bus Error */
+ M302_IVEC_SCC1 =13,
+ M302_IVEC_PB10 =14, /* General-Purpose Interrupt 2 */
+ M302_IVEC_PB11 =15, /* General-Purpose Interrupt 3 */
+ M302_IVEC_IRQ1 =17, /* External Device */
+ M302_IVEC_IRQ6 =22, /* External Device */
+ M302_IVEC_IRQ7 =23 /* External Device */
+};
+
+
+/*
+ * GIMR - Global Interrupt Mode Register
+ * Section 3.2.5.1
+ */
+#define RBIT_GIMR_MOD (1<<15)
+#define RBIT_GIMR_IV7 (1<<14)
+#define RBIT_GIMR_IV6 (1<<13)
+#define RBIT_GIMR_IV1 (1<<12)
+#define RBIT_GIMR_ET7 (1<<10)
+#define RBIT_GIMR_ET6 (1<<9)
+#define RBIT_GIMR_ET1 (1<<8)
+#define RBIT_GIMR_VECTOR (7<<5)
+
+/*
+ * IPR - Interrupt Pending Register (Section 3.2.5.2)
+ * IMR - Interrupt Mask Register (Section 3.2.5.3)
+ * ISR - Interrupt In-Service Register (Section 3.2.5.4)
+ */
+#define RBIT_IPR_PB11 (1<<15)
+#define RBIT_IPR_PB10 (1<<14)
+#define RBIT_IPR_SCC1 (1<<13)
+#define RBIT_IPR_SDMA (1<<12)
+#define RBIT_IPR_IDMA (1<<11)
+#define RBIT_IPR_SCC2 (1<<10)
+#define RBIT_IPR_TIMER1 (1<<9)
+#define RBIT_IPR_SCC3 (1<<8)
+#define RBIT_IPR_PB9 (1<<7)
+#define RBIT_IPR_TIMER2 (1<<6)
+#define RBIT_IPR_SCP (1<<5)
+#define RBIT_IPR_TIMER3 (1<<4)
+#define RBIT_IPR_SMC1 (1<<3)
+#define RBIT_IPR_SMC2 (1<<2)
+#define RBIT_IPR_PB8 (1<<1)
+#define RBIT_IPR_ERR (1<<0)
+
+#define RBIT_ISR_PB11 (1<<15)
+#define RBIT_ISR_PB10 (1<<14)
+#define RBIT_ISR_SCC1 (1<<13)
+#define RBIT_ISR_SDMA (1<<12)
+#define RBIT_ISR_IDMA (1<<11)
+#define RBIT_ISR_SCC2 (1<<10)
+#define RBIT_ISR_TIMER1 (1<<9)
+#define RBIT_ISR_SCC3 (1<<8)
+#define RBIT_ISR_PB9 (1<<7)
+#define RBIT_ISR_TIMER2 (1<<6)
+#define RBIT_ISR_SCP (1<<5)
+#define RBIT_ISR_TIMER3 (1<<4)
+#define RBIT_ISR_SMC1 (1<<3)
+#define RBIT_ISR_SMC2 (1<<2)
+#define RBIT_ISR_PB8 (1<<1)
+
+#define RBIT_IMR_PB11 (1<<15) /* PB11 Interrupt Mask */
+#define RBIT_IMR_PB10 (1<<14) /* PB10 Interrupt Mask */
+#define RBIT_IMR_SCC1 (1<<13) /* SCC1 Interrupt Mask */
+#define RBIT_IMR_SDMA (1<<12) /* SDMA Interrupt Mask */
+#define RBIT_IMR_IDMA (1<<11) /* IDMA Interrupt Mask */
+#define RBIT_IMR_SCC2 (1<<10) /* SCC2 Interrupt Mask */
+#define RBIT_IMR_TIMER1 (1<<9) /* TIMER1 Interrupt Mask */
+#define RBIT_IMR_SCC3 (1<<8) /* SCC3 Interrupt Mask */
+#define RBIT_IMR_PB9 (1<<7) /* PB9 Interrupt Mask */
+#define RBIT_IMR_TIMER2 (1<<6) /* TIMER2 Interrupt Mask */
+#define RBIT_IMR_SCP (1<<5) /* SCP Interrupt Mask */
+#define RBIT_IMR_TIMER3 (1<<4) /* TIMER3 Interrupt Mask */
+#define RBIT_IMR_SMC1 (1<<3) /* SMC1 Interrupt Mask */
+#define RBIT_IMR_SMC2 (1<<2) /* SMC2 Interrupt Mask */
+#define RBIT_IMR_PB8 (1<<1) /* PB8 Interrupt Mask */
+
+
+/*
+ * DRAM Refresh
+ * Section 3.9
+ *
+ * The DRAM refresh memory map replaces the SCC2 Tx BD 6 and Tx BD 7
+ * structures in the parameter RAM.
+ *
+ * Access to the DRAM registers can be accomplished by
+ * the following approach:
+ *
+ * volatile m302_DRAM_refresh_t *dram;
+ * dram = (volatile m302_DRAM_refresh_t *) &m302.scc2.bd.tx[6];
+ *
+ * Then simply use pointer references (e.g. dram->count = 3).
+ */
+typedef struct {
+ rtems_unsigned16 dram_high; /* DRAM high address and FC */
+ rtems_unsigned16 dram_low; /* DRAM low address */
+ rtems_unsigned16 increment; /* increment step (bytes/row) */
+ rtems_unsigned16 count; /* RAM refresh cycle count (#rows) */
+ rtems_unsigned16 t_ptr_h; /* temporary refresh high addr & FC */
+ rtems_unsigned16 t_ptr_l; /* temporary refresh low address */
+ rtems_unsigned16 t_count; /* temporary refresh cycles count */
+ rtems_unsigned16 res; /* reserved */
+} m302_DRAM_refresh_t;
+
+
+/*
+ * TMR - Timer Mode Register (for timers 1 and 2)
+ * Section 3.5.2.1
+ */
+#define RBIT_TMR_ICLK_STOP (0<<1)
+#define RBIT_TMR_ICLK_MASTER (1<<1)
+#define RBIT_TMR_ICLK_MASTER16 (2<<1)
+#define RBIT_TMR_ICLK_TIN (3<<1)
+
+#define RBIT_TMR_OM (1<<5)
+#define RBIT_TMR_ORI (1<<4)
+#define RBIT_TMR_FRR (1<<3)
+#define RBIT_TMR_RST (1<<0)
+
+
+/*
+ * TER - Timer Event Register (for timers 1 and 2)
+ * Section 3.5.2.5
+ */
+#define RBIT_TER_REF (1<<1) /* Output Reference Event */
+#define RBIT_TER_CAP (1<<0) /* Capture Event */
+
+
+/*
+ * SCC Buffer Descriptors and Buffer Descriptors Table
+ * Section 4.5.5
+ */
+typedef struct m302_SCC_bd {
+ rtems_unsigned16 status; /* status and control */
+ rtems_unsigned16 length; /* data length */
+ rtems_unsigned8 *buffer; /* data buffer pointer */
+} m302_SCC_bd_t;
+
+typedef struct {
+ m302_SCC_bd_t rx[8]; /* receive buffer descriptors */
+ m302_SCC_bd_t tx[8]; /* transmit buffer descriptors */
+} m302_SCC_bd_table_t;
+
+
+/*
+ * SCC Parameter RAM (offset 0x080 from an SCC Base)
+ * Section 4.5.6
+ *
+ * Each SCC parameter RAM area begins at offset 0x80 from each SCC base
+ * area (0x400, 0x500, or 0x600 from the dual-port RAM base).
+ *
+ * Offsets 0x9c-0xbf from each SCC base area compose the protocol-specific
+ * portion of the SCC parameter RAM.
+ */
+typedef struct {
+ rtems_unsigned8 rfcr; /* Rx Function Code */
+ rtems_unsigned8 tfcr; /* Tx Function Code */
+ rtems_unsigned16 mrblr; /* Maximum Rx Buffer Length */
+ rtems_unsigned16 _rstate; /* Rx Internal State */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 rbd; /* Rx Internal Buffer Number */
+ rtems_unsigned32 _rdptr; /* Rx Internal Data Pointer */
+ rtems_unsigned16 _rcount; /* Rx Internal Byte Count */
+ rtems_unsigned16 _rtmp; /* Rx Temp */
+ rtems_unsigned16 _tstate; /* Tx Internal State */
+ rtems_unsigned8 res7;
+ rtems_unsigned8 tbd; /* Tx Internal Buffer Number */
+ rtems_unsigned32 _tdptr; /* Tx Internal Data Pointer */
+ rtems_unsigned16 _tcount; /* Tx Internal Byte Count */
+ rtems_unsigned16 _ttmp; /* Tx Temp */
+} m302_SCC_parameters_t;
+
+/*
+ * UART-Specific SCC Parameter RAM
+ * Section 4.5.11.3
+ */
+typedef struct {
+ rtems_unsigned16 max_idl; /* Maximum IDLE Characters (rx) */
+ rtems_unsigned16 idlc; /* Temporary rx IDLE counter */
+ rtems_unsigned16 brkcr; /* Break Count Register (tx) */
+ rtems_unsigned16 parec; /* Receive Parity Error Counter */
+ rtems_unsigned16 frmec; /* Receive Framing Error Counter */
+ rtems_unsigned16 nosec; /* Receive Noise Counter */
+ rtems_unsigned16 brkec; /* Receive Break Condition Counter */
+ rtems_unsigned16 uaddr1; /* UART ADDRESS Character 1 */
+ rtems_unsigned16 uaddr2; /* UART ADDRESS Character 2 */
+ rtems_unsigned16 rccr; /* Receive Control Character Register */
+ rtems_unsigned16 character[8]; /* Control Characters 1 through 8*/
+} m302_SCC_UartSpecific_t;
+/*
+ * This definition allows for the checking of receive buffers
+ * for errors.
+ */
+
+#define RCV_ERR 0x003F
+
+/*
+ * UART receive buffer descriptor bit definitions.
+ * Section 4.5.11.14
+ */
+#define RBIT_UART_CTRL (1<<11) /* buffer contains a control char */
+#define RBIT_UART_ADDR (1<<10) /* first byte contains an address */
+#define RBIT_UART_MATCH (1<<9) /* indicates which addr char matched */
+#define RBIT_UART_IDLE (1<<8) /* buffer closed due to IDLE sequence */
+#define RBIT_UART_BR (1<<5) /* break sequence was received */
+#define RBIT_UART_FR (1<<4) /* framing error was received */
+#define RBIT_UART_PR (1<<3) /* parity error was received */
+#define RBIT_UART_OV (1<<1) /* receiver overrun occurred */
+#define RBIT_UART_CD (1<<0) /* carrier detect lost */
+#define RBIT_UART_STATUS 0x003B /* all status bits */
+
+/*
+ * UART transmit buffer descriptor bit definitions.
+ * Section 4.5.11.15
+ */
+#define RBIT_UART_CR (1<<11) /* clear-to-send report
+ * this results in two idle bits
+ * between back-to-back frames
+ */
+#define RBIT_UART_A (1<<10) /* buffer contains address characters
+ * only valid in multidrop mode (UM0=1)
+ */
+#define RBIT_UART_PREAMBLE (1<<9) /* send preamble before data */
+#define RBIT_UART_CTS_LOST (1<<0) /* CTS lost */
+
+/*
+ * UART event register
+ * Section 4.5.11.16
+ */
+#define M302_UART_EV_CTS (1<<7) /* CTS status changed */
+#define M302_UART_EV_CD (1<<6) /* carrier detect status changed */
+#define M302_UART_EV_IDL (1<<5) /* IDLE sequence status changed */
+#define M302_UART_EV_BRK (1<<4) /* break character was received */
+#define M302_UART_EV_CCR (1<<3) /* control character received */
+#define M302_UART_EV_TX (1<<1) /* buffer has been transmitted */
+#define M302_UART_EV_RX (1<<0) /* buffer has been received */
+
+
+/*
+ * HDLC-Specific SCC Parameter RAM
+ * Section 4.5.12.3
+ *
+ * c_mask_l should be 0xF0B8 for 16-bit CRC, 0xdebb for 32-bit CRC
+ * c_mask_h is a don't care for 16-bit CRC, 0x20E2 for 32-bit CRC
+ */
+typedef struct {
+ rtems_unsigned16 rcrc_l; /* Temp Receive CRC Low */
+ rtems_unsigned16 rcrc_h; /* Temp Receive CRC High */
+ rtems_unsigned16 c_mask_l; /* CRC Mask Low */
+ rtems_unsigned16 c_mask_h; /* CRC Mask High */
+ rtems_unsigned16 tcrc_l; /* Temp Transmit CRC Low */
+ rtems_unsigned16 tcrc_h; /* Temp Transmit CRC High */
+
+ rtems_unsigned16 disfc; /* Discard Frame Counter */
+ rtems_unsigned16 crcec; /* CRC Error Counter */
+ rtems_unsigned16 abtsc; /* Abort Sequence Counter */
+ rtems_unsigned16 nmarc; /* Nonmatching Address Received Cntr */
+ rtems_unsigned16 retrc; /* Frame Retransmission Counter */
+
+ rtems_unsigned16 mflr; /* Maximum Frame Length Register */
+ rtems_unsigned16 max_cnt; /* Maximum_Length Counter */
+
+ rtems_unsigned16 hmask; /* User Defined Frame Address Mask */
+ rtems_unsigned16 haddr1; /* User Defined Frame Address */
+ rtems_unsigned16 haddr2; /* " */
+ rtems_unsigned16 haddr3; /* " */
+ rtems_unsigned16 haddr4; /* " */
+} m302_SCC_HdlcSpecific_t;
+/*
+ * HDLC receiver buffer descriptor bit definitions
+ * Section 4.5.12.10
+ */
+#define RBIT_HDLC_EMPTY_BIT 0x8000 /* buffer associated with BD is empty */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in a frame */
+#define RBIT_HDLC_FIRST_BIT 0x0400 /* buffer is first in a frame */
+#define RBIT_HDLC_FRAME_LEN 0x0020 /* receiver frame length violation */
+#define RBIT_HDLC_NONOCT_Rx 0x0010 /* received non-octet aligned frame */
+#define RBIT_HDLC_ABORT_SEQ 0x0008 /* received abort sequence */
+#define RBIT_HDLC_CRC_ERROR 0x0004 /* frame contains a CRC error */
+#define RBIT_HDLC_OVERRUN 0x0002 /* receiver overrun occurred */
+#define RBIT_HDLC_CD_LOST 0x0001 /* carrier detect lost */
+
+/*
+ * HDLC transmit buffer descriptor bit definitions
+ * Section 4.5.12.11
+ */
+#define RBIT_HDLC_READY_BIT 0x8000 /* buffer is ready to transmit */
+#define RBIT_HDLC_EXT_BUFFER 0x4000 /* buffer is in external memory */
+#define RBIT_HDLC_WRAP_BIT 0x2000 /* last buffer in bd table, so wrap */
+#define RBIT_HDLC_WAKE_UP 0x1000 /* interrupt when buffer serviced */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in the frame */
+#define RBIT_HDLC_TxCRC_BIT 0x0400 /* transmit a CRC sequence */
+#define RBIT_HDLC_UNDERRUN 0x0002 /* transmitter underrun */
+#define RBIT_HDLC_CTS_LOST 0x0001 /* CTS lost */
+
+/*
+ * HDLC event register bit definitions
+ * Section 4.5.12.12
+ */
+#define RBIT_HDLC_CTS 0x80 /* CTS status changed */
+#define RBIT_HDLC_CD 0x40 /* carrier detect status changed */
+#define RBIT_HDLC_IDL 0x20 /* IDLE sequence status changed */
+#define RBIT_HDLC_TXE 0x10 /* transmit error */
+#define RBIT_HDLC_RXF 0x08 /* received frame */
+#define RBIT_HDLC_BSY 0x04 /* frame rcvd and discarded due to
+ * lack of buffers
+ */
+#define RBIT_HDLC_TXB 0x02 /* buffer has been transmitted */
+#define RBIT_HDLC_RXB 0x01 /* received buffer */
+
+
+
+typedef struct {
+ m302_SCC_bd_table_t bd; /* +000 Buffer Descriptor Table */
+ m302_SCC_parameters_t parm; /* +080 Common Parameter RAM */
+ union { /* +09C Protocol-Specific Parm RAM */
+ m302_SCC_UartSpecific_t uart;
+ m302_SCC_HdlcSpecific_t hdlc;
+ } prot;
+ rtems_unsigned8 res[0x040]; /* +0C0 reserved, (not implemented) */
+} m302_SCC_t;
+
+
+/*
+ * Common SCC Registers
+ */
+typedef struct {
+ rtems_unsigned16 res1;
+ rtems_unsigned16 scon; /* SCC Configuration Register 4.5.2 */
+ rtems_unsigned16 scm; /* SCC Mode Register 4.5.3 */
+ rtems_unsigned16 dsr; /* SCC Data Synchronization Register 4.5.4 */
+ rtems_unsigned8 scce; /* SCC Event Register 4.5.8.1 */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 sccm; /* SCC Mask Register 4.5.8.2 */
+ rtems_unsigned8 res3;
+ rtems_unsigned8 sccs; /* SCC Status Register 4.5.8.3 */
+ rtems_unsigned8 res4;
+ rtems_unsigned16 res5;
+} m302_SCC_Registers_t;
+
+/*
+ * SCON - SCC Configuration Register
+ * Section 4.5.2
+ */
+#define RBIT_SCON_WOMS (1<<15) /* Wired-OR Mode Select (NMSI mode only)
+ * When set, the TXD driver is an
+ * open-drain output */
+#define RBIT_SCON_EXTC (1<<14) /* External Clock Source */
+#define RBIT_SCON_TCS (1<<13) /* Transmit Clock Source */
+#define RBIT_SCON_RCS (1<<12) /* Receive Clock Source */
+
+/*
+ * SCM - SCC Mode Register bit definitions
+ * Section 4.5.3
+ * The parameter-specific mode bits occupy bits 15 through 6.
+ */
+#define RBIT_SCM_ENR (1<<3) /* Enable receiver */
+#define RBIT_SCM_ENT (1<<2) /* Enable transmitter */
+
+
+/*
+ * Internal MC68302 Registers
+ * starts at offset 0x800 from dual-port RAM base
+ * Section 2.8
+ */
+typedef struct {
+ /* offset +800 */
+ rtems_unsigned16 res0;
+ rtems_unsigned16 cmr; /* IDMA Channel Mode Register */
+ rtems_unsigned32 sapr; /* IDMA Source Address Pointer */
+ rtems_unsigned32 dapr; /* IDMA Destination Address Pointer */
+ rtems_unsigned16 bcr; /* IDMA Byte Count Register */
+ rtems_unsigned8 csr; /* IDMA Channel Status Register */
+ rtems_unsigned8 res1;
+ rtems_unsigned8 fcr; /* IDMA Function Code Register */
+ rtems_unsigned8 res2;
+
+ /* offset +812 */
+ rtems_unsigned16 gimr; /* Global Interrupt Mode Register */
+ rtems_unsigned16 ipr; /* Interrupt Pending Register */
+ rtems_unsigned16 imr; /* Interrupt Mask Register */
+ rtems_unsigned16 isr; /* Interrupt In-Service Register */
+ rtems_unsigned16 res3;
+ rtems_unsigned16 res4;
+
+ /* offset +81e */
+ rtems_unsigned16 pacnt; /* Port A Control Register */
+ rtems_unsigned16 paddr; /* Port A Data Direction Register */
+ rtems_unsigned16 padat; /* Port A Data Register */
+ rtems_unsigned16 pbcnt; /* Port B Control Register */
+ rtems_unsigned16 pbddr; /* Port B Data Direction Register */
+ rtems_unsigned16 pbdat; /* Port B Data Register */
+ rtems_unsigned16 res5;
+
+ /* offset +82c */
+ rtems_unsigned16 res6;
+ rtems_unsigned16 res7;
+ rtems_unsigned16 br0; /* Base Register (CS0) */
+ rtems_unsigned16 or0; /* Option Register (CS0) */
+ rtems_unsigned16 br1; /* Base Register (CS1) */
+ rtems_unsigned16 or1; /* Option Register (CS1) */
+ rtems_unsigned16 br2; /* Base Register (CS2) */
+ rtems_unsigned16 or2; /* Option Register (CS2) */
+ rtems_unsigned16 br3; /* Base Register (CS3) */
+ rtems_unsigned16 or3; /* Option Register (CS3) */
+
+ /* offset +840 */
+ rtems_unsigned16 tmr1; /* Timer Unit 1 Mode Register */
+ rtems_unsigned16 trr1; /* Timer Unit 1 Reference Register */
+ rtems_unsigned16 tcr1; /* Timer Unit 1 Capture Register */
+ rtems_unsigned16 tcn1; /* Timer Unit 1 Counter */
+ rtems_unsigned8 res8;
+ rtems_unsigned8 ter1; /* Timer Unit 1 Event Register */
+ rtems_unsigned16 wrr; /* Watchdog Reference Register */
+ rtems_unsigned16 wcn; /* Watchdog Counter */
+ rtems_unsigned16 res9;
+ rtems_unsigned16 tmr2; /* Timer Unit 2 Mode Register */
+ rtems_unsigned16 trr2; /* Timer Unit 2 Reference Register */
+ rtems_unsigned16 tcr2; /* Timer Unit 2 Capture Register */
+ rtems_unsigned16 tcn2; /* Timer Unit 2 Counter */
+ rtems_unsigned8 resa;
+ rtems_unsigned8 ter2; /* Timer Unit 2 Event Register */
+ rtems_unsigned16 resb;
+ rtems_unsigned16 resc;
+ rtems_unsigned16 resd;
+
+ /* offset +860 */
+ rtems_unsigned8 cr; /* Command Register */
+ rtems_unsigned8 rese[0x1f];
+
+ /* offset +880, +890, +8a0 */
+ m302_SCC_Registers_t scc[3]; /* SCC1, SCC2, SCC3 Registers */
+
+ /* offset +8b0 */
+ rtems_unsigned16 spmode; /* SCP,SMC Mode and Clock Cntrl Reg */
+ rtems_unsigned16 simask; /* Serial Interface Mask Register */
+ rtems_unsigned16 simode; /* Serial Interface Mode Register */
+} m302_internalReg_t ;
+
+
+/*
+ * MC68302 dual-port RAM structure.
+ * (Includes System RAM, Parameter RAM, and Internal Registers).
+ * Section 2.8
+ */
+typedef struct {
+ rtems_unsigned8 mem[0x240]; /* +000 User Data Memory */
+ rtems_unsigned8 res1[0x1c0]; /* +240 reserved, (not implemented) */
+ m302_SCC_t scc1; /* +400 SCC1 */
+ m302_SCC_t scc2; /* +500 SCC2 */
+ m302_SCC_t scc3; /* +600 SCC3 */
+ rtems_unsigned8 res2[0x100]; /* +700 reserved, (not implemented) */
+ m302_internalReg_t reg; /* +800 68302 Internal Registers */
+} m302_dualPortRAM_t;
+
+
+/*
+ * Declare the variable that's used to reference the variables in
+ * the dual-port RAM.
+ */
+extern volatile m302_dualPortRAM_t m302;
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/cpu/m68k/m68360.h b/cpukit/score/cpu/m68k/m68360.h
new file mode 100644
index 0000000000..84687c49fa
--- /dev/null
+++ b/cpukit/score/cpu/m68k/m68360.h
@@ -0,0 +1,880 @@
+/*
+ **************************************************************************
+ **************************************************************************
+ ** **
+ ** MOTOROLA MC68360 QUAD INTEGRATED COMMUNICATIONS CONTROLLER (QUICC) **
+ ** **
+ ** HARDWARE DECLARATIONS **
+ ** **
+ ** **
+ ** Submitted By: **
+ ** **
+ ** W. Eric Norum **
+ ** Saskatchewan Accelerator Laboratory **
+ ** University of Saskatchewan **
+ ** 107 North Road **
+ ** Saskatoon, Saskatchewan, CANADA **
+ ** S7N 5C6 **
+ ** **
+ ** eric@skatter.usask.ca **
+ ** **
+ ** $Id$ **
+ ** **
+ **************************************************************************
+ **************************************************************************
+ */
+
+#ifndef __MC68360_h
+#define __MC68360_h
+
+/*
+ *************************************************************************
+ * REGISTER SUBBLOCKS *
+ *************************************************************************
+ */
+
+/*
+ * Memory controller registers
+ */
+typedef struct m360MEMCRegisters_ {
+ rtems_unsigned32 br;
+ rtems_unsigned32 or;
+ rtems_unsigned32 _pad[2];
+} m360MEMCRegisters_t;
+
+/*
+ * Serial Communications Controller registers
+ */
+typedef struct m360SCCRegisters_ {
+ rtems_unsigned32 gsmr_l;
+ rtems_unsigned32 gsmr_h;
+ rtems_unsigned16 psmr;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 todr;
+ rtems_unsigned16 dsr;
+ rtems_unsigned16 scce;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned16 sccm;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned8 sccs;
+ rtems_unsigned32 _pad3[2];
+} m360SCCRegisters_t;
+
+/*
+ * Serial Management Controller registers
+ */
+typedef struct m360SMCRegisters_ {
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 smcmr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned8 smce;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned16 _pad3;
+ rtems_unsigned8 smcm;
+ rtems_unsigned8 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SMCRegisters_t;
+
+
+/*
+ *************************************************************************
+ * Miscellaneous Parameters *
+ *************************************************************************
+ */
+typedef struct m360MiscParms_ {
+ rtems_unsigned16 rev_num;
+ rtems_unsigned16 _res1;
+ rtems_unsigned32 _res2;
+ rtems_unsigned32 _res3;
+} m360MiscParms_t;
+
+/*
+ *************************************************************************
+ * RISC Timers *
+ *************************************************************************
+ */
+typedef struct m360TimerParms_ {
+ rtems_unsigned16 tm_base;
+ rtems_unsigned16 _tm_ptr;
+ rtems_unsigned16 _r_tmr;
+ rtems_unsigned16 _r_tmv;
+ rtems_unsigned32 tm_cmd;
+ rtems_unsigned32 tm_cnt;
+} m360TimerParms_t;
+
+/*
+ * RISC Controller Configuration Register (RCCR)
+ * All other bits in this register are either reserved or
+ * used only with a Motorola-supplied RAM microcode packge.
+ */
+#define M360_RCCR_TIME (1<<15) /* Enable timer */
+#define M360_RCCR_TIMEP(x) ((x)<<8) /* Timer period */
+
+/*
+ * Command register
+ * Set up this register before issuing a M360_CR_OP_SET_TIMER command.
+ */
+#define M360_TM_CMD_V (1<<31) /* Set to enable timer */
+#define M360_TM_CMD_R (1<<30) /* Set for automatic restart */
+#define M360_TM_CMD_TIMER(x) ((x)<<16) /* Select timer */
+#define M360_TM_CMD_PERIOD(x) (x) /* Timer period (16 bits) */
+
+/*
+ *************************************************************************
+ * DMA Controllers *
+ *************************************************************************
+ */
+typedef struct m360IDMAparms_ {
+ rtems_unsigned16 ibase;
+ rtems_unsigned16 ibptr;
+ rtems_unsigned32 _istate;
+ rtems_unsigned32 _itemp;
+} m360IDMAparms_t;
+
+/*
+ *************************************************************************
+ * Serial Communication Controllers *
+ *************************************************************************
+ */
+typedef struct m360SCCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ } un;
+} m360SCCparms_t;
+
+typedef struct m360SCCENparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ struct {
+ rtems_unsigned32 c_pres;
+ rtems_unsigned32 c_mask;
+ rtems_unsigned32 crcec;
+ rtems_unsigned32 alec;
+ rtems_unsigned32 disfc;
+ rtems_unsigned16 pads;
+ rtems_unsigned16 ret_lim;
+ rtems_unsigned16 _ret_cnt;
+ rtems_unsigned16 mflr;
+ rtems_unsigned16 minflr;
+ rtems_unsigned16 maxd1;
+ rtems_unsigned16 maxd2;
+ rtems_unsigned16 _maxd;
+ rtems_unsigned16 dma_cnt;
+ rtems_unsigned16 _max_b;
+ rtems_unsigned16 gaddr1;
+ rtems_unsigned16 gaddr2;
+ rtems_unsigned16 gaddr3;
+ rtems_unsigned16 gaddr4;
+ rtems_unsigned32 _tbuf0data0;
+ rtems_unsigned32 _tbuf0data1;
+ rtems_unsigned32 _tbuf0rba0;
+ rtems_unsigned32 _tbuf0crc;
+ rtems_unsigned16 _tbuf0bcnt;
+ rtems_unsigned16 paddr_h;
+ rtems_unsigned16 paddr_m;
+ rtems_unsigned16 paddr_l;
+ rtems_unsigned16 p_per;
+ rtems_unsigned16 _rfbd_ptr;
+ rtems_unsigned16 _tfbd_ptr;
+ rtems_unsigned16 _tlbd_ptr;
+ rtems_unsigned32 _tbuf1data0;
+ rtems_unsigned32 _tbuf1data1;
+ rtems_unsigned32 _tbuf1rba0;
+ rtems_unsigned32 _tbuf1crc;
+ rtems_unsigned16 _tbuf1bcnt;
+ rtems_unsigned16 _tx_len;
+ rtems_unsigned16 iaddr1;
+ rtems_unsigned16 iaddr2;
+ rtems_unsigned16 iaddr3;
+ rtems_unsigned16 iaddr4;
+ rtems_unsigned16 _boff_cnt;
+ rtems_unsigned16 taddr_l;
+ rtems_unsigned16 taddr_m;
+ rtems_unsigned16 taddr_h;
+ } ethernet;
+ } un;
+} m360SCCENparms_t;
+
+/*
+ * Receive and transmit function code register bits
+ * These apply to the function code registers of all devices, not just SCC.
+ */
+#define M360_RFCR_MOT (1<<4)
+#define M360_RFCR_DMA_SPACE 0x8
+#define M360_TFCR_MOT (1<<4)
+#define M360_TFCR_DMA_SPACE 0x8
+
+/*
+ *************************************************************************
+ * Serial Management Controllers *
+ *************************************************************************
+ */
+typedef struct m360SMCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ union {
+ struct {
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 _r_mask;
+ } uart;
+ struct {
+ rtems_unsigned16 _pad0[5];
+ } transparent;
+ } un;
+} m360SMCparms_t;
+
+/*
+ * Mode register
+ */
+#define M360_SMCMR_CLEN(x) ((x)<<11) /* Character length */
+#define M360_SMCMR_2STOP (1<<10) /* 2 stop bits */
+#define M360_SMCMR_PARITY (1<<9) /* Enable parity */
+#define M360_SMCMR_EVEN (1<<8) /* Even parity */
+#define M360_SMCMR_SM_GCI (0<<4) /* GCI Mode */
+#define M360_SMCMR_SM_UART (2<<4) /* UART Mode */
+#define M360_SMCMR_SM_TRANSPARENT (3<<4) /* Transparent Mode */
+#define M360_SMCMR_DM_LOOPBACK (1<<2) /* Local loopback mode */
+#define M360_SMCMR_DM_ECHO (2<<2) /* Echo mode */
+#define M360_SMCMR_TEN (1<<1) /* Enable transmitter */
+#define M360_SMCMR_REN (1<<0) /* Enable receiver */
+
+/*
+ * Event and mask registers (SMCE, SMCM)
+ */
+#define M360_SMCE_BRK (1<<4)
+#define M360_SMCE_BSY (1<<2)
+#define M360_SMCE_TX (1<<1)
+#define M360_SMCE_RX (1<<0)
+
+/*
+ *************************************************************************
+ * Serial Peripheral Interface *
+ *************************************************************************
+ */
+typedef struct m360SPIparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SPIparms_t;
+
+/*
+ * Mode register (SPMODE)
+ */
+#define M360_SPMODE_LOOP (1<<14) /* Local loopback mode */
+#define M360_SPMODE_CI (1<<13) /* Clock invert */
+#define M360_SPMODE_CP (1<<12) /* Clock phase */
+#define M360_SPMODE_DIV16 (1<<11) /* Divide BRGCLK by 16 */
+#define M360_SPMODE_REV (1<<10) /* Reverse data */
+#define M360_SPMODE_MASTER (1<<9) /* SPI is master */
+#define M360_SPMODE_EN (1<<8) /* Enable SPI */
+#define M360_SPMODE_CLEN(x) ((x)<<4) /* Character length */
+#define M360_SPMODE_PM(x) (x) /* Prescaler modulus */
+
+/*
+ * Mode register (SPCOM)
+ */
+#define M360_SPCOM_STR (1<<7) /* Start transmit */
+
+/*
+ * Event and mask registers (SPIE, SPIM)
+ */
+#define M360_SPIE_MME (1<<5) /* Multi-master error */
+#define M360_SPIE_TXE (1<<4) /* Tx error */
+#define M360_SPIE_BSY (1<<2) /* Busy condition*/
+#define M360_SPIE_TXB (1<<1) /* Tx buffer */
+#define M360_SPIE_RXB (1<<0) /* Rx buffer */
+
+/*
+ *************************************************************************
+ * SDMA (SCC, SMC, SPI) Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360BufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 length;
+ volatile void *buffer;
+} m360BufferDescriptor_t;
+
+/*
+ * Bits in receive buffer descriptor status word
+ */
+#define M360_BD_EMPTY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_WRAP (1<<13) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_INTERRUPT (1<<12) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_LAST (1<<11) /* Ethernet, SPI */
+#define M360_BD_CONTROL_CHAR (1<<11) /* SCC UART */
+#define M360_BD_FIRST_IN_FRAME (1<<10) /* Ethernet */
+#define M360_BD_ADDRESS (1<<10) /* SCC UART */
+#define M360_BD_CONTINUOUS (1<<9) /* SCC UART, SMC UART, SPI */
+#define M360_BD_MISS (1<<8) /* Ethernet */
+#define M360_BD_IDLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_ADDRSS_MATCH (1<<7) /* SCC UART */
+#define M360_BD_LONG (1<<5) /* Ethernet */
+#define M360_BD_BREAK (1<<5) /* SCC UART, SMC UART */
+#define M360_BD_NONALIGNED (1<<4) /* Ethernet */
+#define M360_BD_FRAMING_ERROR (1<<4) /* SCC UART, SMC UART */
+#define M360_BD_SHORT (1<<3) /* Ethernet */
+#define M360_BD_PARITY_ERROR (1<<3) /* SCC UART, SMC UART */
+#define M360_BD_CRC_ERROR (1<<2) /* Ethernet */
+#define M360_BD_OVERRUN (1<<1) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_COLLISION (1<<0) /* Ethernet */
+#define M360_BD_CARRIER_LOST (1<<0) /* SCC UART */
+#define M360_BD_MASTER_ERROR (1<<0) /* SPI */
+
+/*
+ * Bits in transmit buffer descriptor status word
+ * Many bits have the same meaning as those in receiver buffer descriptors.
+ */
+#define M360_BD_READY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_PAD (1<<14) /* Ethernet */
+#define M360_BD_CTS_REPORT (1<<11) /* SCC UART */
+#define M360_BD_TX_CRC (1<<10) /* Ethernet */
+#define M360_BD_DEFER (1<<9) /* Ethernet */
+#define M360_BD_HEARTBEAT (1<<8) /* Ethernet */
+#define M360_BD_PREAMBLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_LATE_COLLISION (1<<7) /* Ethernet */
+#define M360_BD_NO_STOP_BIT (1<<7) /* SCC UART */
+#define M360_BD_RETRY_LIMIT (1<<6) /* Ethernet */
+#define M360_BD_RETRY_COUNT(x) (((x)&0x3C)>>2) /* Ethernet */
+#define M360_BD_UNDERRUN (1<<1) /* Ethernet, SPI */
+#define M360_BD_CARRIER_LOST (1<<0) /* Ethernet */
+#define M360_BD_CTS_LOST (1<<0) /* SCC UART */
+
+/*
+ *************************************************************************
+ * IDMA Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360IDMABufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 _pad;
+ rtems_unsigned32 length;
+ void *source;
+ void *destination;
+} m360IDMABufferDescriptor_t;
+
+/*
+ *************************************************************************
+ * RISC Communication Processor Module Command Register (CR) *
+ *************************************************************************
+ */
+#define M360_CR_RST (1<<15) /* Reset communication processor */
+#define M360_CR_OP_INIT_RX_TX (0<<8) /* SCC, SMC UART, SMC GCI, SPI */
+#define M360_CR_OP_INIT_RX (1<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_TX (2<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_HUNT (3<<8) /* SCC, SMC UART */
+#define M360_CR_OP_STOP_TX (4<<8) /* SCC, SMC UART */
+#define M360_CR_OP_GR_STOP_TX (5<<8) /* SCC */
+#define M360_CR_OP_INIT_IDMA (5<<8) /* IDMA */
+#define M360_CR_OP_RESTART_TX (6<<8) /* SCC, SMC UART */
+#define M360_CR_OP_CLOSE_RX_BD (7<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_SET_GRP_ADDR (8<<8) /* SCC */
+#define M360_CR_OP_SET_TIMER (8<<8) /* Timer */
+#define M360_CR_OP_GCI_TIMEOUT (9<<8) /* SMC GCI */
+#define M360_CR_OP_RESERT_BCS (10<<8) /* SCC */
+#define M360_CR_OP_GCI_ABORT (10<<8) /* SMC GCI */
+#define M360_CR_CHAN_SCC1 (0<<4) /* Channel selection */
+#define M360_CR_CHAN_SCC2 (4<<4)
+#define M360_CR_CHAN_SPI (5<<4)
+#define M360_CR_CHAN_TIMER (5<<4)
+#define M360_CR_CHAN_SCC3 (8<<4)
+#define M360_CR_CHAN_SMC1 (9<<4)
+#define M360_CR_CHAN_IDMA1 (9<<4)
+#define M360_CR_CHAN_SCC4 (12<<4)
+#define M360_CR_CHAN_SMC2 (13<<4)
+#define M360_CR_CHAN_IDMA2 (13<<4)
+#define M360_CR_FLG (1<<0) /* Command flag */
+
+/*
+ *************************************************************************
+ * System Protection Control Register (SYPCR) *
+ *************************************************************************
+ */
+#define M360_SYPCR_SWE (1<<7) /* Software watchdog enable */
+#define M360_SYPCR_SWRI (1<<6) /* Software watchdog reset select */
+#define M360_SYPCR_SWT1 (1<<5) /* Software watchdog timing bit 1 */
+#define M360_SYPCR_SWT0 (1<<4) /* Software watchdog timing bit 0 */
+#define M360_SYPCR_DBFE (1<<3) /* Double bus fault monitor enable */
+#define M360_SYPCR_BME (1<<2) /* Bus monitor external enable */
+#define M360_SYPCR_BMT1 (1<<1) /* Bus monitor timing bit 1 */
+#define M360_SYPCR_BMT0 (1<<0) /* Bus monitor timing bit 0 */
+
+/*
+ *************************************************************************
+ * Memory Control Registers *
+ *************************************************************************
+ */
+#define M360_GMR_RCNT(x) ((x)<<24) /* Refresh count */
+#define M360_GMR_RFEN (1<<23) /* Refresh enable */
+#define M360_GMR_RCYC(x) ((x)<<21) /* Refresh cycle length */
+#define M360_GMR_PGS(x) ((x)<<18) /* Page size */
+#define M360_GMR_DPS_32BIT (0<<16) /* DRAM port size */
+#define M360_GMR_DPS_16BIT (1<<16)
+#define M360_GMR_DPS_8BIT (2<<16)
+#define M360_GMR_DPS_DSACK (3<<16)
+#define M360_GMR_WBT40 (1<<15) /* Wait between 040 transfers */
+#define M360_GMR_WBTQ (1<<14) /* Wait between 360 transfers */
+#define M360_GMR_SYNC (1<<13) /* Synchronous external access */
+#define M360_GMR_EMWS (1<<12) /* External master wait state */
+#define M360_GMR_OPAR (1<<11) /* Odd parity */
+#define M360_GMR_PBEE (1<<10) /* Parity bus error enable */
+#define M360_GMR_TSS40 (1<<9) /* TS* sample for 040 */
+#define M360_GMR_NCS (1<<8) /* No CPU space */
+#define M360_GMR_DWQ (1<<7) /* Delay write for 360 */
+#define M360_GMR_DW40 (1<<6) /* Delay write for 040 */
+#define M360_GMR_GAMX (1<<5) /* Global address mux enable */
+
+#define M360_MEMC_BR_FC(x) ((x)<<7) /* Function code limit */
+#define M360_MEMC_BR_TRLXQ (1<<6) /* Relax timing requirements */
+#define M360_MEMC_BR_BACK40 (1<<5) /* Burst acknowledge to 040 */
+#define M360_MEMC_BR_CSNT40 (1<<4) /* CS* negate timing for 040 */
+#define M360_MEMC_BR_CSNTQ (1<<3) /* CS* negate timing for 360 */
+#define M360_MEMC_BR_PAREN (1<<2) /* Enable parity checking */
+#define M360_MEMC_BR_WP (1<<1) /* Write Protect */
+#define M360_MEMC_BR_V (1<<0) /* Base/Option register are valid */
+
+#define M360_MEMC_OR_TCYC(x) ((x)<<28) /* Cycle length (clocks) */
+#define M360_MEMC_OR_WAITS(x) M360_MEMC_OR_TCYC((x)+1)
+#define M360_MEMC_OR_2KB 0x0FFFF800 /* Address range */
+#define M360_MEMC_OR_4KB 0x0FFFF000
+#define M360_MEMC_OR_8KB 0x0FFFE000
+#define M360_MEMC_OR_16KB 0x0FFFC000
+#define M360_MEMC_OR_32KB 0x0FFF8000
+#define M360_MEMC_OR_64KB 0x0FFF0000
+#define M360_MEMC_OR_128KB 0x0FFE0000
+#define M360_MEMC_OR_256KB 0x0FFC0000
+#define M360_MEMC_OR_512KB 0x0FF80000
+#define M360_MEMC_OR_1MB 0x0FF00000
+#define M360_MEMC_OR_2MB 0x0FE00000
+#define M360_MEMC_OR_4MB 0x0FC00000
+#define M360_MEMC_OR_8MB 0x0F800000
+#define M360_MEMC_OR_16MB 0x0F000000
+#define M360_MEMC_OR_32MB 0x0E000000
+#define M360_MEMC_OR_64MB 0x0C000000
+#define M360_MEMC_OR_128MB 0x08000000
+#define M360_MEMC_OR_256MB 0x00000000
+#define M360_MEMC_OR_FCMC(x) ((x)<<7) /* Function code mask */
+#define M360_MEMC_OR_BCYC(x) ((x)<<5) /* Burst cycle length (clocks) */
+#define M360_MEMC_OR_PGME (1<<3) /* Page mode enable */
+#define M360_MEMC_OR_32BIT (0<<1) /* Port size */
+#define M360_MEMC_OR_16BIT (1<<1)
+#define M360_MEMC_OR_8BIT (2<<1)
+#define M360_MEMC_OR_DSACK (3<<1)
+#define M360_MEMC_OR_DRAM (1<<0) /* Dynamic RAM select */
+
+/*
+ *************************************************************************
+ * SI Mode Register (SIMODE) *
+ *************************************************************************
+ */
+#define M360_SI_SMC2_BITS 0xFFFF0000 /* All SMC2 bits */
+#define M360_SI_SMC2_TDM (1<<31) /* Multiplexed SMC2 */
+#define M360_SI_SMC2_BRG1 (0<<28) /* SMC2 clock souce */
+#define M360_SI_SMC2_BRG2 (1<<28)
+#define M360_SI_SMC2_BRG3 (2<<28)
+#define M360_SI_SMC2_BRG4 (3<<28)
+#define M360_SI_SMC2_CLK5 (0<<28)
+#define M360_SI_SMC2_CLK6 (1<<28)
+#define M360_SI_SMC2_CLK7 (2<<28)
+#define M360_SI_SMC2_CLK8 (3<<28)
+#define M360_SI_SMC1_BITS 0x0000FFFF /* All SMC1 bits */
+#define M360_SI_SMC1_TDM (1<<15) /* Multiplexed SMC1 */
+#define M360_SI_SMC1_BRG1 (0<<12) /* SMC1 clock souce */
+#define M360_SI_SMC1_BRG2 (1<<12)
+#define M360_SI_SMC1_BRG3 (2<<12)
+#define M360_SI_SMC1_BRG4 (3<<12)
+#define M360_SI_SMC1_CLK1 (0<<12)
+#define M360_SI_SMC1_CLK2 (1<<12)
+#define M360_SI_SMC1_CLK3 (2<<12)
+#define M360_SI_SMC1_CLK4 (3<<12)
+
+/*
+ *************************************************************************
+ * SDMA Configuration Register (SDMA) *
+ *************************************************************************
+ */
+#define M360_SDMA_FREEZE (2<<13) /* Freeze on next bus cycle */
+#define M360_SDMA_SISM_7 (7<<8) /* Normal interrupt service mask */
+#define M360_SDMA_SAID_4 (4<<4) /* Normal arbitration ID */
+#define M360_SDMA_INTE (1<<1) /* SBER interrupt enable */
+#define M360_SDMA_INTB (1<<0) /* SBKP interrupt enable */
+
+/*
+ *************************************************************************
+ * Baud (sic) Rate Generators *
+ *************************************************************************
+ */
+#define M360_BRG_RST (1<<17) /* Reset generator */
+#define M360_BRG_EN (1<<16) /* Enable generator */
+#define M360_BRG_EXTC_BRGCLK (0<<14) /* Source is BRGCLK */
+#define M360_BRG_EXTC_CLK2 (1<<14) /* Source is CLK2 pin */
+#define M360_BRG_EXTC_CLK6 (2<<14) /* Source is CLK6 pin */
+#define M360_BRG_ATB (1<<13) /* Autobaud */
+#define M360_BRG_115200 (13<<1) /* Assume 25 MHz clock */
+#define M360_BRG_57600 (26<<1)
+#define M360_BRG_38400 (40<<1)
+#define M360_BRG_19200 (80<<1)
+#define M360_BRG_9600 (162<<1)
+#define M360_BRG_4800 (324<<1)
+#define M360_BRG_2400 (650<<1)
+#define M360_BRG_1200 (1301<<1)
+#define M360_BRG_600 (2603<<1)
+#define M360_BRG_300 ((324<<1) | 1)
+#define M360_BRG_150 ((650<<1) | 1)
+#define M360_BRG_75 ((1301<<1) | 1)
+
+/*
+ *************************************************************************
+ * MC68360 DUAL-PORT RAM AND REGISTERS *
+ *************************************************************************
+ */
+typedef struct m360_ {
+ /*
+ * Dual-port RAM
+ */
+ rtems_unsigned8 dpram0[0x400]; /* Microcode program */
+ rtems_unsigned8 dpram1[0x200];
+ rtems_unsigned8 dpram2[0x100]; /* Microcode scratch */
+ rtems_unsigned8 dpram3[0x100]; /* Not on REV A or B masks */
+ rtems_unsigned8 _rsv0[0xC00-0x800];
+ m360SCCENparms_t scc1p;
+ rtems_unsigned8 _rsv1[0xCB0-0xC00-sizeof(m360SCCENparms_t)];
+ m360MiscParms_t miscp;
+ rtems_unsigned8 _rsv2[0xD00-0xCB0-sizeof(m360MiscParms_t)];
+ m360SCCparms_t scc2p;
+ rtems_unsigned8 _rsv3[0xD80-0xD00-sizeof(m360SCCparms_t)];
+ m360SPIparms_t spip;
+ rtems_unsigned8 _rsv4[0xDB0-0xD80-sizeof(m360SPIparms_t)];
+ m360TimerParms_t tmp;
+ rtems_unsigned8 _rsv5[0xE00-0xDB0-sizeof(m360TimerParms_t)];
+ m360SCCparms_t scc3p;
+ rtems_unsigned8 _rsv6[0xE70-0xE00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma1p;
+ rtems_unsigned8 _rsv7[0xE80-0xE70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc1p;
+ rtems_unsigned8 _rsv8[0xF00-0xE80-sizeof(m360SMCparms_t)];
+ m360SCCparms_t scc4p;
+ rtems_unsigned8 _rsv9[0xF70-0xF00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma2p;
+ rtems_unsigned8 _rsv10[0xF80-0xF70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc2p;
+ rtems_unsigned8 _rsv11[0x1000-0xF80-sizeof(m360SMCparms_t)];
+
+ /*
+ * SIM Block
+ */
+ rtems_unsigned32 mcr;
+ rtems_unsigned32 _pad00;
+ rtems_unsigned8 avr;
+ rtems_unsigned8 rsr;
+ rtems_unsigned16 _pad01;
+ rtems_unsigned8 clkocr;
+ rtems_unsigned8 _pad02;
+ rtems_unsigned16 _pad03;
+ rtems_unsigned16 pllcr;
+ rtems_unsigned16 _pad04;
+ rtems_unsigned16 cdvcr;
+ rtems_unsigned16 pepar;
+ rtems_unsigned32 _pad05[2];
+ rtems_unsigned16 _pad06;
+ rtems_unsigned8 sypcr;
+ rtems_unsigned8 swiv;
+ rtems_unsigned16 _pad07;
+ rtems_unsigned16 picr;
+ rtems_unsigned16 _pad08;
+ rtems_unsigned16 pitr;
+ rtems_unsigned16 _pad09;
+ rtems_unsigned8 _pad10;
+ rtems_unsigned8 swsr;
+ rtems_unsigned32 bkar;
+ rtems_unsigned32 bcar;
+ rtems_unsigned32 _pad11[2];
+
+ /*
+ * MEMC Block
+ */
+ rtems_unsigned32 gmr;
+ rtems_unsigned16 mstat;
+ rtems_unsigned16 _pad12;
+ rtems_unsigned32 _pad13[2];
+ m360MEMCRegisters_t memc[8];
+ rtems_unsigned8 _pad14[0xF0-0xD0];
+ rtems_unsigned8 _pad15[0x100-0xF0];
+ rtems_unsigned8 _pad16[0x500-0x100];
+
+ /*
+ * IDMA1 Block
+ */
+ rtems_unsigned16 iccr;
+ rtems_unsigned16 _pad17;
+ rtems_unsigned16 cmr1;
+ rtems_unsigned16 _pad18;
+ rtems_unsigned32 sapr1;
+ rtems_unsigned32 dapr1;
+ rtems_unsigned32 bcr1;
+ rtems_unsigned8 fcr1;
+ rtems_unsigned8 _pad19;
+ rtems_unsigned8 cmar1;
+ rtems_unsigned8 _pad20;
+ rtems_unsigned8 csr1;
+ rtems_unsigned8 _pad21;
+ rtems_unsigned16 _pad22;
+
+ /*
+ * SDMA Block
+ */
+ rtems_unsigned8 sdsr;
+ rtems_unsigned8 _pad23;
+ rtems_unsigned16 sdcr;
+ rtems_unsigned32 sdar;
+
+ /*
+ * IDMA2 Block
+ */
+ rtems_unsigned16 _pad24;
+ rtems_unsigned16 cmr2;
+ rtems_unsigned32 sapr2;
+ rtems_unsigned32 dapr2;
+ rtems_unsigned32 bcr2;
+ rtems_unsigned8 fcr2;
+ rtems_unsigned8 _pad26;
+ rtems_unsigned8 cmar2;
+ rtems_unsigned8 _pad27;
+ rtems_unsigned8 csr2;
+ rtems_unsigned8 _pad28;
+ rtems_unsigned16 _pad29;
+ rtems_unsigned32 _pad30;
+
+ /*
+ * CPIC Block
+ */
+ rtems_unsigned32 cicr;
+ rtems_unsigned32 cipr;
+ rtems_unsigned32 cimr;
+ rtems_unsigned32 cisr;
+
+ /*
+ * Parallel I/O Block
+ */
+ rtems_unsigned16 padir;
+ rtems_unsigned16 papar;
+ rtems_unsigned16 paodr;
+ rtems_unsigned16 padat;
+ rtems_unsigned32 _pad31[2];
+ rtems_unsigned16 pcdir;
+ rtems_unsigned16 pcpar;
+ rtems_unsigned16 pcso;
+ rtems_unsigned16 pcdat;
+ rtems_unsigned16 pcint;
+ rtems_unsigned16 _pad32;
+ rtems_unsigned32 _pad33[5];
+
+ /*
+ * TIMER Block
+ */
+ rtems_unsigned16 tgcr;
+ rtems_unsigned16 _pad34;
+ rtems_unsigned32 _pad35[3];
+ rtems_unsigned16 tmr1;
+ rtems_unsigned16 tmr2;
+ rtems_unsigned16 trr1;
+ rtems_unsigned16 trr2;
+ rtems_unsigned16 tcr1;
+ rtems_unsigned16 tcr2;
+ rtems_unsigned16 tcn1;
+ rtems_unsigned16 tcn2;
+ rtems_unsigned16 tmr3;
+ rtems_unsigned16 tmr4;
+ rtems_unsigned16 trr3;
+ rtems_unsigned16 trr4;
+ rtems_unsigned16 tcr3;
+ rtems_unsigned16 tcr4;
+ rtems_unsigned16 tcn3;
+ rtems_unsigned16 tcn4;
+ rtems_unsigned16 ter1;
+ rtems_unsigned16 ter2;
+ rtems_unsigned16 ter3;
+ rtems_unsigned16 ter4;
+ rtems_unsigned32 _pad36[2];
+
+ /*
+ * CP Block
+ */
+ rtems_unsigned16 cr;
+ rtems_unsigned16 _pad37;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 _pad38;
+ rtems_unsigned32 _pad39[3];
+ rtems_unsigned16 _pad40;
+ rtems_unsigned16 rter;
+ rtems_unsigned16 _pad41;
+ rtems_unsigned16 rtmr;
+ rtems_unsigned32 _pad42[5];
+
+ /*
+ * BRG Block
+ */
+ rtems_unsigned32 brgc1;
+ rtems_unsigned32 brgc2;
+ rtems_unsigned32 brgc3;
+ rtems_unsigned32 brgc4;
+
+ /*
+ * SCC Block
+ */
+ m360SCCRegisters_t scc1;
+ m360SCCRegisters_t scc2;
+ m360SCCRegisters_t scc3;
+ m360SCCRegisters_t scc4;
+
+ /*
+ * SMC Block
+ */
+ m360SMCRegisters_t smc1;
+ m360SMCRegisters_t smc2;
+
+ /*
+ * SPI Block
+ */
+ rtems_unsigned16 spmode;
+ rtems_unsigned16 _pad43[2];
+ rtems_unsigned8 spie;
+ rtems_unsigned8 _pad44;
+ rtems_unsigned16 _pad45;
+ rtems_unsigned8 spim;
+ rtems_unsigned8 _pad46[2];
+ rtems_unsigned8 spcom;
+ rtems_unsigned16 _pad47[2];
+
+ /*
+ * PIP Block
+ */
+ rtems_unsigned16 pipc;
+ rtems_unsigned16 _pad48;
+ rtems_unsigned16 ptpr;
+ rtems_unsigned32 pbdir;
+ rtems_unsigned32 pbpar;
+ rtems_unsigned16 _pad49;
+ rtems_unsigned16 pbodr;
+ rtems_unsigned32 pbdat;
+ rtems_unsigned32 _pad50[6];
+
+ /*
+ * SI Block
+ */
+ rtems_unsigned32 simode;
+ rtems_unsigned8 sigmr;
+ rtems_unsigned8 _pad51;
+ rtems_unsigned8 sistr;
+ rtems_unsigned8 sicmr;
+ rtems_unsigned32 _pad52;
+ rtems_unsigned32 sicr;
+ rtems_unsigned16 _pad53;
+ rtems_unsigned16 sirp[2];
+ rtems_unsigned16 _pad54;
+ rtems_unsigned32 _pad55[2];
+ rtems_unsigned8 siram[256];
+} m360_t;
+
+extern volatile m360_t m360;
+
+#endif /* __MC68360_h */
diff --git a/cpukit/score/cpu/m68k/qsm.h b/cpukit/score/cpu/m68k/qsm.h
new file mode 100644
index 0000000000..e1bf33bc12
--- /dev/null
+++ b/cpukit/score/cpu/m68k/qsm.h
@@ -0,0 +1,209 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * QSM -- Queued Serial Module
+ *
+ * The QSM contains two serial interfaces: (a) the queued serial
+ * peripheral interface (QSPI) and the serial communication interface
+ * (SCI). The QSPI provides peripheral expansion and/or interprocessor
+ * communication through a full-duplex, synchronous, three-wire bus. A
+ * self contained RAM queue permits serial data transfers without CPU
+ * intervention and automatic continuous sampling. The SCI provides a
+ * standard non-return to zero mark/space format with wakeup functions
+ * to allow the CPU to run uninterrupted until woken
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family Queued Serial Module Reference Manual" (Motorola document
+ * QSMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _QSM_H_
+#define _QSM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+/* QSM_CRB (QSM Control Register Block) base address of the QSM
+ control registers */
+#if SIM_MM == 0
+#define QSM_CRB 0x7ffc00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define QSM_CRB 0xfffc00
+#endif
+
+
+#define QSMCR (volatile unsigned short int * const)(0x00 + QSM_CRB)
+ /* QSM Configuration Register */
+#define STOP 0x8000 /* Stop Enable */
+#define FRZ 0x6000 /* Freeze Control */
+#define SUPV 0x0080 /* Supervisor/Unrestricted */
+#define IARB 0x000f /* Inerrupt Arbitration */
+
+
+#define QTEST (volatile unsigned short int * const)(0x02 + QSM_CRB)
+ /* QSM Test Register */
+/* Used only for factor testing */
+
+
+#define QILR (volatile unsigned char * const)(0x04 + QSM_CRB)
+ /* QSM Interrupt Level Register */
+#define ILQSPI 0x38 /* Interrupt Level for QSPI */
+#define ILSCI 0x07 /* Interrupt Level for SCI */
+
+
+#define QIVR (volatile unsigned char * const)(0x05 + QSM_CRB)
+ /* QSM Interrupt Vector Register */
+#define INTV 0xff /* Interrupt Vector Number */
+
+
+#define SCCR0 (volatile unsigned short int * const)(0x08 + QSM_CRB)
+ /* SCI Control Register 0 */
+#define SCBR 0x1fff /* SCI Baud Rate */
+
+
+#define SCCR1 (volatile unsigned short int * const)(0x0a + QSM_CRB)
+ /* SCI Control Register 1 */
+#define LOOPS 0x4000 /* Loop Mode */
+#define WOMS 0x2000 /* Wired-OR Mode for SCI Pins */
+#define ILT 0x1000 /* Idle-Line Detect Type */
+#define PT 0x0800 /* Parity Type */
+#define PE 0x0400 /* Parity Enable */
+#define M 0x0200 /* Mode Select */
+#define WAKE 0x0100 /* Wakeup by Address Mark */
+#define TIE 0x0080 /* Transmit Complete Interrupt Enable */
+#define TCIE 0x0040 /* Transmit Complete Interrupt Enable */
+#define RIE 0x0020 /* Receiver Interrupt Enable */
+#define ILIE 0x0010 /* Idle-Line Interrupt Enable */
+#define TE 0x0008 /* Transmitter Enable */
+#define RE 0x0004 /* Receiver Enable */
+#define RWU 0x0002 /* Receiver Wakeup */
+#define SBK 0x0001 /* Send Break */
+
+
+#define SCSR (volatile unsigned short int * const)(0x0c + QSM_CRB)
+ /* SCI Status Register */
+#define TDRE 0x0100 /* Transmit Data Register Empty */
+#define TC 0x0080 /* Transmit Complete */
+#define RDRF 0x0040 /* Receive Data Register Full */
+#define RAF 0x0020 /* Receiver Active */
+#define IDLE 0x0010 /* Idle-Line Detected */
+#define OR 0x0008 /* Overrun Error */
+#define NF 0x0004 /* Noise Error Flag */
+#define FE 0x0002 /* Framing Error */
+#define PF 0x0001 /* Parity Error */
+
+
+#define SCDR (volatile unsigned short int * const)(0x0e + QSM_CRB)
+ /* SCI Data Register */
+
+
+#define PORTQS (volatile unsigned char * const)(0x15 + QSM_CRB)
+ /* Port QS Data Register */
+
+#define PQSPAR (volatile unsigned char * const)(0x16 + QSM_CRB)
+ /* PORT QS Pin Assignment Rgister */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a QSPI
+ signal. */
+/* note: PQS2 is a digital I/O pin unless the SPI is enabled in which
+ case it becomes the SPI serial clock SCK. */
+/* note: PQS7 is a digital I/O pin unless the SCI transmitter is
+ enabled in which case it becomes the SCI serial output TxD. */
+#define QSMFun 0x0
+#define QSMDis 0x1
+/*
+ * PQSPAR Field | QSM Function | Discrete I/O pin
+ *------------------+--------------+------------------ */
+#define PQSPA0 0 /* MISO | PQS0 */
+#define PQSPA1 1 /* MOSI | PQS1 */
+#define PQSPA2 2 /* SCK | PQS2 (see note)*/
+#define PQSPA3 3 /* PCSO/!SS | PQS3 */
+#define PQSPA4 4 /* PCS1 | PQS4 */
+#define PQSPA5 5 /* PCS2 | PQS5 */
+#define PQSPA6 6 /* PCS3 | PQS6 */
+#define PQSPA7 7 /* TxD | PQS7 (see note)*/
+
+
+#define DDRQS (volatile unsigned char * const)(0x17 + QSM_CRB)
+ /* PORT QS Data Direction Register */
+/* Clearing a bit makes the corresponding pin an input; setting a bit
+ makes the pin an output. */
+
+
+#define SPCR0 (volatile unsigned short int * const)(0x18 + QSM_CRB)
+ /* QSPI Control Register 0 */
+#define MSTR 0x8000 /* Master/Slave Mode Select */
+#define WOMQ 0x4000 /* Wired-OR Mode for QSPI Pins */
+#define BITS 0x3c00 /* Bits Per Transfer */
+#define CPOL 0x0200 /* Clock Polarity */
+#define CPHA 0x0100 /* Clock Phase */
+#define SPBR 0x00ff /* Serial Clock Baud Rate */
+
+
+#define SPCR1 (volatile unsigned short int * const)(0x1a + QSM_CRB)
+ /* QSPI Control Register 1 */
+#define SPE 0x8000 /* QSPI Enable */
+#define DSCKL 0x7f00 /* Delay before SCK */
+#define DTL 0x00ff /* Length of Delay after Transfer */
+
+
+#define SPCR2 (volatile unsigned short int * const)(0x1c + QSM_CRB)
+ /* QSPI Control Register 2 */
+#define SPIFIE 0x8000 /* SPI Finished Interrupt Enable */
+#define WREN 0x4000 /* Wrap Enable */
+#define WRTO 0x2000 /* Wrap To */
+#define ENDQP 0x0f00 /* Ending Queue Pointer */
+#define NEWQP 0x000f /* New Queue Pointer Value */
+
+
+#define SPCR3 (volatile unsigned char * const)(0x1e + QSM_CRB)
+ /* QSPI Control Register 3 */
+#define LOOPQ 0x0400 /* QSPI Loop Mode */
+#define HMIE 0x0200 /* HALTA and MODF Interrupt Enable */
+#define HALT 0x0100 /* Halt */
+
+
+#define SPSR (volatile unsigned char * const)(0x1f + QSM_CRB)
+ /* QSPI Status Register */
+#define SPIF 0x0080 /* QSPI Finished Flag */
+#define MODF 0x0040 /* Mode Fault Flag */
+#define HALTA 0x0020 /* Halt Acknowlwdge Flag */
+#define CPTQP x0000f /* Completed Queue Pointer */
+
+#define QSPIRR (volatile unsigned char * const)(0x100 + QSM_CRB)
+ /* QSPI Receive Data RAM */
+#define QSPITR (volatile unsigned char * const)(0x120 + QSM_CRB)
+ /* QSPI Transmit Data RAM */
+#define QSPIcR (volatile unsigned char * const)(0x140 + QSM_CRB)
+ /* QSPI Command RAM */
+
+#endif /* _QSM_H_ */
diff --git a/cpukit/score/cpu/m68k/rtems/asm.h b/cpukit/score/cpu/m68k/rtems/asm.h
new file mode 100644
index 0000000000..4c53980d51
--- /dev/null
+++ b/cpukit/score/cpu/m68k/rtems/asm.h
@@ -0,0 +1,129 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __M68k_ASM_h
+#define __M68k_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/m68k.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define d0 REG (d0)
+#define d1 REG (d1)
+#define d2 REG (d2)
+#define d3 REG (d3)
+#define d4 REG (d4)
+#define d5 REG (d5)
+#define d6 REG (d6)
+#define d7 REG (d7)
+#define a0 REG (a0)
+#define a1 REG (a1)
+#define a2 REG (a2)
+#define a3 REG (a3)
+#define a4 REG (a4)
+#define a5 REG (a5)
+#define a6 REG (a6)
+#define a7 REG (a7)
+
+#define msp REG (msp)
+#define usp REG (usp)
+#define isp REG (isp)
+#define sr REG (sr)
+#define vbr REG (vbr)
+#define dfc REG (dfc)
+
+#define fp0 REG (fp0)
+#define fp1 REG (fp1)
+#define fp2 REG (fp2)
+#define fp3 REG (fp3)
+#define fp4 REG (fp4)
+#define fp5 REG (fp5)
+#define fp6 REG (fp6)
+#define fp7 REG (fp7)
+
+#define fpc REG (fpc)
+#define fpi REG (fpi)
+#define fps REG (fps)
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/m68k/rtems/m68k/m68302.h b/cpukit/score/cpu/m68k/rtems/m68k/m68302.h
new file mode 100644
index 0000000000..da96478cf3
--- /dev/null
+++ b/cpukit/score/cpu/m68k/rtems/m68k/m68302.h
@@ -0,0 +1,608 @@
+/*
+ *------------------------------------------------------------------
+ *
+ * m68302.h - Definitions for Motorola MC68302 processor.
+ *
+ * Section references in this file refer to revision 2 of Motorola's
+ * "MC68302 Integrated Multiprotocol Processor User's Manual".
+ * (Motorola document MC68302UM/AD REV 2.)
+ *
+ * Based on Don Meyer's cpu68302.h that was posted in comp.sys.m68k
+ * on 17 February, 1993.
+ *
+ * Copyright 1995 David W. Glessner.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *
+ * $Id$
+ *
+ *------------------------------------------------------------------
+ */
+
+#ifndef __MOTOROLA_MC68302_DEFINITIONS_h
+#define __MOTOROLA_MC68302_DEFINITIONS_h
+
+/*
+ * BAR - Base Address Register
+ * Section 2.7
+ */
+#define M302_BAR (*((volatile rtems_unsigned16 *) 0xf2))
+
+/*
+ * SCR - System Control Register
+ * Section 3.8.1
+ */
+#define M302_SCR (*((volatile rtems_unsigned32 *) 0xf4))
+/*
+ * SCR bits
+ */
+#define RBIT_SCR_IPA 0x08000000
+#define RBIT_SCR_HWT 0x04000000
+#define RBIT_SCR_WPV 0x02000000
+#define RBIT_SCR_ADC 0x01000000
+
+#define RBIT_SCR_ERRE 0x00400000
+#define RBIT_SCR_VGE 0x00200000
+#define RBIT_SCR_WPVE 0x00100000
+#define RBIT_SCR_RMCST 0x00080000
+#define RBIT_SCR_EMWS 0x00040000
+#define RBIT_SCR_ADCE 0x00020000
+#define RBIT_SCR_BCLM 0x00010000
+
+#define RBIT_SCR_FRZW 0x00008000
+#define RBIT_SCR_FRZ2 0x00004000
+#define RBIT_SCR_FRZ1 0x00002000
+#define RBIT_SCR_SAM 0x00001000
+#define RBIT_SCR_HWDEN 0x00000800
+#define RBIT_SCR_HWDCN2 0x00000400
+#define RBIT_SCR_HWDCN1 0x00000200
+#define RBIT_SCR_HWDCN0 0x00000100
+
+#define RBIT_SCR_LPREC 0x00000080
+#define RBIT_SCR_LPP16 0x00000040
+#define RBIT_SCR_LPEN 0x00000020
+#define RBIT_SCR_LPCLKDIV 0x0000001f
+
+
+/*
+ * 68000 interrupt and trap vector numbers
+ */
+#define M68K_IVEC_BUS_ERROR 2
+#define M68K_IVEC_ADDRESS_ERROR 3
+#define M68K_IVEC_ILLEGAL_OPCODE 4
+#define M68K_IVEC_ZERO_DIVIDE 5
+#define M68K_IVEC_CHK 6
+#define M68K_IVEC_TRAPV 7
+#define M68K_IVEC_PRIVILEGE 8
+#define M68K_IVEC_TRACE 9
+#define M68K_IVEC_LINE_A 10
+#define M68K_IVEC_LINE_F 11
+/* Unassigned, Reserved 12-14 */
+#define M68K_IVEC_UNINITIALIZED_INT 15
+/* Unassigned, Reserved 16-23 */
+#define M68K_IVEC_SPURIOUS_INT 24
+
+#define M68K_IVEC_LEVEL1_AUTOVECTOR 25
+#define M68K_IVEC_LEVEL2_AUTOVECTOR 26
+#define M68K_IVEC_LEVEL3_AUTOVECTOR 27
+#define M68K_IVEC_LEVEL4_AUTOVECTOR 28
+#define M68K_IVEC_LEVEL5_AUTOVECTOR 29
+#define M68K_IVEC_LEVEL6_AUTOVECTOR 30
+#define M68K_IVEC_LEVEL7_AUTOVECTOR 31
+
+#define M68K_IVEC_TRAP0 32
+#define M68K_IVEC_TRAP1 33
+#define M68K_IVEC_TRAP2 34
+#define M68K_IVEC_TRAP3 35
+#define M68K_IVEC_TRAP4 36
+#define M68K_IVEC_TRAP5 37
+#define M68K_IVEC_TRAP6 38
+#define M68K_IVEC_TRAP7 39
+#define M68K_IVEC_TRAP8 40
+#define M68K_IVEC_TRAP9 41
+#define M68K_IVEC_TRAP10 42
+#define M68K_IVEC_TRAP11 43
+#define M68K_IVEC_TRAP12 44
+#define M68K_IVEC_TRAP13 45
+#define M68K_IVEC_TRAP14 46
+#define M68K_IVEC_TRAP15 47
+/*
+ * Unassigned, Reserved 48-59
+ *
+ * Note: Vectors 60-63 are used by the MC68302 (e.g. BAR, SCR).
+ */
+
+/*
+ * MC68302 Interrupt Vectors
+ * Section 3.2
+ */
+enum m68302_ivec_e {
+ M302_IVEC_ERR =0,
+ M302_IVEC_PB8 =1, /* General-Purpose Interrupt 0 */
+ M302_IVEC_SMC2 =2,
+ M302_IVEC_SMC1 =3,
+ M302_IVEC_TIMER3 =4,
+ M302_IVEC_SCP =5,
+ M302_IVEC_TIMER2 =6,
+ M302_IVEC_PB9 =7, /* General-Purpose Interrupt 1 */
+ M302_IVEC_SCC3 =8,
+ M302_IVEC_TIMER1 =9,
+ M302_IVEC_SCC2 =10,
+ M302_IVEC_IDMA =11,
+ M302_IVEC_SDMA =12, /* SDMA Channels Bus Error */
+ M302_IVEC_SCC1 =13,
+ M302_IVEC_PB10 =14, /* General-Purpose Interrupt 2 */
+ M302_IVEC_PB11 =15, /* General-Purpose Interrupt 3 */
+ M302_IVEC_IRQ1 =17, /* External Device */
+ M302_IVEC_IRQ6 =22, /* External Device */
+ M302_IVEC_IRQ7 =23 /* External Device */
+};
+
+
+/*
+ * GIMR - Global Interrupt Mode Register
+ * Section 3.2.5.1
+ */
+#define RBIT_GIMR_MOD (1<<15)
+#define RBIT_GIMR_IV7 (1<<14)
+#define RBIT_GIMR_IV6 (1<<13)
+#define RBIT_GIMR_IV1 (1<<12)
+#define RBIT_GIMR_ET7 (1<<10)
+#define RBIT_GIMR_ET6 (1<<9)
+#define RBIT_GIMR_ET1 (1<<8)
+#define RBIT_GIMR_VECTOR (7<<5)
+
+/*
+ * IPR - Interrupt Pending Register (Section 3.2.5.2)
+ * IMR - Interrupt Mask Register (Section 3.2.5.3)
+ * ISR - Interrupt In-Service Register (Section 3.2.5.4)
+ */
+#define RBIT_IPR_PB11 (1<<15)
+#define RBIT_IPR_PB10 (1<<14)
+#define RBIT_IPR_SCC1 (1<<13)
+#define RBIT_IPR_SDMA (1<<12)
+#define RBIT_IPR_IDMA (1<<11)
+#define RBIT_IPR_SCC2 (1<<10)
+#define RBIT_IPR_TIMER1 (1<<9)
+#define RBIT_IPR_SCC3 (1<<8)
+#define RBIT_IPR_PB9 (1<<7)
+#define RBIT_IPR_TIMER2 (1<<6)
+#define RBIT_IPR_SCP (1<<5)
+#define RBIT_IPR_TIMER3 (1<<4)
+#define RBIT_IPR_SMC1 (1<<3)
+#define RBIT_IPR_SMC2 (1<<2)
+#define RBIT_IPR_PB8 (1<<1)
+#define RBIT_IPR_ERR (1<<0)
+
+#define RBIT_ISR_PB11 (1<<15)
+#define RBIT_ISR_PB10 (1<<14)
+#define RBIT_ISR_SCC1 (1<<13)
+#define RBIT_ISR_SDMA (1<<12)
+#define RBIT_ISR_IDMA (1<<11)
+#define RBIT_ISR_SCC2 (1<<10)
+#define RBIT_ISR_TIMER1 (1<<9)
+#define RBIT_ISR_SCC3 (1<<8)
+#define RBIT_ISR_PB9 (1<<7)
+#define RBIT_ISR_TIMER2 (1<<6)
+#define RBIT_ISR_SCP (1<<5)
+#define RBIT_ISR_TIMER3 (1<<4)
+#define RBIT_ISR_SMC1 (1<<3)
+#define RBIT_ISR_SMC2 (1<<2)
+#define RBIT_ISR_PB8 (1<<1)
+
+#define RBIT_IMR_PB11 (1<<15) /* PB11 Interrupt Mask */
+#define RBIT_IMR_PB10 (1<<14) /* PB10 Interrupt Mask */
+#define RBIT_IMR_SCC1 (1<<13) /* SCC1 Interrupt Mask */
+#define RBIT_IMR_SDMA (1<<12) /* SDMA Interrupt Mask */
+#define RBIT_IMR_IDMA (1<<11) /* IDMA Interrupt Mask */
+#define RBIT_IMR_SCC2 (1<<10) /* SCC2 Interrupt Mask */
+#define RBIT_IMR_TIMER1 (1<<9) /* TIMER1 Interrupt Mask */
+#define RBIT_IMR_SCC3 (1<<8) /* SCC3 Interrupt Mask */
+#define RBIT_IMR_PB9 (1<<7) /* PB9 Interrupt Mask */
+#define RBIT_IMR_TIMER2 (1<<6) /* TIMER2 Interrupt Mask */
+#define RBIT_IMR_SCP (1<<5) /* SCP Interrupt Mask */
+#define RBIT_IMR_TIMER3 (1<<4) /* TIMER3 Interrupt Mask */
+#define RBIT_IMR_SMC1 (1<<3) /* SMC1 Interrupt Mask */
+#define RBIT_IMR_SMC2 (1<<2) /* SMC2 Interrupt Mask */
+#define RBIT_IMR_PB8 (1<<1) /* PB8 Interrupt Mask */
+
+
+/*
+ * DRAM Refresh
+ * Section 3.9
+ *
+ * The DRAM refresh memory map replaces the SCC2 Tx BD 6 and Tx BD 7
+ * structures in the parameter RAM.
+ *
+ * Access to the DRAM registers can be accomplished by
+ * the following approach:
+ *
+ * volatile m302_DRAM_refresh_t *dram;
+ * dram = (volatile m302_DRAM_refresh_t *) &m302.scc2.bd.tx[6];
+ *
+ * Then simply use pointer references (e.g. dram->count = 3).
+ */
+typedef struct {
+ rtems_unsigned16 dram_high; /* DRAM high address and FC */
+ rtems_unsigned16 dram_low; /* DRAM low address */
+ rtems_unsigned16 increment; /* increment step (bytes/row) */
+ rtems_unsigned16 count; /* RAM refresh cycle count (#rows) */
+ rtems_unsigned16 t_ptr_h; /* temporary refresh high addr & FC */
+ rtems_unsigned16 t_ptr_l; /* temporary refresh low address */
+ rtems_unsigned16 t_count; /* temporary refresh cycles count */
+ rtems_unsigned16 res; /* reserved */
+} m302_DRAM_refresh_t;
+
+
+/*
+ * TMR - Timer Mode Register (for timers 1 and 2)
+ * Section 3.5.2.1
+ */
+#define RBIT_TMR_ICLK_STOP (0<<1)
+#define RBIT_TMR_ICLK_MASTER (1<<1)
+#define RBIT_TMR_ICLK_MASTER16 (2<<1)
+#define RBIT_TMR_ICLK_TIN (3<<1)
+
+#define RBIT_TMR_OM (1<<5)
+#define RBIT_TMR_ORI (1<<4)
+#define RBIT_TMR_FRR (1<<3)
+#define RBIT_TMR_RST (1<<0)
+
+
+/*
+ * TER - Timer Event Register (for timers 1 and 2)
+ * Section 3.5.2.5
+ */
+#define RBIT_TER_REF (1<<1) /* Output Reference Event */
+#define RBIT_TER_CAP (1<<0) /* Capture Event */
+
+
+/*
+ * SCC Buffer Descriptors and Buffer Descriptors Table
+ * Section 4.5.5
+ */
+typedef struct m302_SCC_bd {
+ rtems_unsigned16 status; /* status and control */
+ rtems_unsigned16 length; /* data length */
+ rtems_unsigned8 *buffer; /* data buffer pointer */
+} m302_SCC_bd_t;
+
+typedef struct {
+ m302_SCC_bd_t rx[8]; /* receive buffer descriptors */
+ m302_SCC_bd_t tx[8]; /* transmit buffer descriptors */
+} m302_SCC_bd_table_t;
+
+
+/*
+ * SCC Parameter RAM (offset 0x080 from an SCC Base)
+ * Section 4.5.6
+ *
+ * Each SCC parameter RAM area begins at offset 0x80 from each SCC base
+ * area (0x400, 0x500, or 0x600 from the dual-port RAM base).
+ *
+ * Offsets 0x9c-0xbf from each SCC base area compose the protocol-specific
+ * portion of the SCC parameter RAM.
+ */
+typedef struct {
+ rtems_unsigned8 rfcr; /* Rx Function Code */
+ rtems_unsigned8 tfcr; /* Tx Function Code */
+ rtems_unsigned16 mrblr; /* Maximum Rx Buffer Length */
+ rtems_unsigned16 _rstate; /* Rx Internal State */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 rbd; /* Rx Internal Buffer Number */
+ rtems_unsigned32 _rdptr; /* Rx Internal Data Pointer */
+ rtems_unsigned16 _rcount; /* Rx Internal Byte Count */
+ rtems_unsigned16 _rtmp; /* Rx Temp */
+ rtems_unsigned16 _tstate; /* Tx Internal State */
+ rtems_unsigned8 res7;
+ rtems_unsigned8 tbd; /* Tx Internal Buffer Number */
+ rtems_unsigned32 _tdptr; /* Tx Internal Data Pointer */
+ rtems_unsigned16 _tcount; /* Tx Internal Byte Count */
+ rtems_unsigned16 _ttmp; /* Tx Temp */
+} m302_SCC_parameters_t;
+
+/*
+ * UART-Specific SCC Parameter RAM
+ * Section 4.5.11.3
+ */
+typedef struct {
+ rtems_unsigned16 max_idl; /* Maximum IDLE Characters (rx) */
+ rtems_unsigned16 idlc; /* Temporary rx IDLE counter */
+ rtems_unsigned16 brkcr; /* Break Count Register (tx) */
+ rtems_unsigned16 parec; /* Receive Parity Error Counter */
+ rtems_unsigned16 frmec; /* Receive Framing Error Counter */
+ rtems_unsigned16 nosec; /* Receive Noise Counter */
+ rtems_unsigned16 brkec; /* Receive Break Condition Counter */
+ rtems_unsigned16 uaddr1; /* UART ADDRESS Character 1 */
+ rtems_unsigned16 uaddr2; /* UART ADDRESS Character 2 */
+ rtems_unsigned16 rccr; /* Receive Control Character Register */
+ rtems_unsigned16 character[8]; /* Control Characters 1 through 8*/
+} m302_SCC_UartSpecific_t;
+/*
+ * This definition allows for the checking of receive buffers
+ * for errors.
+ */
+
+#define RCV_ERR 0x003F
+
+/*
+ * UART receive buffer descriptor bit definitions.
+ * Section 4.5.11.14
+ */
+#define RBIT_UART_CTRL (1<<11) /* buffer contains a control char */
+#define RBIT_UART_ADDR (1<<10) /* first byte contains an address */
+#define RBIT_UART_MATCH (1<<9) /* indicates which addr char matched */
+#define RBIT_UART_IDLE (1<<8) /* buffer closed due to IDLE sequence */
+#define RBIT_UART_BR (1<<5) /* break sequence was received */
+#define RBIT_UART_FR (1<<4) /* framing error was received */
+#define RBIT_UART_PR (1<<3) /* parity error was received */
+#define RBIT_UART_OV (1<<1) /* receiver overrun occurred */
+#define RBIT_UART_CD (1<<0) /* carrier detect lost */
+#define RBIT_UART_STATUS 0x003B /* all status bits */
+
+/*
+ * UART transmit buffer descriptor bit definitions.
+ * Section 4.5.11.15
+ */
+#define RBIT_UART_CR (1<<11) /* clear-to-send report
+ * this results in two idle bits
+ * between back-to-back frames
+ */
+#define RBIT_UART_A (1<<10) /* buffer contains address characters
+ * only valid in multidrop mode (UM0=1)
+ */
+#define RBIT_UART_PREAMBLE (1<<9) /* send preamble before data */
+#define RBIT_UART_CTS_LOST (1<<0) /* CTS lost */
+
+/*
+ * UART event register
+ * Section 4.5.11.16
+ */
+#define M302_UART_EV_CTS (1<<7) /* CTS status changed */
+#define M302_UART_EV_CD (1<<6) /* carrier detect status changed */
+#define M302_UART_EV_IDL (1<<5) /* IDLE sequence status changed */
+#define M302_UART_EV_BRK (1<<4) /* break character was received */
+#define M302_UART_EV_CCR (1<<3) /* control character received */
+#define M302_UART_EV_TX (1<<1) /* buffer has been transmitted */
+#define M302_UART_EV_RX (1<<0) /* buffer has been received */
+
+
+/*
+ * HDLC-Specific SCC Parameter RAM
+ * Section 4.5.12.3
+ *
+ * c_mask_l should be 0xF0B8 for 16-bit CRC, 0xdebb for 32-bit CRC
+ * c_mask_h is a don't care for 16-bit CRC, 0x20E2 for 32-bit CRC
+ */
+typedef struct {
+ rtems_unsigned16 rcrc_l; /* Temp Receive CRC Low */
+ rtems_unsigned16 rcrc_h; /* Temp Receive CRC High */
+ rtems_unsigned16 c_mask_l; /* CRC Mask Low */
+ rtems_unsigned16 c_mask_h; /* CRC Mask High */
+ rtems_unsigned16 tcrc_l; /* Temp Transmit CRC Low */
+ rtems_unsigned16 tcrc_h; /* Temp Transmit CRC High */
+
+ rtems_unsigned16 disfc; /* Discard Frame Counter */
+ rtems_unsigned16 crcec; /* CRC Error Counter */
+ rtems_unsigned16 abtsc; /* Abort Sequence Counter */
+ rtems_unsigned16 nmarc; /* Nonmatching Address Received Cntr */
+ rtems_unsigned16 retrc; /* Frame Retransmission Counter */
+
+ rtems_unsigned16 mflr; /* Maximum Frame Length Register */
+ rtems_unsigned16 max_cnt; /* Maximum_Length Counter */
+
+ rtems_unsigned16 hmask; /* User Defined Frame Address Mask */
+ rtems_unsigned16 haddr1; /* User Defined Frame Address */
+ rtems_unsigned16 haddr2; /* " */
+ rtems_unsigned16 haddr3; /* " */
+ rtems_unsigned16 haddr4; /* " */
+} m302_SCC_HdlcSpecific_t;
+/*
+ * HDLC receiver buffer descriptor bit definitions
+ * Section 4.5.12.10
+ */
+#define RBIT_HDLC_EMPTY_BIT 0x8000 /* buffer associated with BD is empty */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in a frame */
+#define RBIT_HDLC_FIRST_BIT 0x0400 /* buffer is first in a frame */
+#define RBIT_HDLC_FRAME_LEN 0x0020 /* receiver frame length violation */
+#define RBIT_HDLC_NONOCT_Rx 0x0010 /* received non-octet aligned frame */
+#define RBIT_HDLC_ABORT_SEQ 0x0008 /* received abort sequence */
+#define RBIT_HDLC_CRC_ERROR 0x0004 /* frame contains a CRC error */
+#define RBIT_HDLC_OVERRUN 0x0002 /* receiver overrun occurred */
+#define RBIT_HDLC_CD_LOST 0x0001 /* carrier detect lost */
+
+/*
+ * HDLC transmit buffer descriptor bit definitions
+ * Section 4.5.12.11
+ */
+#define RBIT_HDLC_READY_BIT 0x8000 /* buffer is ready to transmit */
+#define RBIT_HDLC_EXT_BUFFER 0x4000 /* buffer is in external memory */
+#define RBIT_HDLC_WRAP_BIT 0x2000 /* last buffer in bd table, so wrap */
+#define RBIT_HDLC_WAKE_UP 0x1000 /* interrupt when buffer serviced */
+#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in the frame */
+#define RBIT_HDLC_TxCRC_BIT 0x0400 /* transmit a CRC sequence */
+#define RBIT_HDLC_UNDERRUN 0x0002 /* transmitter underrun */
+#define RBIT_HDLC_CTS_LOST 0x0001 /* CTS lost */
+
+/*
+ * HDLC event register bit definitions
+ * Section 4.5.12.12
+ */
+#define RBIT_HDLC_CTS 0x80 /* CTS status changed */
+#define RBIT_HDLC_CD 0x40 /* carrier detect status changed */
+#define RBIT_HDLC_IDL 0x20 /* IDLE sequence status changed */
+#define RBIT_HDLC_TXE 0x10 /* transmit error */
+#define RBIT_HDLC_RXF 0x08 /* received frame */
+#define RBIT_HDLC_BSY 0x04 /* frame rcvd and discarded due to
+ * lack of buffers
+ */
+#define RBIT_HDLC_TXB 0x02 /* buffer has been transmitted */
+#define RBIT_HDLC_RXB 0x01 /* received buffer */
+
+
+
+typedef struct {
+ m302_SCC_bd_table_t bd; /* +000 Buffer Descriptor Table */
+ m302_SCC_parameters_t parm; /* +080 Common Parameter RAM */
+ union { /* +09C Protocol-Specific Parm RAM */
+ m302_SCC_UartSpecific_t uart;
+ m302_SCC_HdlcSpecific_t hdlc;
+ } prot;
+ rtems_unsigned8 res[0x040]; /* +0C0 reserved, (not implemented) */
+} m302_SCC_t;
+
+
+/*
+ * Common SCC Registers
+ */
+typedef struct {
+ rtems_unsigned16 res1;
+ rtems_unsigned16 scon; /* SCC Configuration Register 4.5.2 */
+ rtems_unsigned16 scm; /* SCC Mode Register 4.5.3 */
+ rtems_unsigned16 dsr; /* SCC Data Synchronization Register 4.5.4 */
+ rtems_unsigned8 scce; /* SCC Event Register 4.5.8.1 */
+ rtems_unsigned8 res2;
+ rtems_unsigned8 sccm; /* SCC Mask Register 4.5.8.2 */
+ rtems_unsigned8 res3;
+ rtems_unsigned8 sccs; /* SCC Status Register 4.5.8.3 */
+ rtems_unsigned8 res4;
+ rtems_unsigned16 res5;
+} m302_SCC_Registers_t;
+
+/*
+ * SCON - SCC Configuration Register
+ * Section 4.5.2
+ */
+#define RBIT_SCON_WOMS (1<<15) /* Wired-OR Mode Select (NMSI mode only)
+ * When set, the TXD driver is an
+ * open-drain output */
+#define RBIT_SCON_EXTC (1<<14) /* External Clock Source */
+#define RBIT_SCON_TCS (1<<13) /* Transmit Clock Source */
+#define RBIT_SCON_RCS (1<<12) /* Receive Clock Source */
+
+/*
+ * SCM - SCC Mode Register bit definitions
+ * Section 4.5.3
+ * The parameter-specific mode bits occupy bits 15 through 6.
+ */
+#define RBIT_SCM_ENR (1<<3) /* Enable receiver */
+#define RBIT_SCM_ENT (1<<2) /* Enable transmitter */
+
+
+/*
+ * Internal MC68302 Registers
+ * starts at offset 0x800 from dual-port RAM base
+ * Section 2.8
+ */
+typedef struct {
+ /* offset +800 */
+ rtems_unsigned16 res0;
+ rtems_unsigned16 cmr; /* IDMA Channel Mode Register */
+ rtems_unsigned32 sapr; /* IDMA Source Address Pointer */
+ rtems_unsigned32 dapr; /* IDMA Destination Address Pointer */
+ rtems_unsigned16 bcr; /* IDMA Byte Count Register */
+ rtems_unsigned8 csr; /* IDMA Channel Status Register */
+ rtems_unsigned8 res1;
+ rtems_unsigned8 fcr; /* IDMA Function Code Register */
+ rtems_unsigned8 res2;
+
+ /* offset +812 */
+ rtems_unsigned16 gimr; /* Global Interrupt Mode Register */
+ rtems_unsigned16 ipr; /* Interrupt Pending Register */
+ rtems_unsigned16 imr; /* Interrupt Mask Register */
+ rtems_unsigned16 isr; /* Interrupt In-Service Register */
+ rtems_unsigned16 res3;
+ rtems_unsigned16 res4;
+
+ /* offset +81e */
+ rtems_unsigned16 pacnt; /* Port A Control Register */
+ rtems_unsigned16 paddr; /* Port A Data Direction Register */
+ rtems_unsigned16 padat; /* Port A Data Register */
+ rtems_unsigned16 pbcnt; /* Port B Control Register */
+ rtems_unsigned16 pbddr; /* Port B Data Direction Register */
+ rtems_unsigned16 pbdat; /* Port B Data Register */
+ rtems_unsigned16 res5;
+
+ /* offset +82c */
+ rtems_unsigned16 res6;
+ rtems_unsigned16 res7;
+ rtems_unsigned16 br0; /* Base Register (CS0) */
+ rtems_unsigned16 or0; /* Option Register (CS0) */
+ rtems_unsigned16 br1; /* Base Register (CS1) */
+ rtems_unsigned16 or1; /* Option Register (CS1) */
+ rtems_unsigned16 br2; /* Base Register (CS2) */
+ rtems_unsigned16 or2; /* Option Register (CS2) */
+ rtems_unsigned16 br3; /* Base Register (CS3) */
+ rtems_unsigned16 or3; /* Option Register (CS3) */
+
+ /* offset +840 */
+ rtems_unsigned16 tmr1; /* Timer Unit 1 Mode Register */
+ rtems_unsigned16 trr1; /* Timer Unit 1 Reference Register */
+ rtems_unsigned16 tcr1; /* Timer Unit 1 Capture Register */
+ rtems_unsigned16 tcn1; /* Timer Unit 1 Counter */
+ rtems_unsigned8 res8;
+ rtems_unsigned8 ter1; /* Timer Unit 1 Event Register */
+ rtems_unsigned16 wrr; /* Watchdog Reference Register */
+ rtems_unsigned16 wcn; /* Watchdog Counter */
+ rtems_unsigned16 res9;
+ rtems_unsigned16 tmr2; /* Timer Unit 2 Mode Register */
+ rtems_unsigned16 trr2; /* Timer Unit 2 Reference Register */
+ rtems_unsigned16 tcr2; /* Timer Unit 2 Capture Register */
+ rtems_unsigned16 tcn2; /* Timer Unit 2 Counter */
+ rtems_unsigned8 resa;
+ rtems_unsigned8 ter2; /* Timer Unit 2 Event Register */
+ rtems_unsigned16 resb;
+ rtems_unsigned16 resc;
+ rtems_unsigned16 resd;
+
+ /* offset +860 */
+ rtems_unsigned8 cr; /* Command Register */
+ rtems_unsigned8 rese[0x1f];
+
+ /* offset +880, +890, +8a0 */
+ m302_SCC_Registers_t scc[3]; /* SCC1, SCC2, SCC3 Registers */
+
+ /* offset +8b0 */
+ rtems_unsigned16 spmode; /* SCP,SMC Mode and Clock Cntrl Reg */
+ rtems_unsigned16 simask; /* Serial Interface Mask Register */
+ rtems_unsigned16 simode; /* Serial Interface Mode Register */
+} m302_internalReg_t ;
+
+
+/*
+ * MC68302 dual-port RAM structure.
+ * (Includes System RAM, Parameter RAM, and Internal Registers).
+ * Section 2.8
+ */
+typedef struct {
+ rtems_unsigned8 mem[0x240]; /* +000 User Data Memory */
+ rtems_unsigned8 res1[0x1c0]; /* +240 reserved, (not implemented) */
+ m302_SCC_t scc1; /* +400 SCC1 */
+ m302_SCC_t scc2; /* +500 SCC2 */
+ m302_SCC_t scc3; /* +600 SCC3 */
+ rtems_unsigned8 res2[0x100]; /* +700 reserved, (not implemented) */
+ m302_internalReg_t reg; /* +800 68302 Internal Registers */
+} m302_dualPortRAM_t;
+
+
+/*
+ * Declare the variable that's used to reference the variables in
+ * the dual-port RAM.
+ */
+extern volatile m302_dualPortRAM_t m302;
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/cpu/m68k/rtems/m68k/m68360.h b/cpukit/score/cpu/m68k/rtems/m68k/m68360.h
new file mode 100644
index 0000000000..84687c49fa
--- /dev/null
+++ b/cpukit/score/cpu/m68k/rtems/m68k/m68360.h
@@ -0,0 +1,880 @@
+/*
+ **************************************************************************
+ **************************************************************************
+ ** **
+ ** MOTOROLA MC68360 QUAD INTEGRATED COMMUNICATIONS CONTROLLER (QUICC) **
+ ** **
+ ** HARDWARE DECLARATIONS **
+ ** **
+ ** **
+ ** Submitted By: **
+ ** **
+ ** W. Eric Norum **
+ ** Saskatchewan Accelerator Laboratory **
+ ** University of Saskatchewan **
+ ** 107 North Road **
+ ** Saskatoon, Saskatchewan, CANADA **
+ ** S7N 5C6 **
+ ** **
+ ** eric@skatter.usask.ca **
+ ** **
+ ** $Id$ **
+ ** **
+ **************************************************************************
+ **************************************************************************
+ */
+
+#ifndef __MC68360_h
+#define __MC68360_h
+
+/*
+ *************************************************************************
+ * REGISTER SUBBLOCKS *
+ *************************************************************************
+ */
+
+/*
+ * Memory controller registers
+ */
+typedef struct m360MEMCRegisters_ {
+ rtems_unsigned32 br;
+ rtems_unsigned32 or;
+ rtems_unsigned32 _pad[2];
+} m360MEMCRegisters_t;
+
+/*
+ * Serial Communications Controller registers
+ */
+typedef struct m360SCCRegisters_ {
+ rtems_unsigned32 gsmr_l;
+ rtems_unsigned32 gsmr_h;
+ rtems_unsigned16 psmr;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 todr;
+ rtems_unsigned16 dsr;
+ rtems_unsigned16 scce;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned16 sccm;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned8 sccs;
+ rtems_unsigned32 _pad3[2];
+} m360SCCRegisters_t;
+
+/*
+ * Serial Management Controller registers
+ */
+typedef struct m360SMCRegisters_ {
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 smcmr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned8 smce;
+ rtems_unsigned8 _pad2;
+ rtems_unsigned16 _pad3;
+ rtems_unsigned8 smcm;
+ rtems_unsigned8 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SMCRegisters_t;
+
+
+/*
+ *************************************************************************
+ * Miscellaneous Parameters *
+ *************************************************************************
+ */
+typedef struct m360MiscParms_ {
+ rtems_unsigned16 rev_num;
+ rtems_unsigned16 _res1;
+ rtems_unsigned32 _res2;
+ rtems_unsigned32 _res3;
+} m360MiscParms_t;
+
+/*
+ *************************************************************************
+ * RISC Timers *
+ *************************************************************************
+ */
+typedef struct m360TimerParms_ {
+ rtems_unsigned16 tm_base;
+ rtems_unsigned16 _tm_ptr;
+ rtems_unsigned16 _r_tmr;
+ rtems_unsigned16 _r_tmv;
+ rtems_unsigned32 tm_cmd;
+ rtems_unsigned32 tm_cnt;
+} m360TimerParms_t;
+
+/*
+ * RISC Controller Configuration Register (RCCR)
+ * All other bits in this register are either reserved or
+ * used only with a Motorola-supplied RAM microcode packge.
+ */
+#define M360_RCCR_TIME (1<<15) /* Enable timer */
+#define M360_RCCR_TIMEP(x) ((x)<<8) /* Timer period */
+
+/*
+ * Command register
+ * Set up this register before issuing a M360_CR_OP_SET_TIMER command.
+ */
+#define M360_TM_CMD_V (1<<31) /* Set to enable timer */
+#define M360_TM_CMD_R (1<<30) /* Set for automatic restart */
+#define M360_TM_CMD_TIMER(x) ((x)<<16) /* Select timer */
+#define M360_TM_CMD_PERIOD(x) (x) /* Timer period (16 bits) */
+
+/*
+ *************************************************************************
+ * DMA Controllers *
+ *************************************************************************
+ */
+typedef struct m360IDMAparms_ {
+ rtems_unsigned16 ibase;
+ rtems_unsigned16 ibptr;
+ rtems_unsigned32 _istate;
+ rtems_unsigned32 _itemp;
+} m360IDMAparms_t;
+
+/*
+ *************************************************************************
+ * Serial Communication Controllers *
+ *************************************************************************
+ */
+typedef struct m360SCCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ } un;
+} m360SCCparms_t;
+
+typedef struct m360SCCENparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ rtems_unsigned32 _rcrc;
+ rtems_unsigned32 _tcrc;
+ union {
+ struct {
+ rtems_unsigned32 _res0;
+ rtems_unsigned32 _res1;
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _idlc;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 parec;
+ rtems_unsigned16 frmec;
+ rtems_unsigned16 nosec;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 uaddr[2];
+ rtems_unsigned16 _rtemp;
+ rtems_unsigned16 toseq;
+ rtems_unsigned16 character[8];
+ rtems_unsigned16 rccm;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 rlbc;
+ } uart;
+ struct {
+ rtems_unsigned32 c_pres;
+ rtems_unsigned32 c_mask;
+ rtems_unsigned32 crcec;
+ rtems_unsigned32 alec;
+ rtems_unsigned32 disfc;
+ rtems_unsigned16 pads;
+ rtems_unsigned16 ret_lim;
+ rtems_unsigned16 _ret_cnt;
+ rtems_unsigned16 mflr;
+ rtems_unsigned16 minflr;
+ rtems_unsigned16 maxd1;
+ rtems_unsigned16 maxd2;
+ rtems_unsigned16 _maxd;
+ rtems_unsigned16 dma_cnt;
+ rtems_unsigned16 _max_b;
+ rtems_unsigned16 gaddr1;
+ rtems_unsigned16 gaddr2;
+ rtems_unsigned16 gaddr3;
+ rtems_unsigned16 gaddr4;
+ rtems_unsigned32 _tbuf0data0;
+ rtems_unsigned32 _tbuf0data1;
+ rtems_unsigned32 _tbuf0rba0;
+ rtems_unsigned32 _tbuf0crc;
+ rtems_unsigned16 _tbuf0bcnt;
+ rtems_unsigned16 paddr_h;
+ rtems_unsigned16 paddr_m;
+ rtems_unsigned16 paddr_l;
+ rtems_unsigned16 p_per;
+ rtems_unsigned16 _rfbd_ptr;
+ rtems_unsigned16 _tfbd_ptr;
+ rtems_unsigned16 _tlbd_ptr;
+ rtems_unsigned32 _tbuf1data0;
+ rtems_unsigned32 _tbuf1data1;
+ rtems_unsigned32 _tbuf1rba0;
+ rtems_unsigned32 _tbuf1crc;
+ rtems_unsigned16 _tbuf1bcnt;
+ rtems_unsigned16 _tx_len;
+ rtems_unsigned16 iaddr1;
+ rtems_unsigned16 iaddr2;
+ rtems_unsigned16 iaddr3;
+ rtems_unsigned16 iaddr4;
+ rtems_unsigned16 _boff_cnt;
+ rtems_unsigned16 taddr_l;
+ rtems_unsigned16 taddr_m;
+ rtems_unsigned16 taddr_h;
+ } ethernet;
+ } un;
+} m360SCCENparms_t;
+
+/*
+ * Receive and transmit function code register bits
+ * These apply to the function code registers of all devices, not just SCC.
+ */
+#define M360_RFCR_MOT (1<<4)
+#define M360_RFCR_DMA_SPACE 0x8
+#define M360_TFCR_MOT (1<<4)
+#define M360_TFCR_DMA_SPACE 0x8
+
+/*
+ *************************************************************************
+ * Serial Management Controllers *
+ *************************************************************************
+ */
+typedef struct m360SMCparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+ union {
+ struct {
+ rtems_unsigned16 max_idl;
+ rtems_unsigned16 _pad0;
+ rtems_unsigned16 brklen;
+ rtems_unsigned16 brkec;
+ rtems_unsigned16 brkcr;
+ rtems_unsigned16 _r_mask;
+ } uart;
+ struct {
+ rtems_unsigned16 _pad0[5];
+ } transparent;
+ } un;
+} m360SMCparms_t;
+
+/*
+ * Mode register
+ */
+#define M360_SMCMR_CLEN(x) ((x)<<11) /* Character length */
+#define M360_SMCMR_2STOP (1<<10) /* 2 stop bits */
+#define M360_SMCMR_PARITY (1<<9) /* Enable parity */
+#define M360_SMCMR_EVEN (1<<8) /* Even parity */
+#define M360_SMCMR_SM_GCI (0<<4) /* GCI Mode */
+#define M360_SMCMR_SM_UART (2<<4) /* UART Mode */
+#define M360_SMCMR_SM_TRANSPARENT (3<<4) /* Transparent Mode */
+#define M360_SMCMR_DM_LOOPBACK (1<<2) /* Local loopback mode */
+#define M360_SMCMR_DM_ECHO (2<<2) /* Echo mode */
+#define M360_SMCMR_TEN (1<<1) /* Enable transmitter */
+#define M360_SMCMR_REN (1<<0) /* Enable receiver */
+
+/*
+ * Event and mask registers (SMCE, SMCM)
+ */
+#define M360_SMCE_BRK (1<<4)
+#define M360_SMCE_BSY (1<<2)
+#define M360_SMCE_TX (1<<1)
+#define M360_SMCE_RX (1<<0)
+
+/*
+ *************************************************************************
+ * Serial Peripheral Interface *
+ *************************************************************************
+ */
+typedef struct m360SPIparms_ {
+ rtems_unsigned16 rbase;
+ rtems_unsigned16 tbase;
+ rtems_unsigned8 rfcr;
+ rtems_unsigned8 tfcr;
+ rtems_unsigned16 mrblr;
+ rtems_unsigned32 _rstate;
+ rtems_unsigned32 _pad0;
+ rtems_unsigned16 _rbptr;
+ rtems_unsigned16 _pad1;
+ rtems_unsigned32 _pad2;
+ rtems_unsigned32 _tstate;
+ rtems_unsigned32 _pad3;
+ rtems_unsigned16 _tbptr;
+ rtems_unsigned16 _pad4;
+ rtems_unsigned32 _pad5;
+} m360SPIparms_t;
+
+/*
+ * Mode register (SPMODE)
+ */
+#define M360_SPMODE_LOOP (1<<14) /* Local loopback mode */
+#define M360_SPMODE_CI (1<<13) /* Clock invert */
+#define M360_SPMODE_CP (1<<12) /* Clock phase */
+#define M360_SPMODE_DIV16 (1<<11) /* Divide BRGCLK by 16 */
+#define M360_SPMODE_REV (1<<10) /* Reverse data */
+#define M360_SPMODE_MASTER (1<<9) /* SPI is master */
+#define M360_SPMODE_EN (1<<8) /* Enable SPI */
+#define M360_SPMODE_CLEN(x) ((x)<<4) /* Character length */
+#define M360_SPMODE_PM(x) (x) /* Prescaler modulus */
+
+/*
+ * Mode register (SPCOM)
+ */
+#define M360_SPCOM_STR (1<<7) /* Start transmit */
+
+/*
+ * Event and mask registers (SPIE, SPIM)
+ */
+#define M360_SPIE_MME (1<<5) /* Multi-master error */
+#define M360_SPIE_TXE (1<<4) /* Tx error */
+#define M360_SPIE_BSY (1<<2) /* Busy condition*/
+#define M360_SPIE_TXB (1<<1) /* Tx buffer */
+#define M360_SPIE_RXB (1<<0) /* Rx buffer */
+
+/*
+ *************************************************************************
+ * SDMA (SCC, SMC, SPI) Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360BufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 length;
+ volatile void *buffer;
+} m360BufferDescriptor_t;
+
+/*
+ * Bits in receive buffer descriptor status word
+ */
+#define M360_BD_EMPTY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_WRAP (1<<13) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_INTERRUPT (1<<12) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_LAST (1<<11) /* Ethernet, SPI */
+#define M360_BD_CONTROL_CHAR (1<<11) /* SCC UART */
+#define M360_BD_FIRST_IN_FRAME (1<<10) /* Ethernet */
+#define M360_BD_ADDRESS (1<<10) /* SCC UART */
+#define M360_BD_CONTINUOUS (1<<9) /* SCC UART, SMC UART, SPI */
+#define M360_BD_MISS (1<<8) /* Ethernet */
+#define M360_BD_IDLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_ADDRSS_MATCH (1<<7) /* SCC UART */
+#define M360_BD_LONG (1<<5) /* Ethernet */
+#define M360_BD_BREAK (1<<5) /* SCC UART, SMC UART */
+#define M360_BD_NONALIGNED (1<<4) /* Ethernet */
+#define M360_BD_FRAMING_ERROR (1<<4) /* SCC UART, SMC UART */
+#define M360_BD_SHORT (1<<3) /* Ethernet */
+#define M360_BD_PARITY_ERROR (1<<3) /* SCC UART, SMC UART */
+#define M360_BD_CRC_ERROR (1<<2) /* Ethernet */
+#define M360_BD_OVERRUN (1<<1) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_COLLISION (1<<0) /* Ethernet */
+#define M360_BD_CARRIER_LOST (1<<0) /* SCC UART */
+#define M360_BD_MASTER_ERROR (1<<0) /* SPI */
+
+/*
+ * Bits in transmit buffer descriptor status word
+ * Many bits have the same meaning as those in receiver buffer descriptors.
+ */
+#define M360_BD_READY (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
+#define M360_BD_PAD (1<<14) /* Ethernet */
+#define M360_BD_CTS_REPORT (1<<11) /* SCC UART */
+#define M360_BD_TX_CRC (1<<10) /* Ethernet */
+#define M360_BD_DEFER (1<<9) /* Ethernet */
+#define M360_BD_HEARTBEAT (1<<8) /* Ethernet */
+#define M360_BD_PREAMBLE (1<<8) /* SCC UART, SMC UART */
+#define M360_BD_LATE_COLLISION (1<<7) /* Ethernet */
+#define M360_BD_NO_STOP_BIT (1<<7) /* SCC UART */
+#define M360_BD_RETRY_LIMIT (1<<6) /* Ethernet */
+#define M360_BD_RETRY_COUNT(x) (((x)&0x3C)>>2) /* Ethernet */
+#define M360_BD_UNDERRUN (1<<1) /* Ethernet, SPI */
+#define M360_BD_CARRIER_LOST (1<<0) /* Ethernet */
+#define M360_BD_CTS_LOST (1<<0) /* SCC UART */
+
+/*
+ *************************************************************************
+ * IDMA Buffer Descriptors *
+ *************************************************************************
+ */
+typedef struct m360IDMABufferDescriptor_ {
+ rtems_unsigned16 status;
+ rtems_unsigned16 _pad;
+ rtems_unsigned32 length;
+ void *source;
+ void *destination;
+} m360IDMABufferDescriptor_t;
+
+/*
+ *************************************************************************
+ * RISC Communication Processor Module Command Register (CR) *
+ *************************************************************************
+ */
+#define M360_CR_RST (1<<15) /* Reset communication processor */
+#define M360_CR_OP_INIT_RX_TX (0<<8) /* SCC, SMC UART, SMC GCI, SPI */
+#define M360_CR_OP_INIT_RX (1<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_TX (2<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_INIT_HUNT (3<<8) /* SCC, SMC UART */
+#define M360_CR_OP_STOP_TX (4<<8) /* SCC, SMC UART */
+#define M360_CR_OP_GR_STOP_TX (5<<8) /* SCC */
+#define M360_CR_OP_INIT_IDMA (5<<8) /* IDMA */
+#define M360_CR_OP_RESTART_TX (6<<8) /* SCC, SMC UART */
+#define M360_CR_OP_CLOSE_RX_BD (7<<8) /* SCC, SMC UART, SPI */
+#define M360_CR_OP_SET_GRP_ADDR (8<<8) /* SCC */
+#define M360_CR_OP_SET_TIMER (8<<8) /* Timer */
+#define M360_CR_OP_GCI_TIMEOUT (9<<8) /* SMC GCI */
+#define M360_CR_OP_RESERT_BCS (10<<8) /* SCC */
+#define M360_CR_OP_GCI_ABORT (10<<8) /* SMC GCI */
+#define M360_CR_CHAN_SCC1 (0<<4) /* Channel selection */
+#define M360_CR_CHAN_SCC2 (4<<4)
+#define M360_CR_CHAN_SPI (5<<4)
+#define M360_CR_CHAN_TIMER (5<<4)
+#define M360_CR_CHAN_SCC3 (8<<4)
+#define M360_CR_CHAN_SMC1 (9<<4)
+#define M360_CR_CHAN_IDMA1 (9<<4)
+#define M360_CR_CHAN_SCC4 (12<<4)
+#define M360_CR_CHAN_SMC2 (13<<4)
+#define M360_CR_CHAN_IDMA2 (13<<4)
+#define M360_CR_FLG (1<<0) /* Command flag */
+
+/*
+ *************************************************************************
+ * System Protection Control Register (SYPCR) *
+ *************************************************************************
+ */
+#define M360_SYPCR_SWE (1<<7) /* Software watchdog enable */
+#define M360_SYPCR_SWRI (1<<6) /* Software watchdog reset select */
+#define M360_SYPCR_SWT1 (1<<5) /* Software watchdog timing bit 1 */
+#define M360_SYPCR_SWT0 (1<<4) /* Software watchdog timing bit 0 */
+#define M360_SYPCR_DBFE (1<<3) /* Double bus fault monitor enable */
+#define M360_SYPCR_BME (1<<2) /* Bus monitor external enable */
+#define M360_SYPCR_BMT1 (1<<1) /* Bus monitor timing bit 1 */
+#define M360_SYPCR_BMT0 (1<<0) /* Bus monitor timing bit 0 */
+
+/*
+ *************************************************************************
+ * Memory Control Registers *
+ *************************************************************************
+ */
+#define M360_GMR_RCNT(x) ((x)<<24) /* Refresh count */
+#define M360_GMR_RFEN (1<<23) /* Refresh enable */
+#define M360_GMR_RCYC(x) ((x)<<21) /* Refresh cycle length */
+#define M360_GMR_PGS(x) ((x)<<18) /* Page size */
+#define M360_GMR_DPS_32BIT (0<<16) /* DRAM port size */
+#define M360_GMR_DPS_16BIT (1<<16)
+#define M360_GMR_DPS_8BIT (2<<16)
+#define M360_GMR_DPS_DSACK (3<<16)
+#define M360_GMR_WBT40 (1<<15) /* Wait between 040 transfers */
+#define M360_GMR_WBTQ (1<<14) /* Wait between 360 transfers */
+#define M360_GMR_SYNC (1<<13) /* Synchronous external access */
+#define M360_GMR_EMWS (1<<12) /* External master wait state */
+#define M360_GMR_OPAR (1<<11) /* Odd parity */
+#define M360_GMR_PBEE (1<<10) /* Parity bus error enable */
+#define M360_GMR_TSS40 (1<<9) /* TS* sample for 040 */
+#define M360_GMR_NCS (1<<8) /* No CPU space */
+#define M360_GMR_DWQ (1<<7) /* Delay write for 360 */
+#define M360_GMR_DW40 (1<<6) /* Delay write for 040 */
+#define M360_GMR_GAMX (1<<5) /* Global address mux enable */
+
+#define M360_MEMC_BR_FC(x) ((x)<<7) /* Function code limit */
+#define M360_MEMC_BR_TRLXQ (1<<6) /* Relax timing requirements */
+#define M360_MEMC_BR_BACK40 (1<<5) /* Burst acknowledge to 040 */
+#define M360_MEMC_BR_CSNT40 (1<<4) /* CS* negate timing for 040 */
+#define M360_MEMC_BR_CSNTQ (1<<3) /* CS* negate timing for 360 */
+#define M360_MEMC_BR_PAREN (1<<2) /* Enable parity checking */
+#define M360_MEMC_BR_WP (1<<1) /* Write Protect */
+#define M360_MEMC_BR_V (1<<0) /* Base/Option register are valid */
+
+#define M360_MEMC_OR_TCYC(x) ((x)<<28) /* Cycle length (clocks) */
+#define M360_MEMC_OR_WAITS(x) M360_MEMC_OR_TCYC((x)+1)
+#define M360_MEMC_OR_2KB 0x0FFFF800 /* Address range */
+#define M360_MEMC_OR_4KB 0x0FFFF000
+#define M360_MEMC_OR_8KB 0x0FFFE000
+#define M360_MEMC_OR_16KB 0x0FFFC000
+#define M360_MEMC_OR_32KB 0x0FFF8000
+#define M360_MEMC_OR_64KB 0x0FFF0000
+#define M360_MEMC_OR_128KB 0x0FFE0000
+#define M360_MEMC_OR_256KB 0x0FFC0000
+#define M360_MEMC_OR_512KB 0x0FF80000
+#define M360_MEMC_OR_1MB 0x0FF00000
+#define M360_MEMC_OR_2MB 0x0FE00000
+#define M360_MEMC_OR_4MB 0x0FC00000
+#define M360_MEMC_OR_8MB 0x0F800000
+#define M360_MEMC_OR_16MB 0x0F000000
+#define M360_MEMC_OR_32MB 0x0E000000
+#define M360_MEMC_OR_64MB 0x0C000000
+#define M360_MEMC_OR_128MB 0x08000000
+#define M360_MEMC_OR_256MB 0x00000000
+#define M360_MEMC_OR_FCMC(x) ((x)<<7) /* Function code mask */
+#define M360_MEMC_OR_BCYC(x) ((x)<<5) /* Burst cycle length (clocks) */
+#define M360_MEMC_OR_PGME (1<<3) /* Page mode enable */
+#define M360_MEMC_OR_32BIT (0<<1) /* Port size */
+#define M360_MEMC_OR_16BIT (1<<1)
+#define M360_MEMC_OR_8BIT (2<<1)
+#define M360_MEMC_OR_DSACK (3<<1)
+#define M360_MEMC_OR_DRAM (1<<0) /* Dynamic RAM select */
+
+/*
+ *************************************************************************
+ * SI Mode Register (SIMODE) *
+ *************************************************************************
+ */
+#define M360_SI_SMC2_BITS 0xFFFF0000 /* All SMC2 bits */
+#define M360_SI_SMC2_TDM (1<<31) /* Multiplexed SMC2 */
+#define M360_SI_SMC2_BRG1 (0<<28) /* SMC2 clock souce */
+#define M360_SI_SMC2_BRG2 (1<<28)
+#define M360_SI_SMC2_BRG3 (2<<28)
+#define M360_SI_SMC2_BRG4 (3<<28)
+#define M360_SI_SMC2_CLK5 (0<<28)
+#define M360_SI_SMC2_CLK6 (1<<28)
+#define M360_SI_SMC2_CLK7 (2<<28)
+#define M360_SI_SMC2_CLK8 (3<<28)
+#define M360_SI_SMC1_BITS 0x0000FFFF /* All SMC1 bits */
+#define M360_SI_SMC1_TDM (1<<15) /* Multiplexed SMC1 */
+#define M360_SI_SMC1_BRG1 (0<<12) /* SMC1 clock souce */
+#define M360_SI_SMC1_BRG2 (1<<12)
+#define M360_SI_SMC1_BRG3 (2<<12)
+#define M360_SI_SMC1_BRG4 (3<<12)
+#define M360_SI_SMC1_CLK1 (0<<12)
+#define M360_SI_SMC1_CLK2 (1<<12)
+#define M360_SI_SMC1_CLK3 (2<<12)
+#define M360_SI_SMC1_CLK4 (3<<12)
+
+/*
+ *************************************************************************
+ * SDMA Configuration Register (SDMA) *
+ *************************************************************************
+ */
+#define M360_SDMA_FREEZE (2<<13) /* Freeze on next bus cycle */
+#define M360_SDMA_SISM_7 (7<<8) /* Normal interrupt service mask */
+#define M360_SDMA_SAID_4 (4<<4) /* Normal arbitration ID */
+#define M360_SDMA_INTE (1<<1) /* SBER interrupt enable */
+#define M360_SDMA_INTB (1<<0) /* SBKP interrupt enable */
+
+/*
+ *************************************************************************
+ * Baud (sic) Rate Generators *
+ *************************************************************************
+ */
+#define M360_BRG_RST (1<<17) /* Reset generator */
+#define M360_BRG_EN (1<<16) /* Enable generator */
+#define M360_BRG_EXTC_BRGCLK (0<<14) /* Source is BRGCLK */
+#define M360_BRG_EXTC_CLK2 (1<<14) /* Source is CLK2 pin */
+#define M360_BRG_EXTC_CLK6 (2<<14) /* Source is CLK6 pin */
+#define M360_BRG_ATB (1<<13) /* Autobaud */
+#define M360_BRG_115200 (13<<1) /* Assume 25 MHz clock */
+#define M360_BRG_57600 (26<<1)
+#define M360_BRG_38400 (40<<1)
+#define M360_BRG_19200 (80<<1)
+#define M360_BRG_9600 (162<<1)
+#define M360_BRG_4800 (324<<1)
+#define M360_BRG_2400 (650<<1)
+#define M360_BRG_1200 (1301<<1)
+#define M360_BRG_600 (2603<<1)
+#define M360_BRG_300 ((324<<1) | 1)
+#define M360_BRG_150 ((650<<1) | 1)
+#define M360_BRG_75 ((1301<<1) | 1)
+
+/*
+ *************************************************************************
+ * MC68360 DUAL-PORT RAM AND REGISTERS *
+ *************************************************************************
+ */
+typedef struct m360_ {
+ /*
+ * Dual-port RAM
+ */
+ rtems_unsigned8 dpram0[0x400]; /* Microcode program */
+ rtems_unsigned8 dpram1[0x200];
+ rtems_unsigned8 dpram2[0x100]; /* Microcode scratch */
+ rtems_unsigned8 dpram3[0x100]; /* Not on REV A or B masks */
+ rtems_unsigned8 _rsv0[0xC00-0x800];
+ m360SCCENparms_t scc1p;
+ rtems_unsigned8 _rsv1[0xCB0-0xC00-sizeof(m360SCCENparms_t)];
+ m360MiscParms_t miscp;
+ rtems_unsigned8 _rsv2[0xD00-0xCB0-sizeof(m360MiscParms_t)];
+ m360SCCparms_t scc2p;
+ rtems_unsigned8 _rsv3[0xD80-0xD00-sizeof(m360SCCparms_t)];
+ m360SPIparms_t spip;
+ rtems_unsigned8 _rsv4[0xDB0-0xD80-sizeof(m360SPIparms_t)];
+ m360TimerParms_t tmp;
+ rtems_unsigned8 _rsv5[0xE00-0xDB0-sizeof(m360TimerParms_t)];
+ m360SCCparms_t scc3p;
+ rtems_unsigned8 _rsv6[0xE70-0xE00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma1p;
+ rtems_unsigned8 _rsv7[0xE80-0xE70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc1p;
+ rtems_unsigned8 _rsv8[0xF00-0xE80-sizeof(m360SMCparms_t)];
+ m360SCCparms_t scc4p;
+ rtems_unsigned8 _rsv9[0xF70-0xF00-sizeof(m360SCCparms_t)];
+ m360IDMAparms_t idma2p;
+ rtems_unsigned8 _rsv10[0xF80-0xF70-sizeof(m360IDMAparms_t)];
+ m360SMCparms_t smc2p;
+ rtems_unsigned8 _rsv11[0x1000-0xF80-sizeof(m360SMCparms_t)];
+
+ /*
+ * SIM Block
+ */
+ rtems_unsigned32 mcr;
+ rtems_unsigned32 _pad00;
+ rtems_unsigned8 avr;
+ rtems_unsigned8 rsr;
+ rtems_unsigned16 _pad01;
+ rtems_unsigned8 clkocr;
+ rtems_unsigned8 _pad02;
+ rtems_unsigned16 _pad03;
+ rtems_unsigned16 pllcr;
+ rtems_unsigned16 _pad04;
+ rtems_unsigned16 cdvcr;
+ rtems_unsigned16 pepar;
+ rtems_unsigned32 _pad05[2];
+ rtems_unsigned16 _pad06;
+ rtems_unsigned8 sypcr;
+ rtems_unsigned8 swiv;
+ rtems_unsigned16 _pad07;
+ rtems_unsigned16 picr;
+ rtems_unsigned16 _pad08;
+ rtems_unsigned16 pitr;
+ rtems_unsigned16 _pad09;
+ rtems_unsigned8 _pad10;
+ rtems_unsigned8 swsr;
+ rtems_unsigned32 bkar;
+ rtems_unsigned32 bcar;
+ rtems_unsigned32 _pad11[2];
+
+ /*
+ * MEMC Block
+ */
+ rtems_unsigned32 gmr;
+ rtems_unsigned16 mstat;
+ rtems_unsigned16 _pad12;
+ rtems_unsigned32 _pad13[2];
+ m360MEMCRegisters_t memc[8];
+ rtems_unsigned8 _pad14[0xF0-0xD0];
+ rtems_unsigned8 _pad15[0x100-0xF0];
+ rtems_unsigned8 _pad16[0x500-0x100];
+
+ /*
+ * IDMA1 Block
+ */
+ rtems_unsigned16 iccr;
+ rtems_unsigned16 _pad17;
+ rtems_unsigned16 cmr1;
+ rtems_unsigned16 _pad18;
+ rtems_unsigned32 sapr1;
+ rtems_unsigned32 dapr1;
+ rtems_unsigned32 bcr1;
+ rtems_unsigned8 fcr1;
+ rtems_unsigned8 _pad19;
+ rtems_unsigned8 cmar1;
+ rtems_unsigned8 _pad20;
+ rtems_unsigned8 csr1;
+ rtems_unsigned8 _pad21;
+ rtems_unsigned16 _pad22;
+
+ /*
+ * SDMA Block
+ */
+ rtems_unsigned8 sdsr;
+ rtems_unsigned8 _pad23;
+ rtems_unsigned16 sdcr;
+ rtems_unsigned32 sdar;
+
+ /*
+ * IDMA2 Block
+ */
+ rtems_unsigned16 _pad24;
+ rtems_unsigned16 cmr2;
+ rtems_unsigned32 sapr2;
+ rtems_unsigned32 dapr2;
+ rtems_unsigned32 bcr2;
+ rtems_unsigned8 fcr2;
+ rtems_unsigned8 _pad26;
+ rtems_unsigned8 cmar2;
+ rtems_unsigned8 _pad27;
+ rtems_unsigned8 csr2;
+ rtems_unsigned8 _pad28;
+ rtems_unsigned16 _pad29;
+ rtems_unsigned32 _pad30;
+
+ /*
+ * CPIC Block
+ */
+ rtems_unsigned32 cicr;
+ rtems_unsigned32 cipr;
+ rtems_unsigned32 cimr;
+ rtems_unsigned32 cisr;
+
+ /*
+ * Parallel I/O Block
+ */
+ rtems_unsigned16 padir;
+ rtems_unsigned16 papar;
+ rtems_unsigned16 paodr;
+ rtems_unsigned16 padat;
+ rtems_unsigned32 _pad31[2];
+ rtems_unsigned16 pcdir;
+ rtems_unsigned16 pcpar;
+ rtems_unsigned16 pcso;
+ rtems_unsigned16 pcdat;
+ rtems_unsigned16 pcint;
+ rtems_unsigned16 _pad32;
+ rtems_unsigned32 _pad33[5];
+
+ /*
+ * TIMER Block
+ */
+ rtems_unsigned16 tgcr;
+ rtems_unsigned16 _pad34;
+ rtems_unsigned32 _pad35[3];
+ rtems_unsigned16 tmr1;
+ rtems_unsigned16 tmr2;
+ rtems_unsigned16 trr1;
+ rtems_unsigned16 trr2;
+ rtems_unsigned16 tcr1;
+ rtems_unsigned16 tcr2;
+ rtems_unsigned16 tcn1;
+ rtems_unsigned16 tcn2;
+ rtems_unsigned16 tmr3;
+ rtems_unsigned16 tmr4;
+ rtems_unsigned16 trr3;
+ rtems_unsigned16 trr4;
+ rtems_unsigned16 tcr3;
+ rtems_unsigned16 tcr4;
+ rtems_unsigned16 tcn3;
+ rtems_unsigned16 tcn4;
+ rtems_unsigned16 ter1;
+ rtems_unsigned16 ter2;
+ rtems_unsigned16 ter3;
+ rtems_unsigned16 ter4;
+ rtems_unsigned32 _pad36[2];
+
+ /*
+ * CP Block
+ */
+ rtems_unsigned16 cr;
+ rtems_unsigned16 _pad37;
+ rtems_unsigned16 rccr;
+ rtems_unsigned16 _pad38;
+ rtems_unsigned32 _pad39[3];
+ rtems_unsigned16 _pad40;
+ rtems_unsigned16 rter;
+ rtems_unsigned16 _pad41;
+ rtems_unsigned16 rtmr;
+ rtems_unsigned32 _pad42[5];
+
+ /*
+ * BRG Block
+ */
+ rtems_unsigned32 brgc1;
+ rtems_unsigned32 brgc2;
+ rtems_unsigned32 brgc3;
+ rtems_unsigned32 brgc4;
+
+ /*
+ * SCC Block
+ */
+ m360SCCRegisters_t scc1;
+ m360SCCRegisters_t scc2;
+ m360SCCRegisters_t scc3;
+ m360SCCRegisters_t scc4;
+
+ /*
+ * SMC Block
+ */
+ m360SMCRegisters_t smc1;
+ m360SMCRegisters_t smc2;
+
+ /*
+ * SPI Block
+ */
+ rtems_unsigned16 spmode;
+ rtems_unsigned16 _pad43[2];
+ rtems_unsigned8 spie;
+ rtems_unsigned8 _pad44;
+ rtems_unsigned16 _pad45;
+ rtems_unsigned8 spim;
+ rtems_unsigned8 _pad46[2];
+ rtems_unsigned8 spcom;
+ rtems_unsigned16 _pad47[2];
+
+ /*
+ * PIP Block
+ */
+ rtems_unsigned16 pipc;
+ rtems_unsigned16 _pad48;
+ rtems_unsigned16 ptpr;
+ rtems_unsigned32 pbdir;
+ rtems_unsigned32 pbpar;
+ rtems_unsigned16 _pad49;
+ rtems_unsigned16 pbodr;
+ rtems_unsigned32 pbdat;
+ rtems_unsigned32 _pad50[6];
+
+ /*
+ * SI Block
+ */
+ rtems_unsigned32 simode;
+ rtems_unsigned8 sigmr;
+ rtems_unsigned8 _pad51;
+ rtems_unsigned8 sistr;
+ rtems_unsigned8 sicmr;
+ rtems_unsigned32 _pad52;
+ rtems_unsigned32 sicr;
+ rtems_unsigned16 _pad53;
+ rtems_unsigned16 sirp[2];
+ rtems_unsigned16 _pad54;
+ rtems_unsigned32 _pad55[2];
+ rtems_unsigned8 siram[256];
+} m360_t;
+
+extern volatile m360_t m360;
+
+#endif /* __MC68360_h */
diff --git a/cpukit/score/cpu/m68k/rtems/m68k/qsm.h b/cpukit/score/cpu/m68k/rtems/m68k/qsm.h
new file mode 100644
index 0000000000..e1bf33bc12
--- /dev/null
+++ b/cpukit/score/cpu/m68k/rtems/m68k/qsm.h
@@ -0,0 +1,209 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * QSM -- Queued Serial Module
+ *
+ * The QSM contains two serial interfaces: (a) the queued serial
+ * peripheral interface (QSPI) and the serial communication interface
+ * (SCI). The QSPI provides peripheral expansion and/or interprocessor
+ * communication through a full-duplex, synchronous, three-wire bus. A
+ * self contained RAM queue permits serial data transfers without CPU
+ * intervention and automatic continuous sampling. The SCI provides a
+ * standard non-return to zero mark/space format with wakeup functions
+ * to allow the CPU to run uninterrupted until woken
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family Queued Serial Module Reference Manual" (Motorola document
+ * QSMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _QSM_H_
+#define _QSM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+/* QSM_CRB (QSM Control Register Block) base address of the QSM
+ control registers */
+#if SIM_MM == 0
+#define QSM_CRB 0x7ffc00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define QSM_CRB 0xfffc00
+#endif
+
+
+#define QSMCR (volatile unsigned short int * const)(0x00 + QSM_CRB)
+ /* QSM Configuration Register */
+#define STOP 0x8000 /* Stop Enable */
+#define FRZ 0x6000 /* Freeze Control */
+#define SUPV 0x0080 /* Supervisor/Unrestricted */
+#define IARB 0x000f /* Inerrupt Arbitration */
+
+
+#define QTEST (volatile unsigned short int * const)(0x02 + QSM_CRB)
+ /* QSM Test Register */
+/* Used only for factor testing */
+
+
+#define QILR (volatile unsigned char * const)(0x04 + QSM_CRB)
+ /* QSM Interrupt Level Register */
+#define ILQSPI 0x38 /* Interrupt Level for QSPI */
+#define ILSCI 0x07 /* Interrupt Level for SCI */
+
+
+#define QIVR (volatile unsigned char * const)(0x05 + QSM_CRB)
+ /* QSM Interrupt Vector Register */
+#define INTV 0xff /* Interrupt Vector Number */
+
+
+#define SCCR0 (volatile unsigned short int * const)(0x08 + QSM_CRB)
+ /* SCI Control Register 0 */
+#define SCBR 0x1fff /* SCI Baud Rate */
+
+
+#define SCCR1 (volatile unsigned short int * const)(0x0a + QSM_CRB)
+ /* SCI Control Register 1 */
+#define LOOPS 0x4000 /* Loop Mode */
+#define WOMS 0x2000 /* Wired-OR Mode for SCI Pins */
+#define ILT 0x1000 /* Idle-Line Detect Type */
+#define PT 0x0800 /* Parity Type */
+#define PE 0x0400 /* Parity Enable */
+#define M 0x0200 /* Mode Select */
+#define WAKE 0x0100 /* Wakeup by Address Mark */
+#define TIE 0x0080 /* Transmit Complete Interrupt Enable */
+#define TCIE 0x0040 /* Transmit Complete Interrupt Enable */
+#define RIE 0x0020 /* Receiver Interrupt Enable */
+#define ILIE 0x0010 /* Idle-Line Interrupt Enable */
+#define TE 0x0008 /* Transmitter Enable */
+#define RE 0x0004 /* Receiver Enable */
+#define RWU 0x0002 /* Receiver Wakeup */
+#define SBK 0x0001 /* Send Break */
+
+
+#define SCSR (volatile unsigned short int * const)(0x0c + QSM_CRB)
+ /* SCI Status Register */
+#define TDRE 0x0100 /* Transmit Data Register Empty */
+#define TC 0x0080 /* Transmit Complete */
+#define RDRF 0x0040 /* Receive Data Register Full */
+#define RAF 0x0020 /* Receiver Active */
+#define IDLE 0x0010 /* Idle-Line Detected */
+#define OR 0x0008 /* Overrun Error */
+#define NF 0x0004 /* Noise Error Flag */
+#define FE 0x0002 /* Framing Error */
+#define PF 0x0001 /* Parity Error */
+
+
+#define SCDR (volatile unsigned short int * const)(0x0e + QSM_CRB)
+ /* SCI Data Register */
+
+
+#define PORTQS (volatile unsigned char * const)(0x15 + QSM_CRB)
+ /* Port QS Data Register */
+
+#define PQSPAR (volatile unsigned char * const)(0x16 + QSM_CRB)
+ /* PORT QS Pin Assignment Rgister */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a QSPI
+ signal. */
+/* note: PQS2 is a digital I/O pin unless the SPI is enabled in which
+ case it becomes the SPI serial clock SCK. */
+/* note: PQS7 is a digital I/O pin unless the SCI transmitter is
+ enabled in which case it becomes the SCI serial output TxD. */
+#define QSMFun 0x0
+#define QSMDis 0x1
+/*
+ * PQSPAR Field | QSM Function | Discrete I/O pin
+ *------------------+--------------+------------------ */
+#define PQSPA0 0 /* MISO | PQS0 */
+#define PQSPA1 1 /* MOSI | PQS1 */
+#define PQSPA2 2 /* SCK | PQS2 (see note)*/
+#define PQSPA3 3 /* PCSO/!SS | PQS3 */
+#define PQSPA4 4 /* PCS1 | PQS4 */
+#define PQSPA5 5 /* PCS2 | PQS5 */
+#define PQSPA6 6 /* PCS3 | PQS6 */
+#define PQSPA7 7 /* TxD | PQS7 (see note)*/
+
+
+#define DDRQS (volatile unsigned char * const)(0x17 + QSM_CRB)
+ /* PORT QS Data Direction Register */
+/* Clearing a bit makes the corresponding pin an input; setting a bit
+ makes the pin an output. */
+
+
+#define SPCR0 (volatile unsigned short int * const)(0x18 + QSM_CRB)
+ /* QSPI Control Register 0 */
+#define MSTR 0x8000 /* Master/Slave Mode Select */
+#define WOMQ 0x4000 /* Wired-OR Mode for QSPI Pins */
+#define BITS 0x3c00 /* Bits Per Transfer */
+#define CPOL 0x0200 /* Clock Polarity */
+#define CPHA 0x0100 /* Clock Phase */
+#define SPBR 0x00ff /* Serial Clock Baud Rate */
+
+
+#define SPCR1 (volatile unsigned short int * const)(0x1a + QSM_CRB)
+ /* QSPI Control Register 1 */
+#define SPE 0x8000 /* QSPI Enable */
+#define DSCKL 0x7f00 /* Delay before SCK */
+#define DTL 0x00ff /* Length of Delay after Transfer */
+
+
+#define SPCR2 (volatile unsigned short int * const)(0x1c + QSM_CRB)
+ /* QSPI Control Register 2 */
+#define SPIFIE 0x8000 /* SPI Finished Interrupt Enable */
+#define WREN 0x4000 /* Wrap Enable */
+#define WRTO 0x2000 /* Wrap To */
+#define ENDQP 0x0f00 /* Ending Queue Pointer */
+#define NEWQP 0x000f /* New Queue Pointer Value */
+
+
+#define SPCR3 (volatile unsigned char * const)(0x1e + QSM_CRB)
+ /* QSPI Control Register 3 */
+#define LOOPQ 0x0400 /* QSPI Loop Mode */
+#define HMIE 0x0200 /* HALTA and MODF Interrupt Enable */
+#define HALT 0x0100 /* Halt */
+
+
+#define SPSR (volatile unsigned char * const)(0x1f + QSM_CRB)
+ /* QSPI Status Register */
+#define SPIF 0x0080 /* QSPI Finished Flag */
+#define MODF 0x0040 /* Mode Fault Flag */
+#define HALTA 0x0020 /* Halt Acknowlwdge Flag */
+#define CPTQP x0000f /* Completed Queue Pointer */
+
+#define QSPIRR (volatile unsigned char * const)(0x100 + QSM_CRB)
+ /* QSPI Receive Data RAM */
+#define QSPITR (volatile unsigned char * const)(0x120 + QSM_CRB)
+ /* QSPI Transmit Data RAM */
+#define QSPIcR (volatile unsigned char * const)(0x140 + QSM_CRB)
+ /* QSPI Command RAM */
+
+#endif /* _QSM_H_ */
diff --git a/cpukit/score/cpu/m68k/rtems/m68k/sim.h b/cpukit/score/cpu/m68k/rtems/m68k/sim.h
new file mode 100644
index 0000000000..fae7fe8783
--- /dev/null
+++ b/cpukit/score/cpu/m68k/rtems/m68k/sim.h
@@ -0,0 +1,328 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * SIM -- System Integration Module
+ *
+ * The system integration module (SIM) is used on many Motorola 16-
+ * and 32-bit MCUs for the following functions:
+ *
+ * () System configuration and protection. Bus and software watchdog
+ * monitors are provided in addition to periodic interrupt generators.
+ *
+ * () Clock signal generation for other intermodule bus (IMB) members
+ * and external devices.
+ *
+ * () The generation of chip-select signals that simplify external
+ * circuitry interface.
+ *
+ * () Data ports that are available for general purpose input and
+ * output.
+ *
+ * () A system test block that is intended only for factory tests.
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family System Integration Module Reference Manual" (Motorola document
+ * SIMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _SIM_H_
+#define _SIM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+
+/* SIM_CRB (SIM Control Register Block) base address of the SIM
+ control registers */
+/* not included in ram_init.h */
+#if SIM_MM == 0
+#define SIM_CRB 0x7ffa00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define SIM_CRB 0xfffa00
+#endif
+/* end not included in ram_init.h */
+
+
+
+#define SIMCR (volatile unsigned short int * const)(0x00 + SIM_CRB)
+ /* Module Configuration Register */
+#define EXOFF 0x8000 /* External Clock Off */
+#define FRZSW 0x4000 /* Freeze Software Enable */
+#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */
+#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/
+#define SHEN 0x0300 /* Show Cycle Enable */
+#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */
+#define MM 0x0040 /* Module Mapping */
+#define IARB 0x000f /* Interrupt Arbitration Field */
+
+
+
+#define SIMTR (volatile unsigned short int * const)(0x02 + SIM_CRB)
+ /* SIM Test Register */
+/* Used only for factor testing */
+
+
+
+#define SYNCR (volatile unsigned short int * const)(0x04 + SIM_CRB)
+ /* Clock Synthesizer Control Register */
+#define W 0x8000 /* Frequency Control (VCO) */
+#define X 0x4000 /* Frequency Control Bit (Prescale) */
+#define Y 0x3f00 /* Frequency Control Counter */
+#define EDIV 0x0080 /* ECLK Divide Rate */
+#define SLIMP 0x0010 /* Limp Mode Status */
+#define SLOCK 0x0008 /* Synthesizer Lock */
+#define RSTEN 0x0004 /* Reset Enable */
+#define STSIM 0x0002 /* Stop Mode SIM Clock */
+#define STEXT 0x0001 /* Stop Mode External Clock */
+
+
+
+#define RSR (volatile unsigned char * const)(0x07 + SIM_CRB)
+ /* Reset Status Register */
+#define EXT 0x0080 /* External Reset */
+#define POW 0x0040 /* Power-On Reset */
+#define SW 0x0020 /* Software Watchdog Reset */
+#define DBF 0x0010 /* Double Bus Fault Reset */
+#define LOC 0x0004 /* Loss of Clock Reset */
+#define SYS 0x0002 /* System Reset */
+#define TST 0x0001 /* Test Submodule Reset */
+
+
+
+#define SIMTRE (volatile unsigned short int * const)(0x08 + SIM_CRB)
+ /* System Integration Test Register */
+/* Used only for factor testing */
+
+
+
+#define PORTE0 (volatile unsigned char * const)(0x11 + SIM_CRB)
+#define PORTE1 (volatile unsigned char * const)(0x13 + SIM_CRB)
+ /* Port E Data Register */
+#define DDRE (volatile unsigned char * const)(0x15 + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PEPAR (volatile unsigned char * const)(0x17 + SIM_CRB)
+ /* Port E Pin Assignment Register */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define PORTF0 (volatile unsigned char * const)(0x19 + SIM_CRB)
+#define PORTF1 (volatile unsigned char * const)(0x1b + SIM_CRB)
+ /* Port F Data Register */
+#define DDRF (volatile unsigned char * const)(0x1d + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PFPAR (volatile unsigned char * const)(0x1f + SIM_CRB)
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define SYPCR (volatile unsigned char * const)(0x21 + SIM_CRB)
+/* !!! can write to only once after reset !!! */
+ /* System Protection Control Register */
+#define SWE 0x80 /* Software Watch Enable */
+#define SWP 0x40 /* Software Watchdog Prescale */
+#define SWT 0x30 /* Software Watchdog Timing */
+#define HME 0x08 /* Halt Monitor Enable */
+#define BME 0x04 /* Bus Monitor External Enable */
+#define BMT 0x03 /* Bus Monitor Timing */
+
+
+
+#define PICR (volatile unsigned short int * const)(0x22 + SIM_CRB)
+ /* Periodic Interrupt Control Reg. */
+#define PIRQL 0x0700 /* Periodic Interrupt Request Level */
+#define PIV 0x00ff /* Periodic Interrupt Level */
+
+
+
+#define PITR (volatile unsigned short int * const)(0x24 + SIM_CRB)
+ /* Periodic Interrupt Timer Register */
+#define PTP 0x0100 /* Periodic Timer Prescaler Control */
+#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */
+
+
+
+#define SWSR (volatile unsigned char * const)(0x27 + SIM_CRB)
+ /* Software Service Register */
+/* write 0x55 then 0xaa to service the software watchdog */
+
+
+
+#define TSTMSRA (volatile unsigned short int * const)(0x30 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTMSRB (volatile unsigned short int * const)(0x32 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTSC (volatile unsigned short int * const)(0x34 + SIM_CRB)
+ /* Test Module Shift Count */
+#define TSTRC (volatile unsigned short int * const)(0x36 + SIM_CRB)
+ /* Test Module Repetition Counter */
+#define CREG (volatile unsigned short int * const)(0x38 + SIM_CRB)
+ /* Test Module Control */
+#define DREG (volatile unsigned short int * const)(0x3a + SIM_CRB)
+ /* Test Module Distributed */
+/* Used only for factor testing */
+
+
+
+#define PORTC (volatile unsigned char * const)(0x41 + SIM_CRB)
+ /* Port C Data */
+
+
+
+#define CSPAR0 (volatile unsigned short int * const)(0x44 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Resgister 0 */
+/* CSPAR0 contains seven two-bit fields that determine the functions
+ of corresponding chip-select pins. CSPAR0[15:14] are not
+ used. These bits always read zero; write have no effect. CSPAR0 bit
+ 1 always reads one; writes to CSPAR0 bit 1 have no effect. */
+#define CSPAR1 (volatile unsigned short int * const)(0x46 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Register 1 */
+/* CSPAR1 contains five two-bit fields that determine the finctions of
+ corresponding chip-select pins. CSPAR1[15:10] are not used. These
+ bits always read zero; writes have no effect. */
+/*
+ *
+ * Bit Field | Description
+ * ------------+---------------
+ * 00 | Discrete Output
+ * 01 | Alternate Function
+ * 10 | Chip Select (8-bit port)
+ * 11 | Chip Select (16-bit port)
+ */
+#define DisOut 0x0
+#define AltFun 0x1
+#define CS8bit 0x2
+#define CS16bit 0x3
+/*
+ *
+ * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output
+ *-----------------+--------------------+--------------------+---------------*/
+#define CS_5 12 /* !CS5 | FC2 | PC2 */
+#define CS_4 10 /* !CS4 | FC1 | PC1 */
+#define CS_3 8 /* !CS3 | FC0 | PC0 */
+#define CS_2 6 /* !CS2 | !BGACK | */
+#define CS_1 4 /* !CS1 | !BG | */
+#define CS_0 2 /* !CS0 | !BR | */
+#define CSBOOT 0 /* !CSBOOT | | */
+/* | | | */
+#define CS_10 8 /* !CS10 | ADDR23 | ECLK */
+#define CS_9 6 /* !CS9 | ADDR22 | PC6 */
+#define CS_8 4 /* !CS8 | ADDR21 | PC5 */
+#define CS_7 2 /* !CS7 | ADDR20 | PC4 */
+#define CS_6 0 /* !CS6 | ADDR19 | PC3 */
+
+#define BS_2K 0x0
+#define BS_8K 0x1
+#define BS_16K 0x2
+#define BS_64K 0x3
+#define BS_128K 0x4
+#define BS_256K 0x5
+#define BS_512K 0x6
+#define BS_1M 0x7
+
+#define CSBARBT (volatile unsigned short int * const)(0x48 + SIM_CRB)
+#define CSBAR0 (volatile unsigned short int * const)(0x4c + SIM_CRB)
+#define CSBAR1 (volatile unsigned short int * const)(0x50 + SIM_CRB)
+#define CSBAR2 (volatile unsigned short int * const)(0x54 + SIM_CRB)
+#define CSBAR3 (volatile unsigned short int * const)(0x58 + SIM_CRB)
+#define CSBAR4 (volatile unsigned short int * const)(0x5c + SIM_CRB)
+#define CSBAR5 (volatile unsigned short int * const)(0x60 + SIM_CRB)
+#define CSBAR6 (volatile unsigned short int * const)(0x64 + SIM_CRB)
+#define CSBAR7 (volatile unsigned short int * const)(0x68 + SIM_CRB)
+#define CSBAR8 (volatile unsigned short int * const)(0x6c + SIM_CRB)
+#define CSBAR9 (volatile unsigned short int * const)(0x70 + SIM_CRB)
+#define CSBAR10 (volatile unsigned short int * const)(0x74 + SIM_CRB)
+
+#define MODE 0x8000
+#define Disable 0
+#define LowerByte 0x2000
+#define UpperByte 0x4000
+#define BothBytes 0x6000
+#define ReadOnly 0x0800
+#define WriteOnly 0x1000
+#define ReadWrite 0x1800
+#define SyncAS 0x0
+#define SyncDS 0x0400
+
+#define WaitStates_0 (0x0 << 6)
+#define WaitStates_1 (0x1 << 6)
+#define WaitStates_2 (0x2 << 6)
+#define WaitStates_3 (0x3 << 6)
+#define WaitStates_4 (0x4 << 6)
+#define WaitStates_5 (0x5 << 6)
+#define WaitStates_6 (0x6 << 6)
+#define WaitStates_7 (0x7 << 6)
+#define WaitStates_8 (0x8 << 6)
+#define WaitStates_9 (0x9 << 6)
+#define WaitStates_10 (0xa << 6)
+#define WaitStates_11 (0xb << 6)
+#define WaitStates_12 (0xc << 6)
+#define WaitStates_13 (0xd << 6)
+#define FastTerm (0xe << 6)
+#define External (0xf << 6)
+
+#define CPUSpace (0x0 << 4)
+#define UserSpace (0x1 << 4)
+#define SupSpace (0x2 << 4)
+#define UserSupSpace (0x3 << 4)
+
+#define IPLevel_any 0x0
+#define IPLevel_1 0x2
+#define IPLevel_2 0x4
+#define IPLevel_3 0x6
+#define IPLevel_4 0x8
+#define IPLevel_5 0xa
+#define IPLevel_6 0xc
+#define IPLevel_7 0xe
+
+#define AVEC 1
+
+#define CSORBT (volatile unsigned short int * const)(0x4a + SIM_CRB)
+#define CSOR0 (volatile unsigned short int * const)(0x4e + SIM_CRB)
+#define CSOR1 (volatile unsigned short int * const)(0x52 + SIM_CRB)
+#define CSOR2 (volatile unsigned short int * const)(0x56 + SIM_CRB)
+#define CSOR3 (volatile unsigned short int * const)(0x5a + SIM_CRB)
+#define CSOR4 (volatile unsigned short int * const)(0x5e + SIM_CRB)
+#define CSOR5 (volatile unsigned short int * const)(0x62 + SIM_CRB)
+#define CSOR6 (volatile unsigned short int * const)(0x66 + SIM_CRB)
+#define CSOR7 (volatile unsigned short int * const)(0x6a + SIM_CRB)
+#define CSOR8 (volatile unsigned short int * const)(0x6e + SIM_CRB)
+#define CSOR9 (volatile unsigned short int * const)(0x72 + SIM_CRB)
+#define CSOR10 (volatile unsigned short int * const)(0x76 + SIM_CRB)
+
+#endif /* _SIM_h_ */
diff --git a/cpukit/score/cpu/m68k/sim.h b/cpukit/score/cpu/m68k/sim.h
new file mode 100644
index 0000000000..fae7fe8783
--- /dev/null
+++ b/cpukit/score/cpu/m68k/sim.h
@@ -0,0 +1,328 @@
+/*
+ *-------------------------------------------------------------------
+ *
+ * SIM -- System Integration Module
+ *
+ * The system integration module (SIM) is used on many Motorola 16-
+ * and 32-bit MCUs for the following functions:
+ *
+ * () System configuration and protection. Bus and software watchdog
+ * monitors are provided in addition to periodic interrupt generators.
+ *
+ * () Clock signal generation for other intermodule bus (IMB) members
+ * and external devices.
+ *
+ * () The generation of chip-select signals that simplify external
+ * circuitry interface.
+ *
+ * () Data ports that are available for general purpose input and
+ * output.
+ *
+ * () A system test block that is intended only for factory tests.
+ *
+ * For more information, refer to Motorola's "Modular Microcontroller
+ * Family System Integration Module Reference Manual" (Motorola document
+ * SIMRM/AD).
+ *
+ * This file has been created by John S. Gwynne for support of
+ * Motorola's 68332 MCU in the efi332 project.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. Redistribution of source code and documentation must retain
+ * the above authorship, this list of conditions and the
+ * following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * This software is provided "AS IS" without warranty of any kind,
+ * either expressed or implied, including, but not limited to, the
+ * implied warranties of merchantability, title and fitness for a
+ * particular purpose.
+ *
+ *------------------------------------------------------------------
+ *
+ * $Id$
+ */
+
+#ifndef _SIM_H_
+#define _SIM_H_
+
+
+#include <efi332.h>
+
+
+/* SAM-- shift and mask */
+#undef SAM
+#define SAM(a,b,c) ((a << b) & c)
+
+
+
+/* SIM_CRB (SIM Control Register Block) base address of the SIM
+ control registers */
+/* not included in ram_init.h */
+#if SIM_MM == 0
+#define SIM_CRB 0x7ffa00
+#else
+#undef SIM_MM
+#define SIM_MM 1
+#define SIM_CRB 0xfffa00
+#endif
+/* end not included in ram_init.h */
+
+
+
+#define SIMCR (volatile unsigned short int * const)(0x00 + SIM_CRB)
+ /* Module Configuration Register */
+#define EXOFF 0x8000 /* External Clock Off */
+#define FRZSW 0x4000 /* Freeze Software Enable */
+#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */
+#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/
+#define SHEN 0x0300 /* Show Cycle Enable */
+#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */
+#define MM 0x0040 /* Module Mapping */
+#define IARB 0x000f /* Interrupt Arbitration Field */
+
+
+
+#define SIMTR (volatile unsigned short int * const)(0x02 + SIM_CRB)
+ /* SIM Test Register */
+/* Used only for factor testing */
+
+
+
+#define SYNCR (volatile unsigned short int * const)(0x04 + SIM_CRB)
+ /* Clock Synthesizer Control Register */
+#define W 0x8000 /* Frequency Control (VCO) */
+#define X 0x4000 /* Frequency Control Bit (Prescale) */
+#define Y 0x3f00 /* Frequency Control Counter */
+#define EDIV 0x0080 /* ECLK Divide Rate */
+#define SLIMP 0x0010 /* Limp Mode Status */
+#define SLOCK 0x0008 /* Synthesizer Lock */
+#define RSTEN 0x0004 /* Reset Enable */
+#define STSIM 0x0002 /* Stop Mode SIM Clock */
+#define STEXT 0x0001 /* Stop Mode External Clock */
+
+
+
+#define RSR (volatile unsigned char * const)(0x07 + SIM_CRB)
+ /* Reset Status Register */
+#define EXT 0x0080 /* External Reset */
+#define POW 0x0040 /* Power-On Reset */
+#define SW 0x0020 /* Software Watchdog Reset */
+#define DBF 0x0010 /* Double Bus Fault Reset */
+#define LOC 0x0004 /* Loss of Clock Reset */
+#define SYS 0x0002 /* System Reset */
+#define TST 0x0001 /* Test Submodule Reset */
+
+
+
+#define SIMTRE (volatile unsigned short int * const)(0x08 + SIM_CRB)
+ /* System Integration Test Register */
+/* Used only for factor testing */
+
+
+
+#define PORTE0 (volatile unsigned char * const)(0x11 + SIM_CRB)
+#define PORTE1 (volatile unsigned char * const)(0x13 + SIM_CRB)
+ /* Port E Data Register */
+#define DDRE (volatile unsigned char * const)(0x15 + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PEPAR (volatile unsigned char * const)(0x17 + SIM_CRB)
+ /* Port E Pin Assignment Register */
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define PORTF0 (volatile unsigned char * const)(0x19 + SIM_CRB)
+#define PORTF1 (volatile unsigned char * const)(0x1b + SIM_CRB)
+ /* Port F Data Register */
+#define DDRF (volatile unsigned char * const)(0x1d + SIM_CRB)
+ /* Port E Data Direction Register */
+#define PFPAR (volatile unsigned char * const)(0x1f + SIM_CRB)
+/* Any bit cleared (zero) defines the corresponding pin to be an I/O
+ pin. Any bit set defines the corresponding pin to be a bus control
+ signal. */
+
+
+
+#define SYPCR (volatile unsigned char * const)(0x21 + SIM_CRB)
+/* !!! can write to only once after reset !!! */
+ /* System Protection Control Register */
+#define SWE 0x80 /* Software Watch Enable */
+#define SWP 0x40 /* Software Watchdog Prescale */
+#define SWT 0x30 /* Software Watchdog Timing */
+#define HME 0x08 /* Halt Monitor Enable */
+#define BME 0x04 /* Bus Monitor External Enable */
+#define BMT 0x03 /* Bus Monitor Timing */
+
+
+
+#define PICR (volatile unsigned short int * const)(0x22 + SIM_CRB)
+ /* Periodic Interrupt Control Reg. */
+#define PIRQL 0x0700 /* Periodic Interrupt Request Level */
+#define PIV 0x00ff /* Periodic Interrupt Level */
+
+
+
+#define PITR (volatile unsigned short int * const)(0x24 + SIM_CRB)
+ /* Periodic Interrupt Timer Register */
+#define PTP 0x0100 /* Periodic Timer Prescaler Control */
+#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */
+
+
+
+#define SWSR (volatile unsigned char * const)(0x27 + SIM_CRB)
+ /* Software Service Register */
+/* write 0x55 then 0xaa to service the software watchdog */
+
+
+
+#define TSTMSRA (volatile unsigned short int * const)(0x30 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTMSRB (volatile unsigned short int * const)(0x32 + SIM_CRB)
+ /* Test Module Master Shift A */
+#define TSTSC (volatile unsigned short int * const)(0x34 + SIM_CRB)
+ /* Test Module Shift Count */
+#define TSTRC (volatile unsigned short int * const)(0x36 + SIM_CRB)
+ /* Test Module Repetition Counter */
+#define CREG (volatile unsigned short int * const)(0x38 + SIM_CRB)
+ /* Test Module Control */
+#define DREG (volatile unsigned short int * const)(0x3a + SIM_CRB)
+ /* Test Module Distributed */
+/* Used only for factor testing */
+
+
+
+#define PORTC (volatile unsigned char * const)(0x41 + SIM_CRB)
+ /* Port C Data */
+
+
+
+#define CSPAR0 (volatile unsigned short int * const)(0x44 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Resgister 0 */
+/* CSPAR0 contains seven two-bit fields that determine the functions
+ of corresponding chip-select pins. CSPAR0[15:14] are not
+ used. These bits always read zero; write have no effect. CSPAR0 bit
+ 1 always reads one; writes to CSPAR0 bit 1 have no effect. */
+#define CSPAR1 (volatile unsigned short int * const)(0x46 + SIM_CRB)
+ /* Chip Select Pin Assignment
+ Register 1 */
+/* CSPAR1 contains five two-bit fields that determine the finctions of
+ corresponding chip-select pins. CSPAR1[15:10] are not used. These
+ bits always read zero; writes have no effect. */
+/*
+ *
+ * Bit Field | Description
+ * ------------+---------------
+ * 00 | Discrete Output
+ * 01 | Alternate Function
+ * 10 | Chip Select (8-bit port)
+ * 11 | Chip Select (16-bit port)
+ */
+#define DisOut 0x0
+#define AltFun 0x1
+#define CS8bit 0x2
+#define CS16bit 0x3
+/*
+ *
+ * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output
+ *-----------------+--------------------+--------------------+---------------*/
+#define CS_5 12 /* !CS5 | FC2 | PC2 */
+#define CS_4 10 /* !CS4 | FC1 | PC1 */
+#define CS_3 8 /* !CS3 | FC0 | PC0 */
+#define CS_2 6 /* !CS2 | !BGACK | */
+#define CS_1 4 /* !CS1 | !BG | */
+#define CS_0 2 /* !CS0 | !BR | */
+#define CSBOOT 0 /* !CSBOOT | | */
+/* | | | */
+#define CS_10 8 /* !CS10 | ADDR23 | ECLK */
+#define CS_9 6 /* !CS9 | ADDR22 | PC6 */
+#define CS_8 4 /* !CS8 | ADDR21 | PC5 */
+#define CS_7 2 /* !CS7 | ADDR20 | PC4 */
+#define CS_6 0 /* !CS6 | ADDR19 | PC3 */
+
+#define BS_2K 0x0
+#define BS_8K 0x1
+#define BS_16K 0x2
+#define BS_64K 0x3
+#define BS_128K 0x4
+#define BS_256K 0x5
+#define BS_512K 0x6
+#define BS_1M 0x7
+
+#define CSBARBT (volatile unsigned short int * const)(0x48 + SIM_CRB)
+#define CSBAR0 (volatile unsigned short int * const)(0x4c + SIM_CRB)
+#define CSBAR1 (volatile unsigned short int * const)(0x50 + SIM_CRB)
+#define CSBAR2 (volatile unsigned short int * const)(0x54 + SIM_CRB)
+#define CSBAR3 (volatile unsigned short int * const)(0x58 + SIM_CRB)
+#define CSBAR4 (volatile unsigned short int * const)(0x5c + SIM_CRB)
+#define CSBAR5 (volatile unsigned short int * const)(0x60 + SIM_CRB)
+#define CSBAR6 (volatile unsigned short int * const)(0x64 + SIM_CRB)
+#define CSBAR7 (volatile unsigned short int * const)(0x68 + SIM_CRB)
+#define CSBAR8 (volatile unsigned short int * const)(0x6c + SIM_CRB)
+#define CSBAR9 (volatile unsigned short int * const)(0x70 + SIM_CRB)
+#define CSBAR10 (volatile unsigned short int * const)(0x74 + SIM_CRB)
+
+#define MODE 0x8000
+#define Disable 0
+#define LowerByte 0x2000
+#define UpperByte 0x4000
+#define BothBytes 0x6000
+#define ReadOnly 0x0800
+#define WriteOnly 0x1000
+#define ReadWrite 0x1800
+#define SyncAS 0x0
+#define SyncDS 0x0400
+
+#define WaitStates_0 (0x0 << 6)
+#define WaitStates_1 (0x1 << 6)
+#define WaitStates_2 (0x2 << 6)
+#define WaitStates_3 (0x3 << 6)
+#define WaitStates_4 (0x4 << 6)
+#define WaitStates_5 (0x5 << 6)
+#define WaitStates_6 (0x6 << 6)
+#define WaitStates_7 (0x7 << 6)
+#define WaitStates_8 (0x8 << 6)
+#define WaitStates_9 (0x9 << 6)
+#define WaitStates_10 (0xa << 6)
+#define WaitStates_11 (0xb << 6)
+#define WaitStates_12 (0xc << 6)
+#define WaitStates_13 (0xd << 6)
+#define FastTerm (0xe << 6)
+#define External (0xf << 6)
+
+#define CPUSpace (0x0 << 4)
+#define UserSpace (0x1 << 4)
+#define SupSpace (0x2 << 4)
+#define UserSupSpace (0x3 << 4)
+
+#define IPLevel_any 0x0
+#define IPLevel_1 0x2
+#define IPLevel_2 0x4
+#define IPLevel_3 0x6
+#define IPLevel_4 0x8
+#define IPLevel_5 0xa
+#define IPLevel_6 0xc
+#define IPLevel_7 0xe
+
+#define AVEC 1
+
+#define CSORBT (volatile unsigned short int * const)(0x4a + SIM_CRB)
+#define CSOR0 (volatile unsigned short int * const)(0x4e + SIM_CRB)
+#define CSOR1 (volatile unsigned short int * const)(0x52 + SIM_CRB)
+#define CSOR2 (volatile unsigned short int * const)(0x56 + SIM_CRB)
+#define CSOR3 (volatile unsigned short int * const)(0x5a + SIM_CRB)
+#define CSOR4 (volatile unsigned short int * const)(0x5e + SIM_CRB)
+#define CSOR5 (volatile unsigned short int * const)(0x62 + SIM_CRB)
+#define CSOR6 (volatile unsigned short int * const)(0x66 + SIM_CRB)
+#define CSOR7 (volatile unsigned short int * const)(0x6a + SIM_CRB)
+#define CSOR8 (volatile unsigned short int * const)(0x6e + SIM_CRB)
+#define CSOR9 (volatile unsigned short int * const)(0x72 + SIM_CRB)
+#define CSOR10 (volatile unsigned short int * const)(0x76 + SIM_CRB)
+
+#endif /* _SIM_h_ */
diff --git a/cpukit/score/cpu/no_cpu/asm.h b/cpukit/score/cpu/no_cpu/asm.h
new file mode 100644
index 0000000000..66d98be652
--- /dev/null
+++ b/cpukit/score/cpu/no_cpu/asm.h
@@ -0,0 +1,98 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __NO_CPU_ASM_h
+#define __NO_CPU_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/no_cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/no_cpu/cpu.c b/cpukit/score/cpu/no_cpu/cpu.c
new file mode 100644
index 0000000000..ba533324ac
--- /dev/null
+++ b/cpukit/score/cpu/no_cpu/cpu.c
@@ -0,0 +1,160 @@
+/*
+ * XXX CPU Dependent Source
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/wkspace.h>
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ /*
+ * The thread_dispatch argument is the address of the entry point
+ * for the routine called at the end of an ISR once it has been
+ * decided a context switch is necessary. On some compilation
+ * systems it is difficult to call a high-level language routine
+ * from assembly. This allows us to trick these systems.
+ *
+ * If you encounter this problem save the entry point in a CPU
+ * dependent variable.
+ */
+
+ _CPU_Thread_dispatch_pointer = thread_dispatch;
+
+ /*
+ * If there is not an easy way to initialize the FP context
+ * during Context_Initialize, then it is usually easier to
+ * save an "uninitialized" FP context here and copy it to
+ * the task's during Context_Initialize.
+ */
+
+ /* FP context initialization support goes here */
+
+ _CPU_Table = *cpu_table;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ /*
+ * This routine returns the current interrupt level.
+ */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ /*
+ * This is where we install the interrupt handler into the "raw" interrupt
+ * table used by the CPU to dispatch interrupt handlers.
+ */
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * NOTES:
+ *
+ * 1. This is the same as the regular CPU independent algorithm.
+ *
+ * 2. If you implement this using a "halt", "idle", or "shutdown"
+ * instruction, then don't forget to put it in an infinite loop.
+ *
+ * 3. Be warned. Some processors with onboard DMA have been known
+ * to stop the DMA if the CPU were put in IDLE mode. This might
+ * also be a problem with other on-chip peripherals. So use this
+ * hook with caution.
+ */
+
+void _CPU_Thread_Idle_body( void )
+{
+
+ for( ; ; )
+ /* insert your "halt" instruction here */ ;
+}
diff --git a/cpukit/score/cpu/no_cpu/cpu_asm.c b/cpukit/score/cpu/no_cpu/cpu_asm.c
new file mode 100644
index 0000000000..5a36ece987
--- /dev/null
+++ b/cpukit/score/cpu/no_cpu/cpu_asm.c
@@ -0,0 +1,165 @@
+/* cpu_asm.c ===> cpu_asm.S or cpu_asm.s
+ *
+ * This file contains the basic algorithms for all assembly code used
+ * in an specific CPU port of RTEMS. These algorithms must be implemented
+ * in assembly language
+ *
+ * NOTE: This is supposed to be a .S or .s file NOT a C file.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * This is supposed to be an assembly file. This means that system.h
+ * and cpu.h should not be included in a "real" cpu_asm file. An
+ * implementation in assembly should include "cpu_asm.h>
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/cpu.h>
+/* #include "cpu_asm.h> */
+
+/*
+ * _CPU_Context_save_fp_context
+ *
+ * This routine is responsible for saving the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+void _CPU_Context_save_fp(
+ void **fp_context_ptr
+)
+{
+}
+
+/*
+ * _CPU_Context_restore_fp_context
+ *
+ * This routine is responsible for restoring the FP context
+ * at *fp_context_ptr. If the point to load the FP context
+ * from is changed then the pointer is modified by this routine.
+ *
+ * Sometimes a macro implementation of this is in cpu.h which dereferences
+ * the ** and a similarly named routine in this file is passed something
+ * like a (Context_Control_fp *). The general rule on making this decision
+ * is to avoid writing assembly language.
+ */
+
+void _CPU_Context_restore_fp(
+ void **fp_context_ptr
+)
+{
+}
+
+/* _CPU_Context_switch
+ *
+ * This routine performs a normal non-FP context switch.
+ */
+
+void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+)
+{
+}
+
+/*
+ * _CPU_Context_restore
+ *
+ * This routine is generallu used only to restart self in an
+ * efficient manner. It may simply be a label in _CPU_Context_switch.
+ *
+ * NOTE: May be unnecessary to reload some registers.
+ */
+
+void _CPU_Context_restore(
+ Context_Control *new_context
+)
+{
+}
+
+/* void __ISR_Handler()
+ *
+ * This routine provides the RTEMS interrupt management.
+ *
+ */
+
+void _ISR_Handler()
+{
+ /*
+ * This discussion ignores a lot of the ugly details in a real
+ * implementation such as saving enough registers/state to be
+ * able to do something real. Keep in mind that the goal is
+ * to invoke a user's ISR handler which is written in C and
+ * uses a certain set of registers.
+ *
+ * Also note that the exact order is to a large extent flexible.
+ * Hardware will dictate a sequence for a certain subset of
+ * _ISR_Handler while requirements for setting
+ */
+
+ /*
+ * At entry to "common" _ISR_Handler, the vector number must be
+ * available. On some CPUs the hardware puts either the vector
+ * number or the offset into the vector table for this ISR in a
+ * known place. If the hardware does not give us this information,
+ * then the assembly portion of RTEMS for this port will contain
+ * a set of distinct interrupt entry points which somehow place
+ * the vector number in a known place (which is safe if another
+ * interrupt nests this one) and branches to _ISR_Handler.
+ *
+ * save some or all context on stack
+ * may need to save some special interrupt information for exit
+ *
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * if ( _ISR_Nest_level == 0 )
+ * switch to software interrupt stack
+ * #endif
+ *
+ * _ISR_Nest_level++;
+ *
+ * _Thread_Dispatch_disable_level++;
+ *
+ * (*_ISR_Vector_table[ vector ])( vector );
+ *
+ * --_ISR_Nest_level;
+ *
+ * if ( _ISR_Nest_level )
+ * goto the label "exit interrupt (simple case)"
+ *
+ * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
+ * restore stack
+ * #endif
+ *
+ * if ( !_Context_Switch_necessary )
+ * goto the label "exit interrupt (simple case)"
+ *
+ * if ( !_ISR_Signals_to_thread_executing )
+ * _ISR_Signals_to_thread_executing = FALSE;
+ * goto the label "exit interrupt (simple case)"
+ *
+ * call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
+ *
+ * prepare to get out of interrupt
+ * return from interrupt (maybe to _ISR_Dispatch)
+ *
+ * LABEL "exit interrupt (simple case):
+ * prepare to get out of interrupt
+ * return from interrupt
+ */
+}
+
diff --git a/cpukit/score/cpu/no_cpu/rtems/asm.h b/cpukit/score/cpu/no_cpu/rtems/asm.h
new file mode 100644
index 0000000000..66d98be652
--- /dev/null
+++ b/cpukit/score/cpu/no_cpu/rtems/asm.h
@@ -0,0 +1,98 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted. This file is:
+ *
+ * COPYRIGHT (c) 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * $Id$
+ */
+
+#ifndef __NO_CPU_ASM_h
+#define __NO_CPU_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+#include <rtems/score/no_cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/sparc/README b/cpukit/score/cpu/sparc/README
new file mode 100644
index 0000000000..c4c2200075
--- /dev/null
+++ b/cpukit/score/cpu/sparc/README
@@ -0,0 +1,110 @@
+#
+# $Id$
+#
+
+This file discusses SPARC specific issues which are important to
+this port. The primary topics in this file are:
+
+ + Global Register Usage
+ + Stack Frame
+ + EF bit in the PSR
+
+
+Global Register Usage
+=====================
+
+This information on register usage is based heavily on a comment in the
+file gcc-2.7.0/config/sparc/sparc.h in the the gcc 2.7.0 source.
+
+ + g0 is hardwired to 0
+ + On non-v9 systems:
+ - g1 is free to use as temporary.
+ - g2-g4 are reserved for applications. Gcc normally uses them as
+ temporaries, but this can be disabled via the -mno-app-regs option.
+ - g5 through g7 are reserved for the operating system.
+ + On v9 systems:
+ - g1 and g5 are free to use as temporaries.
+ - g2-g4 are reserved for applications (the compiler will not normally use
+ them, but they can be used as temporaries with -mapp-regs).
+ - g6-g7 are reserved for the operating system.
+
+ NOTE: As of gcc 2.7.0 register g1 was used in the following scenarios:
+
+ + as a temporary by the 64 bit sethi pattern
+ + when restoring call-preserved registers in large stack frames
+
+RTEMS places no constraints on the usage of the global registers. Although
+gcc assumes that either g5-g7 (non-V9) or g6-g7 (V9) are reserved for the
+operating system, RTEMS does not assume any special use for them.
+
+
+
+Stack Frame
+===========
+
+The stack grows downward (i.e. to lower addresses) on the SPARC architecture.
+
+The following is the organization of the stack frame:
+
+
+
+ | ............... |
+ fp | |
+ +-------------------------------+
+ | |
+ | Local registers, temporaries, |
+ | and saved floats | x bytes
+ | |
+ sp + x +-------------------------------+
+ | |
+ | outgoing parameters past |
+ | the sixth one | x bytes
+ | |
+ sp + 92 +-------------------------------+ *
+ | | *
+ | area for callee to save | *
+ | register arguments | * 24 bytes
+ | | *
+ sp + 68 +-------------------------------+ *
+ | | *
+ | structure return pointer | * 4 bytes
+ | | *
+ sp + 64 +-------------------------------+ *
+ | | *
+ | local register set | * 32 bytes
+ | | *
+ sp + 32 +-------------------------------+ *
+ | | *
+ | input register set | * 32 bytes
+ | | *
+ sp +-------------------------------+ *
+
+
+* = minimal stack frame
+
+x = optional components
+
+EF bit in the PSR
+=================
+
+The EF (enable floating point unit) in the PSR is utilized in this port to
+prevent non-floating point tasks from performing floating point
+operations. This bit is maintained as part of the integer context.
+However, the floating point context is switched BEFORE the integer
+context. Thus the EF bit in place at the time of the FP switch may
+indicate that FP operations are disabled. This occurs on certain task
+switches, when the EF bit will be 0 for the outgoing task and thus a fault
+will be generated on the first FP operation of the FP context save.
+
+The remedy for this is to enable FP access as the first step in both the
+save and restore of the FP context area. This bit will be subsequently
+reloaded by the integer context switch.
+
+Two of the scenarios which demonstrate this problem are outlined below:
+
+1. When the first FP task is switched to. The system tasks are not FP and
+thus would be unable to restore the FP context of the incoming task.
+
+2. On a deferred FP context switch. In this case, the system might switch
+from FP Task A to non-FP Task B and then to FP Task C. In this scenario,
+the floating point state must technically be saved by a non-FP task.
diff --git a/cpukit/score/cpu/sparc/asm.h b/cpukit/score/cpu/sparc/asm.h
new file mode 100644
index 0000000000..a3d62416b8
--- /dev/null
+++ b/cpukit/score/cpu/sparc/asm.h
@@ -0,0 +1,111 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted.
+ *
+ * $Id$
+ */
+
+#ifndef __SPARC_ASM_h
+#define __SPARC_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+
+#include <rtems/score/sparc.h>
+#include <rtems/score/cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
+/* XXX The following ifdef magic fixes the problem but results in a warning */
+/* XXX when compiling assembly code. */
+#undef __USER_LABEL_PREFIX__
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+/*
+ * Entry for traps which jump to a programmer-specified trap handler.
+ */
+
+#define TRAP(_vector, _handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ mov _vector, %l3
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c
new file mode 100644
index 0000000000..23a93f176e
--- /dev/null
+++ b/cpukit/score/cpu/sparc/cpu.c
@@ -0,0 +1,404 @@
+/*
+ * SPARC Dependent Source
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * Ported to ERC32 implementation of the SPARC by On-Line Applications
+ * Research Corporation (OAR) under contract to the European Space
+ * Agency (ESA).
+ *
+ * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
+ * European Space Agency.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+
+#if defined(erc32)
+#include <erc32.h>
+#endif
+
+/*
+ * This initializes the set of opcodes placed in each trap
+ * table entry. The routine which installs a handler is responsible
+ * for filling in the fields for the _handler address and the _vector
+ * trap type.
+ *
+ * The constants following this structure are masks for the fields which
+ * must be filled in when the handler is installed.
+ */
+
+const CPU_Trap_table_entry _CPU_Trap_slot_template = {
+ 0xa1480000, /* mov %psr, %l0 */
+ 0x29000000, /* sethi %hi(_handler), %l4 */
+ 0x81c52000, /* jmp %l4 + %lo(_handler) */
+ 0xa6102000 /* mov _vector, %l3 */
+};
+
+/*PAGE
+ *
+ * _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * Input Parameters:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ *
+ * Output Parameters: NONE
+ *
+ * NOTE: There is no need to save the pointer to the thread dispatch routine.
+ * The SPARC's assembly code can reference it directly with no problems.
+ */
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ void *pointer;
+ unsigned32 trap_table_start;
+ unsigned32 tbr_value;
+ CPU_Trap_table_entry *old_tbr;
+ CPU_Trap_table_entry *trap_table;
+
+ /*
+ * Install the executive's trap table. All entries from the original
+ * trap table are copied into the executive's trap table. This is essential
+ * since this preserves critical trap handlers such as the window underflow
+ * and overflow handlers. It is the responsibility of the BSP to provide
+ * install these in the initial trap table.
+ */
+
+ trap_table_start = (unsigned32) &_CPU_Trap_Table_area;
+ if (trap_table_start & (SPARC_TRAP_TABLE_ALIGNMENT-1))
+ trap_table_start = (trap_table_start + SPARC_TRAP_TABLE_ALIGNMENT) &
+ ~(SPARC_TRAP_TABLE_ALIGNMENT-1);
+
+ trap_table = (CPU_Trap_table_entry *) trap_table_start;
+
+ sparc_get_tbr( tbr_value );
+
+ old_tbr = (CPU_Trap_table_entry *) (tbr_value & 0xfffff000);
+
+ memcpy( trap_table, (void *) old_tbr, 256 * sizeof( CPU_Trap_table_entry ) );
+
+ sparc_set_tbr( trap_table_start );
+
+ /*
+ * This seems to be the most appropriate way to obtain an initial
+ * FP context on the SPARC. The NULL fp context is copied it to
+ * the task's FP context during Context_Initialize.
+ */
+
+ pointer = &_CPU_Null_fp_context;
+ _CPU_Context_save_fp( &pointer );
+
+ /*
+ * Grab our own copy of the user's CPU table.
+ */
+
+ _CPU_Table = *cpu_table;
+
+#if defined(erc32)
+
+ /*
+ * ERC32 specific initialization
+ */
+
+ _ERC32_MEC_Timer_Control_Mirror = 0;
+ ERC32_MEC.Timer_Control = 0;
+
+ ERC32_MEC.Control |= ERC32_CONFIGURATION_POWER_DOWN_ALLOWED;
+
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ *
+ * Input Parameters: NONE
+ *
+ * Output Parameters:
+ * returns the current interrupt level (PIL field of the PSR)
+ */
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+ unsigned32 level;
+
+ sparc_get_interrupt_level( level );
+
+ return level;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ *
+ * This routine installs the specified handler as a "raw" non-executive
+ * supported trap handler (a.k.a. interrupt service routine).
+ *
+ * Input Parameters:
+ * vector - trap table entry number plus synchronous
+ * vs. asynchronous information
+ * new_handler - address of the handler to be installed
+ * old_handler - pointer to an address of the handler previously installed
+ *
+ * Output Parameters: NONE
+ * *new_handler - address of the handler previously installed
+ *
+ * NOTE:
+ *
+ * On the SPARC, there are really only 256 vectors. However, the executive
+ * has no easy, fast, reliable way to determine which traps are synchronous
+ * and which are asynchronous. By default, synchronous traps return to the
+ * instruction which caused the interrupt. So if you install a software
+ * trap handler as an executive interrupt handler (which is desirable since
+ * RTEMS takes care of window and register issues), then the executive needs
+ * to know that the return address is to the trap rather than the instruction
+ * following the trap.
+ *
+ * So vectors 0 through 255 are treated as regular asynchronous traps which
+ * provide the "correct" return address. Vectors 256 through 512 are assumed
+ * by the executive to be synchronous and to require that the return address
+ * be fudged.
+ *
+ * If you use this mechanism to install a trap handler which must reexecute
+ * the instruction which caused the trap, then it should be installed as
+ * an asynchronous trap. This will avoid the executive changing the return
+ * address.
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ unsigned32 real_vector;
+ CPU_Trap_table_entry *tbr;
+ CPU_Trap_table_entry *slot;
+ unsigned32 u32_tbr;
+ unsigned32 u32_handler;
+
+ /*
+ * Get the "real" trap number for this vector ignoring the synchronous
+ * versus asynchronous indicator included with our vector numbers.
+ */
+
+ real_vector = SPARC_REAL_TRAP_NUMBER( vector );
+
+ /*
+ * Get the current base address of the trap table and calculate a pointer
+ * to the slot we are interested in.
+ */
+
+ sparc_get_tbr( u32_tbr );
+
+ u32_tbr &= 0xfffff000;
+
+ tbr = (CPU_Trap_table_entry *) u32_tbr;
+
+ slot = &tbr[ real_vector ];
+
+ /*
+ * Get the address of the old_handler from the trap table.
+ *
+ * NOTE: The old_handler returned will be bogus if it does not follow
+ * the RTEMS model.
+ */
+
+#define HIGH_BITS_MASK 0xFFFFFC00
+#define HIGH_BITS_SHIFT 10
+#define LOW_BITS_MASK 0x000003FF
+
+ if ( slot->mov_psr_l0 == _CPU_Trap_slot_template.mov_psr_l0 ) {
+ u32_handler =
+ ((slot->sethi_of_handler_to_l4 & HIGH_BITS_MASK) << HIGH_BITS_SHIFT) |
+ (slot->jmp_to_low_of_handler_plus_l4 & LOW_BITS_MASK);
+ *old_handler = (proc_ptr) u32_handler;
+ } else
+ *old_handler = 0;
+
+ /*
+ * Copy the template to the slot and then fix it.
+ */
+
+ *slot = _CPU_Trap_slot_template;
+
+ u32_handler = (unsigned32) new_handler;
+
+ slot->mov_vector_l3 |= vector;
+ slot->sethi_of_handler_to_l4 |=
+ (u32_handler & HIGH_BITS_MASK) >> HIGH_BITS_SHIFT;
+ slot->jmp_to_low_of_handler_plus_l4 |= (u32_handler & LOW_BITS_MASK);
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * new_handler - replacement ISR for this vector number
+ * old_handler - pointer to former ISR for this vector number
+ *
+ * Output parameters:
+ * *old_handler - former ISR for this vector number
+ *
+ */
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ unsigned32 real_vector;
+ proc_ptr ignored;
+
+ /*
+ * Get the "real" trap number for this vector ignoring the synchronous
+ * versus asynchronous indicator included with our vector numbers.
+ */
+
+ real_vector = SPARC_REAL_TRAP_NUMBER( vector );
+
+ /*
+ * Return the previous ISR handler.
+ */
+
+ *old_handler = _ISR_Vector_table[ real_vector ];
+
+ /*
+ * Install the wrapper so this ISR can be invoked properly.
+ */
+
+ _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ real_vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Context_Initialize
+ *
+ * This kernel routine initializes the basic non-FP context area associated
+ * with each thread.
+ *
+ * Input parameters:
+ * the_context - pointer to the context area
+ * stack_base - address of memory for the SPARC
+ * size - size in bytes of the stack area
+ * new_level - interrupt level for this context area
+ * entry_point - the starting execution point for this this context
+ * is_fp - TRUE if this context is associated with an FP thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CPU_Context_Initialize(
+ Context_Control *the_context,
+ unsigned32 *stack_base,
+ unsigned32 size,
+ unsigned32 new_level,
+ void *entry_point,
+ boolean is_fp
+)
+{
+ unsigned32 stack_high; /* highest "stack aligned" address */
+ unsigned32 the_size;
+ unsigned32 tmp_psr;
+
+ /*
+ * On CPUs with stacks which grow down (i.e. SPARC), we build the stack
+ * based on the stack_high address.
+ */
+
+ stack_high = ((unsigned32)(stack_base) + size);
+ stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ the_size = size & ~(CPU_STACK_ALIGNMENT - 1);
+
+ /*
+ * See the README in this directory for a diagram of the stack.
+ */
+
+ the_context->o7 = ((unsigned32) entry_point) - 8;
+ the_context->o6_sp = stack_high - CPU_MINIMUM_STACK_FRAME_SIZE;
+ the_context->i6_fp = stack_high;
+
+ /*
+ * Build the PSR for the task. Most everything can be 0 and the
+ * CWP is corrected during the context switch.
+ *
+ * The EF bit determines if the floating point unit is available.
+ * The FPU is ONLY enabled if the context is associated with an FP task
+ * and this SPARC model has an FPU.
+ */
+
+ sparc_get_psr( tmp_psr );
+ tmp_psr &= ~SPARC_PSR_PIL_MASK;
+ tmp_psr |= (new_level << 8) & SPARC_PSR_PIL_MASK;
+ tmp_psr &= ~SPARC_PSR_EF_MASK; /* disabled by default */
+
+#if (SPARC_HAS_FPU == 1)
+ /*
+ * If this bit is not set, then a task gets a fault when it accesses
+ * a floating point register. This is a nice way to detect floating
+ * point tasks which are not currently declared as such.
+ */
+
+ if ( is_fp )
+ tmp_psr |= SPARC_PSR_EF_MASK;
+#endif
+ the_context->psr = tmp_psr;
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * Some SPARC implementations have low power, sleep, or idle modes. This
+ * tries to take advantage of those models.
+ */
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
+
+/*
+ * This is the implementation for the erc32.
+ *
+ * NOTE: Low power mode was enabled at initialization time.
+ */
+
+#if defined(erc32)
+
+void _CPU_Thread_Idle_body( void )
+{
+ while (1) {
+ ERC32_MEC.Power_Down = 0; /* value is irrelevant */
+ }
+}
+
+#endif
+
+#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */
diff --git a/cpukit/score/cpu/sparc/rtems/asm.h b/cpukit/score/cpu/sparc/rtems/asm.h
new file mode 100644
index 0000000000..a3d62416b8
--- /dev/null
+++ b/cpukit/score/cpu/sparc/rtems/asm.h
@@ -0,0 +1,111 @@
+/* asm.h
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ *
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted.
+ *
+ * $Id$
+ */
+
+#ifndef __SPARC_ASM_h
+#define __SPARC_ASM_h
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#define ASM
+
+#include <rtems/score/sparc.h>
+#include <rtems/score/cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
+/* XXX The following ifdef magic fixes the problem but results in a warning */
+/* XXX when compiling assembly code. */
+#undef __USER_LABEL_PREFIX__
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+/*
+ * Entry for traps which jump to a programmer-specified trap handler.
+ */
+
+#define TRAP(_vector, _handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ mov _vector, %l3
+
+#endif
+/* end of include file */
+
+
diff --git a/cpukit/score/cpu/unix/cpu.c b/cpukit/score/cpu/unix/cpu.c
new file mode 100644
index 0000000000..4c1604465f
--- /dev/null
+++ b/cpukit/score/cpu/unix/cpu.c
@@ -0,0 +1,969 @@
+/*
+ * UNIX Simulator Dependent Source
+ *
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/interr.h>
+
+#if defined(solaris2)
+/*
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#define __STRICT_ANSI__
+*/
+#define __EXTENSIONS__
+#endif
+
+#if defined(linux)
+#define MALLOC_0_RETURNS_NULL
+#endif
+
+#include <sys/types.h>
+#include <sys/times.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <string.h> /* memset */
+
+#ifndef SA_RESTART
+#define SA_RESTART 0
+#endif
+
+typedef struct {
+ jmp_buf regs;
+ sigset_t isr_level;
+} Context_Control_overlay;
+
+void _CPU_Signal_initialize(void);
+void _CPU_Stray_signal(int);
+void _CPU_ISR_Handler(int);
+
+sigset_t _CPU_Signal_mask;
+Context_Control _CPU_Context_Default_with_ISRs_enabled;
+Context_Control _CPU_Context_Default_with_ISRs_disabled;
+
+/*
+ * Which cpu are we? Used by libcpu and libbsp.
+ */
+
+int cpu_number;
+
+/*PAGE
+ *
+ * _CPU_ISR_From_CPU_Init
+ */
+
+sigset_t posix_empty_mask;
+
+void _CPU_ISR_From_CPU_Init()
+{
+ unsigned32 i;
+ proc_ptr old_handler;
+
+ /*
+ * Generate an empty mask to be used by disable_support
+ */
+
+ sigemptyset(&posix_empty_mask);
+
+ /*
+ * Block all the signals except SIGTRAP for the debugger
+ * and SIGABRT for fatal errors.
+ */
+
+ (void) sigfillset(&_CPU_Signal_mask);
+ (void) sigdelset(&_CPU_Signal_mask, SIGTRAP);
+ (void) sigdelset(&_CPU_Signal_mask, SIGABRT);
+ (void) sigdelset(&_CPU_Signal_mask, SIGIOT);
+ (void) sigdelset(&_CPU_Signal_mask, SIGCONT);
+
+ _CPU_ISR_Enable(1);
+
+ /*
+ * Set the handler for all signals to be signal_handler
+ * which will then vector out to the correct handler
+ * for whichever signal actually happened. Initially
+ * set the vectors to the stray signal handler.
+ */
+
+ for (i = 0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++)
+ (void)_CPU_ISR_install_vector(i, _CPU_Stray_signal, &old_handler);
+
+ _CPU_Signal_initialize();
+}
+
+void _CPU_Signal_initialize( void )
+{
+ struct sigaction act;
+ sigset_t mask;
+
+ /* mark them all active except for TraceTrap and Abort */
+
+ sigfillset(&mask);
+ sigdelset(&mask, SIGTRAP);
+ sigdelset(&mask, SIGABRT);
+ sigdelset(&mask, SIGIOT);
+ sigdelset(&mask, SIGCONT);
+ sigprocmask(SIG_UNBLOCK, &mask, 0);
+
+ act.sa_handler = _CPU_ISR_Handler;
+ act.sa_mask = mask;
+ act.sa_flags = SA_RESTART;
+
+ sigaction(SIGHUP, &act, 0);
+ sigaction(SIGINT, &act, 0);
+ sigaction(SIGQUIT, &act, 0);
+ sigaction(SIGILL, &act, 0);
+#ifdef SIGEMT
+ sigaction(SIGEMT, &act, 0);
+#endif
+ sigaction(SIGFPE, &act, 0);
+ sigaction(SIGKILL, &act, 0);
+ sigaction(SIGBUS, &act, 0);
+ sigaction(SIGSEGV, &act, 0);
+#ifdef SIGSYS
+ sigaction(SIGSYS, &act, 0);
+#endif
+ sigaction(SIGPIPE, &act, 0);
+ sigaction(SIGALRM, &act, 0);
+ sigaction(SIGTERM, &act, 0);
+ sigaction(SIGUSR1, &act, 0);
+ sigaction(SIGUSR2, &act, 0);
+ sigaction(SIGCHLD, &act, 0);
+ sigaction(SIGCLD, &act, 0);
+ sigaction(SIGPWR, &act, 0);
+ sigaction(SIGVTALRM, &act, 0);
+ sigaction(SIGPROF, &act, 0);
+ sigaction(SIGIO, &act, 0);
+ sigaction(SIGWINCH, &act, 0);
+ sigaction(SIGSTOP, &act, 0);
+ sigaction(SIGTTIN, &act, 0);
+ sigaction(SIGTTOU, &act, 0);
+ sigaction(SIGURG, &act, 0);
+#ifdef SIGLOST
+ sigaction(SIGLOST, &act, 0);
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_Context_From_CPU_Init
+ */
+
+void _CPU_Context_From_CPU_Init()
+{
+
+#if defined(hppa1_1) && defined(RTEMS_UNIXLIB_SETJMP)
+ /*
+ * HACK - set the _SYSTEM_ID to 0x20c so that setjmp/longjmp
+ * will handle the full 32 floating point registers.
+ */
+
+ {
+ extern unsigned32 _SYSTEM_ID;
+
+ _SYSTEM_ID = 0x20c;
+ }
+#endif
+
+ /*
+ * get default values to use in _CPU_Context_Initialize()
+ */
+
+
+ (void) memset(
+ &_CPU_Context_Default_with_ISRs_enabled,
+ 0,
+ sizeof(Context_Control)
+ );
+ (void) memset(
+ &_CPU_Context_Default_with_ISRs_disabled,
+ 0,
+ sizeof(Context_Control)
+ );
+
+ _CPU_ISR_Set_level( 0 );
+ _CPU_Context_switch(
+ &_CPU_Context_Default_with_ISRs_enabled,
+ &_CPU_Context_Default_with_ISRs_enabled
+ );
+
+ _CPU_ISR_Set_level( 1 );
+ _CPU_Context_switch(
+ &_CPU_Context_Default_with_ISRs_disabled,
+ &_CPU_Context_Default_with_ISRs_disabled
+ );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Get_level
+ */
+
+sigset_t GET_old_mask;
+
+unsigned32 _CPU_ISR_Get_level( void )
+{
+/* sigset_t old_mask; */
+ unsigned32 old_level;
+
+ sigprocmask(0, 0, &GET_old_mask);
+
+ if (memcmp((void *)&posix_empty_mask, (void *)&GET_old_mask, sizeof(sigset_t)))
+ old_level = 1;
+ else
+ old_level = 0;
+
+ return old_level;
+}
+
+/* _CPU_Initialize
+ *
+ * This routine performs processor dependent initialization.
+ *
+ * INPUT PARAMETERS:
+ * cpu_table - CPU table to initialize
+ * thread_dispatch - address of disptaching routine
+ */
+
+
+void _CPU_Initialize(
+ rtems_cpu_table *cpu_table,
+ void (*thread_dispatch) /* ignored on this CPU */
+)
+{
+ /*
+ * The thread_dispatch argument is the address of the entry point
+ * for the routine called at the end of an ISR once it has been
+ * decided a context switch is necessary. On some compilation
+ * systems it is difficult to call a high-level language routine
+ * from assembly. This allows us to trick these systems.
+ *
+ * If you encounter this problem save the entry point in a CPU
+ * dependent variable.
+ */
+
+ _CPU_Thread_dispatch_pointer = thread_dispatch;
+
+ /*
+ * XXX; If there is not an easy way to initialize the FP context
+ * during Context_Initialize, then it is usually easier to
+ * save an "uninitialized" FP context here and copy it to
+ * the task's during Context_Initialize.
+ */
+
+ /* XXX: FP context initialization support */
+
+ _CPU_Table = *cpu_table;
+
+ _CPU_ISR_From_CPU_Init();
+
+ _CPU_Context_From_CPU_Init();
+
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_raw_handler
+ */
+
+void _CPU_ISR_install_raw_handler(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ _CPU_Fatal_halt( 0xdeaddead );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ */
+
+
+void _CPU_ISR_install_vector(
+ unsigned32 vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _CPU_ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
+
+/*PAGE
+ *
+ * _CPU_Install_interrupt_stack
+ */
+
+void _CPU_Install_interrupt_stack( void )
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Thread_Idle_body
+ *
+ * Stop until we get a signal which is the logically the same thing
+ * entering low-power or sleep mode on a real processor and waiting for
+ * an interrupt. This significantly reduces the consumption of host
+ * CPU cycles which is again similar to low power mode.
+ */
+
+void _CPU_Thread_Idle_body( void )
+{
+ while (1)
+ pause();
+}
+
+/*PAGE
+ *
+ * _CPU_Context_Initialize
+ */
+
+void _CPU_Context_Initialize(
+ Context_Control *_the_context,
+ unsigned32 *_stack_base,
+ unsigned32 _size,
+ unsigned32 _new_level,
+ void *_entry_point,
+ boolean _is_fp
+)
+{
+ void *source;
+ unsigned32 *addr;
+ unsigned32 jmp_addr;
+ unsigned32 _stack_low; /* lowest "stack aligned" address */
+ unsigned32 _stack_high; /* highest "stack aligned" address */
+ unsigned32 _the_size;
+
+ jmp_addr = (unsigned32) _entry_point;
+
+ /*
+ * On CPUs with stacks which grow down, we build the stack
+ * based on the _stack_high address. On CPUs with stacks which
+ * grow up, we build the stack based on the _stack_low address.
+ */
+
+ _stack_low = (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT - 1;
+ _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ _stack_high = (unsigned32)(_stack_base) + _size;
+ _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ if (_stack_high > _stack_low)
+ _the_size = _stack_high - _stack_low;
+ else
+ _the_size = _stack_low - _stack_high;
+
+ /*
+ * Slam our jmp_buf template into the context we are creating
+ */
+
+ if ( _new_level == 0 )
+ source = &_CPU_Context_Default_with_ISRs_enabled;
+ else
+ source = &_CPU_Context_Default_with_ISRs_disabled;
+
+ memcpy(
+ _the_context,
+ source,
+ sizeof(Context_Control) /* sizeof(jmp_buf)); */
+ );
+
+ addr = (unsigned32 *)_the_context;
+
+#if defined(hppa1_1)
+ *(addr + RP_OFF) = jmp_addr;
+ *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
+
+ /*
+ * See if we are using shared libraries by checking
+ * bit 30 in 24 off of newp. If bit 30 is set then
+ * we are using shared libraries and the jump address
+ * points to the pointer, so we put that into rp instead.
+ */
+
+ if (jmp_addr & 0x40000000) {
+ jmp_addr &= 0xfffffffc;
+ *(addr + RP_OFF) = *(unsigned32 *)jmp_addr;
+ }
+#elif defined(sparc)
+
+ /*
+ * See /usr/include/sys/stack.h in Solaris 2.3 for a nice
+ * diagram of the stack.
+ */
+
+ asm ("ta 0x03"); /* flush registers */
+
+ *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
+ *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
+ *(addr + FP_OFF) = (unsigned32)(_stack_high);
+
+#elif defined(i386)
+
+ /*
+ * This information was gathered by disassembling setjmp().
+ */
+
+ {
+ unsigned32 stack_ptr;
+
+ stack_ptr = _stack_high - CPU_FRAME_SIZE;
+
+ *(addr + EBX_OFF) = 0xFEEDFEED;
+ *(addr + ESI_OFF) = 0xDEADDEAD;
+ *(addr + EDI_OFF) = 0xDEAFDEAF;
+ *(addr + EBP_OFF) = stack_ptr;
+ *(addr + ESP_OFF) = stack_ptr;
+ *(addr + RET_OFF) = jmp_addr;
+
+ addr = (unsigned32 *) stack_ptr;
+
+ addr[ 0 ] = jmp_addr;
+ addr[ 1 ] = (unsigned32) stack_ptr;
+ addr[ 2 ] = (unsigned32) stack_ptr;
+ }
+
+#else
+#error "UNKNOWN CPU!!!"
+#endif
+
+}
+
+/*PAGE
+ *
+ * _CPU_Context_restore
+ */
+
+void _CPU_Context_restore(
+ Context_Control *next
+)
+{
+ Context_Control_overlay *nextp = (Context_Control_overlay *)next;
+
+ sigprocmask( SIG_SETMASK, &nextp->isr_level, 0 );
+ longjmp( nextp->regs, 0 );
+}
+
+/*PAGE
+ *
+ * _CPU_Context_switch
+ */
+
+void _CPU_Context_switch(
+ Context_Control *current,
+ Context_Control *next
+)
+{
+ Context_Control_overlay *currentp = (Context_Control_overlay *)current;
+ Context_Control_overlay *nextp = (Context_Control_overlay *)next;
+
+ int status;
+
+ /*
+ * Switch levels in one operation
+ */
+
+ status = sigprocmask( SIG_SETMASK, &nextp->isr_level, &currentp->isr_level );
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+
+ if (setjmp(currentp->regs) == 0) { /* Save the current context */
+ longjmp(nextp->regs, 0); /* Switch to the new context */
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+ }
+
+}
+
+/*PAGE
+ *
+ * _CPU_Save_float_context
+ */
+
+void _CPU_Save_float_context(
+ Context_Control_fp *fp_context
+)
+{
+}
+
+/*PAGE
+ *
+ * _CPU_Restore_float_context
+ */
+
+void _CPU_Restore_float_context(
+ Context_Control_fp *fp_context
+)
+{
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Disable_support
+ */
+
+unsigned32 _CPU_ISR_Disable_support(void)
+{
+ int status;
+ sigset_t old_mask;
+
+ status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask);
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+
+ if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t)))
+ return 1;
+
+ return 0;
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Enable
+ */
+
+void _CPU_ISR_Enable(
+ unsigned32 level
+)
+{
+ int status;
+
+ if (level == 0)
+ status = sigprocmask(SIG_UNBLOCK, &_CPU_Signal_mask, 0);
+ else
+ status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, 0);
+
+ if ( status )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ status
+ );
+}
+
+/*PAGE
+ *
+ * _CPU_ISR_Handler
+ *
+ * External interrupt handler.
+ * This is installed as a UNIX signal handler.
+ * It vectors out to specific user interrupt handlers.
+ */
+
+void _CPU_ISR_Handler(int vector)
+{
+ extern void _Thread_Dispatch(void);
+ extern unsigned32 _Thread_Dispatch_disable_level;
+ extern boolean _Context_Switch_necessary;
+
+ if (_ISR_Nest_level++ == 0) {
+ /* switch to interrupt stack */
+ }
+
+ _Thread_Dispatch_disable_level++;
+
+ if (_ISR_Vector_table[vector]) {
+ _ISR_Vector_table[vector](vector);
+ } else {
+ _CPU_Stray_signal(vector);
+ }
+
+ if (_ISR_Nest_level-- == 0) {
+ /* switch back to original stack */
+ }
+
+ _Thread_Dispatch_disable_level--;
+
+ if (_Thread_Dispatch_disable_level == 0 &&
+ (_Context_Switch_necessary || _ISR_Signals_to_thread_executing)) {
+ _ISR_Signals_to_thread_executing = FALSE;
+ _CPU_ISR_Enable(0);
+ _Thread_Dispatch();
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_Stray_signal
+ */
+
+void _CPU_Stray_signal(int sig_num)
+{
+ char buffer[ 4 ];
+
+ /*
+ * print "stray" msg about ones which that might mean something
+ * Avoid using the stdio section of the library.
+ * The following is generally safe.
+ */
+
+ switch (sig_num)
+ {
+ case SIGCLD:
+ break;
+
+ default:
+ {
+ /*
+ * We avoid using the stdio section of the library.
+ * The following is generally safe
+ */
+
+ int digit;
+ int number = sig_num;
+ int len = 0;
+
+ digit = number / 100;
+ number %= 100;
+ if (digit) buffer[len++] = '0' + digit;
+
+ digit = number / 10;
+ number %= 10;
+ if (digit || len) buffer[len++] = '0' + digit;
+
+ digit = number;
+ buffer[len++] = '0' + digit;
+
+ buffer[ len++ ] = '\n';
+
+ write( 2, "Stray signal ", 13 );
+ write( 2, buffer, len );
+
+ }
+ }
+
+ /*
+ * If it was a "fatal" signal, then exit here
+ * If app code has installed a hander for one of these, then
+ * we won't call _CPU_Stray_signal, so this is ok.
+ */
+
+ switch (sig_num) {
+ case SIGINT:
+ case SIGHUP:
+ case SIGQUIT:
+ case SIGILL:
+#ifdef SIGEMT
+ case SIGEMT:
+#endif
+ case SIGKILL:
+ case SIGBUS:
+ case SIGSEGV:
+ case SIGTERM:
+ _CPU_Fatal_error(0x100 + sig_num);
+ }
+}
+
+/*PAGE
+ *
+ * _CPU_Fatal_error
+ */
+
+void _CPU_Fatal_error(unsigned32 error)
+{
+ setitimer(ITIMER_REAL, 0, 0);
+
+ if ( error ) {
+#ifdef RTEMS_DEBUG
+ abort();
+#endif
+ if (getenv("RTEMS_DEBUG"))
+ abort();
+ }
+
+ _exit(error);
+}
+
+/*
+ * Special Purpose Routines to hide the use of UNIX system calls.
+ */
+
+int _CPU_Get_clock_vector( void )
+{
+ return SIGALRM;
+}
+
+void _CPU_Start_clock(
+ int microseconds
+)
+{
+ struct itimerval new;
+
+ new.it_value.tv_sec = 0;
+ new.it_value.tv_usec = microseconds;
+ new.it_interval.tv_sec = 0;
+ new.it_interval.tv_usec = microseconds;
+
+ setitimer(ITIMER_REAL, &new, 0);
+}
+
+void _CPU_Stop_clock( void )
+{
+ struct itimerval new;
+ struct sigaction act;
+
+ /*
+ * Set the SIGALRM signal to ignore any last
+ * signals that might come in while we are
+ * disarming the timer and removing the interrupt
+ * vector.
+ */
+
+ (void) memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_IGN;
+
+ sigaction(SIGALRM, &act, 0);
+
+ (void) memset(&new, 0, sizeof(new));
+ setitimer(ITIMER_REAL, &new, 0);
+}
+
+int _CPU_SHM_Semid;
+extern void fix_syscall_errno( void );
+
+void _CPU_SHM_Init(
+ unsigned32 maximum_nodes,
+ boolean is_master_node,
+ void **shm_address,
+ unsigned32 *shm_length
+)
+{
+ int i;
+ int shmid;
+ char *shm_addr;
+ key_t shm_key;
+ key_t sem_key;
+ int status;
+ int shm_size;
+
+ if (getenv("RTEMS_SHM_KEY"))
+ shm_key = strtol(getenv("RTEMS_SHM_KEY"), 0, 0);
+ else
+#ifdef RTEMS_SHM_KEY
+ shm_key = RTEMS_SHM_KEY;
+#else
+ shm_key = 0xa000;
+#endif
+
+ if (getenv("RTEMS_SHM_SIZE"))
+ shm_size = strtol(getenv("RTEMS_SHM_SIZE"), 0, 0);
+ else
+#ifdef RTEMS_SHM_SIZE
+ shm_size = RTEMS_SHM_SIZE;
+#else
+ shm_size = 64 * 1024;
+#endif
+
+ if (getenv("RTEMS_SHM_SEMAPHORE_KEY"))
+ sem_key = strtol(getenv("RTEMS_SHM_SEMAPHORE_KEY"), 0, 0);
+ else
+#ifdef RTEMS_SHM_SEMAPHORE_KEY
+ sem_key = RTEMS_SHM_SEMAPHORE_KEY;
+#else
+ sem_key = 0xa001;
+#endif
+
+ shmid = shmget(shm_key, shm_size, IPC_CREAT | 0660);
+ if ( shmid == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "shmget" );
+ _CPU_Fatal_halt( 0xdead0001 );
+ }
+
+ shm_addr = shmat(shmid, (char *)0, SHM_RND);
+ if ( shm_addr == (void *)-1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "shmat" );
+ _CPU_Fatal_halt( 0xdead0002 );
+ }
+
+ _CPU_SHM_Semid = semget(sem_key, maximum_nodes + 1, IPC_CREAT | 0660);
+ if ( _CPU_SHM_Semid == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ perror( "semget" );
+ _CPU_Fatal_halt( 0xdead0003 );
+ }
+
+ if ( is_master_node ) {
+ for ( i=0 ; i <= maximum_nodes ; i++ ) {
+#if defined(solaris2)
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ ushort *array;
+ } help;
+
+ help.val = 1;
+ status = semctl( _CPU_SHM_Semid, i, SETVAL, help );
+#endif
+#if defined(hpux)
+ status = semctl( _CPU_SHM_Semid, i, SETVAL, 1 );
+#endif
+
+ fix_syscall_errno(); /* in case of newlib */
+ if ( status == -1 ) {
+ _CPU_Fatal_halt( 0xdead0004 );
+ }
+ }
+ }
+
+ *shm_address = shm_addr;
+ *shm_length = shm_size;
+
+}
+
+int _CPU_Get_pid( void )
+{
+ return getpid();
+}
+
+/*
+ * Define this to use signals for MPCI shared memory driver.
+ * If undefined, the shared memory driver will poll from the
+ * clock interrupt.
+ * Ref: ../shmsupp/getcfg.c
+ *
+ * BEWARE:: many UN*X kernels and debuggers become severely confused when
+ * debugging programs which use signals. The problem is *much*
+ * worse when using multiple signals, since ptrace(2) tends to
+ * drop all signals except 1 in the case of multiples.
+ * On hpux9, this problem was so bad, we couldn't use interrupts
+ * with the shared memory driver if we ever hoped to debug
+ * RTEMS programs.
+ * Maybe systems that use /proc don't have this problem...
+ */
+
+
+int _CPU_SHM_Get_vector( void )
+{
+#ifdef CPU_USE_SHM_INTERRUPTS
+ return SIGUSR1;
+#else
+ return 0;
+#endif
+}
+
+void _CPU_SHM_Send_interrupt(
+ int pid,
+ int vector
+)
+{
+ kill((pid_t) pid, vector);
+}
+
+void _CPU_SHM_Lock(
+ int semaphore
+)
+{
+ struct sembuf sb;
+ int status;
+
+ sb.sem_num = semaphore;
+ sb.sem_op = -1;
+ sb.sem_flg = 0;
+
+ while (1) {
+ status = semop(_CPU_SHM_Semid, &sb, 1);
+ if ( status >= 0 )
+ break;
+ if ( status == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ if (errno == EINTR)
+ continue;
+ perror("shm lock");
+ _CPU_Fatal_halt( 0xdead0005 );
+ }
+ }
+
+}
+
+void _CPU_SHM_Unlock(
+ int semaphore
+)
+{
+ struct sembuf sb;
+ int status;
+
+ sb.sem_num = semaphore;
+ sb.sem_op = 1;
+ sb.sem_flg = 0;
+
+ while (1) {
+ status = semop(_CPU_SHM_Semid, &sb, 1);
+ if ( status >= 0 )
+ break;
+
+ if ( status == -1 ) {
+ fix_syscall_errno(); /* in case of newlib */
+ if (errno == EINTR)
+ continue;
+ perror("shm unlock");
+ _CPU_Fatal_halt( 0xdead0006 );
+ }
+ }
+
+}
diff --git a/cpukit/score/include/rtems/debug.h b/cpukit/score/include/rtems/debug.h
new file mode 100644
index 0000000000..afe6251bbe
--- /dev/null
+++ b/cpukit/score/include/rtems/debug.h
@@ -0,0 +1,98 @@
+/* debug.h
+ *
+ * This include file contains the information pertaining to the debug
+ * support within RTEMS. It is currently cast in the form of a
+ * Manager since it is externally accessible.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_DEBUG_h
+#define __RTEMS_DEBUG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type is used to manage the debug mask.
+ */
+
+typedef unsigned32 rtems_debug_control;
+
+/*
+ * These constants represent various classes of debugging.
+ */
+
+#define RTEMS_DEBUG_ALL_MASK 0xffffffff
+#define RTEMS_DEBUG_REGION 0x00000001
+
+/*
+ * This variable contains the current debug level.
+ */
+
+EXTERN rtems_debug_control _Debug_Level;
+
+/*
+ * _Debug_Manager_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _Debug_Manager_initialization( void );
+
+/*
+ * rtems_debug_enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables the specified types of debug checks.
+ */
+
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+);
+
+/*
+ * rtems_debug_disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables the specified types of debug checks.
+ */
+
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+);
+
+/*
+ *
+ * _Debug_Is_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the requested debug level is
+ * enabled, and FALSE otherwise.
+ */
+
+boolean _Debug_Is_enabled(
+ rtems_debug_control level
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/address.h b/cpukit/score/include/rtems/score/address.h
new file mode 100644
index 0000000000..d9be75ee4b
--- /dev/null
+++ b/cpukit/score/include/rtems/score/address.h
@@ -0,0 +1,31 @@
+/* address.h
+ *
+ * This include file contains the information required to manipulate
+ * physical addresses.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_ADDRESSES_h
+#define __RTEMS_ADDRESSES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h
new file mode 100644
index 0000000000..44e7bc8dd3
--- /dev/null
+++ b/cpukit/score/include/rtems/score/apiext.h
@@ -0,0 +1,102 @@
+/* apiext.h
+ *
+ * XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __API_EXTENSIONS_h
+#define __API_EXTENSIONS_h
+
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The control structure which defines the points at which an API
+ * can add an extension to the system initialization thread.
+ */
+
+typedef void (*API_extensions_Predriver_hook)(void);
+typedef void (*API_extensions_Postdriver_hook)(void);
+typedef void (*API_extensions_Postswitch_hook)(
+ Thread_Control *
+ );
+
+
+typedef struct {
+ Chain_Node Node;
+ API_extensions_Predriver_hook predriver_hook;
+ API_extensions_Postdriver_hook postdriver_hook;
+ API_extensions_Postswitch_hook postswitch_hook;
+} API_extensions_Control;
+
+/*
+ * This is the list of API extensions to the system initialization.
+ */
+
+EXTERN Chain_Control _API_extensions_List;
+
+/*
+ * _API_extensions_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the API extension handler.
+ *
+ */
+
+void _API_extensions_Initialization( void );
+
+/*
+ * _API_extensions_Add
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Add(
+ API_extensions_Control *the_extension
+);
+
+/*
+ * _API_extensions_Run_predriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_predriver( void );
+
+/*
+ * _API_extensions_Run_postdriver
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postdriver( void );
+
+/*
+ * _API_extensions_Run_postswitch
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _API_extensions_Run_postswitch( void );
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/bitfield.h b/cpukit/score/include/rtems/score/bitfield.h
new file mode 100644
index 0000000000..6dbf1e0ba0
--- /dev/null
+++ b/cpukit/score/include/rtems/score/bitfield.h
@@ -0,0 +1,98 @@
+/* bitfield.h
+ *
+ * This include file contains all bit field manipulation routines.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_BITFIELD_h
+#define __RTEMS_BITFIELD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Bitfield_Find_first_bit
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the bit_number of the first bit set
+ * in the specified value. The correspondence between bit_number
+ * and actual bit position is processor dependent. The search for
+ * the first bit set may run from most to least significant bit
+ * or vice-versa.
+ *
+ * NOTE:
+ *
+ * This routine is used when the executing thread is removed
+ * from the ready state and, as a result, its performance has a
+ * significant impact on the performance of the executive as a whole.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
+
+#ifndef INIT
+ extern const unsigned char __log2table[256];
+#else
+const unsigned char __log2table[256] = {
+ 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
+
+#endif
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ _CPU_Bitfield_Find_first_bit( _value, _bit_number )
+
+#else
+
+/*
+ * The following must be a macro because if a CPU specific version
+ * is used it will most likely use inline assembly.
+ */
+
+#define _Bitfield_Find_first_bit( _value, _bit_number ) \
+ { \
+ register __value = (_value); \
+ register const unsigned char *__p = __log2table; \
+ \
+ if ( __value < 0x100 ) \
+ (_bit_number) = __p[ __value ] + 8; \
+ else \
+ (_bit_number) = __p[ __value >> 8 ]; \
+ }
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/chain.h b/cpukit/score/include/rtems/score/chain.h
new file mode 100644
index 0000000000..11c1f8aee0
--- /dev/null
+++ b/cpukit/score/include/rtems/score/chain.h
@@ -0,0 +1,168 @@
+/* chain.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Doubly Linked Chain Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CHAIN_h
+#define __RTEMS_CHAIN_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/address.h>
+
+/*
+ * This is used to manage each element (node) which is placed
+ * on a chain.
+ *
+ * NOTE: Typically, a more complicated structure will use the
+ * chain package. The more complicated structure will
+ * include a chain node as the first element in its
+ * control structure. It will then call the chain package
+ * with a pointer to that node element. The node pointer
+ * and the higher level structure start at the same address
+ * so the user can cast the pointers back and forth.
+ *
+ */
+
+typedef struct Chain_Node_struct Chain_Node;
+
+struct Chain_Node_struct {
+ Chain_Node *next;
+ Chain_Node *previous;
+};
+
+/*
+ * This is used to manage a chain. A chain consists of a doubly
+ * linked list of zero or more nodes.
+ *
+ * NOTE: This implementation does not require special checks for
+ * manipulating the first and last elements on the chain.
+ * To accomplish this the chain control structure is
+ * treated as two overlapping chain nodes. The permanent
+ * head of the chain overlays a node structure on the
+ * first and permanent_null fields. The permanent tail
+ * of the chain overlays a node structure on the
+ * permanent_null and last elements of the structure.
+ *
+ */
+
+typedef struct {
+ Chain_Node *first;
+ Chain_Node *permanent_null;
+ Chain_Node *last;
+} Chain_Control;
+
+/*
+ * _Chain_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_chain structure to manage the
+ * contiguous array of number_nodes nodes which starts at
+ * starting_address. Each node is of node_size bytes.
+ *
+ */
+
+void _Chain_Initialize(
+ Chain_Control *the_chain,
+ void *starting_address,
+ unsigned32 number_nodes,
+ unsigned32 node_size
+);
+
+/*
+ * _Chain_Get_first_unprotected
+ */
+
+#ifndef USE_INLINES
+Chain_Node *_Chain_Get_first_unprotected(
+ Chain_Control *the_chain
+);
+#endif
+
+/*
+ * _Chain_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It disables interrupts to insure the atomicity of the
+ * extract operation.
+ *
+ */
+
+void _Chain_Extract(
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It disables interrupts to insure the atomicity of the
+ * get operation.
+ *
+ */
+
+Chain_Node *_Chain_Get(
+ Chain_Control *the_chain
+);
+
+/*
+ * _Chain_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It disables interrupts to insure the atomicity
+ * of the extract operation.
+ *
+ */
+
+void _Chain_Insert(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+);
+
+/*
+ * _Chain_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * append operation.
+ *
+ */
+
+void _Chain_Append(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/chain.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h
new file mode 100644
index 0000000000..4cd1f1e4c5
--- /dev/null
+++ b/cpukit/score/include/rtems/score/context.h
@@ -0,0 +1,134 @@
+/* context.h
+ *
+ * This include file contains all information about a context.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CONTEXT_h
+#define __RTEMS_CONTEXT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/cpu.h>
+
+/*
+ * The following constant defines the number of bytes required
+ * to store a full floating point context.
+ */
+
+#define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE
+
+/*
+ * The following variable is set to TRUE when a reschedule operation
+ * has determined that the processor should be taken away from the
+ * currently executing thread and given to the heir thread.
+ */
+
+EXTERN boolean _Context_Switch_necessary;
+
+/*
+ * _Context_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes THE_CONTEXT such that the stack
+ * pointer, interrupt level, and entry point are correct for the
+ * thread's initial state.
+ */
+
+#define \
+ _Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp ) \
+ _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp )
+
+/*
+ * _Context_Switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current context into the EXECUTING
+ * context record and restores the context specified by HEIR.
+ */
+
+#define _Context_Switch( _executing, _heir ) \
+ _CPU_Context_switch( _executing, _heir )
+
+/*
+ * _Context_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine restarts the calling thread by restoring its initial
+ * stack pointer and returning to the thread's entry point.
+ */
+
+#define _Context_Restart_self( _the_context ) \
+ _CPU_Context_Restart_self( _the_context )
+
+/*
+ * _Context_Fp_start
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the floating
+ * point context save area. It is assumed that the are reserved
+ * for the floating point save area is large enough.
+ */
+
+#define _Context_Fp_start( _base, _offset ) \
+ _CPU_Context_Fp_start( (_base), (_offset) )
+
+/*
+ * _Context_Initialize_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the floating point context save
+ * area to contain an initial known state.
+ */
+
+#define _Context_Initialize_fp( _fp_area ) \
+ _CPU_Context_Initialize_fp( _fp_area )
+
+/*
+ * _Context_Restore_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine restores the floating point context contained
+ * in the FP_CONTEXT area. It is assumed that the current
+ * floating point context has been saved by a previous invocation
+ * of SAVE_FP.
+ */
+
+#define _Context_Restore_fp( _fp ) \
+ _CPU_Context_restore_fp( _fp )
+
+/*
+ * _Context_Save_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine saves the current floating point context
+ * in the FP_CONTEXT area.
+ */
+
+#define _Context_Save_fp( _fp ) \
+ _CPU_Context_save_fp( _fp )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/copyrt.h b/cpukit/score/include/rtems/score/copyrt.h
new file mode 100644
index 0000000000..c711ba09b3
--- /dev/null
+++ b/cpukit/score/include/rtems/score/copyrt.h
@@ -0,0 +1,42 @@
+/* copyrt.h
+ *
+ * This include file contains the copyright notice for RTEMS
+ * which is included in every binary copy of the executive.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_COPYRIGHT_h
+#define __RTEMS_COPYRIGHT_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef INIT
+
+const char _Copyright_Notice[] =
+"COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n\
+On-Line Applications Research Corporation (OAR).\n\
+All rights assigned to U.S. Government, 1994.\n";
+
+#else
+
+extern const char _Copyright_Notice[];
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/coremsg.h b/cpukit/score/include/rtems/score/coremsg.h
new file mode 100644
index 0000000000..b51e07ef61
--- /dev/null
+++ b/cpukit/score/include/rtems/score/coremsg.h
@@ -0,0 +1,274 @@
+/* coremsg.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Message queue Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
+#define __RTEMS_CORE_MESSAGE_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on message_queues.
+ */
+
+typedef void ( *CORE_message_queue_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * The following defines the data types needed to manipulate
+ * the contents of message buffers.
+ * Since msgs are variable length we just make a ptr to 1.
+ */
+
+typedef struct {
+ unsigned32 size;
+
+#ifndef __cplusplus
+ /* NOTE: [0] is gcc specific,
+ * but specifically disallowed by ANSI STD C++
+ * g++ warns about it, so we #ifdef it out to
+ * get rid of warnings when compiled by g++.
+ */
+ unsigned32 buffer[0];
+#endif
+
+} CORE_message_queue_Buffer;
+
+/*
+ * The following records define the organization of a message
+ * buffer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ CORE_message_queue_Buffer Contents;
+} CORE_message_queue_Buffer_control;
+
+/*
+ * Blocking disciplines for a message_queue.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
+} CORE_message_queue_Disciplines;
+
+/*
+ * The following enumerated type details the modes in which a message
+ * may be submitted to a message queue. The message may be posted
+ * in a send or urgent fashion.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_SEND_REQUEST = 0,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
+} CORE_message_queue_Submit_types;
+
+/*
+ * Core Message queue handler return statuses.
+ */
+
+typedef enum {
+ CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
+ CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
+ CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
+ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+} CORE_message_queue_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each message queue.
+ */
+
+typedef struct {
+ CORE_message_queue_Disciplines discipline;
+} CORE_message_queue_Attributes;
+
+/*
+ * The following defines the type for a Notification handler. A notification
+ * handler is invoked when the message queue makes a 0->1 transition on
+ * pending messages.
+ */
+
+typedef void (*CORE_message_queue_Notify_Handler)( void * );
+
+/*
+ * The following defines the control block used to manage each
+ * counting message_queue.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_message_queue_Attributes Attributes;
+ unsigned32 maximum_pending_messages;
+ unsigned32 number_of_pending_messages;
+ unsigned32 maximum_message_size;
+ Chain_Control Pending_messages;
+ CORE_message_queue_Buffer *message_buffers;
+ CORE_message_queue_Notify_Handler notify_handler;
+ void *notify_argument;
+ Chain_Control Inactive_messages;
+} CORE_message_queue_Control;
+
+/*
+ * _CORE_message_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the message_queue based on the parameters passed.
+ */
+
+boolean _CORE_message_queue_Initialize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Classes the_class,
+ CORE_message_queue_Attributes *the_message_queue_attributes,
+ unsigned32 maximum_pending_messages,
+ unsigned32 maximum_message_size,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_message_queue_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function closes a message by returning all allocated space and
+ * flushing the message_queue's task wait queue.
+ */
+
+void _CORE_message_queue_Close(
+ CORE_message_queue_Control *the_message_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ *
+ * _CORE_message_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This function flushes the message_queue's task wait queue. The number
+ * messages flushed from the queue is returned.
+ *
+ */
+
+unsigned32 _CORE_message_queue_Flush(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ * _CORE_message_queue_Flush_support
+ *
+ * DESCRIPTION:
+ *
+ * This routine flushes all outstanding messages and returns
+ * them to the inactive message chain.
+ */
+
+unsigned32 _CORE_message_queue_Flush_support(
+ CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *
+ * _CORE_message_queue_Broadcast
+ *
+ * DESCRIPTION:
+ *
+ * This function sends a message for every thread waiting on the queue and
+ * returns the number of threads made ready by the message.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Submit
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+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
+);
+
+/*
+ *
+ * _CORE_message_queue_Seize
+ *
+ * DESCRIPTION:
+ *
+ * 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.
+ *
+ */
+
+void _CORE_message_queue_Seize(
+ CORE_message_queue_Control *the_message_queue,
+ Objects_Id id,
+ void *buffer,
+ unsigned32 *size,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremsg.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
new file mode 100644
index 0000000000..73b7e34417
--- /dev/null
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -0,0 +1,171 @@
+/* mutex.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Mutex Handler. A mutex is an enhanced version of the standard
+ * Dijkstra binary semaphore used to provide synchronization and mutual
+ * exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_MUTEX_h
+#define __RTEMS_CORE_MUTEX_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on mutexes.
+ */
+
+typedef void ( *CORE_mutex_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a mutex.
+ */
+
+typedef enum {
+ CORE_MUTEX_DISCIPLINES_FIFO,
+ CORE_MUTEX_DISCIPLINES_PRIORITY,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT,
+ CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+} CORE_mutex_Disciplines;
+
+/*
+ * Mutex handler return statuses.
+ */
+
+typedef enum {
+ CORE_MUTEX_STATUS_SUCCESSFUL,
+ CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+ CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
+ CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
+ CORE_MUTEX_WAS_DELETED,
+ CORE_MUTEX_TIMEOUT
+} CORE_mutex_Status;
+
+/*
+ * Locked and unlocked values
+ */
+
+#define CORE_MUTEX_UNLOCKED 1
+#define CORE_MUTEX_LOCKED 0
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each mutex.
+ */
+
+typedef struct {
+ boolean allow_nesting;
+ CORE_mutex_Disciplines discipline;
+ Priority_Control priority_ceiling;
+} CORE_mutex_Attributes;
+
+/*
+ * The following defines the control block used to manage each mutex.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_mutex_Attributes Attributes;
+ unsigned32 lock;
+ unsigned32 nest_count;
+ Thread_Control *holder;
+ Objects_Id holder_id;
+} CORE_mutex_Control;
+
+/*
+ * _CORE_mutex_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the mutex based on the parameters passed.
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_mutex_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_mutex.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+);
+
+/*
+ * _CORE_mutex_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a mutex by flushing the associated
+ * wait queue.
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coremutex.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h
new file mode 100644
index 0000000000..88f712be5d
--- /dev/null
+++ b/cpukit/score/include/rtems/score/coresem.h
@@ -0,0 +1,156 @@
+/* core_sem.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Counting Semaphore Handler. A counting semaphore is the
+ * standard Dijkstra binary semaphore used to provide synchronization
+ * and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h
+#define __RTEMS_CORE_COUNTING_SEMAPHORE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following type defines the callout which the API provides
+ * to support global/multiprocessor operations on semaphores.
+ */
+
+typedef void ( *CORE_semaphore_API_mp_support_callout )(
+ Thread_Control *,
+ Objects_Id
+ );
+
+/*
+ * Blocking disciplines for a semaphore.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_DISCIPLINES_FIFO,
+ CORE_SEMAPHORE_DISCIPLINES_PRIORITY
+} CORE_semaphore_Disciplines;
+
+/*
+ * Core Semaphore handler return statuses.
+ */
+
+typedef enum {
+ CORE_SEMAPHORE_STATUS_SUCCESSFUL,
+ CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
+ CORE_SEMAPHORE_WAS_DELETED,
+ CORE_SEMAPHORE_TIMEOUT
+} CORE_semaphore_Status;
+
+/*
+ * The following defines the control block used to manage the
+ * attributes of each semaphore.
+ */
+
+typedef struct {
+ CORE_semaphore_Disciplines discipline;
+} CORE_semaphore_Attributes;
+
+/*
+ * The following defines the control block used to manage each
+ * counting semaphore.
+ */
+
+typedef struct {
+ Thread_queue_Control Wait_queue;
+ CORE_semaphore_Attributes Attributes;
+ unsigned32 count;
+} CORE_semaphore_Control;
+
+/*
+ * _CORE_semaphore_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the semaphore based on the parameters passed.
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+);
+
+/*
+ * _CORE_semaphore_Seize
+ *
+ * DESCRIPTION:
+ *
+ * This routine attempts to receive a unit from the_semaphore.
+ * If a unit is available or if the wait flag is FALSE, then the routine
+ * returns. Otherwise, the calling task is blocked until a unit becomes
+ * available.
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _CORE_semaphore_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the semaphore. If a task was blocked waiting
+ * for a unit from this semaphore, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the semaphore.
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+);
+
+/*
+ * _CORE_semaphore_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine assists in the deletion of a semaphore by flushing the
+ * associated wait queue.
+ */
+
+void _CORE_semaphore_Flush(
+ CORE_semaphore_Control *the_semaphore,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/coresem.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h
new file mode 100644
index 0000000000..c1a0650d0a
--- /dev/null
+++ b/cpukit/score/include/rtems/score/heap.h
@@ -0,0 +1,226 @@
+/* heap.h
+ *
+ * This include file contains the information pertaining to the Heap
+ * Handler. A heap is a doubly linked list of variable size
+ * blocks which are allocated using the first fit method. Garbage
+ * collection is performed each time a block is returned to the heap by
+ * coalescing neighbor blocks. Control information for both allocated
+ * and unallocated blocks is contained in the heap space. A heap header
+ * contains control information for the heap.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_HEAP_h
+#define __RTEMS_HEAP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Status codes for heap_extend
+ */
+
+typedef enum {
+ HEAP_EXTEND_SUCCESSFUL,
+ HEAP_EXTEND_ERROR,
+ HEAP_EXTEND_NOT_IMPLEMENTED
+} Heap_Extend_status;
+
+/*
+ * Constants used in the size/used field of each heap block to
+ * indicate when a block is free or in use.
+ */
+
+#define HEAP_BLOCK_USED 1 /* indicates block is in use */
+#define HEAP_BLOCK_FREE 0 /* indicates block is free */
+
+/*
+ * The size/used field value for the dummy front and back flags.
+ */
+
+#define HEAP_DUMMY_FLAG (0 + HEAP_BLOCK_USED)
+
+/*
+ * The following constants reflect various requirements of the
+ * heap data structures which impact the management of a heap.
+ *
+ * NOTE: Because free block overhead is greater than used block
+ * overhead AND a portion of the allocated space is from
+ * the extra free block overhead, the absolute lower bound
+ * of the minimum fragment size is equal to the size of
+ * the free block overhead.
+ */
+
+#define HEAP_OVERHEAD \
+ (sizeof( unsigned32 ) * 2) /* size dummy first and last blocks */
+#define HEAP_BLOCK_USED_OVERHEAD \
+ (sizeof( void * ) * 2) /* num bytes overhead in used block */
+#define HEAP_MINIMUM_SIZE \
+ (HEAP_OVERHEAD + sizeof (Heap_Block))
+ /* min number of bytes the user may */
+ /* specify for the heap size */
+
+/*
+ * The following defines the data structure used to manage
+ * individual blocks in a heap. When the block is allocated, the
+ * next and previous fields are not used by the Heap Handler
+ * and thus the address returned for the block starts at
+ * the address of the next field.
+ *
+ * NOTE: The next and previous pointers are only valid when the
+ * block is free. Caution must be exercised to insure that
+ * allocated blocks are large enough to contain them and
+ * that they are not accidentally overwritten when the
+ * block is actually allocated.
+ */
+
+typedef struct Heap_Block_struct Heap_Block;
+
+struct Heap_Block_struct {
+ unsigned32 back_flag; /* size and status of prev block */
+ unsigned32 front_flag; /* size and status of block */
+ Heap_Block *next; /* pointer to next block */
+ Heap_Block *previous; /* pointer to previous block */
+};
+
+/*
+ * The following defines the control block used to manage each heap.
+ *
+ * NOTE:
+ *
+ * This structure is layed out such that it can be used a a dummy
+ * first and last block on the free block chain. The extra padding
+ * insures the dummy last block is the correct size.
+ *
+ * The first Heap_Block starts at first while the second starts at
+ * final. This is effectively the same trick as is used in the Chain
+ * Handler.
+ */
+
+typedef struct {
+ Heap_Block *start; /* first valid block address in heap */
+ Heap_Block *final; /* last valid block address in heap */
+
+ Heap_Block *first; /* pointer to first block in heap */
+ Heap_Block *permanent_null; /* always NULL pointer */
+ Heap_Block *last; /* pointer to last block in heap */
+ unsigned32 page_size; /* allocation unit */
+ unsigned32 reserved;
+} Heap_Control;
+
+/*
+ * _Heap_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_heap record to manage the
+ * contiguous heap of size bytes which starts at starting_address.
+ * Blocks of memory are allocated from the heap in multiples of
+ * page_size byte units.
+ */
+
+unsigned32 _Heap_Initialize(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 page_size
+);
+
+/*
+ * _Heap_Extend
+ *
+ * DESCRIPTION:
+ *
+ * This routine grows the_heap memory area using the size bytes which
+ * begin at starting_address.
+ */
+
+Heap_Extend_status _Heap_Extend(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 size,
+ unsigned32 *amount_extended
+);
+
+/*
+ * _Heap_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * DESCRIPTION:
+ *
+ * This function attempts to allocate a block of size bytes from
+ * the_heap. If insufficient memory is free in the_heap to allocate
+ * a block of the requested size, then NULL is returned.
+ */
+
+void *_Heap_Allocate(
+ Heap_Control *the_heap,
+ unsigned32 size
+);
+
+/*
+ * _Heap_Size_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This kernel routine sets size to the size of the given heap block.
+ * It returns TRUE if the starting_address is in the heap, and FALSE
+ * otherwise.
+ */
+
+boolean _Heap_Size_of_user_area(
+ Heap_Control *the_heap,
+ void *starting_address,
+ unsigned32 *size
+);
+
+/*
+ * _Heap_Free
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the block of memory which begins
+ * at starting_address to the_heap. Any coalescing which is
+ * possible with the freeing of this routine is performed.
+ */
+
+boolean _Heap_Free(
+ Heap_Control *the_heap,
+ void *start_address
+);
+
+/*
+ * _Heap_Walk
+ *
+ * DESCRIPTION:
+ *
+ * This routine walks the heap to verify its integrity.
+ */
+
+void _Heap_Walk(
+ Heap_Control *the_heap,
+ int source,
+ boolean do_dump
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/heap.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
new file mode 100644
index 0000000000..b9b2a3c51a
--- /dev/null
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -0,0 +1,94 @@
+/* interr.h
+ *
+ * This include file contains constants and prototypes related
+ * to the Internal Error Handler.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_INTERNAL_ERROR_h
+#define __RTEMS_INTERNAL_ERROR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This type lists the possible sources from which an error
+ * can be reported.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_CORE,
+ INTERNAL_ERROR_RTEMS_API
+} Internal_errors_Source;
+
+/*
+ * A list of errors which are generated internally by the executive core.
+ */
+
+typedef enum {
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
+ INTERNAL_ERROR_NO_CPU_TABLE,
+ INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS,
+ INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
+ INTERNAL_ERROR_WORKSPACE_ALLOCATION,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
+ INTERNAL_ERROR_THREAD_EXITTED,
+ INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
+ INTERNAL_ERROR_INVALID_NODE,
+ INTERNAL_ERROR_NO_MPCI,
+ INTERNAL_ERROR_BAD_PACKET,
+ INTERNAL_ERROR_OUT_OF_PACKETS,
+ INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
+ INTERNAL_ERROR_OUT_OF_PROXIES,
+ INTERNAL_ERROR_INVALID_GLOBAL_ID,
+ INTERNAL_ERROR_BAD_STACK_HOOK
+} Internal_errors_Core_list;
+
+/*
+ * This type holds the fatal error information.
+ */
+
+typedef struct {
+ Internal_errors_Source the_source;
+ boolean is_internal;
+ unsigned32 the_error;
+} Internal_errors_Information;
+
+/*
+ * When a fatal error occurs, the error information is stored here.
+ */
+
+EXTERN Internal_errors_Information Internal_errors_What_happened;
+
+/*
+ * _Internal_error_Occurred
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the application or the executive itself
+ * determines that a fatal error has occurred.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/isr.h b/cpukit/score/include/rtems/score/isr.h
new file mode 100644
index 0000000000..cf8f4cad59
--- /dev/null
+++ b/cpukit/score/include/rtems/score/isr.h
@@ -0,0 +1,224 @@
+/* isr.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the management of processor interrupt levels. This handler
+ * supports interrupt critical sections, vectoring of user interrupt
+ * handlers, nesting of interrupts, and manipulating interrupt levels.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_h
+#define __ISR_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * the interrupt level portion of the status register.
+ */
+
+typedef unsigned32 ISR_Level;
+
+/*
+ * The following type defines the type used to manage the vectors.
+ */
+
+typedef unsigned32 ISR_Vector_number;
+
+/*
+ * Return type for ISR Handler
+ */
+
+typedef void ISR_Handler;
+
+/*
+ * Pointer to an ISR Handler
+ */
+
+typedef ISR_Handler ( *ISR_Handler_entry )(
+ ISR_Vector_number
+ );
+/*
+ * This constant promotes out the number of vectors truly supported by
+ * the current CPU being used. This is usually the number of distinct vectors
+ * the cpu can vector.
+ */
+
+#define ISR_NUMBER_OF_VECTORS CPU_INTERRUPT_NUMBER_OF_VECTORS
+
+/*
+ * This constant promotes out the highest valid interrupt vector number.
+ */
+
+#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER
+
+/*
+ * The following is TRUE if signals have been sent to the currently
+ * executing thread by an ISR handler.
+ */
+
+EXTERN boolean _ISR_Signals_to_thread_executing;
+
+/*
+ * The following contains the interrupt service routine nest level.
+ * When this variable is zero, a thread is executing.
+ */
+
+EXTERN unsigned32 _ISR_Nest_level;
+
+/*
+ * The following declares the Vector Table. Application
+ * interrupt service routines are vectored by the ISR Handler via this table.
+ */
+
+EXTERN ISR_Handler_entry _ISR_Vector_table[ ISR_NUMBER_OF_VECTORS ];
+
+/*
+ * _ISR_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _ISR_Handler_initialization ( void );
+
+/*
+ * _ISR_Disable
+ *
+ * DESCRIPTION:
+ *
+ * This routine disables all interrupts so that a critical section
+ * of code can be executing without being interrupted. Upon return,
+ * the argument _level will contain the previous interrupt mask level.
+ */
+
+#define _ISR_Disable( _level ) \
+ _CPU_ISR_Disable( _level )
+
+/*
+ * _ISR_Enable
+ *
+ * DESCRIPTION:
+ *
+ * This routine enables interrupts to the previous interrupt mask
+ * LEVEL. It is used at the end of a critical section of code to
+ * enable interrupts so they can be processed again.
+ */
+
+#define _ISR_Enable( _level ) \
+ _CPU_ISR_Enable( _level )
+
+/*
+ * _ISR_Flash
+ *
+ * DESCRIPTION:
+ *
+ * This routine temporarily enables interrupts to the previous
+ * interrupt mask level and then disables all interrupts so that
+ * the caller can continue into the second part of a critical
+ * section. This routine is used to temporarily enable interrupts
+ * during a long critical section. It is used in long sections of
+ * critical code when a point is reached at which interrupts can
+ * be temporarily enabled. Deciding where to flash interrupts
+ * in a long critical section is often difficult and the point
+ * must be selected with care to insure that the critical section
+ * properly protects itself.
+ */
+
+#define _ISR_Flash( _level ) \
+ _CPU_ISR_Flash( _level )
+
+/*
+ * _ISR_Install_vector
+ *
+ * DESCRIPTION:
+ *
+ * This routine installs new_handler as the interrupt service routine
+ * for the specified vector. The previous interrupt service routine is
+ * returned as old_handler.
+ */
+
+#define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \
+ _CPU_ISR_install_vector( _vector, _new_handler, _old_handler )
+
+/*
+ * _ISR_Get_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current interrupt level.
+ */
+
+#define _ISR_Get_level() \
+ _CPU_ISR_Get_level()
+
+/*
+ * _ISR_Set_level
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current interrupt level to that specified
+ * by new_level. The new interrupt level is effective when the
+ * routine exits.
+ */
+
+#define _ISR_Set_level( _new_level ) \
+ _CPU_ISR_Set_level( _new_level )
+
+/*
+ * _ISR_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the interrupt dispatcher. ALL interrupts
+ * are vectored to this routine so that minimal context can be saved
+ * and setup performed before the application's high-level language
+ * interrupt service routine is invoked. After the application's
+ * interrupt service routine returns control to this routine, it
+ * will determine if a thread dispatch is necessary. If so, it will
+ * insure that the necessary thread scheduling operations are
+ * performed when the outermost interrupt service routine exits.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Handler( void );
+
+/*
+ * _ISR_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine provides a wrapper so that the routine
+ * _Thread_Dispatch can be invoked when a reschedule is necessary
+ * at the end of the outermost interrupt service routine. This
+ * wrapper is necessary to establish the processor context needed
+ * by _Thread_Dispatch and to save the processor context which is
+ * corrupted by _Thread_Dispatch. This context typically consists
+ * of registers which are not preserved across routine invocations.
+ *
+ * NOTE: Implemented in assembly language.
+ */
+
+void _ISR_Dispatch( void );
+
+#include <rtems/score/isr.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/mpci.h b/cpukit/score/include/rtems/score/mpci.h
new file mode 100644
index 0000000000..25d7ac4094
--- /dev/null
+++ b/cpukit/score/include/rtems/score/mpci.h
@@ -0,0 +1,411 @@
+/* mpci.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the MPCI layer. It provides mechanisms to utilize packets.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MPCI_h
+#define __MPCI_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/coresem.h>
+
+/*
+ * The following constants define the stack size requirements for
+ * the system threads.
+ */
+
+#define MPCI_RECEIVE_SERVER_STACK_SIZE \
+ ( STACK_MINIMUM_SIZE + \
+ CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \
+ _CPU_Table.extra_mpci_receive_server_stack \
+ )
+
+/*
+ * The following defines the node number used when a broadcast is desired.
+ */
+
+#define MPCI_ALL_NODES 0
+
+/*
+ * For packets associated with requests that don't already have a timeout,
+ * use the one specified by this MPCI driver. The value specified by
+ * the MPCI driver sets an upper limit on how long a remote request
+ * should take to complete.
+ */
+
+#define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF
+
+/*
+ * The following records define the Multiprocessor Communications
+ * Interface (MPCI) Table. This table defines the user-provided
+ * MPCI which is a required part of a multiprocessor system.
+ *
+ * For non-blocking local operations that become remote operations,
+ * we need a timeout. This is a per-driver timeout: default_timeout
+ */
+
+typedef void MPCI_Entry;
+
+typedef MPCI_Entry ( *MPCI_initialization_entry )( void );
+
+typedef MPCI_Entry ( *MPCI_get_packet_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef MPCI_Entry ( *MPCI_return_packet_entry )(
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_send_entry )(
+ unsigned32,
+ MP_packet_Prefix *
+ );
+
+typedef MPCI_Entry ( *MPCI_receive_entry )(
+ MP_packet_Prefix **
+ );
+
+typedef struct {
+ unsigned32 default_timeout; /* in ticks */
+ unsigned32 maximum_packet_size;
+ MPCI_initialization_entry initialization;
+ MPCI_get_packet_entry get_packet;
+ MPCI_return_packet_entry return_packet;
+ MPCI_send_entry send_packet;
+ MPCI_receive_entry receive_packet;
+} MPCI_Control;
+
+/*
+ * The following defines the type for packet processing routines
+ * invoked by the MPCI Receive server.
+ */
+
+typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
+
+/*
+ * The following enumerated type defines the list of
+ * internal MP operations.
+ */
+
+typedef enum {
+ MPCI_PACKETS_SYSTEM_VERIFY = 0
+} MPCI_Internal_Remote_operations;
+
+/*
+ * The following data structure defines the packet used to perform
+ * remote event operations.
+ */
+
+typedef struct {
+ MP_packet_Prefix Prefix;
+ MPCI_Internal_Remote_operations operation;
+ unsigned32 maximum_nodes;
+ unsigned32 maximum_global_objects;
+} MPCI_Internal_packet;
+
+/*
+ * This is the core semaphore which the MPCI Receive Server blocks on.
+ */
+
+EXTERN CORE_semaphore_Control _MPCI_Semaphore;
+/*
+ * The following thread queue is used to maintain a list of tasks
+ * which currently have outstanding remote requests.
+ */
+
+EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
+
+/*
+ * The following define the internal pointers to the user's
+ * configuration information.
+ */
+
+EXTERN MPCI_Control *_MPCI_table;
+
+/*
+ * The following points to the MPCI Receive Server.
+ */
+
+EXTERN Thread_Control *_MPCI_Receive_server_tcb;
+
+/*
+ * The following table contains the process packet routines provided
+ * by each object that supports MP operations.
+ */
+
+EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
+
+/*
+ * _MPCI_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table,
+ unsigned32 timeout_status
+);
+
+/*
+ * _MPCI_Create_server
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the packet receive server used in MP systems.
+ */
+
+void _MPCI_Create_server( void );
+
+/*
+ * _MPCI_Initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the MPCI driver by
+ * invoking the user provided MPCI initialization callout.
+ */
+
+void _MPCI_Initialization ( void );
+
+/*
+ * _MPCI_Register_packet_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine registers the MPCI packet processor for the
+ * designated object class.
+ */
+
+void _MPCI_Register_packet_processor(
+ MP_packet_Classes the_object,
+ MPCI_Packet_processor the_packet_processor
+
+);
+
+/*
+ * _MPCI_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This function obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+MP_packet_Prefix *_MPCI_Get_packet ( void );
+
+/*
+ * _MPCI_Return_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a packet by invoking the user provided
+ * MPCI return packet callout.
+ */
+
+void _MPCI_Return_packet (
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a process packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_process_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine 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
+);
+
+/*
+ * _MPCI_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a response packet by invoking the user provided
+ * MPCI send callout.
+ */
+
+void _MPCI_Send_response_packet (
+ unsigned32 destination,
+ MP_packet_Prefix *the_packet
+);
+
+/*
+ * _MPCI_Receive_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine receives a packet by invoking the user provided
+ * MPCI receive callout.
+ */
+
+MP_packet_Prefix *_MPCI_Receive_packet ( void );
+
+/*
+ * _MPCI_Process_response
+ *
+ * DESCRIPTION:
+ *
+ * This routine obtains a packet by invoking the user provided
+ * MPCI get packet callout.
+ */
+
+Thread_Control *_MPCI_Process_response (
+ MP_packet_Prefix *the_packet
+);
+
+/*PAGE
+ *
+ * _MPCI_Receive_server
+ *
+ */
+
+Thread _MPCI_Receive_server(
+ unsigned32 ignored
+);
+
+/*PAGE
+ *
+ * _MPCI_Announce
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _MPCI_Announce ( void );
+
+/*
+ * _MPCI_Internal_packets_Send_process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+
+void _MPCI_Internal_packets_Send_process_packet (
+ MPCI_Internal_Remote_operations operation
+);
+
+/*
+ * _MPCI_Internal_packets_Send_request_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ *
+ * This routine is not needed since there are no request
+ * packets to be sent by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_response_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ *
+ * This routine is not needed since there are no response
+ * packets to be sent by this manager.
+ */
+
+/*
+ *
+ * _MPCI_Internal_packets_Process_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+
+void _MPCI_Internal_packets_Process_packet (
+ MP_packet_Prefix *the_packet_prefix
+);
+
+/*
+ * _MPCI_Internal_packets_Send_object_was_deleted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Send_extract_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ *
+ * This routine is not needed since there are no objects
+ * deleted by this manager.
+ */
+
+/*
+ * _MPCI_Internal_packets_Get_packet
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to obtain a internal threads mp packet.
+ */
+
+ MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/mppkt.h b/cpukit/score/include/rtems/score/mppkt.h
new file mode 100644
index 0000000000..0c651bc4e8
--- /dev/null
+++ b/cpukit/score/include/rtems/score/mppkt.h
@@ -0,0 +1,100 @@
+/* mppkt.h
+ *
+ * This package is the specification for the Packet Handler.
+ * This handler defines the basic packet and provides
+ * mechanisms to utilize packets based on this prefix.
+ * Packets are the fundamental basis for messages passed between
+ * nodes in an MP system.
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MP_PACKET_h
+#define __MP_PACKET_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following enumerated type defines the packet classes.
+ *
+ * NOTE: In general, each class corresponds to a manager
+ * which supports global operations. Each manager
+ * defines the set of supported operations.
+ */
+
+typedef enum {
+ MP_PACKET_MPCI_INTERNAL = 0,
+ MP_PACKET_TASKS = 1,
+ MP_PACKET_MESSAGE_QUEUE = 2,
+ MP_PACKET_SEMAPHORE = 3,
+ MP_PACKET_PARTITION = 4,
+ MP_PACKET_REGION = 5,
+ MP_PACKET_EVENT = 6,
+ MP_PACKET_SIGNAL = 7
+} MP_packet_Classes;
+
+#define MP_PACKET_CLASSES_FIRST MP_PACKET_MPCI_INTERNAL
+#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL
+
+/*
+ * The following record contains the prefix for every packet
+ * passed between nodes in an MP system.
+ *
+ * NOTE: This structure is padded to insure that anything
+ * following it is on a 16 byte boundary. This is
+ * the most stringent structure alignment rule
+ * encountered yet (i960CA).
+ */
+
+typedef struct {
+ MP_packet_Classes the_class;
+ Objects_Id id;
+ Objects_Id source_tid;
+ Priority_Control source_priority;
+ unsigned32 return_code;
+ unsigned32 length;
+ unsigned32 to_convert;
+ Watchdog_Interval timeout;
+} MP_packet_Prefix;
+
+/*
+ * An MPCI must support packets of at least this size.
+ */
+
+#define MP_PACKET_MINIMUM_PACKET_SIZE 64
+
+/*
+ * The following constant defines the number of unsigned32's
+ * in a packet which must be converted to native format in a
+ * heterogeneous system. In packets longer than
+ * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
+ * may a user message buffer which is not automatically endian swapped.
+ */
+
+#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/mppkt.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
new file mode 100644
index 0000000000..d70009c3c9
--- /dev/null
+++ b/cpukit/score/include/rtems/score/object.h
@@ -0,0 +1,397 @@
+/* object.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Object Handler. This Handler provides mechanisms which
+ * can be used to initialize and manipulate all objects which have
+ * ids.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_h
+#define __OBJECTS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+
+/*
+ * The following type defines the control block used to manage
+ * object names.
+ */
+
+typedef void * Objects_Name;
+
+/*
+ * Space for object names is allocated in multiples of this.
+ *
+ * NOTE: Must be a power of 2. Matches the name manipulation routines.
+ */
+
+#define OBJECTS_NAME_ALIGNMENT 4
+
+/*
+ * Functions which compare names are prototyped like this.
+ */
+
+typedef boolean (*Objects_Name_comparators)(
+ void * /* name_1 */,
+ void * /* name_2 */,
+ unsigned32 /* length */
+);
+
+/*
+ * The following type defines the control block used to manage
+ * object IDs. The format is as follows (0=LSB):
+ *
+ * Bits 0 .. 15 = index
+ * Bits 16 .. 25 = node
+ * Bits 26 .. 31 = class
+ */
+
+typedef unsigned32 Objects_Id;
+
+#define OBJECTS_INDEX_START_BIT 0
+#define OBJECTS_NODE_START_BIT 16
+#define OBJECTS_CLASS_START_BIT 26
+
+#define OBJECTS_INDEX_MASK 0x0000ffff
+#define OBJECTS_NODE_MASK 0x03ff0000
+#define OBJECTS_CLASS_MASK 0xfc000000
+
+#define OBJECTS_INDEX_VALID_BITS 0x0000ffff
+#define OBJECTS_NODE_VALID_BITS 0x000003ff
+#define OBJECTS_CLASS_VALID_BITS 0x000000cf
+
+/*
+ * This enumerated type is used in the class field of the object ID.
+ */
+
+typedef enum {
+ OBJECTS_NO_CLASS = 0,
+ OBJECTS_INTERNAL_THREADS = 1,
+ OBJECTS_RTEMS_TASKS = 2,
+ OBJECTS_POSIX_THREADS = 3,
+ OBJECTS_RTEMS_TIMERS = 4,
+ OBJECTS_RTEMS_SEMAPHORES = 5,
+ OBJECTS_RTEMS_MESSAGE_QUEUES = 6,
+ OBJECTS_RTEMS_PARTITIONS = 7,
+ OBJECTS_RTEMS_REGIONS = 8,
+ OBJECTS_RTEMS_PORTS = 9,
+ OBJECTS_RTEMS_PERIODS = 10,
+ OBJECTS_RTEMS_EXTENSIONS = 11,
+ OBJECTS_POSIX_KEYS = 12,
+ OBJECTS_POSIX_INTERRUPTS = 13,
+ OBJECTS_POSIX_MESSAGE_QUEUES = 14,
+ OBJECTS_POSIX_MUTEXES = 15,
+ OBJECTS_POSIX_SEMAPHORES = 16,
+ OBJECTS_POSIX_CONDITION_VARIABLES = 17
+} Objects_Classes;
+
+#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS
+#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES
+#define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_MPCI_PACKETS
+#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS
+
+/*
+ * This enumerated type lists the locations which may be returned
+ * by _Objects_Get. These codes indicate the success of locating
+ * an object with the specified ID.
+ */
+
+typedef enum {
+ OBJECTS_LOCAL = 0, /* object is local */
+ OBJECTS_REMOTE = 1, /* object is remote */
+ OBJECTS_ERROR = 2 /* id was invalid */
+} Objects_Locations;
+
+/*
+ * The following defines the Object Control Block used to manage
+ * each object local to this node.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Objects_Id id;
+ Objects_Name name;
+} Objects_Control;
+
+/*
+ * The following defines the structure for the information used to
+ * manage each class of objects.
+ */
+
+typedef struct {
+ Objects_Classes the_class; /* Class of this object */
+ Objects_Id minimum_id; /* minimum valid id of this type */
+ Objects_Id maximum_id; /* maximum valid id of this type */
+ unsigned32 maximum; /* maximum number of objects */
+ Objects_Control **local_table; /* table of local object pointers */
+ Objects_Name *name_table; /* table of local object names */
+ Chain_Control *global_table; /* pointer to global table */
+ Chain_Control Inactive; /* chain of inactive ctl blocks */
+ boolean is_string; /* TRUE if names are strings */
+ unsigned32 name_length; /* maximum length of names */
+ boolean is_thread; /* TRUE if these are threads */
+ /* irregardless of API */
+} Objects_Information;
+
+/*
+ * The following defines the data storage which contains the
+ * node number of the local node.
+ */
+
+EXTERN unsigned32 _Objects_Local_node;
+EXTERN unsigned32 _Objects_Maximum_nodes;
+
+/*
+ * The following is the list of information blocks for each object
+ * class. From the ID, we can go to one of these information blocks,
+ * and obtain a pointer to the appropriate object control block.
+ */
+
+EXTERN Objects_Information
+ *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1];
+
+/*
+ * The following defines the constant which may be used
+ * with _Objects_Get to manipulate the calling task.
+ *
+ */
+
+#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
+
+/*
+ * The following define the constants which may be used in name searches.
+ */
+
+#define OBJECTS_SEARCH_ALL_NODES 0
+#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
+#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
+#define OBJECTS_WHO_AM_I 0
+
+/*
+ * Parameters and return id's for _Objects_Get_next
+ */
+
+#define OBJECTS_ID_INITIAL_INDEX (0)
+#define OBJECTS_ID_FINAL_INDEX (0xffff)
+
+#define OBJECTS_ID_INITIAL(_class, _node) \
+ _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
+
+#define OBJECTS_ID_FINAL ((Objects_Id)~0)
+
+/*
+ * _Objects_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function performs the initialization necessary for this handler.
+ *
+ */
+
+void _Objects_Handler_initialization(
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*
+ * _Objects_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This function initializes an object class information record.
+ * SUPPORTS_GLOBAL is TRUE if the object class supports global
+ * objects, and FALSE otherwise. Maximum indicates the number
+ * of objects required in this class and size indicates the size
+ * in bytes of each control block for this object class. The
+ * name length and string designator are also set. In addition,
+ * the class may be a task, therefore this information is also included.
+ */
+
+void _Objects_Initialize_information (
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_task
+);
+
+/*
+ * _Objects_Clear_name
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Clear_name(
+ void *name,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Copy_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_string(
+ void *source,
+ void *destination
+);
+
+/*
+ * _Objects_Copy_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_raw(
+ void *source,
+ void *destination,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_string
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_string(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+
+/*
+ * _Objects_Compare_name_raw
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_raw(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+);
+/*
+ * _Objects_Name_to_id
+ *
+ * DESCRIPTION:
+ *
+ * This function implements the common portion of the object
+ * identification directives. This directive returns the object
+ * id associated with name. If more than one object of this class
+ * is named name, then the object to which the id belongs is
+ * arbitrary. Node indicates the extent of the search for the
+ * id of the object named name. If the object class supports global
+ * objects, then the search can be limited to a particular node
+ * or allowed to encompass all nodes.
+ *
+ */
+
+typedef enum {
+ OBJECTS_SUCCESSFUL,
+ OBJECTS_INVALID_NAME,
+ OBJECTS_INVALID_NODE
+} Objects_Name_to_id_errors;
+
+#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL
+#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE
+
+Objects_Name_to_id_errors _Objects_Name_to_id(
+ Objects_Information *information,
+ Objects_Name name,
+ unsigned32 node,
+ Objects_Id *id
+);
+
+/*
+ * _Objects_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps object ids to object control blocks.
+ * If id corresponds to a local object, then it returns
+ * the_object control pointer which maps to id and location
+ * is set to OBJECTS_LOCAL. If the object class supports global
+ * objects and the object id is global and resides on a remote
+ * node, then location is set to OBJECTS_REMOTE, and the_object
+ * is undefined. Otherwise, location is set to OBJECTS_ERROR
+ * and the_object is undefined.
+ *
+ */
+
+Objects_Control *_Objects_Get (
+ Objects_Information *information,
+ Objects_Id id,
+ Objects_Locations *location
+);
+
+/*
+ * _Objects_Get_next
+ *
+ * DESCRIPTION:
+ *
+ * Like _Objects_Get, but is used to find "next" open object.
+ *
+ */
+
+Objects_Control *_Objects_Get_next(
+ Objects_Information *information,
+ Objects_Id id,
+ unsigned32 *location_p,
+ Objects_Id *next_id_p
+);
+
+/*
+ * _Objects_Get_information
+ *
+ * DESCRIPTION:
+ *
+ * Returns the information control block for the class of objects
+ * corresponding to this id.
+ */
+
+Objects_Information *_Objects_Get_information(
+ Objects_Id id
+);
+
+/*
+ * Pieces of object.inl are promoted out to the user
+ */
+
+#include <rtems/score/object.inl>
+#include <rtems/score/objectmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/objectmp.h b/cpukit/score/include/rtems/score/objectmp.h
new file mode 100644
index 0000000000..96496656df
--- /dev/null
+++ b/cpukit/score/include/rtems/score/objectmp.h
@@ -0,0 +1,152 @@
+/* objectmp.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of Global RTEMS Objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_OBJECTS_MP_h
+#define __RTEMS_OBJECTS_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This defines the Global Object Control Block used to manage
+ * objects resident on other nodes.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ unsigned32 name; /* XXX broken but works */
+ /* XXX If any API is MP with variable length names .. BOOM!!!! */
+} Objects_MP_Control;
+
+/*
+ * _Objects_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine intializes the inactive global object chain
+ * based on the maximum number of global objects configured.
+ */
+
+void _Objects_MP_Handler_initialization (
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
+);
+
+/*PAGE
+ *
+ * _Objects_MP_Open
+ *
+ * DESCRIPTION:
+ *
+ * This routine place the specified global object in the
+ * specified information table.
+ */
+
+void _Objects_MP_Open (
+ Objects_Information *information,
+ Objects_MP_Control *the_global_object,
+ unsigned32 the_name, /* XXX -- wrong for variable */
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Allocate_and_open
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates a global object control block
+ * and places it in the specified information table. If the
+ * allocation fails, then is_fatal_error determines the
+ * error processing actions taken.
+ */
+
+boolean _Objects_MP_Allocate_and_open (
+ Objects_Information *information,
+ unsigned32 the_name, /* XXX -- wrong for variable length */
+ Objects_Id the_id,
+ boolean is_fatal_error
+);
+
+/*
+ * _Objects_MP_Close
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes a global object from the specified
+ * information table and deallocates the global object control block.
+ */
+
+void _Objects_MP_Close (
+ Objects_Information *information,
+ Objects_Id the_id
+);
+
+/*
+ * _Objects_MP_Global_name_search
+ *
+ * DESCRIPTION:
+ *
+ * This routine looks for the object with the_name in the global
+ * object tables indicated by information. It returns the ID of the
+ * object with that name if one is found.
+ */
+
+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
+);
+
+/*
+ * _Objects_MP_Is_remote
+ *
+ * DESCRIPTION:
+ *
+ * This function searches the Global Object Table managed
+ * by information for the object indicated by ID. If the object
+ * is found, then location is set to objects_remote, otherwise
+ * location is set to objects_error. In both cases, the_object
+ * is undefined.
+ */
+
+void _Objects_MP_Is_remote (
+ Objects_Information *information,
+ Objects_Id the_id,
+ Objects_Locations *location,
+ Objects_Control **the_object
+);
+
+/*
+ * The following chain header is used to manage the set of
+ * inactive global object control blocks.
+ */
+
+EXTERN unsigned32 _Objects_MP_Maximum_global_objects;
+EXTERN Chain_Control _Objects_MP_Inactive_global_objects;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/objectmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/priority.h b/cpukit/score/include/rtems/score/priority.h
new file mode 100644
index 0000000000..b7de14f0f9
--- /dev/null
+++ b/cpukit/score/include/rtems/score/priority.h
@@ -0,0 +1,96 @@
+/* priority.h
+ *
+ * This include file contains all thread priority manipulation routines.
+ * This Handler provides mechanisms which can be used to
+ * initialize and manipulate thread priorities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_h
+#define __PRIORITY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage
+ * thread priorities.
+ *
+ * NOTE: Priority 0 is reserved for internal threads only.
+ */
+
+typedef unsigned32 Priority_Control;
+
+#define PRIORITY_MINIMUM 0 /* highest thread priority */
+#define PRIORITY_MAXIMUM 255 /* lowest thread priority */
+
+/*
+ * The following record defines the information associated with
+ * each thread to manage its interaction with the priority bit maps.
+ */
+
+typedef struct {
+ Priority_Bit_map_control *minor; /* addr of minor bit map slot */
+ Priority_Bit_map_control ready_major; /* priority bit map ready mask */
+ Priority_Bit_map_control ready_minor; /* priority bit map ready mask */
+ Priority_Bit_map_control block_major; /* priority bit map block mask */
+ Priority_Bit_map_control block_minor; /* priority bit map block mask */
+} Priority_Information;
+
+/*
+ * The following data items are the priority bit map.
+ * Each of the sixteen bits used in the _Priority_Major_bit_map is
+ * associated with one of the sixteen entries in the _Priority_Bit_map.
+ * Each bit in the _Priority_Bit_map indicates whether or not there are
+ * threads ready at a particular priority. The mapping of
+ * individual priority levels to particular bits is processor
+ * dependent as is the value of each bit used to indicate that
+ * threads are ready at that priority.
+ */
+
+EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map;
+EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
+
+/*
+ * The definition of the Priority_Bit_map_control type is CPU dependent.
+ *
+ */
+
+/*
+ * Priority Bitfield Manipulation Routines
+ *
+ * NOTE:
+ *
+ * These may simply be pass throughs to CPU dependent routines.
+ */
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+
+#define _Priority_Mask( _bit_number ) \
+ _CPU_Priority_Mask( _bit_number )
+
+#define _Priority_Bits_index( _priority ) \
+ _CPU_Priority_bits_index( _priority )
+
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/priority.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/stack.h b/cpukit/score/include/rtems/score/stack.h
new file mode 100644
index 0000000000..bf72782b42
--- /dev/null
+++ b/cpukit/score/include/rtems/score/stack.h
@@ -0,0 +1,50 @@
+/* stack.h
+ *
+ * This include file contains all information about the thread
+ * Stack Handler. This Handler provides mechanisms which can be used to
+ * initialize and utilize stacks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_h
+#define __STACK_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following constant defines the minimum stack size which every
+ * thread must exceed.
+ */
+
+#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the control block used to manage each stack.
+ */
+
+typedef struct {
+ unsigned32 size; /* stack size */
+ void *area; /* low memory addr of stack */
+} Stack_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/stack.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/states.h b/cpukit/score/include/rtems/score/states.h
new file mode 100644
index 0000000000..1f8fd49fae
--- /dev/null
+++ b/cpukit/score/include/rtems/score/states.h
@@ -0,0 +1,78 @@
+/* states.h
+ *
+ * This include file contains thread execution state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_STATES_h
+#define __RTEMS_STATES_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following type defines the control block used to manage a
+ * thread's state.
+ */
+
+typedef unsigned32 States_Control;
+
+/*
+ * The following constants define the individual states which may be
+ * be used to compose and manipulate a thread's state.
+ */
+
+#define STATES_ALL_SET 0xffff /* all states */
+#define STATES_READY 0x0000 /* ready to run */
+#define STATES_DORMANT 0x0001 /* created not started */
+#define STATES_SUSPENDED 0x0002 /* waiting for resume */
+#define STATES_TRANSIENT 0x0004 /* thread in transition */
+#define STATES_DELAYING 0x0008 /* wait for timeout */
+#define STATES_WAITING_FOR_TIME 0x0010 /* wait for TOD */
+#define STATES_WAITING_FOR_BUFFER 0x0020
+#define STATES_WAITING_FOR_SEGMENT 0x0040
+#define STATES_WAITING_FOR_MESSAGE 0x0080
+#define STATES_WAITING_FOR_EVENT 0x0100
+#define STATES_WAITING_FOR_SEMAPHORE 0x0200
+#define STATES_WAITING_FOR_MUTEX 0x0400
+#define STATES_WAITING_FOR_CONDITION_VARIABLE 0x0800
+#define STATES_WAITING_FOR_RPC_REPLY 0x1000
+#define STATES_WAITING_FOR_PERIOD 0x2000
+
+#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \
+ STATES_WAITING_FOR_SEGMENT | \
+ STATES_WAITING_FOR_MESSAGE | \
+ STATES_WAITING_FOR_MUTEX | \
+ STATES_WAITING_FOR_CONDITION_VARIABLE | \
+ STATES_WAITING_FOR_SEMAPHORE )
+
+#define STATES_WAITING_ON_THREAD_QUEUE \
+ ( STATES_LOCALLY_BLOCKED | \
+ STATES_WAITING_FOR_RPC_REPLY )
+
+#define STATES_BLOCKED ( STATES_DELAYING | \
+ STATES_WAITING_FOR_TIME | \
+ STATES_WAITING_FOR_PERIOD | \
+ STATES_WAITING_FOR_EVENT | \
+ STATES_WAITING_ON_THREAD_QUEUE )
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/states.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/sysstate.h b/cpukit/score/include/rtems/score/sysstate.h
new file mode 100644
index 0000000000..d7e43b2356
--- /dev/null
+++ b/cpukit/score/include/rtems/score/sysstate.h
@@ -0,0 +1,66 @@
+/* sysstates.h
+ *
+ * This include file contains information regarding the system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_STATE_h
+#define __RTEMS_SYSTEM_STATE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* types */
+
+/* enumerated constants */
+
+/*
+ * The following type defines the possible system states.
+ */
+
+typedef enum {
+ SYSTEM_STATE_BEFORE_INITIALIZATION, /* start -> end of 1st init part */
+ SYSTEM_STATE_BEFORE_MULTITASKING, /* end of 1st -> beginning of 2nd */
+ SYSTEM_STATE_BEGIN_MULTITASKING, /* just before multitasking starts */
+ SYSTEM_STATE_UP, /* normal operation */
+ SYSTEM_STATE_FAILED /* fatal error occurred */
+} System_state_Codes;
+
+#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
+#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
+
+/*
+ * The following variable indicates whether or not this is
+ * an multiprocessing system.
+ */
+
+EXTERN boolean _System_state_Is_multiprocessing;
+
+/*
+ * The following variable contains the current system state.
+ */
+
+EXTERN System_state_Codes _System_state_Current;
+
+/*
+ * Make it possible for the application to get the system state information.
+ */
+
+#include <rtems/score/sysstate.inl>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
new file mode 100644
index 0000000000..74399545b9
--- /dev/null
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -0,0 +1,585 @@
+/* thread.h
+ *
+ * This include file contains all constants and structures associated
+ * with the thread control block.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_h
+#define __THREAD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/context.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following defines the "return type" of a thread.
+ */
+
+typedef void Thread;
+
+/*
+ * The following defines the ways in which the entry point for a
+ * thread can be invoked. Basically, it can be passed any
+ * combination/permutation of a pointer and an unsigned32 value.
+ *
+ * NOTE: For now, we are ignoring the return type.
+ */
+
+typedef enum {
+ THREAD_START_NUMERIC,
+ THREAD_START_POINTER,
+ THREAD_START_BOTH_POINTER_FIRST,
+ THREAD_START_BOTH_NUMERIC_FIRST
+} Thread_Start_types;
+
+typedef Thread ( *Thread_Entry )( );
+
+/*
+ * The following structure contains the information which defines
+ * the starting state of a thread.
+ */
+
+typedef struct {
+ Thread_Entry entry_point; /* starting thread address */
+ Thread_Start_types prototype; /* how task is invoked */
+ void *pointer_argument; /* pointer argument */
+ unsigned32 numeric_argument; /* numeric argument */
+ /* initial execution modes */
+ boolean is_preemptible;
+ boolean is_timeslice;
+ unsigned32 isr_level;
+ Priority_Control initial_priority; /* initial priority */
+ Stack_Control Initial_stack; /* stack information */
+ void *fp_context; /* initial FP context area address */
+ void *stack; /* initial FP context area address */
+} Thread_Start_information;
+
+/*
+ * The following structure contains the information necessary to manage
+ * a thread which it is waiting for a resource.
+ */
+
+#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
+
+typedef struct {
+ Objects_Id id; /* waiting on this object */
+ unsigned32 count; /* "generic" fields to be used */
+ void *return_argument; /* when blocking */
+ void *return_argument_1;
+ unsigned32 option;
+
+ /*
+ * NOTE: The following assumes that all API return codes can be
+ * treated as an unsigned32.
+ */
+ unsigned32 return_code; /* status for thread awakened */
+
+ Chain_Control Block2n; /* 2 - n priority blocked chain */
+ Thread_queue_Control *queue; /* pointer to thread queue */
+} Thread_Wait_information;
+
+/*
+ * The following defines the control block used to manage
+ * each thread proxy.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ Chain_Node Active;
+} Thread_Proxy_control;
+
+
+/*
+ * The following record defines the control block used
+ * to manage each thread.
+ *
+ * NOTE: It is critical that proxies and threads have identical
+ * memory images for the shared part.
+ */
+
+typedef enum {
+ THREAD_API_RTEMS,
+ THREAD_API_POSIX
+} Thread_APIs;
+
+#define THREAD_API_FIRST THREAD_API_RTEMS
+#define THREAD_API_LAST THREAD_API_POSIX
+
+typedef struct {
+ Objects_Control Object;
+ States_Control current_state;
+ Priority_Control current_priority;
+ Priority_Control real_priority;
+ unsigned32 resource_count;
+ Thread_Wait_information Wait;
+ Watchdog_Control Timer;
+ MP_packet_Prefix *receive_packet;
+ /****************** end of common block ********************/
+ boolean is_global;
+ boolean do_post_task_switch_extension;
+ Chain_Control *ready;
+ Priority_Information Priority_map;
+ Thread_Start_information Start;
+ boolean is_preemptible;
+ boolean is_timeslice;
+ Context_Control Registers;
+ void *fp_context;
+ void *API_Extensions[ THREAD_API_LAST + 1 ];
+ void **extensions;
+} Thread_Control;
+
+/*
+ * The following constants define the stack size requirements for
+ * the idle thread.
+ */
+
+
+#define THREAD_IDLE_STACK_SIZE STACK_MINIMUM_SIZE
+
+/*
+ * The following defines the information control block used to
+ * manage this class of objects.
+ */
+
+EXTERN Objects_Information _Thread_Internal_information;
+
+/*
+ * The following define the thread control pointers used to access
+ * and manipulate the idle thread.
+ */
+
+EXTERN Thread_Control *_Thread_Idle;
+
+/*
+ * The following context area contains the context of the "thread"
+ * which invoked the start multitasking routine. This context is
+ * restored as the last action of the stop multitasking routine. Thus
+ * control of the processor can be returned to the environment
+ * which initiated the system.
+ */
+
+EXTERN Context_Control _Thread_BSP_context;
+
+/*
+ * The following declares the dispatch critical section nesting
+ * counter which is used to prevent context switches at inopportune
+ * moments.
+ */
+
+EXTERN unsigned32 _Thread_Dispatch_disable_level;
+
+/*
+ * The following holds how many user extensions are in the system. This
+ * is used to determine how many user extension data areas to allocate
+ * per thread.
+ */
+
+EXTERN unsigned32 _Thread_Maximum_extensions;
+
+/*
+ * The following data items are used to manage timeslicing.
+ */
+
+EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
+EXTERN unsigned32 _Thread_Ticks_per_timeslice;
+
+/*
+ * The following points to the array of FIFOs used to manage the
+ * set of ready threads.
+ */
+
+EXTERN Chain_Control *_Thread_Ready_chain;
+
+/*
+ * The following points to the thread which is currently executing.
+ * This thread is implicitly manipulated by numerous directives.
+ */
+
+EXTERN Thread_Control *_Thread_Executing;
+
+/*
+ * The following points to the highest priority ready thread
+ * in the system. Unless the current thread is not preemptibl,
+ * then this thread will be context switched to when the next
+ * dispatch occurs.
+ */
+
+EXTERN Thread_Control *_Thread_Heir;
+
+/*
+ * The following points to the thread whose floating point
+ * context is currently loaded.
+ */
+
+EXTERN Thread_Control *_Thread_Allocated_fp;
+
+/*
+ * _Thread_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Thread_Handler_initialization (
+ unsigned32 ticks_per_timeslice,
+ unsigned32 maximum_extensions,
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_Create_idle
+ *
+ * DESCRIPTION:
+ *
+ * This routine creates the idle thread.
+ *
+ * WARNING!! No thread should be created before this one.
+ */
+
+void _Thread_Create_idle( void );
+
+/*
+ * _Thread_Start_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine initiates multitasking. It is invoked only as
+ * part of initialization and its invocation is the last act of
+ * the non-multitasking part of the system initialization.
+ */
+
+void _Thread_Start_multitasking( void );
+
+/*
+ * _Thread_Dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is responsible for transferring control of the
+ * processor from the executing thread to the heir thread. As part
+ * of this process, it is responsible for the following actions:
+ *
+ * + saving the context of the executing thread
+ * + restoring the context of the heir thread
+ * + dispatching any signals for the resulting executing thread
+ */
+
+void _Thread_Dispatch( void );
+
+/*
+ * _Thread_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Initialize(
+ Objects_Information *information,
+ Thread_Control *the_thread,
+ void *stack_area, /* NULL if to be allocated */
+ unsigned32 stack_size, /* insure it is >= min */
+ boolean is_fp, /* TRUE if thread uses FP */
+ Priority_Control priority,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
+ Objects_Name name
+
+);
+
+/*
+ * _Thread_Start
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+boolean _Thread_Start(
+ Thread_Control *the_thread,
+ Thread_Start_types the_prototype,
+ void *entry_point,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Restart
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+/* XXX multiple task arg profiles */
+
+boolean _Thread_Restart(
+ Thread_Control *the_thread,
+ void *pointer_argument,
+ unsigned32 numeric_argument
+);
+
+/*
+ * _Thread_Close
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+void _Thread_Close(
+ Objects_Information *information,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Ready
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes any set states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Ready(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Clear_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the indicated STATES for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Clear_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_state
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the indicated states for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ *
+ */
+
+void _Thread_Set_state(
+ Thread_Control *the_thread,
+ States_Control state
+);
+
+/*
+ * _Thread_Set_transient
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the TRANSIENT state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+void _Thread_Set_transient(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Reset_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked upon expiration of the currently
+ * executing thread's timeslice. If no other thread's are ready
+ * at the priority of the currently executing thread, then the
+ * executing thread's timeslice is reset. Otherwise, the
+ * currently executing thread is placed at the rear of the
+ * FIFO for this priority and a new heir is selected.
+ */
+
+void _Thread_Reset_timeslice( void );
+
+/*
+ * _Thread_Tickle_timeslice
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked as part of processing each clock tick.
+ * It is responsible for determining if the current thread allows
+ * timeslicing and, if so, when its timeslice expires.
+ */
+
+void _Thread_Tickle_timeslice( void );
+
+/*
+ * _Thread_Yield_processor
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread of equal
+ * or greater priority.
+ */
+
+void _Thread_Yield_processor( void );
+
+/*
+ * _Thread_Load_environment
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the context of the_thread to its
+ * appropriate starting state.
+ */
+
+void _Thread_Load_environment(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_Handler
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the wrapper function for all threads. It is
+ * the starting point for all threads. The user provided thread
+ * entry point is invoked by this routine. Operations
+ * which must be performed immediately before and after the user's
+ * thread executes are found here.
+ */
+
+void _Thread_Handler( void );
+
+/*
+ * _Thread_Delay_ended
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a thread must be unblocked at the
+ * end of a time based delay (i.e. wake after or wake when).
+ */
+
+void _Thread_Delay_ended(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * _Thread_Change_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine changes the current priority of the_thread to
+ * new_priority. It performs any necessary scheduling operations
+ * including the selection of a new heir thread.
+ */
+
+void _Thread_Change_priority (
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Set_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine updates the priority related fields in the_thread
+ * control block to indicate the current priority is now new_priority.
+ */
+
+void _Thread_Set_priority(
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+);
+
+/*
+ * _Thread_Evaluate_mode
+ *
+ * DESCRIPTION:
+ *
+ * This routine XXX
+ */
+
+boolean _Thread_Evaluate_mode( void );
+
+/*
+ * _Thread_Get
+ *
+ * NOTE: If we are not using static inlines, this must be a real
+ * subroutine call.
+ */
+
+#ifndef USE_INLINES
+Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+);
+#endif
+
+/*
+ * _Thread_Idle_body
+ *
+ * DESCRIPTION:
+ *
+ * This routine is the body of the system idle thread.
+ */
+
+#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
+Thread _Thread_Idle_body(
+ unsigned32 ignored
+);
+#endif
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/thread.inl>
+#endif
+#include <rtems/score/threadmp.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/threadmp.h b/cpukit/score/include/rtems/score/threadmp.h
new file mode 100644
index 0000000000..0466a04065
--- /dev/null
+++ b/cpukit/score/include/rtems/score/threadmp.h
@@ -0,0 +1,89 @@
+/* threadmp.h
+ *
+ * This include file contains the specification for all routines
+ * and data specific to the multiprocessing portion of the thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_THREAD_MP_h
+#define __RTEMS_THREAD_MP_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * _Thread_MP_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the multiprocessing portion of the Thread Handler.
+ */
+
+void _Thread_MP_Handler_initialization (
+ unsigned32 maximum_proxies
+);
+
+/*
+ * _Thread_MP_Allocate_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This allocates a proxy control block from
+ * the inactive chain of free proxy control blocks.
+ *
+ * NOTE: This function returns a thread control pointer
+ * because proxies are substitutes for remote threads.
+ */
+
+Thread_Control *_Thread_MP_Allocate_proxy (
+ States_Control the_state
+);
+
+/*
+ * _Thread_MP_Find_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the proxy control block for the specified
+ * id from the active chain of proxy control blocks.
+ */
+
+Thread_Control *_Thread_MP_Find_proxy (
+ Objects_Id the_id
+);
+
+/*
+ * The following is used to determine when the multiprocessing receive
+ * thread is executing so that a proxy can be allocated instead of
+ * blocking the multiprocessing receive thread.
+ */
+
+EXTERN Thread_Control *_Thread_MP_Receive;
+
+/*
+ * The following chains are used to manage proxies.
+ */
+
+EXTERN Chain_Control _Thread_MP_Active_proxies;
+EXTERN Chain_Control _Thread_MP_Inactive_proxies;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/threadmp.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
new file mode 100644
index 0000000000..6a074daf16
--- /dev/null
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -0,0 +1,301 @@
+/* threadq.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the manipulation of objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_h
+#define __THREAD_QUEUE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/tqdata.h>
+
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * Constant for indefinite wait.
+ */
+
+#define THREAD_QUEUE_WAIT_FOREVER WATCHDOG_NO_TIMEOUT
+
+/*
+ * The following type defines the callout used when a remote task
+ * is extracted from a local thread queue.
+ */
+
+typedef void ( *Thread_queue_Flush_callout )(
+ Thread_Control *
+ );
+
+/*
+ * The following type defines the callout used when a local task
+ * is extracted from a remote thread queue (i.e. it's proxy must
+ * extracted from the remote queue).
+ */
+
+typedef void ( *Thread_queue_Extract_callout )(
+ Thread_Control *
+ );
+
+EXTERN Thread_queue_Extract_callout
+ _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
+
+/*
+ * _Thread_queue_Dequeue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to a thread waiting on
+ * the_thread_queue. The selection of this thread is based on
+ * the discipline of the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout.
+ */
+
+void _Thread_queue_Enqueue(
+ Thread_queue_Control *the_thread_queue,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_Extract_with_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_thread from the_thread_queue
+ * and insures that if there is a proxy for this task on
+ * another node, it is also dealt with.
+ */
+
+boolean _Thread_queue_Extract_with_proxy(
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is selected
+ * based on the discipline of the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Flush
+ *
+ * DESCRIPTION:
+ *
+ * This routine unblocks all threads blocked on the_thread_queue
+ * and cancels any associated timeouts.
+ */
+
+void _Thread_queue_Flush(
+ Thread_queue_Control *the_thread_queue,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+);
+
+/*
+ * _Thread_queue_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_thread_queue based on the
+ * discipline indicated in attribute_set. The state set on
+ * threads which block on the_thread_queue is state.
+ */
+
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ Objects_Classes the_class,
+ Thread_queue_Disciplines the_discipline,
+ States_Control state,
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
+);
+
+/*
+ * _Thread_queue_Dequeue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * thread waiting on the_thread_queue. If no threads are waiting
+ * on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * priority discipline.
+ */
+
+void _Thread_queue_Enqueue_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_priority(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The "first" thread is the highest
+ * priority thread waiting on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_priority(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Dequeue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the thread which has
+ * been waiting the longest on the_thread_queue. If no
+ * threads are waiting on the_thread_queue, then NULL is returned.
+ */
+
+Thread_Control *_Thread_queue_Dequeue_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_Enqueue_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout using the
+ * FIFO discipline.
+ */
+
+void _Thread_queue_Enqueue_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout
+);
+
+/*
+ * _Thread_queue_Extract_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes the_thread from the_thread_queue
+ * and cancels any timeouts associated with this blocking.
+ */
+
+void _Thread_queue_Extract_fifo(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/*
+ * _Thread_queue_First_FIFO
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the "first" thread
+ * on the_thread_queue. The first thread is the thread
+ * which has been waiting longest on the_thread_queue.
+ */
+
+Thread_Control *_Thread_queue_First_fifo(
+ Thread_queue_Control *the_thread_queue
+);
+
+/*
+ * _Thread_queue_timeout
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when a task's request has not
+ * been satisfied after the timeout interval specified to
+ * enqueue. The task represented by ID will be unblocked and
+ * its status code will be set in it's control block to indicate
+ * that a timeout has occurred.
+ */
+
+void _Thread_queue_Timeout (
+ Objects_Id id,
+ void *ignored
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
new file mode 100644
index 0000000000..b0fb686014
--- /dev/null
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -0,0 +1,260 @@
+/* tod.h
+ *
+ * This include file contains all the constants and structures associated
+ * with the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_h
+#define __TIME_OF_DAY_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/watchdog.h>
+
+/*
+ * The following constants are related to the time of day.
+ */
+
+#define TOD_SECONDS_PER_MINUTE 60
+#define TOD_MINUTES_PER_HOUR 60
+#define TOD_MONTHS_PER_YEAR 12
+#define TOD_DAYS_PER_YEAR 365
+#define TOD_HOURS_PER_DAY 24
+#define TOD_SECONDS_PER_DAY (TOD_SECONDS_PER_MINUTE * \
+ TOD_MINUTES_PER_HOUR * \
+ TOD_HOURS_PER_DAY)
+
+#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY)
+
+#define TOD_MICROSECONDS_PER_SECOND 1000000
+#define TOD_MILLISECONDS_PER_SECOND 1000
+
+/*
+ * The following constant define the earliest year to which an
+ * time of day can be initialized. This is considered the
+ * epoch.
+ */
+
+#define TOD_BASE_YEAR 1988
+
+/*
+ * The following record defines the time of control block. This
+ * control block is used to maintain the current time of day.
+ */
+
+typedef struct { /* RTEID style time/date */
+ unsigned32 year; /* year, A.D. */
+ unsigned32 month; /* month, 1 -> 12 */
+ unsigned32 day; /* day, 1 -> 31 */
+ unsigned32 hour; /* hour, 0 -> 23 */
+ unsigned32 minute; /* minute, 0 -> 59 */
+ unsigned32 second; /* second, 0 -> 59 */
+ unsigned32 ticks; /* elapsed ticks between secs */
+} TOD_Control;
+
+/*
+ * The following contains the current time of day.
+ */
+
+EXTERN TOD_Control _TOD_Current;
+
+/*
+ * The following contains the number of seconds from 00:00:00
+ * January 1, TOD_BASE_YEAR until the current time of day.
+ */
+
+EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
+
+/*
+ * The following contains the number of ticks since the
+ * system was booted.
+ */
+
+EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
+
+/*
+ * The following contains the number of microseconds per tick.
+ */
+
+EXTERN unsigned32 _TOD_Microseconds_per_tick;
+
+/*
+ * The following contains the number of clock ticks per second.
+ *
+ * NOTE:
+ *
+ * If one second is NOT evenly divisible by the number of microseconds
+ * per clock tick, this value will contain only the integer portion
+ * of the division. This means that the interval between clock ticks
+ * can be a source of error in the current time of day.
+ */
+
+EXTERN unsigned32 _TOD_Ticks_per_second;
+
+/*
+ * This is the control structure for the watchdog timer which
+ * fires to service the seconds chain.
+ */
+
+EXTERN Watchdog_Control _TOD_Seconds_watchdog;
+
+#ifdef INIT
+
+/*
+ * The following array contains the number of days in all months.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ * The second dimension should range from 1 to 12 for January to
+ * February, respectively.
+ */
+
+const unsigned32 _TOD_Days_per_month[ 2 ][ 13 ] = {
+ { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+/*
+ * The following array contains the number of days in all months
+ * up to the month indicated by the index of the second dimension.
+ * The first dimension should be 1 for leap years, and 0 otherwise.
+ */
+
+const unsigned16 _TOD_Days_to_date[2][13] = {
+ { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
+ { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
+};
+
+/*
+ * The following array contains the number of days in the years
+ * since the last leap year. The index should be 0 for leap
+ * years, and the number of years since the beginning of a leap
+ * year otherwise.
+ */
+
+const unsigned16 _TOD_Days_since_last_leap_year[4] = { 0, 366, 761, 1126 };
+
+#else
+
+extern const unsigned16 _TOD_Days_to_date[2][13]; /* Julian days */
+extern const unsigned16 _TOD_Days_since_last_leap_year[4];
+extern const unsigned32 _TOD_Days_per_month[2][13];
+
+#endif
+
+/*
+ * _TOD_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _TOD_Handler_initialization(
+ unsigned32 microseconds_per_tick
+);
+
+/*
+ * _TOD_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current time of day to THE_TOD and
+ * the equivalent SECONDS_SINCE_EPOCH.
+ */
+
+void _TOD_Set(
+ TOD_Control *the_tod,
+ Watchdog_Interval seconds_since_epoch
+);
+
+/*
+ * _TOD_Validate
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if THE_TOD contains
+ * a valid time of day, and FALSE otherwise.
+ */
+
+boolean _TOD_Validate(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_To_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number seconds between the epoch and THE_TOD.
+ */
+
+Watchdog_Interval _TOD_To_seconds(
+ TOD_Control *the_tod
+);
+
+/*
+ * _TOD_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is scheduled as a watchdog function and is invoked at
+ * each second boundary. It updates the current time of day to indicate
+ * that a second has passed and processes the seconds watchdog chain.
+ */
+
+void _TOD_Tickle(
+ Objects_Id id,
+ void *ignored
+);
+
+/*
+ * TOD_MILLISECONDS_TO_MICROSECONDS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to microseconds.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000)
+
+/*
+ * TOD_MILLISECONDS_TO_TICKS
+ *
+ * DESCRIPTION:
+ *
+ * This routine converts an interval expressed in milliseconds to ticks.
+ *
+ * NOTE:
+ *
+ * This must be a macro so it can be used in "static" tables.
+ */
+
+#define TOD_MILLISECONDS_TO_TICKS(_ms) \
+ (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick)
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tod.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/tqdata.h b/cpukit/score/include/rtems/score/tqdata.h
new file mode 100644
index 0000000000..c9c9585f7f
--- /dev/null
+++ b/cpukit/score/include/rtems/score/tqdata.h
@@ -0,0 +1,91 @@
+/* tqdata.h
+ *
+ * This include file contains all the constants and structures
+ * needed to declare a thread queue.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_h
+#define __THREAD_QUEUE_DATA_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/chain.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+
+/*
+ * The following enumerated type details all of the disciplines
+ * supported by the Thread Queue Handler.
+ */
+
+typedef enum {
+ THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */
+ THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */
+} Thread_queue_Disciplines;
+
+/*
+ * The following enumerated types indicate what happened while the thread
+ * queue was in the synchronization window.
+ */
+
+typedef enum {
+ THREAD_QUEUE_SYNCHRONIZED,
+ THREAD_QUEUE_NOTHING_HAPPENED,
+ THREAD_QUEUE_TIMEOUT,
+ THREAD_QUEUE_SATISFIED
+} Thread_queue_States;
+
+/*
+ * The following constants are used to manage the priority queues.
+ *
+ * There are four chains used to maintain a priority -- each chain
+ * manages a distinct set of task priorities. The number of chains
+ * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS.
+ * The following set must be consistent.
+ *
+ * The set below configures 4 headers -- each contains 64 priorities.
+ * Header x manages priority range (x*64) through ((x*64)+63). If
+ * the priority is more than half way through the priority range it
+ * is in, then the search is performed from the rear of the chain.
+ * This halves the search time to find the insertion point.
+ */
+
+#define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4
+#define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64
+#define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20
+
+typedef struct {
+ union {
+ Chain_Control Fifo; /* FIFO discipline list */
+ Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS];
+ /* priority discipline list */
+ } Queues;
+ Thread_queue_States sync_state; /* alloc/dealloc critical section */
+ Thread_queue_Disciplines discipline; /* queue discipline */
+ States_Control state; /* state of threads on Thread_q */
+ unsigned32 timeout_status;
+ unsigned32 count;
+} Thread_queue_Control;
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/tqdata.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h
new file mode 100644
index 0000000000..1a6ac3437e
--- /dev/null
+++ b/cpukit/score/include/rtems/score/userext.h
@@ -0,0 +1,213 @@
+/* userext.h
+ *
+ * This include file contains all information about user extensions. This
+ * Handler provides mechanisms which can be used to initialize and manipulate
+ * all user extensions.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_h
+#define __USER_EXTENSIONS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/interr.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+
+/*
+ * The following records defines the User Extension Table.
+ * This table defines the application dependent routines which
+ * are invoked at critical points in the life of each thread and
+ * the system as a whole.
+ */
+
+typedef void User_extensions_routine;
+
+typedef boolean ( *User_extensions_thread_create_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_delete_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_start_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_restart_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
+ Thread_Control *,
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_begin_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )(
+ Thread_Control *
+ );
+
+typedef User_extensions_routine ( *User_extensions_fatal_extension )(
+ Internal_errors_Source /* the_source */,
+ boolean /* is_internal */,
+ unsigned32 /* the_error */
+ );
+
+
+typedef struct {
+ User_extensions_thread_create_extension thread_create;
+ User_extensions_thread_start_extension thread_start;
+ User_extensions_thread_restart_extension thread_restart;
+ User_extensions_thread_delete_extension thread_delete;
+ User_extensions_thread_switch_extension thread_switch;
+ User_extensions_thread_begin_extension thread_begin;
+ User_extensions_thread_exitted_extension thread_exitted;
+ User_extensions_fatal_extension fatal;
+} User_extensions_Table;
+
+/*
+ * The following is used to manage each user extension set.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ User_extensions_Table Callouts;
+} User_extensions_Control;
+
+/*
+ * The following contains the static extension set which may be
+ * configured by the application.
+ */
+
+EXTERN User_extensions_Control _User_extensions_Initial;
+
+/*
+ * The following is used to manage the list of active extensions.
+ */
+
+EXTERN Chain_Control _User_extensions_List;
+
+/*
+ * _User_extensions_Thread_create
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread creation operate.
+ */
+
+boolean _User_extensions_Thread_create (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_delete
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread deletion operation.
+ */
+
+void _User_extensions_Thread_delete (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_start
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread start operation.
+ */
+
+void _User_extensions_Thread_start (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_restart
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension for
+ * the thread restart operation.
+ */
+
+void _User_extensions_Thread_restart (
+ Thread_Control *the_thread
+);
+
+/*
+ * _User_extensions_Thread_begin
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread begins.
+ */
+
+void _User_extensions_Thread_begin (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Thread_exitted
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a thread exits.
+ */
+
+void _User_extensions_Thread_exitted (
+ Thread_Control *executing
+);
+
+/*
+ * _User_extensions_Fatal
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension invoked
+ * when a fatal error occurs.
+ */
+
+void _User_extensions_Fatal (
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/userext.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/watchdog.h b/cpukit/score/include/rtems/score/watchdog.h
new file mode 100644
index 0000000000..9b13407c8e
--- /dev/null
+++ b/cpukit/score/include/rtems/score/watchdog.h
@@ -0,0 +1,185 @@
+/* watchdog.h
+ *
+ * This include file contains all the constants and structures associated
+ * with watchdog timers. This Handler provides mechanisms which can be
+ * used to initialize and manipulate watchdog timers.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_h
+#define __WATCHDOG_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+
+/*
+ * The following type defines the control block used to manage
+ * intervals.
+ */
+
+typedef unsigned32 Watchdog_Interval;
+
+/*
+ * The following types define a pointer to a watchdog service routine.
+ */
+
+typedef void Watchdog_Service_routine;
+
+typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
+ Objects_Id,
+ void *
+ );
+
+/*
+ * Constant for indefinite wait. (actually an illegal interval)
+ */
+
+#define WATCHDOG_NO_TIMEOUT 0
+
+/*
+ * The following enumerated type lists the states in which a
+ * watchdog timer may be at any given time.
+ */
+
+typedef enum {
+ WATCHDOG_INACTIVE, /* off all chains */
+ WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
+ WATCHDOG_ACTIVE, /* on chain, allowed to fire */
+ WATCHDOG_REMOVE_IT /* on chain, remove without firing if expires */
+} Watchdog_States;
+
+/*
+ * The following enumerated type details the manner in which
+ * a watchdog chain may be adjusted by the Watchdog_Adjust
+ * routine. The direction indicates a movement FORWARD
+ * or BACKWARD in time.
+ */
+
+typedef enum {
+ WATCHDOG_FORWARD, /* adjust delta value forward */
+ WATCHDOG_BACKWARD /* adjust delta value backward */
+} Watchdog_Adjust_directions;
+
+/*
+ * The following record defines the control block used
+ * to manage each watchdog timer.
+ */
+
+typedef struct {
+ Chain_Node Node;
+ Watchdog_States state;
+ Watchdog_Interval initial;
+ Watchdog_Interval delta_interval;
+ Watchdog_Service_routine_entry routine;
+ Objects_Id id;
+ void *user_data;
+} Watchdog_Control;
+
+/*
+ * The following are used for synchronization purposes
+ * during an insert on a watchdog delta chain.
+ */
+
+EXTERN volatile unsigned32 _Watchdog_Sync_level;
+EXTERN volatile unsigned32 _Watchdog_Sync_count;
+
+/*
+ * The following defines the watchdog chains which are managed
+ * on ticks and second boundaries.
+ */
+
+EXTERN Chain_Control _Watchdog_Ticks_chain;
+EXTERN Chain_Control _Watchdog_Seconds_chain;
+
+/*
+ * _Watchdog_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the watchdog handler. The watchdog
+ * synchronization flag is initialized and the watchdog chains are
+ * initialized and emptied.
+ */
+
+void _Watchdog_Handler_initialization( void );
+
+/*
+ * _Watchdog_Remove
+ *
+ * DESCRIPTION:
+ *
+ * This routine removes THE_WATCHDOG from the watchdog chain on which
+ * it resides and returns the state THE_WATCHDOG timer was in.
+ */
+
+Watchdog_States _Watchdog_Remove (
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Adjust
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the HEADER watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+void _Watchdog_Adjust (
+ Chain_Control *header,
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+);
+
+/*
+ * _Watchdog_Insert
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the HEADER watchdog chain
+ * for a time of UNITS. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ *
+ */
+
+void _Watchdog_Insert (
+ Chain_Control *header,
+ Watchdog_Control *the_watchdog
+);
+
+/*
+ * _Watchdog_Tickle
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at appropriate intervals to update
+ * the HEADER watchdog chain.
+ */
+
+void _Watchdog_Tickle (
+ Chain_Control *header
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/watchdog.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/wkspace.h b/cpukit/score/include/rtems/score/wkspace.h
new file mode 100644
index 0000000000..9814a707b1
--- /dev/null
+++ b/cpukit/score/include/rtems/score/wkspace.h
@@ -0,0 +1,71 @@
+/* wkspace.h
+ *
+ * This include file contains information related to the
+ * RAM Workspace. This Handler provides mechanisms which can be used to
+ * define, initialize and manipulate the workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_h
+#define __WORKSPACE_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+
+/*
+ * The following is used to manage the Workspace.
+ *
+ */
+
+EXTERN Heap_Control _Workspace_Area; /* executive heap header */
+
+/*
+ * _Workspace_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+void _Workspace_Handler_initialization(
+ void *starting_address,
+ unsigned32 size
+);
+
+/*
+ * _Workspace_Allocate_or_fatal_error
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then the internal error handler is invoked.
+ */
+
+void *_Workspace_Allocate_or_fatal_error(
+ unsigned32 size
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/wkspace.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h
new file mode 100644
index 0000000000..9b50159c81
--- /dev/null
+++ b/cpukit/score/include/rtems/system.h
@@ -0,0 +1,134 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the executive. This must be the first include file
+ * included in all internal RTEMS files.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __RTEMS_SYSTEM_h
+#define __RTEMS_SYSTEM_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following define the CPU Family and Model within the family
+ *
+ * NOTE: The string "REPLACE_THIS_WITH_USE_INLINE_OR_MACROS" is replaced
+ * with either "USE_INLINES" or "USE_MACROS" based upon the
+ * whether this target configuration uses the inline or
+ * macro implementations of the inlined RTEMS routines.
+ */
+
+
+#define REPLACE_THIS_WITH_USE_INLINE_OR_MACROS
+
+/*
+ * The following insures that all data is declared in the space
+ * of the Initialization Manager. It is referenced as "external"
+ * in every other file.
+ */
+
+#ifdef INIT
+#undef EXTERN
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+/*
+ * The following (in conjunction with compiler arguments) are used
+ * to choose between the use of static inline functions and macro
+ * functions. The static inline implementation allows better
+ * type checking with no cost in code size or execution speed.
+ */
+
+#ifdef USE_INLINES
+# define STATIC static
+# ifdef __GNUC__
+# define INLINE __inline__
+# else
+# define INLINE inline
+# endif
+#else
+# define STATIC
+# define INLINE
+#endif
+
+/*
+ * Include a base set of files.
+ */
+
+/*
+ * XXX: Eventually proc_ptr needs to disappear!!!
+ */
+
+typedef void * proc_ptr;
+
+#include <rtems/score/cpu.h> /* processor specific information */
+
+/*
+ * Define NULL
+ */
+
+#ifndef NULL
+#define NULL 0 /* NULL value */
+#endif
+
+/*
+ * Boolean constants
+ */
+
+#if !defined( TRUE ) || (TRUE != 1)
+#undef TRUE
+#define TRUE (1)
+#endif
+
+#if !defined( FALSE ) || (FALSE != 0)
+#undef FALSE
+#define FALSE (0)
+#endif
+
+#define stringify( _x ) # _x
+
+#define RTEMS_offsetof(type, field) \
+ ((unsigned32) &(((type *) 0)->field))
+
+/*
+ * The following is the extern for the RTEMS version string.
+ * The contents of this string are CPU specific.
+ */
+
+extern const char _RTEMS_version[]; /* RTEMS version string */
+extern const char _Copyright_Notice[]; /* RTEMS copyright string */
+
+/*
+ * The following defines the CPU dependent information table.
+ */
+
+EXTERN rtems_cpu_table _CPU_Table; /* CPU dependent info */
+
+/*
+ * XXX weird RTEMS stuff
+ */
+
+#define RTEMS_MAXIMUM_NAME_LENGTH 4
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/address.inl b/cpukit/score/inline/rtems/score/address.inl
new file mode 100644
index 0000000000..343123c981
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/address.inl
@@ -0,0 +1,120 @@
+/* inline/address.inl
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_ADDRESSES_inl
+#define __INLINE_ADDRESSES_inl
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to add an offset to a base address.
+ * It returns the resulting address. This address is typically
+ * converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Add_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base + offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract an offset from a base
+ * address. It returns the resulting address. This address is
+ * typically converted to an access type before being used further.
+ */
+
+STATIC INLINE void *_Addresses_Subtract_offset (
+ void *base,
+ unsigned32 offset
+)
+{
+ return (void *)((char *)base - offset);
+}
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to subtract two addresses. It returns the
+ * resulting offset.
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+STATIC INLINE unsigned32 _Addresses_Subtract (
+ void *left,
+ void *right
+)
+{
+ return ((char *) left - (char *) right);
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is correctly
+ * aligned for this processor and FALSE otherwise. Proper alignment
+ * is based on correctness and efficiency.
+ */
+
+STATIC INLINE boolean _Addresses_Is_aligned (
+ void *address
+)
+{
+ return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 );
+}
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the given address is within the
+ * memory range specified and FALSE otherwise. base is the address
+ * of the first byte in the memory range and limit is the address
+ * of the last byte in the memory range. The base address is
+ * assumed to be lower than the limit address.
+ */
+
+STATIC INLINE boolean _Addresses_Is_in_range (
+ void *address,
+ void *base,
+ void *limit
+)
+{
+ return ( address >= base && address <= limit );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/chain.inl b/cpukit/score/inline/rtems/score/chain.inl
new file mode 100644
index 0000000000..7fd3fef934
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/chain.inl
@@ -0,0 +1,390 @@
+/* inline/chain.inl
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * NOTE: The routines in this file are ordered from simple
+ * to complex. No other Chain Handler routine is referenced
+ * unless it has already been defined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CHAIN_inl
+#define __INLINE_CHAIN_inl
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if LEFT and RIGHT are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Are_nodes_equal(
+ Chain_Node *left,
+ Chain_Node *right
+)
+{
+ return left == right;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_chain is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_null_node(
+ Chain_Node *the_node
+)
+{
+ return ( the_node == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the first node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Head(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) the_chain;
+}
+
+/*PAGE
+ *
+ * _Chain_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the last node on the chain.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Tail(
+ Chain_Control *the_chain
+)
+{
+ return (Chain_Node *) &the_chain->permanent_null;
+}
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there a no nodes on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_empty(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the first node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_first(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->previous == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the last node on a chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_last(
+ Chain_Node *the_node
+)
+{
+ return ( the_node->next == NULL );
+}
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if there is only one node on the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Has_only_one_node(
+ Chain_Control *the_chain
+)
+{
+ return ( the_chain->first == the_chain->last );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the head of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_head(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Head( the_chain ) );
+}
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_node is the tail of the_chain and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Chain_Is_tail(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ return ( the_node == _Chain_Tail( the_chain ) );
+}
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified chain to contain zero nodes.
+ */
+
+STATIC INLINE void _Chain_Initialize_empty(
+ Chain_Control *the_chain
+)
+{
+ the_chain->first = _Chain_Tail( the_chain );
+ the_chain->permanent_null = NULL;
+ the_chain->last = _Chain_Head( the_chain );
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine extracts the_node from the chain on which it resides.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * extract operation.
+ */
+
+STATIC INLINE void _Chain_Extract_unprotected(
+ Chain_Node *the_node
+)
+{
+ Chain_Node *next;
+ Chain_Node *previous;
+
+ next = the_node->next;
+ previous = the_node->previous;
+ next->previous = previous;
+ previous->next = next;
+}
+
+/*PAGE
+ *
+ * _Chain_Get_first_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. It does NOT disable interrupts to insure
+ * the atomicity of the get operation.
+ */
+
+STATIC INLINE 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;
+}
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first node from the_chain and returns
+ * a pointer to that node. If the_chain is empty, then NULL is returned.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * get operation.
+ */
+
+STATIC INLINE Chain_Node *_Chain_Get_unprotected(
+ Chain_Control *the_chain
+)
+{
+ if ( !_Chain_Is_empty( the_chain ) )
+ return _Chain_Get_first_unprotected( the_chain );
+ else
+ return NULL;
+}
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts the_node on a chain immediately following
+ * after_node. It does NOT disable interrupts to insure the atomicity
+ * of the extract operation.
+ */
+
+STATIC INLINE void _Chain_Insert_unprotected(
+ Chain_Node *after_node,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *before_node;
+
+ the_node->previous = after_node;
+ before_node = after_node->next;
+ after_node->next = the_node;
+ the_node->next = before_node;
+ before_node->previous = the_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine appends the_node onto the end of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * append operation.
+ */
+
+STATIC INLINE void _Chain_Append_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ Chain_Node *old_last_node;
+
+ the_node->next = _Chain_Tail( the_chain );
+ old_last_node = the_chain->last;
+ the_chain->last = the_node;
+ old_last_node->next = the_node;
+ the_node->previous = old_last_node;
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It does NOT disable interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend_unprotected(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert_unprotected( _Chain_Head( the_chain ), the_node );
+
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine prepends the_node onto the front of the_chain.
+ * It disables interrupts to insure the atomicity of the
+ * prepend operation.
+ */
+
+STATIC INLINE void _Chain_Prepend(
+ Chain_Control *the_chain,
+ Chain_Node *the_node
+)
+{
+ _Chain_Insert( _Chain_Head( the_chain ), the_node );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/coremsg.inl b/cpukit/score/inline/rtems/score/coremsg.inl
new file mode 100644
index 0000000000..84e7250aa7
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/coremsg.inl
@@ -0,0 +1,260 @@
+/* coremsg.inl
+ *
+ * This include file contains the static inline implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+#include <string.h> /* needed for memcpy */
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the end of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_SEND_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ * DESCRIPTION:
+ *
+ * This routine sends a message to the front of the specified message queue.
+ */
+
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+ 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
+)
+{
+ return _CORE_message_queue_Submit(
+ the_message_queue,
+ buffer,
+ size,
+ id,
+ api_message_queue_mp_support,
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine copies the contents of the source message buffer
+ * to the destination message buffer.
+ */
+
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+ void *source,
+ void *destination,
+ unsigned32 size
+)
+{
+ memcpy(destination, source, size);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a message buffer from the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE CORE_message_queue_Buffer_control *
+_CORE_message_queue_Allocate_message_buffer (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get( &the_message_queue->Inactive_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a message buffer to the inactive
+ * message buffer chain.
+ */
+
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the first message from the_message_queue
+ * and returns a pointer to it.
+ */
+
+STATIC INLINE
+ CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (CORE_message_queue_Buffer_control *)
+ _Chain_Get_unprotected( &the_message_queue->Pending_messages );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+ CORE_message_queue_Attributes *the_attribute
+)
+{
+ return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the rear of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Append (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ * DESCRIPTION:
+ *
+ * This routine places the_message at the front of the outstanding
+ * messages on the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Prepend (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Buffer_control *the_message
+)
+{
+ _Chain_Prepend(
+ &the_message_queue->Pending_messages,
+ &the_message->Node
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_message_queue is TRUE and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return ( the_message_queue == NULL );
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if notification is enabled on this message
+ * queue and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_notify_enabled (
+ CORE_message_queue_Control *the_message_queue
+)
+{
+ return (the_message_queue->notify_handler != NULL);
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the notification information for the_message_queue.
+ */
+
+STATIC INLINE void _CORE_message_queue_Set_notify (
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Notify_Handler the_handler,
+ void *the_argument
+)
+{
+ the_message_queue->notify_handler = the_handler;
+ the_message_queue->notify_argument = the_argument;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
new file mode 100644
index 0000000000..537d6f7e5f
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/coremutex.inl
@@ -0,0 +1,124 @@
+/* inline/coremutex.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_MUTEX_inl
+#define __INLINE_CORE_MUTEX_inl
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex specified is locked and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_locked(
+ CORE_mutex_Control *the_mutex
+)
+{
+ return the_mutex->lock == CORE_MUTEX_LOCKED;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_fifo(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is PRIORITY and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * INHERIT_PRIORITY and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_inherit_priority(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex's wait discipline is
+ * PRIORITY_CEILING and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the mutex allows a task to obtain a
+ * semaphore more than once and nest.
+ */
+
+STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed(
+ CORE_mutex_Attributes *the_attribute
+)
+{
+ return the_attribute->allow_nesting == TRUE;
+
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/coresem.inl b/cpukit/score/inline/rtems/score/coresem.inl
new file mode 100644
index 0000000000..6f82318d10
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/coresem.inl
@@ -0,0 +1,54 @@
+/* inline/coresem.inl
+ *
+ * This include file contains all of the inlined routines associated
+ * with the CORE semaphore.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_CORE_SEMAPHORE_inl
+#define __INLINE_CORE_SEMAPHORE_inl
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority attribute is
+ * enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_semaphore_Is_priority(
+ CORE_semaphore_Attributes *the_attribute
+)
+{
+ return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Get_count
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the current count associated with the semaphore.
+ */
+
+STATIC INLINE unsigned32 _CORE_semaphore_Get_count(
+ CORE_semaphore_Control *the_semaphore
+)
+{
+ return the_semaphore->count;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/heap.inl b/cpukit/score/inline/rtems/score/heap.inl
new file mode 100644
index 0000000000..6b4b1af74e
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/heap.inl
@@ -0,0 +1,274 @@
+/* heap.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the head of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Head (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->start;
+}
+
+/*PAGE
+ *
+ * _Heap_Tail
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the tail of the specified heap.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Tail (
+ Heap_Control *the_heap
+)
+{
+ return (Heap_Block *)&the_heap->final;
+}
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * precedes the_block in memory.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Previous_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Subtract_offset(
+ (void *)the_block,
+ the_block->back_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the address of the block which physically
+ * follows the_block in memory.
+ *
+ * NOTE: Next_block assumes that the block is free.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Next_block (
+ Heap_Block *the_block
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset(
+ (void *)the_block,
+ the_block->front_flag & ~ HEAP_BLOCK_USED
+ );
+}
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ *
+ * DESCRIPTION:
+ *
+ * This function calculates and returns a block's location (address)
+ * in the heap based upad a base address and an offset.
+ */
+
+STATIC INLINE Heap_Block *_Heap_Block_at(
+ void *base,
+ unsigned32 offset
+)
+{
+ return (Heap_Block *) _Addresses_Add_offset( (void *)base, offset );
+}
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+STATIC INLINE Heap_Block *_Heap_User_block_at(
+ void *base
+)
+{
+ unsigned32 offset;
+
+ offset = *(((unsigned32 *) base) - 1);
+ return _Heap_Block_at( base, -offset + -HEAP_BLOCK_USED_OVERHEAD);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the previous block of the_block
+ * is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_previous_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->back_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is free, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_free (
+ Heap_Block *the_block
+)
+{
+ return !(the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the block is currently allocated,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_used (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the size of the_block in bytes.
+ */
+
+STATIC INLINE unsigned32 _Heap_Block_size (
+ Heap_Block *the_block
+)
+{
+ return (the_block->front_flag & ~HEAP_BLOCK_USED);
+}
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the starting address of the portion of the block
+ * which the user may access.
+ */
+
+STATIC INLINE void *_Heap_Start_of_user_area (
+ Heap_Block *the_block
+)
+{
+ return (void *) &the_block->next;
+}
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_block is within the memory area
+ * managed by the_heap, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Heap_Is_block_in (
+ Heap_Control *the_heap,
+ Heap_Block *the_block
+)
+{
+ return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final );
+}
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function validates a specified heap page size. If the page size
+ * is 0 or if lies outside a page size alignment boundary it is invalid
+ * and FALSE is returned. Otherwise, the page size is valid and TRUE is
+ * returned.
+ */
+
+STATIC INLINE boolean _Heap_Is_page_size_valid(
+ unsigned32 page_size
+)
+{
+ return ((page_size != 0) &&
+ ((page_size % CPU_HEAP_ALIGNMENT) == 0));
+}
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the block flag composed of size and in_use_flag.
+ * The flag returned is suitable for use as a back or front flag in a
+ * heap block.
+ */
+
+STATIC INLINE unsigned32 _Heap_Build_flag (
+ unsigned32 size,
+ unsigned32 in_use_flag
+)
+{
+ return size | in_use_flag;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/isr.inl b/cpukit/score/inline/rtems/score/isr.inl
new file mode 100644
index 0000000000..2dd41315bc
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/isr.inl
@@ -0,0 +1,73 @@
+/* isr.inl
+ *
+ * This include file contains the static implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the processor is currently servicing
+ * and interrupt and FALSE otherwise. A return value of TRUE indicates
+ * that the caller is an interrupt service routine, NOT a thread. The
+ * directives available to an interrupt service routine are restricted.
+ */
+
+STATIC INLINE boolean _ISR_Is_in_progress( void )
+{
+ return (_ISR_Nest_level != 0);
+}
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the vector is a valid vector number
+ * for this processor and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_vector_number_valid (
+ unsigned32 vector
+)
+{
+ return ( vector <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER );
+}
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if handler is the entry point of a valid
+ * use interrupt service routine and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _ISR_Is_valid_user_handler (
+ void *handler
+)
+{
+ return ( handler != NULL);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/mppkt.inl b/cpukit/score/inline/rtems/score/mppkt.inl
new file mode 100644
index 0000000000..c8b6ecd117
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/mppkt.inl
@@ -0,0 +1,58 @@
+/* inline/mppkt.inl
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_PACKET_inl
+#define __INLINE_MP_PACKET_inl
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is valid,
+ * and FALSE otherwise.
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_valid_packet_class (
+ MP_packet_Classes the_packet_class
+)
+{
+ return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
+}
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the the_packet_class is null,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Mp_packet_Is_null (
+ MP_packet_Prefix *the_packet
+)
+{
+ return the_packet == NULL;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
new file mode 100644
index 0000000000..249814bacf
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/object.inl
@@ -0,0 +1,244 @@
+/* object.inl
+ *
+ * This include file contains the static inline implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ * DESCRIPTION:
+ *
+ * This function builds an object's id from the processor node and index
+ * values specified.
+ */
+
+STATIC INLINE Objects_Id _Objects_Build_id(
+ Objects_Classes the_class,
+ unsigned32 node,
+ unsigned32 index
+)
+{
+ return ( (the_class << OBJECTS_CLASS_START_BIT) |
+ (node << OBJECTS_NODE_START_BIT) |
+ (index << OBJECTS_INDEX_START_BIT) );
+}
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ */
+
+STATIC INLINE Objects_Classes _Objects_Get_class(
+ Objects_Id id
+)
+{
+ return (Objects_Classes)
+ ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
+}
+
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the node portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_node(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index portion of the ID.
+ */
+
+STATIC INLINE unsigned32 _Objects_Get_index(
+ Objects_Id id
+)
+{
+ return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the class is valid.
+ */
+
+STATIC INLINE boolean _Objects_Is_class_valid(
+ Objects_Classes the_class
+)
+{
+ return the_class <= OBJECTS_CLASSES_LAST;
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the node is of the local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_node(
+ unsigned32 node
+)
+{
+ return ( node == _Objects_Local_node );
+}
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the id is of a local object, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Is_local_id(
+ Objects_Id id
+)
+{
+ return _Objects_Is_local_node( _Objects_Get_node(id) );
+}
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if left and right are equal,
+ * and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Objects_Are_ids_equal(
+ Objects_Id left,
+ Objects_Id right
+)
+{
+ return ( left == right );
+}
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a object control block from
+ * the inactive chain of free object control blocks.
+ */
+
+STATIC INLINE Objects_Control *_Objects_Allocate(
+ Objects_Information *information
+)
+{
+ return (Objects_Control *) _Chain_Get( &information->Inactive );
+}
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees a object control block to the
+ * inactive chain of free object control blocks.
+ */
+
+STATIC INLINE void _Objects_Free(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ _Chain_Append( &information->Inactive, &the_object->Node );
+}
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ * DESCRIPTION:
+ *
+ * This function places the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables, respectively.
+ */
+
+STATIC INLINE void _Objects_Open(
+ Objects_Information *information,
+ Objects_Control *the_object,
+ Objects_Name name
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = the_object;
+
+ if ( information->is_string )
+ _Objects_Copy_name_string( name, the_object->name );
+ else
+ _Objects_Copy_name_raw( name, the_object->name, information->name_length );
+}
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ * DESCRIPTION:
+ *
+ * This function removes the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables.
+ */
+
+STATIC INLINE void _Objects_Close(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ unsigned32 index;
+
+ index = _Objects_Get_index( the_object->id );
+ information->local_table[ index ] = NULL;
+ _Objects_Clear_name( the_object->name, information->name_length );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/objectmp.inl b/cpukit/score/inline/rtems/score/objectmp.inl
new file mode 100644
index 0000000000..dda2799643
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/objectmp.inl
@@ -0,0 +1,73 @@
+/* inline/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_OBJECTS_inl
+#define __INLINE_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function allocates a Global Object control block.
+ */
+
+STATIC INLINE Objects_MP_Control *_Objects_MP_Allocate_global_object (
+ void
+)
+{
+ return (Objects_MP_Control *)
+ _Chain_Get( &_Objects_MP_Inactive_global_objects );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Free_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This routine deallocates a Global Object control block.
+ */
+
+STATIC INLINE void _Objects_MP_Free_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ _Chain_Append(
+ &_Objects_MP_Inactive_global_objects,
+ &the_object->Object.Node
+ );
+}
+
+/*PAGE
+ *
+ * _Objects_MP_Is_null_global_object
+ *
+ * DESCRIPTION:
+ *
+ * This function returns whether the global object is NULL or not.
+ */
+
+STATIC INLINE boolean _Objects_MP_Is_null_global_object (
+ Objects_MP_Control *the_object
+)
+{
+ return( the_object == NULL );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/priority.inl b/cpukit/score/inline/rtems/score/priority.inl
new file mode 100644
index 0000000000..d65056057b
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/priority.inl
@@ -0,0 +1,247 @@
+/* priority.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _Priority_Handler_initialization( void )
+{
+ unsigned32 index;
+
+ _Priority_Major_bit_map = 0;
+ for ( index=0 ; index <16 ; index++ )
+ _Priority_Bit_map[ index ] = 0;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority if valid for a
+ * user task, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_valid (
+ Priority_Control the_priority
+)
+{
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+ return ( the_priority <= PRIORITY_MAXIMUM );
+}
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the major portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Major (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority / 16 );
+}
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the minor portion of the_priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Minor (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority % 16 );
+}
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the mask associated with the major or minor
+ * number passed to it.
+ */
+
+STATIC INLINE unsigned32 _Priority_Mask (
+ unsigned32 bit_number
+)
+{
+ return (0x8000 >> bit_number);
+}
+
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ * DESCRIPTION:
+ *
+ * This function translates the bit numbers returned by the bit scan
+ * of a priority bit field into something suitable for use as
+ * a major or minor component of a priority.
+ */
+
+STATIC INLINE unsigned32 _Priority_Bits_index (
+ unsigned32 bit_number
+)
+{
+ return bit_number;
+}
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been readied.
+ */
+
+STATIC INLINE void _Priority_Add_to_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor |= the_priority_map->ready_minor;
+ _Priority_Major_bit_map |= the_priority_map->ready_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ * DESCRIPTION:
+ *
+ * This routine uses the_priority_map to update the priority
+ * bit maps to indicate that a thread has been removed from the
+ * ready state.
+ */
+
+STATIC INLINE void _Priority_Remove_from_bit_map (
+ Priority_Information *the_priority_map
+)
+{
+ *the_priority_map->minor &= the_priority_map->block_minor;
+ if ( *the_priority_map->minor == 0 )
+ _Priority_Major_bit_map &= the_priority_map->block_major;
+}
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the priority of the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE Priority_Control _Priority_Get_highest( void )
+{
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control major;
+
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major );
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor );
+
+ return (_Priority_Bits_index( major ) << 4) +
+ _Priority_Bits_index( minor );
+}
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_priority_map so that it
+ * contains the information necessary to manage a thread
+ * at new_priority.
+ */
+
+STATIC INLINE void _Priority_Initialize_information(
+ Priority_Information *the_priority_map,
+ Priority_Control new_priority
+)
+{
+ Priority_Bit_map_control major;
+ Priority_Bit_map_control minor;
+ Priority_Bit_map_control mask;
+
+ major = _Priority_Major( new_priority );
+ minor = _Priority_Minor( new_priority );
+
+ the_priority_map->minor =
+ &_Priority_Bit_map[ _Priority_Bits_index(major) ];
+
+ mask = _Priority_Mask( major );
+ the_priority_map->ready_major = mask;
+ the_priority_map->block_major = ~mask;
+
+ mask = _Priority_Mask( minor );
+ the_priority_map->ready_minor = mask;
+ the_priority_map->block_minor = ~mask;
+}
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the priority GROUP is empty, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Priority_Is_group_empty (
+ Priority_Control the_priority
+)
+{
+ return the_priority == 0;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/stack.inl b/cpukit/score/inline/rtems/score/stack.inl
new file mode 100644
index 0000000000..d29874a7dd
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/stack.inl
@@ -0,0 +1,81 @@
+/* stack.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the_stack record to indicate that
+ * size bytes of memory starting at starting_address have been
+ * reserved for a stack.
+ */
+
+STATIC INLINE void _Stack_Initialize (
+ Stack_Control *the_stack,
+ void *starting_address,
+ unsigned32 size
+)
+{
+ the_stack->area = starting_address;
+ the_stack->size = size;
+}
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if size bytes is enough memory for
+ * a valid stack area on this processor, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Stack_Is_enough (
+ unsigned32 size
+)
+{
+ return ( size >= STACK_MINIMUM_SIZE );
+}
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ *
+ * DESCRIPTION:
+ *
+ * This function increases the stack size to insure that the thread
+ * has the desired amount of stack space after the initial stack
+ * pointer is determined based on alignment restrictions.
+ *
+ * NOTE:
+ *
+ * The amount of adjustment for alignment is CPU dependent.
+ */
+
+STATIC INLINE unsigned32 _Stack_Adjust_size (
+ unsigned32 size
+)
+{
+ return size + CPU_STACK_ALIGNMENT;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/states.inl b/cpukit/score/inline/rtems/score/states.inl
new file mode 100644
index 0000000000..fad8ce727c
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/states.inl
@@ -0,0 +1,384 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ * DESCRIPTION:
+ *
+ * This function sets the given states_to_set into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Set (
+ States_Control states_to_set,
+ States_Control current_state
+)
+{
+ return (current_state | states_to_set);
+}
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ * DESCRIPTION:
+ *
+ * This function clears the given states_to_clear into the current_state
+ * passed in. The result is returned to the user in current_state.
+ */
+
+STATIC INLINE States_Control _States_Clear (
+ States_Control states_to_clear,
+ States_Control current_state
+)
+{
+ return (current_state & ~states_to_clear);
+}
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_states indicates that the
+ * state is READY, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_ready (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_READY);
+}
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is the ONLY state
+ * set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_only_dormant (
+ States_Control the_states
+)
+{
+ return (the_states == STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DORMANT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_dormant (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DORMANT);
+}
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the SUSPENDED state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_suspended (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_SUSPENDED);
+}
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the TRANSIENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_transient (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_TRANSIENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the DELAYING state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_delaying (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_DELAYING);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_BUFFER state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_buffer (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_BUFFER);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_segment (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEGMENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_message (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MESSAGE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_EVENT state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_event (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_EVENT);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_MUTEX state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_mutex (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_MUTEX);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_SEMAPHORE state
+ * is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_semaphore (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_SEMAPHORE);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_time (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_TIME);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_TIME state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_rpc_reply (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_RPC_REPLY);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the WAITING_FOR_PERIOD state is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_for_period (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_FOR_PERIOD);
+}
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_locally_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_LOCALLY_BLOCKED);
+}
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked waiting for a local resource is set in
+ * the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_waiting_on_thread_queue (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_WAITING_ON_THREAD_QUEUE);
+}
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if one of the states which indicates
+ * that a task is blocked is set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Is_blocked (
+ States_Control the_states
+)
+{
+ return (the_states & STATES_BLOCKED);
+}
+
+/*PAGE
+ *
+ *
+ * _States_Are_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if any of the states in the mask
+ * are set in the_states, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _States_Are_set (
+ States_Control the_states,
+ States_Control mask
+)
+{
+ return ( (the_states & mask) != STATES_READY);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/sysstate.inl b/cpukit/score/inline/rtems/score/sysstate.inl
new file mode 100644
index 0000000000..08f8b9c513
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/sysstate.inl
@@ -0,0 +1,154 @@
+/* sysstates.inl
+ *
+ * This file contains the inline implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the system state handler.
+ */
+
+STATIC INLINE void _System_state_Handler_initialization (
+ boolean is_multiprocessing
+)
+{
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION;
+ _System_state_Is_multiprocessing = is_multiprocessing;
+}
+
+/*PAGE
+ *
+ * _System_state_Set
+ *
+ * DESCRIPTION:
+ *
+ * This routine sets the current system state to that specified by
+ * the called.
+ */
+
+STATIC INLINE void _System_state_Set (
+ System_state_Codes state
+)
+{
+ _System_state_Current = state;
+}
+
+/*PAGE
+ *
+ * _System_state_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the current system state.
+ */
+
+STATIC INLINE System_state_Codes _System_state_Get ( void )
+{
+ return _System_state_Current;
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before initialization" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_initialization (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "before multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_before_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "begin multitasking" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_begin_multitasking (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_BEGIN_MULTITASKING);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "up" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_up (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_UP);
+}
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the state is equal to the
+ * "failed" state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _System_state_Is_failed (
+ System_state_Codes state
+)
+{
+ return (state == SYSTEM_STATE_FAILED);
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
new file mode 100644
index 0000000000..53d5d41751
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/thread.inl
@@ -0,0 +1,404 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ * DESCRIPTION:
+ *
+ * This routine halts multitasking and returns control to
+ * the "thread" (i.e. the BSP) which initially invoked the
+ * routine which initialized the system.
+ */
+
+STATIC INLINE void _Thread_Stop_multitasking( void )
+{
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the currently executing
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Executing );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is the heir
+ * thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_heir (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the currently executing thread
+ * is also the heir thread, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void )
+{
+ return ( _Thread_Executing == _Thread_Heir );
+}
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears the SUSPENDED state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Resume (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_SUSPENDED );
+}
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ * DESCRIPTION:
+ *
+ * This routine clears any blocking state for the_thread. It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+STATIC INLINE void _Thread_Unblock (
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_BLOCKED );
+}
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets the current context of the calling thread
+ * to that of its initial state.
+ */
+
+STATIC INLINE void _Thread_Restart_self( void )
+{
+ if ( _Thread_Executing->fp_context != NULL )
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers );
+}
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ * DESCRIPTION:
+ *
+ * This function returns a pointer to the highest priority
+ * ready thread.
+ */
+
+STATIC INLINE void _Thread_Calculate_heir( void )
+{
+ _Thread_Heir = (Thread_Control *)
+ _Thread_Ready_chain[ _Priority_Get_highest() ].first;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the floating point context of
+ * the_thread is currently loaded in the floating point unit, and
+ * FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_allocated_fp (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == _Thread_Allocated_fp );
+}
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked when the currently loaded floating
+ * point context is now longer associated with an active thread.
+ */
+
+STATIC INLINE void _Thread_Deallocate_fp( void )
+{
+ _Thread_Allocated_fp = NULL;
+}
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine prevents dispatching.
+ */
+
+STATIC INLINE void _Thread_Disable_dispatch( void )
+{
+ _Thread_Dispatch_disable_level += 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. If this is
+ * the outer most dispatching critical section, then a dispatching
+ * operation will be performed and, if necessary, control of the
+ * processor will be transferred to the heir thread.
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+STATIC INLINE void _Thread_Enable_dispatch()
+{
+ if ( (--_Thread_Dispatch_disable_level) == 0 )
+ _Thread_Dispatch();
+}
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ * DESCRIPTION:
+ *
+ * This routine allows dispatching to occur again. However,
+ * no dispatching operation is performed even if this is the outer
+ * most dispatching critical section.
+ */
+
+STATIC INLINE void _Thread_Unnest_dispatch( void )
+{
+ _Thread_Dispatch_disable_level -= 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_dispatching_enabled( void )
+{
+ return ( _Thread_Dispatch_disable_level == 0 );
+}
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if dispatching is disabled, and FALSE
+ * otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_context_switch_necessary( void )
+{
+ return ( _Context_Switch_necessary );
+}
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the thread dispatching subsystem.
+ */
+
+STATIC INLINE void _Thread_Dispatch_initialization( void )
+{
+ _Thread_Dispatch_disable_level = 1;
+}
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_thread is NULL and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_null (
+ Thread_Control *the_thread
+)
+{
+ return ( the_thread == NULL );
+}
+
+/*PAGE
+ *
+ * _Thread_Get
+ *
+ * DESCRIPTION:
+ *
+ * This function maps thread IDs to thread control
+ * blocks. If ID corresponds to a local thread, then it
+ * returns the_thread control pointer which maps to ID
+ * and location is set to OBJECTS_LOCAL. If the thread ID is
+ * global and resides on a remote node, then location is set
+ * to OBJECTS_REMOTE, and the_thread is undefined.
+ * Otherwise, location is set to OBJECTS_ERROR and
+ * the_thread is undefined.
+ *
+ * NOTE: XXX... This routine may be able to be optimized.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Get (
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ Objects_Classes 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_class = _Objects_Get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ tp = (Thread_Control *) _Objects_Get( information, id, location );
+
+done:
+ return tp;
+}
+
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the status code is equal to the
+ * status which indicates that a proxy is blocking, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Thread_Is_proxy_blocking (
+ unsigned32 code
+)
+{
+ return (code == THREAD_STATUS_PROXY_BLOCKING);
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine allocates an internal thread.
+ */
+
+STATIC INLINE Thread_Control *_Thread_Internal_allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information );
+}
+
+/*PAGE
+ *
+ * _Thread_Internal_free
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees an internal thread.
+ */
+
+STATIC INLINE void _Thread_Internal_free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free( &_Thread_Internal_information, &the_task->Object );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/threadmp.inl b/cpukit/score/inline/rtems/score/threadmp.inl
new file mode 100644
index 0000000000..f16f64e48a
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/threadmp.inl
@@ -0,0 +1,61 @@
+/* inline/threadmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __INLINE_MP_THREAD_inl
+#define __INLINE_MP_THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ * DESCRIPTION:
+ *
+ * This function returns true if the thread in question is the
+ * multiprocessing receive thread.
+ */
+
+STATIC INLINE boolean _Thread_MP_Is_receive (
+ Thread_Control *the_thread
+)
+{
+ return the_thread == _Thread_MP_Receive;
+}
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a proxy control block to the
+ * inactive chain of free proxy control blocks.
+ */
+
+STATIC INLINE void _Thread_MP_Free_proxy (
+ Thread_Control *the_thread
+)
+{
+ Thread_Proxy_control *the_proxy;
+
+ the_proxy = (Thread_Proxy_control *) the_thread;
+
+ _Chain_Extract( &the_proxy->Active );
+
+ _Chain_Append( &_Thread_MP_Inactive_proxies, &the_thread->Object.Node );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/tod.inl b/cpukit/score/inline/rtems/score/tod.inl
new file mode 100644
index 0000000000..5ed1e76d8f
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/tod.inl
@@ -0,0 +1,82 @@
+/* tod.inl
+ *
+ * This file contains the static inline implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the application has set the current
+ * time of day, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _TOD_Is_set( void )
+{
+ return _Watchdog_Is_active( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine increments the ticks field of the current time of
+ * day at each clock tick.
+ */
+
+STATIC INLINE void _TOD_Tickle_ticks( void )
+{
+ _TOD_Current.ticks += 1;
+ _TOD_Ticks_since_boot += 1;
+}
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Deactivate( void )
+{
+ _Watchdog_Remove( &_TOD_Seconds_watchdog );
+}
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates updating of the current time of day.
+ */
+
+STATIC INLINE void _TOD_Activate(
+ Watchdog_Interval ticks
+)
+{
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, ticks );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/tqdata.inl b/cpukit/score/inline/rtems/score/tqdata.inl
new file mode 100644
index 0000000000..c7d8630062
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/tqdata.inl
@@ -0,0 +1,89 @@
+/* tqdata.inl
+ *
+ * This file contains the static inline implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the index of the priority chain on which
+ * a thread of the_priority should be placed.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Header_number (
+ Priority_Control the_priority
+)
+{
+ return (the_priority / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER);
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ * DESCRIPTION:
+ *
+ * This function returns TRUE if the_priority indicates that the
+ * enqueue search should start at the front of this priority
+ * group chain, and FALSE if the search should start at the rear.
+ */
+
+STATIC INLINE boolean _Thread_queue_Is_reverse_search (
+ Priority_Control the_priority
+)
+{
+ return ( the_priority & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the number of threads waiting on this thread queue.
+ */
+
+STATIC INLINE unsigned32 _Thread_queue_Get_number_waiting (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ return ( the_thread_queue->count );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked to indicate that the specified thread queue is
+ * entering a critical section.
+ */
+
+STATIC INLINE void _Thread_queue_Enter_critical_section (
+ Thread_queue_Control *the_thread_queue
+)
+{
+ the_thread_queue->sync_state = THREAD_QUEUE_NOTHING_HAPPENED;
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl
new file mode 100644
index 0000000000..a9a858b2e2
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/userext.inl
@@ -0,0 +1,121 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ * DESCRIPTION:
+ *
+ * This routine performs the initialization necessary for this handler.
+ */
+
+STATIC INLINE void _User_extensions_Handler_initialization (
+ User_extensions_Table *initial_extensions
+)
+{
+ _Chain_Initialize_empty( &_User_extensions_List );
+
+ if ( initial_extensions ) {
+ _User_extensions_Initial.Callouts = *initial_extensions;
+ _Chain_Append( &_User_extensions_List, &_User_extensions_Initial.Node );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to add a user extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+)
+{
+ the_extension->Callouts = *extension_table;
+
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ * DESCRIPTION:
+ *
+ * This routine is used to add an API extension set to the active list.
+ */
+
+STATIC INLINE void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Prepend( &_User_extensions_List, &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to remove a user extension set from the active list.
+ */
+
+STATIC INLINE void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Extract( &the_extension->Node );
+}
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ * DESCRIPTION:
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ */
+
+STATIC INLINE void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+)
+{
+ 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_switch != NULL )
+ (*the_extension->Callouts.thread_switch)( executing, heir );
+ }
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/watchdog.inl b/cpukit/score/inline/rtems/score/watchdog.inl
new file mode 100644
index 0000000000..75fb662dfc
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/watchdog.inl
@@ -0,0 +1,324 @@
+/* watchdog.inl
+ *
+ * This file contains the static inline implementation of all inlined
+ * routines in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ * DESCRIPTION:
+ *
+ * This routine initializes the specified watchdog. The watchdog is
+ * made inactive, the watchdog id and handler routine are set to the
+ * specified values.
+ */
+
+STATIC INLINE void _Watchdog_Initialize(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Service_routine_entry routine,
+ Objects_Id id,
+ void *user_data
+)
+{
+ the_watchdog->state = WATCHDOG_INACTIVE;
+ the_watchdog->routine = routine;
+ the_watchdog->id = id;
+ the_watchdog->user_data = user_data;
+}
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns TRUE if the watchdog timer is in the ACTIVE
+ * state, and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _Watchdog_Is_active(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( the_watchdog->state == WATCHDOG_ACTIVE );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ * DESCRIPTION:
+ *
+ * This routine activates THE_WATCHDOG timer which is already
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Activate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_ACTIVE;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ * DESCRIPTION:
+ *
+ * This routine deactivates THE_WATCHDOG timer which will remain
+ * on a watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Deactivate(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ the_watchdog->state = WATCHDOG_REMOVE_IT;
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the ticks
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_ticks( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine is invoked at each clock tick to update the seconds
+ * watchdog chain.
+ */
+
+STATIC INLINE void _Watchdog_Tickle_seconds( void )
+{
+
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the ticks watchdog chain
+ * for a time of UNITS ticks. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_ticks(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine inserts THE_WATCHDOG into the seconds watchdog chain
+ * for a time of UNITS seconds. The INSERT_MODE indicates whether
+ * THE_WATCHDOG is to be activated automatically or later, explicitly
+ * by the caller.
+ */
+
+STATIC INLINE void _Watchdog_Insert_seconds(
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval units
+)
+{
+
+ the_watchdog->initial = units;
+
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the seconds watchdog chain in the forward
+ * or backward DIRECTION for UNITS seconds. This is invoked when the
+ * current time of day is changed.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_seconds(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ * DESCRIPTION:
+ *
+ * This routine adjusts the ticks watchdog chain in the forward
+ * or backward DIRECTION for UNITS ticks.
+ */
+
+STATIC INLINE void _Watchdog_Adjust_ticks(
+ Watchdog_Adjust_directions direction,
+ Watchdog_Interval units
+)
+{
+
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, direction, units );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ * DESCRIPTION:
+ *
+ * This routine resets THE_WATCHDOG timer to its state at INSERT
+ * time. This routine is valid only on interval watchdog timers
+ * and is used to make an interval watchdog timer fire "every" so
+ * many ticks.
+ */
+
+STATIC INLINE void _Watchdog_Reset(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ (void) _Watchdog_Remove( the_watchdog );
+
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer following
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Next(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.next );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the watchdog timer preceding
+ * THE_WATCHDOG on the watchdog chain.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Previous(
+ Watchdog_Control *the_watchdog
+)
+{
+
+ return ( (Watchdog_Control *) the_watchdog->Node.previous );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the first watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_First(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->first );
+
+}
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns a pointer to the last watchdog timer
+ * on the watchdog chain HEADER.
+ */
+
+STATIC INLINE Watchdog_Control *_Watchdog_Last(
+ Chain_Control *header
+)
+{
+
+ return ( (Watchdog_Control *) header->last );
+
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/wkspace.inl b/cpukit/score/inline/rtems/score/wkspace.inl
new file mode 100644
index 0000000000..47174a9c9d
--- /dev/null
+++ b/cpukit/score/inline/rtems/score/wkspace.inl
@@ -0,0 +1,57 @@
+/* wkspace.inl
+ *
+ * This include file contains the bodies of the routines which contains
+ * information related to the RAM Workspace.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ * DESCRIPTION:
+ *
+ * This routine returns the address of a block of memory of size
+ * bytes. If a block of the appropriate size cannot be allocated
+ * from the workspace, then NULL is returned.
+ */
+
+STATIC INLINE void *_Workspace_Allocate(
+ unsigned32 size
+)
+{
+ return _Heap_Allocate( &_Workspace_Area, size );
+}
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ * DESCRIPTION:
+ *
+ * This function frees the specified block of memory. If the block
+ * belongs to the Workspace and can be successfully freed, then
+ * TRUE is returned. Otherwise FALSE is returned.
+ */
+
+STATIC INLINE boolean _Workspace_Free(
+ void *block
+)
+{
+ return _Heap_Free( &_Workspace_Area, block );
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/README b/cpukit/score/macros/README
new file mode 100644
index 0000000000..b2f0c4d481
--- /dev/null
+++ b/cpukit/score/macros/README
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+The files in this directory are not considered the "primary" source
+of inlined routines for RTEMS. The "inline" directory contains
+the implementations of the inlined basis which are regularly
+tested. In general, an effort is made to keep the contents of
+this directory up to date but testing is only performed irregularly
+and even then it is usually with a single target processor and BSP.
+
+The primary purpose of the code in this directory is to insure
+that RTEMS can be compiled using a C compiler which does not support
+static inline routines.
+
+These were last successfully tested on 2/1/95 on a prerelease version
+of 3.2.0. The testing was done only on the Force CPU386 i386 target board.
+No testing was done on version of the code in the final release.
diff --git a/cpukit/score/macros/rtems/score/README b/cpukit/score/macros/rtems/score/README
new file mode 100644
index 0000000000..b2f0c4d481
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/README
@@ -0,0 +1,18 @@
+#
+# $Id$
+#
+
+The files in this directory are not considered the "primary" source
+of inlined routines for RTEMS. The "inline" directory contains
+the implementations of the inlined basis which are regularly
+tested. In general, an effort is made to keep the contents of
+this directory up to date but testing is only performed irregularly
+and even then it is usually with a single target processor and BSP.
+
+The primary purpose of the code in this directory is to insure
+that RTEMS can be compiled using a C compiler which does not support
+static inline routines.
+
+These were last successfully tested on 2/1/95 on a prerelease version
+of 3.2.0. The testing was done only on the Force CPU386 i386 target board.
+No testing was done on version of the code in the final release.
diff --git a/cpukit/score/macros/rtems/score/address.inl b/cpukit/score/macros/rtems/score/address.inl
new file mode 100644
index 0000000000..c0d45c3c6b
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/address.inl
@@ -0,0 +1,68 @@
+/* macros/address.h
+ *
+ * This include file contains the bodies of the routines
+ * about addresses which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_ADDRESSES_h
+#define __MACROS_ADDRESSES_h
+
+/*PAGE
+ *
+ * _Addresses_Add_offset
+ *
+ */
+
+#define _Addresses_Add_offset( _base, _offset ) \
+ ((void *)((char *)(_base) + (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract_offset
+ *
+ */
+
+#define _Addresses_Subtract_offset( _base, _offset ) \
+ ((void *)((char *)(_base) - (_offset)))
+
+/*PAGE
+ *
+ * _Addresses_Subtract
+ *
+ * NOTE: The cast of an address to an unsigned32 makes this code
+ * dependent on an addresses being thirty two bits.
+ */
+
+#define _Addresses_Subtract( _left, _right ) \
+ ((void *)(_left) - (void *)(_right))
+
+/*PAGE
+ *
+ * _Addresses_Is_aligned
+ *
+ */
+
+#define _Addresses_Is_aligned( _address ) \
+ ( ( (unsigned32)(_address) % 4 ) == 0 )
+
+/*PAGE
+ *
+ * _Addresses_Is_in_range
+ *
+ */
+
+#define _Addresses_Is_in_range( _address, _base, _limit ) \
+ ( (_address) >= (_base) && (_address) <= (_limit) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/chain.inl b/cpukit/score/macros/rtems/score/chain.inl
new file mode 100644
index 0000000000..0f09499f1d
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/chain.inl
@@ -0,0 +1,200 @@
+/* macros/chain.h
+ *
+ * This include file contains the bodies of the routines which are
+ * associated with doubly linked chains and inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CHAIN_h
+#define __MACROS_CHAIN_h
+
+/*PAGE
+ *
+ * _Chain_Are_nodes_equal
+ */
+
+#define _Chain_Are_nodes_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Chain_Is_null
+ */
+
+#define _Chain_Is_null( _the_chain ) \
+ ( (_the_chain) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_null_node
+ */
+
+#define _Chain_Is_null_node( _the_node ) \
+ ( (_the_node) == NULL )
+
+/*PAGE
+ *
+ * _Chain_Head
+ */
+
+#define _Chain_Head( _the_chain ) \
+ ((Chain_Node *) (_the_chain))
+
+/*PAGE
+ *
+ * _Chain_Tail
+ */
+
+#define _Chain_Tail( _the_chain ) \
+ ((Chain_Node *) &(_the_chain)->permanent_null)
+
+/*PAGE
+ *
+ * _Chain_Is_empty
+ */
+
+#define _Chain_Is_empty( _the_chain ) \
+ ( (_the_chain)->first == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_first
+ */
+
+#define _Chain_Is_first( _the_node ) \
+ ( (the_node)->previous == NULL )
+
+/*PAGE
+ *
+ * _Chain_Is_last
+ */
+
+#define _Chain_Is_last( _the_node ) \
+ ( (_the_node)->next == NULL )
+
+/*PAGE
+ *
+ * _Chain_Has_only_one_node
+ */
+
+#define _Chain_Has_only_one_node( _the_chain ) \
+ ( (_the_chain)->first == (_the_chain)->last )
+
+/*PAGE
+ *
+ * _Chain_Is_head
+ */
+
+#define _Chain_Is_head( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Head( (_the_chain) ) )
+
+/*PAGE
+ *
+ * _Chain_Is_tail
+ */
+
+#define _Chain_Is_tail( _the_chain, _the_node ) \
+ ( (_the_node) == _Chain_Tail( (_the_chain) ) )
+
+/*PAGE
+ *
+ * Chain_Initialize_empty
+ */
+
+#define _Chain_Initialize_empty( _the_chain ) \
+{ \
+ (_the_chain)->first = _Chain_Tail( (_the_chain) ); \
+ (_the_chain)->permanent_null = NULL; \
+ (_the_chain)->last = _Chain_Head( (_the_chain) ); \
+}
+
+/*PAGE
+ *
+ * _Chain_Extract_unprotected
+ */
+
+#define _Chain_Extract_unprotected( _the_node ) \
+{ \
+ Chain_Node *_next; \
+ Chain_Node *_previous; \
+ \
+ _next = (_the_node)->next; \
+ _previous = (_the_node)->previous; \
+ _next->previous = _previous; \
+ _previous->next = _next; \
+}
+
+/*PAGE
+ *
+ * _Chain_Get_unprotected
+ */
+
+/*PAGE
+ *
+ * Chain_Get_unprotected
+ */
+
+#define _Chain_Get_unprotected( _the_chain ) \
+ (( !_Chain_Is_empty( (_the_chain) ) ) \
+ ? _Chain_Get_first_unprotected( (_the_chain) ) \
+ : NULL)
+
+/*PAGE
+ *
+ * _Chain_Insert_unprotected
+ */
+
+#define _Chain_Insert_unprotected( _after_node, _the_node ) \
+{ \
+ Chain_Node *_before_node; \
+ \
+ (_the_node)->previous = (_after_node); \
+ _before_node = (_after_node)->next; \
+ (_after_node)->next = (_the_node); \
+ (_the_node)->next = _before_node; \
+ _before_node->previous = (_the_node); \
+}
+
+/*PAGE
+ *
+ * _Chain_Append_unprotected
+ */
+
+#define _Chain_Append_unprotected( _the_chain, _the_node ) \
+{ \
+ Chain_Node *_old_last_node; \
+ \
+ (_the_node)->next = _Chain_Tail( (_the_chain) ); \
+ _old_last_node = (_the_chain)->last; \
+ (_the_chain)->last = (_the_node); \
+ _old_last_node->next = (_the_node); \
+ (_the_node)->previous = _old_last_node; \
+}
+
+/*PAGE
+ *
+ * _Chain_Prepend_unprotected
+ */
+
+#define _Chain_Prepend_unprotected( _the_chain, _the_node ) \
+ _Chain_Insert_unprotected( _Chain_Head( (_the_chain) ), (_the_node) )
+
+/*PAGE
+ *
+ * _Chain_Prepend
+ */
+
+#define _Chain_Prepend( _the_chain, _the_node ) \
+ _Chain_Insert( _Chain_Head( (_the_chain) ), (_the_node) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/coremsg.inl b/cpukit/score/macros/rtems/score/coremsg.inl
new file mode 100644
index 0000000000..90bef885ed
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/coremsg.inl
@@ -0,0 +1,143 @@
+/* coremsg.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Core Message Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ * _CORE_message_queue_Send
+ *
+ */
+
+#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Urgent
+ *
+ */
+
+#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+ (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Copy_buffer
+ */
+
+#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \
+ memcpy( _destination, _source, _size)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get( &(_the_message_queue)->Inactive_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
+ _Chain_Append( \
+ &(_the_message_queue)->Inactive_messages, \
+ &(_the_message)->Node \
+ )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_priority
+ *
+ */
+
+#define _CORE_message_queue_Is_priority( _the_attribute ) \
+ ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY)
+
+/*PAGE
+ *
+ * _CORE_message_queue_Get_pending_message
+ *
+ */
+
+#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \
+ (CORE_message_queue_Buffer_control *) \
+ _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Append
+ *
+ */
+
+#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
+ _Chain_Append( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Prepend
+ *
+ */
+
+#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
+ _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
+ &(_the_message)->Node )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_null
+ *
+ */
+
+#define _CORE_message_queue_Is_null( _the_message_queue ) \
+ ( (_the_message_queue) == NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Is_notify_enabled
+ *
+ */
+
+#define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \
+ ( (_the_message_queue)->notify_handler != NULL )
+
+/*PAGE
+ *
+ * _CORE_message_queue_Set_notify
+ *
+ */
+
+#define _CORE_message_queue_Set_notify( \
+ _the_message_queue, _the_handler, _the_argument ) \
+ do { \
+ (_the_message_queue)->notify_handler = (_the_handler); \
+ (_the_message_queue)->notify_argument = (_the_argument); \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/coremutex.inl b/cpukit/score/macros/rtems/score/coremutex.inl
new file mode 100644
index 0000000000..e8dbc9322c
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/coremutex.inl
@@ -0,0 +1,77 @@
+/* macros/coremutex.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core mutexes.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_MUTEX_h
+#define __MACROS_CORE_MUTEX_h
+
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_locked
+ *
+ */
+
+#define _CORE_mutex_Is_locked( _the_mutex ) \
+ ( (_the_mutex)->lock == CORE_MUTEX_LOCKED )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_fifo
+ *
+ */
+
+#define _CORE_mutex_Is_fifo( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority
+ *
+ */
+
+#define _CORE_mutex_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_inherit_priority
+ *
+ */
+
+#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == \
+ CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_priority_ceiling
+ *
+ */
+
+#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\
+ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING )
+
+/*PAGE
+ *
+ * _CORE_mutex_Is_nesting_allowed
+ *
+ */
+
+#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \
+ ( (_the_attribute)->allow_nesting == TRUE )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/coresem.inl b/cpukit/score/macros/rtems/score/coresem.inl
new file mode 100644
index 0000000000..499b4a1433
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/coresem.inl
@@ -0,0 +1,40 @@
+/* macros/coresem.h
+ *
+ * This include file contains all of the inlined routines associated
+ * with core semaphores.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_CORE_SEMAPHORE_h
+#define __MACROS_CORE_SEMAPHORE_h
+
+/*PAGE
+ *
+ * _CORE_semaphore_Is_priority
+ *
+ */
+
+#define _CORE_semaphore_Is_priority( _the_attribute ) \
+ ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY )
+
+/*PAGE
+ *
+ * _Core_semaphore_Get_count
+ *
+ */
+
+#define _Core_semaphore_Get_count( _the_semaphore ) \
+ ( (_the_semaphore)->count )
+
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/heap.inl b/cpukit/score/macros/rtems/score/heap.inl
new file mode 100644
index 0000000000..94f4ff9194
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/heap.inl
@@ -0,0 +1,150 @@
+/* heap.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the heap handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __HEAP_inl
+#define __HEAP_inl
+
+#include <rtems/score/address.h>
+
+/*PAGE
+ *
+ * _Heap_Head
+ */
+
+#define _Heap_Head( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->start)
+
+/*PAGE
+ *
+ * _Heap_Tail
+ */
+
+#define _Heap_Tail( _the_heap ) \
+ ((Heap_Block *)&(_the_heap)->final)
+
+/*PAGE
+ *
+ * _Heap_Previous_block
+ */
+
+#define _Heap_Previous_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Subtract_offset( \
+ (void *)(_the_block), \
+ (_the_block)->back_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Next_block
+ */
+
+#define _Heap_Next_block( _the_block ) \
+ ( (Heap_Block *) _Addresses_Add_offset( \
+ (void *)(_the_block), \
+ (_the_block)->front_flag & ~ HEAP_BLOCK_USED \
+ ) \
+ )
+
+/*PAGE
+ *
+ * _Heap_Block_at
+ */
+
+#define _Heap_Block_at( _base, _offset ) \
+ ( (Heap_Block *) \
+ _Addresses_Add_offset( (void *)(_base), (_offset) ) )
+
+/*PAGE
+ *
+ * _Heap_User_block_at
+ *
+ */
+
+#define _Heap_User_block_at( _base ) \
+ _Heap_Block_at( \
+ (_base), \
+ -*(((unsigned32 *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \
+ )
+
+/*PAGE
+ *
+ * _Heap_Is_previous_block_free
+ */
+
+#define _Heap_Is_previous_block_free( _the_block ) \
+ ( !((_the_block)->back_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_free
+ */
+
+#define _Heap_Is_block_free( _the_block ) \
+ ( !((_the_block)->front_flag & HEAP_BLOCK_USED) )
+
+/*PAGE
+ *
+ * _Heap_Is_block_used
+ */
+
+#define _Heap_Is_block_used( _the_block ) \
+ ((_the_block)->front_flag & HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Block_size
+ */
+
+#define _Heap_Block_size( _the_block ) \
+ ((_the_block)->front_flag & ~HEAP_BLOCK_USED)
+
+/*PAGE
+ *
+ * _Heap_Start_of_user_area
+ */
+
+#define _Heap_Start_of_user_area( _the_block ) \
+ ((void *) &(_the_block)->next)
+
+/*PAGE
+ *
+ * _Heap_Is_block_in
+ */
+
+#define _Heap_Is_block_in( _the_heap, _the_block ) \
+ ( ((_the_block) >= (_the_heap)->start) && \
+ ((_the_block) <= (_the_heap)->final) )
+
+/*PAGE
+ *
+ * _Heap_Is_page_size_valid
+ */
+
+#define _Heap_Is_page_size_valid( _page_size ) \
+ ( ((_page_size) != 0) && \
+ (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) )
+
+/*PAGE
+ *
+ * _Heap_Build_flag
+ */
+
+#define _Heap_Build_flag( _size, _in_use_flag ) \
+ ( (_size) | (_in_use_flag))
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/isr.inl b/cpukit/score/macros/rtems/score/isr.inl
new file mode 100644
index 0000000000..95f0319396
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/isr.inl
@@ -0,0 +1,48 @@
+/* isr.inl
+ *
+ * This include file contains the macro implementation of all
+ * inlined routines in the Interrupt Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __ISR_inl
+#define __ISR_inl
+
+/*PAGE
+ *
+ * _ISR_Is_in_progress
+ *
+ */
+
+#define _ISR_Is_in_progress() \
+ (_ISR_Nest_level != 0)
+
+/*PAGE
+ *
+ * _ISR_Is_vector_number_valid
+ *
+ */
+
+#define _ISR_Is_vector_number_valid( _vector ) \
+ ( (_vector) <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER )
+
+/*PAGE
+ *
+ * _ISR_Is_valid_user_handler
+ *
+ */
+
+#define _ISR_Is_valid_user_handler( _handler ) \
+ ((_handler) != NULL)
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/mppkt.inl b/cpukit/score/macros/rtems/score/mppkt.inl
new file mode 100644
index 0000000000..ff1d51034b
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/mppkt.inl
@@ -0,0 +1,41 @@
+/* macros/mppkt.h
+ *
+ * This package is the implementation of the Packet Handler
+ * routines which are inlined.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_PACKET_h
+#define __MACROS_MP_PACKET_h
+
+/*PAGE
+ *
+ * _Mp_packet_Is_valid_packet_class
+ *
+ * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
+ * because this enum starts at lower bound of zero.
+ */
+
+#define _Mp_packet_Is_valid_packet_class( _the_packet_class ) \
+ ( (_the_packet_class) <= MP_PACKET_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Mp_packet_Is_null
+ *
+ */
+
+#define _Mp_packet_Is_null ( _the_packet ) \
+ ( (_the_packet) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/object.inl b/cpukit/score/macros/rtems/score/object.inl
new file mode 100644
index 0000000000..8a5a0a3411
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/object.inl
@@ -0,0 +1,148 @@
+/* object.inl
+ *
+ * This include file contains the macro implementation of all
+ * of the inlined routines in the Object Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __OBJECTS_inl
+#define __OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_Build_id
+ *
+ */
+
+#define _Objects_Build_id( _the_class, _node, _index ) \
+ ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
+ ((_node) << OBJECTS_NODE_START_BIT) | \
+ ((_index) << OBJECTS_INDEX_START_BIT) )
+
+/*PAGE
+ *
+ * _Objects_Get_class
+ */
+
+#define _Objects_Get_class( _id ) \
+ (Objects_Classes) \
+ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_node
+ *
+ */
+
+#define _Objects_Get_node( _id ) \
+ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Get_index
+ *
+ */
+
+#define _Objects_Get_index( _id ) \
+ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
+
+/*PAGE
+ *
+ * _Objects_Is_class_valid
+ *
+ */
+
+#define _Objects_Is_class_valid( _the_class ) \
+ ( (_the_class) <= OBJECTS_CLASSES_LAST )
+
+/*PAGE
+ *
+ * _Objects_Is_local_node
+ *
+ */
+
+#define _Objects_Is_local_node( _node ) \
+ ( (_node) == _Objects_Local_node )
+
+/*PAGE
+ *
+ * _Objects_Is_local_id
+ *
+ */
+
+#define _Objects_Is_local_id( _id ) \
+ _Objects_Is_local_node( _Objects_Get_node(_id) )
+
+/*PAGE
+ *
+ * _Objects_Are_ids_equal
+ *
+ */
+
+#define _Objects_Are_ids_equal( _left, _right ) \
+ ( (_left) == (_right) )
+
+/*PAGE
+ *
+ * _Objects_Allocate
+ *
+ */
+
+#define _Objects_Allocate( _information ) \
+ (Objects_Control *) _Chain_Get( &(_information)->Inactive )
+
+/*PAGE
+ *
+ * _Objects_Free
+ *
+ */
+
+#define _Objects_Free( _information, _the_object ) \
+ _Chain_Append( &(_information)->Inactive, &(_the_object)->Node )
+
+/*PAGE
+ *
+ * _Objects_Open
+ *
+ */
+
+#define _Objects_Open( _information, _the_object, _name ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = (_the_object); \
+ \
+ if ( (_information)->is_string ) \
+ _Objects_Copy_name_string( (_name), (_the_object)->name ); \
+ else \
+ _Objects_Copy_name_raw( \
+ (_name), (_the_object)->name, (_information)->name_length ); \
+ }
+
+/*PAGE
+ *
+ * _Objects_Close
+ *
+ */
+
+#define _Objects_Close( _information, _the_object ) \
+ { \
+ unsigned32 _index; \
+ \
+ _index = _Objects_Get_index( (_the_object)->id ); \
+ (_information)->local_table[ _index ] = NULL; \
+ _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
+ }
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/objectmp.inl b/cpukit/score/macros/rtems/score/objectmp.inl
new file mode 100644
index 0000000000..2f1c5ac7fa
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/objectmp.inl
@@ -0,0 +1,50 @@
+/* macros/objectmp.inl
+ *
+ * This include file contains the bodies of all inlined routines
+ * which deal with global objects.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_OBJECTS_inl
+#define __MACROS_MP_OBJECTS_inl
+
+/*PAGE
+ *
+ * _Objects_MP_Allocate_global_object
+ *
+ */
+
+#define _Objects_MP_Allocate_global_object() \
+ (Objects_MP_Control *) \
+ _Chain_Get( &_Objects_MP_Inactive_global_objects )
+
+/*PAGE
+ * _Objects_MP_Free_global_object
+ *
+ */
+
+#define _Objects_MP_Free_global_object( _the_object ) \
+ _Chain_Append( \
+ &_Objects_MP_Inactive_global_objects, \
+ &(_the_object)->Object.Node \
+ )
+
+/*PAGE
+ * _Objects_MP_Is_null_global_object
+ *
+ */
+
+#define _Objects_MP_Is_null_global_object( _the_object ) \
+ ( (_the_object) == NULL )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/priority.inl b/cpukit/score/macros/rtems/score/priority.inl
new file mode 100644
index 0000000000..4c5d32b3b3
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/priority.inl
@@ -0,0 +1,170 @@
+/* priority.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Priority Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __PRIORITY_inl
+#define __PRIORITY_inl
+
+#include <rtems/score/bitfield.h>
+
+/*PAGE
+ *
+ * _Priority_Handler_initialization
+ *
+ */
+
+#define _Priority_Handler_initialization() \
+ { \
+ unsigned32 index; \
+ \
+ _Priority_Major_bit_map = 0; \
+ for ( index=0 ; index <16 ; index++ ) \
+ _Priority_Bit_map[ index ] = 0; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_valid
+ *
+ */
+
+ /*
+ * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
+ * then checking for less than 0 is unnecessary.
+ */
+
+#define _Priority_Is_valid( _the_priority ) \
+ ( (_the_priority) <= PRIORITY_MAXIMUM )
+
+/*PAGE
+ *
+ * _Priority_Major
+ *
+ */
+
+#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 )
+
+/*PAGE
+ *
+ * _Priority_Minor
+ *
+ */
+
+#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 )
+
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
+
+/*PAGE
+ *
+ * _Priority_Mask
+ *
+ */
+
+#define _Priority_Mask( _bit_number ) \
+ (0x8000 >> _bit_number)
+
+/*PAGE
+ *
+ * _Priority_Bits_index
+ *
+ */
+
+#define _Priority_Bits_index( _bit_number ) \
+ (_bit_number)
+
+#endif
+
+/*PAGE
+ *
+ * _Priority_Add_to_bit_map
+ *
+ */
+
+#define _Priority_Add_to_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \
+ _Priority_Major_bit_map |= (_the_priority_map)->ready_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Remove_from_bit_map
+ *
+ */
+
+#define _Priority_Remove_from_bit_map( _the_priority_map ) \
+ { \
+ *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \
+ if ( *(_the_priority_map)->minor == 0 ) \
+ _Priority_Major_bit_map &= (_the_priority_map)->block_major; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Get_highest
+ *
+ */
+
+#define _Priority_Get_highest( _high_priority ) \
+ { \
+ Priority_Bit_map_control minor; \
+ Priority_Bit_map_control major; \
+ \
+ _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \
+ _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \
+ \
+ (_high_priority) = (_Priority_Bits_index( major ) * 16) + \
+ _Priority_Bits_index( minor ); \
+ }
+
+/*PAGE
+ *
+ * _Priority_Initialize_information
+ *
+ */
+
+#define _Priority_Initialize_information( \
+ _the_priority_map, _new_priority ) \
+ { \
+ Priority_Bit_map_control _major; \
+ Priority_Bit_map_control _minor; \
+ Priority_Bit_map_control _mask; \
+ \
+ _major = _Priority_Major( (_new_priority) ); \
+ _minor = _Priority_Minor( (_new_priority) ); \
+ \
+ (_the_priority_map)->minor = \
+ &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \
+ \
+ _mask = _Priority_Mask( _major ); \
+ (_the_priority_map)->ready_major = _mask; \
+ (_the_priority_map)->block_major = ~_mask; \
+ \
+ _mask = _Priority_Mask( _minor ); \
+ (_the_priority_map)->ready_minor = _mask; \
+ (_the_priority_map)->block_minor = ~_mask; \
+ }
+
+/*PAGE
+ *
+ * _Priority_Is_group_empty
+ *
+ */
+
+#define _Priority_Is_group_empty ( _the_priority ) \
+ ( (_the_priority) == 0 )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/stack.inl b/cpukit/score/macros/rtems/score/stack.inl
new file mode 100644
index 0000000000..d20eebd0b9
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/stack.inl
@@ -0,0 +1,50 @@
+/* stack.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Stack Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STACK_inl
+#define __STACK_inl
+
+/*PAGE
+ *
+ * _Stack_Initialize
+ *
+ */
+
+#define _Stack_Initialize( _the_stack, _starting_address, _size ) \
+ { \
+ (_the_stack)->area = (_starting_address); \
+ (_the_stack)->size = (_size); \
+ }
+
+/*PAGE
+ *
+ * _Stack_Is_enough
+ *
+ */
+
+#define _Stack_Is_enough( _size ) \
+ ( (_size) >= STACK_MINIMUM_SIZE )
+
+/*PAGE
+ *
+ * _Stack_Adjust_size
+ */
+
+#define _Stack_Adjust_size( _size ) \
+ ((_size) + CPU_STACK_ALIGNMENT)
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/states.inl b/cpukit/score/macros/rtems/score/states.inl
new file mode 100644
index 0000000000..4fa138d107
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/states.inl
@@ -0,0 +1,210 @@
+/* states.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines associated with thread state information.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STATES_inl
+#define __STATES_inl
+
+/*PAGE
+ *
+ * _States_Set
+ *
+ */
+
+#define _States_Set( _states_to_set, _current_state ) \
+ ((_current_state) | (_states_to_set))
+
+/*PAGE
+ *
+ * _States_Clear
+ *
+ */
+
+#define _States_Clear( _states_to_clear, _current_state ) \
+ ((_current_state) & ~(_states_to_clear))
+
+/*PAGE
+ *
+ * _States_Is_ready
+ *
+ */
+
+#define _States_Is_ready( _the_states ) \
+ ( (_the_states) == STATES_READY )
+
+/*PAGE
+ *
+ * _States_Is_only_dormant
+ *
+ */
+
+#define _States_Is_only_dormant( _the_states ) \
+ ( (_the_states) == STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_dormant
+ *
+ */
+
+#define _States_Is_dormant( _the_states ) \
+ ( (_the_states) & STATES_DORMANT )
+
+/*PAGE
+ *
+ * _States_Is_suspended
+ *
+ */
+
+#define _States_Is_suspended( _the_states ) \
+ ( (_the_states) & STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _States_Is_Transient
+ *
+ */
+
+#define _States_Is_transient( _the_states ) \
+ ( (_the_states) & STATES_TRANSIENT )
+
+/*PAGE
+ *
+ * _States_Is_delaying
+ *
+ */
+
+#define _States_Is_delaying( _the_states ) \
+ ( (_the_states) & STATES_DELAYING )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_buffer
+ *
+ */
+
+#define _States_Is_waiting_for_buffer( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_BUFFER )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_segment
+ *
+ */
+
+#define _States_Is_waiting_for_segment( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEGMENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_message
+ *
+ */
+
+#define _States_Is_waiting_for_message( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MESSAGE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_event
+ *
+ */
+
+#define _States_Is_waiting_for_event( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_EVENT )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_mutex
+ *
+ */
+
+#define _States_Is_waiting_for_mutex( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_MUTEX )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_semaphore
+ *
+ */
+
+#define _States_Is_waiting_for_semaphore( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_SEMAPHORE )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_time
+ *
+ */
+
+#define _States_Is_waiting_for_time( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_TIME )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_rpc_reply
+ *
+ */
+
+#define _States_Is_waiting_for_rpc_reply( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_RPC_REPLY )
+
+/*PAGE
+ *
+ * _States_Is_waiting_for_period
+ *
+ */
+
+#define _States_Is_waiting_for_period( _the_states ) \
+ ( (_the_states) & STATES_WAITING_FOR_PERIOD )
+
+/*PAGE
+ *
+ * _States_Is_locally_blocked
+ *
+ */
+
+#define _States_Is_locally_blocked( _the_states ) \
+ ( (_the_states) & STATES_LOCALLY_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Is_waiting_on_thread_queue
+ *
+ */
+
+#define _States_Is_waiting_on_thread_queue( _the_states ) \
+ ( (_the_states) & STATES_WAITING_ON_THREAD_QUEUE )
+
+/*PAGE
+ *
+ * _States_Is_blocked
+ *
+ */
+
+#define _States_Is_blocked( _the_states ) \
+ ( (_the_states) & STATES_BLOCKED )
+
+/*PAGE
+ *
+ * _States_Are_set
+ *
+ */
+
+#define _States_Are_set( _the_states, _mask ) \
+ ( ((_the_states) & (_mask)) != STATES_READY )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/sysstate.inl b/cpukit/score/macros/rtems/score/sysstate.inl
new file mode 100644
index 0000000000..d0cb932924
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/sysstate.inl
@@ -0,0 +1,90 @@
+/* sysstates.inl
+ *
+ * This file contains the macro implementation of routines regarding the
+ * system state.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __SYSTEM_STATE_inl
+#define __SYSTEM_STATE_inl
+
+/*PAGE
+ *
+ * _System_state_Handler_initialization
+ */
+
+#define _System_state_Handler_initialization( _is_multiprocessing ) \
+ do { \
+ _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \
+ _System_state_Is_multiprocessing = (_is_multiprocessing); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Set
+ */
+
+#define _System_state_Set( _state ) \
+ do { \
+ _System_state_Current = (_state); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _System_state_Get
+ */
+
+#define _System_state_Get() \
+ (_System_state_Current)
+
+/*PAGE
+ *
+ * _System_state_Is_before_initialization
+ */
+
+#define _System_state_Is_before_initialization( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_INITIALIZATION)
+
+/*PAGE
+ *
+ * _System_state_Is_before_multitasking
+ */
+
+#define _System_state_Is_before_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEFORE_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_begin_multitasking
+ */
+
+#define _System_state_Is_begin_multitasking( _state ) \
+ ((_state) == SYSTEM_STATE_BEGIN_MULTITASKING)
+
+/*PAGE
+ *
+ * _System_state_Is_up
+ */
+
+#define _System_state_Is_up( _state ) \
+ ((_state) == SYSTEM_STATE_UP)
+
+/*PAGE
+ *
+ * _System_state_Is_failed
+ */
+
+#define _System_state_Is_failed( _state ) \
+ ((_state) == SYSTEM_STATE_FAILED)
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/thread.inl b/cpukit/score/macros/rtems/score/thread.inl
new file mode 100644
index 0000000000..735686aa20
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/thread.inl
@@ -0,0 +1,217 @@
+/* thread.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_inl
+#define __THREAD_inl
+
+/*PAGE
+ *
+ * _Thread_Stop_multitasking
+ *
+ */
+
+#define _Thread_Stop_multitasking() \
+ _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
+
+/*PAGE
+ *
+ * _Thread_Is_executing
+ *
+ */
+
+#define _Thread_Is_executing( _the_thread ) \
+ ( (_the_thread) == _Thread_Executing )
+
+/*PAGE
+ *
+ * _Thread_Is_heir
+ *
+ */
+
+#define _Thread_Is_heir( _the_thread ) \
+ ( (_the_thread) == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Is_executing_also_the_heir
+ *
+ */
+
+#define _Thread_Is_executing_also_the_heir() \
+ ( _Thread_Executing == _Thread_Heir )
+
+/*PAGE
+ *
+ * _Thread_Resume
+ *
+ */
+
+#define _Thread_Resume( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_SUSPENDED )
+
+/*PAGE
+ *
+ * _Thread_Unblock
+ *
+ */
+
+#define _Thread_Unblock( _the_thread ) \
+ _Thread_Clear_state( (_the_thread), STATES_BLOCKED );
+
+/*PAGE
+ *
+ * _Thread_Restart_self
+ *
+ */
+
+#define _Thread_Restart_self() \
+ { \
+ if ( _Thread_Executing->fp_context != NULL ) \
+ _Context_Restore_fp( &_Thread_Executing->fp_context ); \
+ \
+ _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \
+ }
+
+/*PAGE
+ *
+ * _Thread_Calculate_heir
+ *
+ */
+
+#define _Thread_Calculate_heir() \
+ { \
+ Priority_Control highest; \
+ \
+ _Priority_Get_highest( highest ); \
+ \
+ _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \
+ }
+
+/*PAGE
+ *
+ * _Thread_Is_allocated_fp
+ *
+ */
+
+#define _Thread_Is_allocated_fp( _the_thread ) \
+ ( (_the_thread) == _Thread_Allocated_fp )
+
+/*PAGE
+ *
+ * _Thread_Deallocate_fp
+ *
+ */
+
+#define _Thread_Deallocate_fp() \
+ _Thread_Allocated_fp = NULL
+
+/*PAGE
+ *
+ * _Thread_Disable_dispatch
+ *
+ */
+
+#define _Thread_Disable_dispatch() \
+ _Thread_Dispatch_disable_level += 1
+
+/*PAGE
+ *
+ * _Thread_Enable_dispatch
+ *
+ */
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
+#define _Thread_Enable_dispatch() \
+ { if ( (--_Thread_Dispatch_disable_level) == 0 ) \
+ _Thread_Dispatch(); \
+ }
+#endif
+
+#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
+void _Thread_Enable_dispatch( void );
+#endif
+
+/*PAGE
+ *
+ * _Thread_Unnest_dispatch
+ *
+ */
+
+#define _Thread_Unnest_dispatch() \
+ _Thread_Dispatch_disable_level -= 1
+
+/*PAGE
+ *
+ * _Thread_Is_dispatching_enabled
+ *
+ */
+
+#define _Thread_Is_dispatching_enabled() \
+ ( _Thread_Dispatch_disable_level == 0 )
+
+/*PAGE
+ *
+ * _Thread_Is_context_switch_necessary
+ *
+ */
+
+#define _Thread_Is_context_switch_necessary() \
+ ( _Context_Switch_necessary == TRUE )
+
+/*PAGE
+ *
+ * _Thread_Dispatch_initialization
+ *
+ */
+
+#define _Thread_Dispatch_initialization() \
+ _Thread_Dispatch_disable_level = 1
+
+/*PAGE
+ *
+ * _Thread_Is_null
+ *
+ */
+
+#define _Thread_Is_null( _the_thread ) \
+ ( (_the_thread) == NULL )
+
+/*
+ * _Thread_Is_proxy_blocking
+ *
+ */
+
+#define _Thread_Is_proxy_blocking( _code ) \
+ ( (_code) == THREAD_STATUS_PROXY_BLOCKING )
+
+/*
+ * _Thread_Internal_allocate
+ *
+ */
+
+#define _Thread_Internal_allocate() \
+ ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information ))
+
+/*
+ * _Thread_Internal_free
+ *
+ */
+
+#define _Thread_Internal_free( _the_task ) \
+ _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/threadmp.inl b/cpukit/score/macros/rtems/score/threadmp.inl
new file mode 100644
index 0000000000..c601862f96
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/threadmp.inl
@@ -0,0 +1,50 @@
+/* macros/threadmp.h
+ *
+ * This include file contains the bodies of all inlined routines
+ * for the multiprocessing part of thread package.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __MACROS_MP_THREAD_h
+#define __MACROS_MP_THREAD_h
+
+/*PAGE
+ *
+ * _Thread_MP_Is_receive
+ *
+ */
+
+#define _Thread_MP_Is_receive( _the_thread ) \
+ ( (_the_thread) == _Thread_MP_Receive)
+
+/*PAGE
+ *
+ * _Thread_MP_Free_proxy
+ *
+ */
+
+#define _Thread_MP_Free_proxy( _the_thread ) \
+{ \
+ Thread_Proxy_control *_the_proxy; \
+ \
+ _the_proxy = (Thread_Proxy_control *) (_the_thread); \
+ \
+ _Chain_Extract( &_the_proxy->Active ); \
+ \
+ _Chain_Append( \
+ &_Thread_MP_Inactive_proxies, \
+ &(_the_thread)->Object.Node \
+ ); \
+}
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/tod.inl b/cpukit/score/macros/rtems/score/tod.inl
new file mode 100644
index 0000000000..ecab4e6eae
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/tod.inl
@@ -0,0 +1,58 @@
+/* tod.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the Time of Day Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TIME_OF_DAY_inl
+#define __TIME_OF_DAY_inl
+
+/*PAGE
+ *
+ * _TOD_Is_set
+ *
+ */
+
+#define _TOD_Is_set() \
+ _Watchdog_Is_active( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Tickle_ticks
+ *
+ */
+
+#define _TOD_Tickle_ticks() \
+ _TOD_Current.ticks++; \
+ _TOD_Ticks_since_boot++
+
+/*PAGE
+ *
+ * _TOD_Deactivate
+ *
+ */
+
+#define _TOD_Deactivate() \
+ _Watchdog_Remove( &_TOD_Seconds_watchdog )
+
+/*PAGE
+ *
+ * _TOD_Activate
+ *
+ */
+
+#define _TOD_Activate( _ticks ) \
+ _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, (_ticks) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/tqdata.inl b/cpukit/score/macros/rtems/score/tqdata.inl
new file mode 100644
index 0000000000..5ffb79bcb1
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/tqdata.inl
@@ -0,0 +1,59 @@
+/* tqdata.inl
+ *
+ * This file contains the macro implementation of the inlined
+ * routines needed to support the Thread Queue Data.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __THREAD_QUEUE_DATA_inl
+#define __THREAD_QUEUE_DATA_inl
+
+/*PAGE
+ *
+ * _Thread_queue_Header_number
+ *
+ */
+
+#define _Thread_queue_Header_number( _the_priority ) \
+ ((_the_priority) / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER)
+
+/*PAGE
+ *
+ * _Thread_queue_Is_reverse_search
+ *
+ */
+
+#define _Thread_queue_Is_reverse_search( _the_priority ) \
+ ( (_the_priority) & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK )
+
+/*PAGE
+ *
+ * _Thread_queue_Get_number_waiting
+ *
+ */
+
+#define _Thread_queue_Get_number_waiting( _the_thread_queue ) \
+ ( (_the_thread_queue)->count )
+
+/*PAGE
+ *
+ * _Thread_queue_Enter_critical_section
+ *
+ */
+
+#define _Thread_queue_Enter_critical_section( _the_thread_queue ) \
+ do { \
+ (_the_thread_queue)->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; \
+ } while ( 0 )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/userext.inl b/cpukit/score/macros/rtems/score/userext.inl
new file mode 100644
index 0000000000..4b5b8083bf
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/userext.inl
@@ -0,0 +1,126 @@
+/* userext.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the User Extension Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __USER_EXTENSIONS_inl
+#define __USER_EXTENSIONS_inl
+
+/*PAGE
+ *
+ * _User_extensions_Handler_initialization
+ *
+ */
+
+#define _User_extensions_Handler_initialization( _initial_extensions ) \
+ { \
+ _Chain_Initialize_empty( &_User_extensions_List ); \
+ \
+ if ( (_initial_extensions) ) { \
+ _User_extensions_Initial.Callouts = *(_initial_extensions); \
+ _Chain_Append( \
+ &_User_extensions_List, &_User_extensions_Initial.Node ); \
+ } \
+ }
+
+/*PAGE
+ *
+ * _User_extensions_Add_set
+ */
+
+#define _User_extensions_Add_set( _the_extension, _extension_table ) \
+ do { \
+ (_the_extension)->Callouts = *(_extension_table); \
+ \
+ _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Add_API_set
+ */
+
+#define _User_extensions_Add_API_set( _the_extension ) \
+ _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node )
+
+
+/*PAGE
+ *
+ * _User_extensions_Remove_set
+ */
+
+#define _User_extensions_Remove_set( _the_extension ) \
+ _Chain_Extract( &(_the_extension)->Node )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_forward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_forward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Run_list_backward
+ *
+ * NOTE: No parentheses around macro names here to avoid
+ * messing up the name and function call expansion.
+ */
+
+#define _User_extensions_Run_list_backward( _name, _arguments ) \
+ do { \
+ 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.## _name != NULL ) \
+ (*the_extension->Callouts.## _name) _arguments; \
+ \
+ } \
+ \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _User_extensions_Thread_switch
+ *
+ */
+
+#define _User_extensions_Thread_switch( _executing, _heir ) \
+ _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/watchdog.inl b/cpukit/score/macros/rtems/score/watchdog.inl
new file mode 100644
index 0000000000..d24224f93d
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/watchdog.inl
@@ -0,0 +1,172 @@
+/* watchdog.inl
+ *
+ * This file contains the macro implementation of all inlined routines
+ * in the Watchdog Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WATCHDOG_inl
+#define __WATCHDOG_inl
+
+#include <rtems/score/object.h>
+
+/*PAGE
+ *
+ * _Watchdog_Initialize
+ *
+ */
+
+#define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \
+ { \
+ (_the_watchdog)->state = WATCHDOG_INACTIVE; \
+ (_the_watchdog)->routine = (_routine); \
+ (_the_watchdog)->id = (_id); \
+ (_the_watchdog)->user_data = (_user_data); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Is_active
+ *
+ */
+
+#define _Watchdog_Is_active( _the_watchdog ) \
+ ( (_the_watchdog)->state == WATCHDOG_ACTIVE )
+
+/*PAGE
+ *
+ * _Watchdog_Activate
+ *
+ */
+
+#define _Watchdog_Activate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_ACTIVE
+
+/*PAGE
+ *
+ * _Watchdog_Deactivate
+ *
+ */
+
+#define _Watchdog_Deactivate( _the_watchdog ) \
+ (_the_watchdog)->state = WATCHDOG_REMOVE_IT
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_ticks
+ *
+ */
+
+#define _Watchdog_Tickle_ticks() \
+ _Watchdog_Tickle( &_Watchdog_Ticks_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Tickle_seconds
+ *
+ */
+
+#define _Watchdog_Tickle_seconds() \
+ _Watchdog_Tickle( &_Watchdog_Seconds_chain )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_ticks
+ *
+ */
+
+#define _Watchdog_Insert_ticks( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Insert_seconds
+ *
+ */
+
+#define _Watchdog_Insert_seconds( _the_watchdog, _units ) \
+ do { \
+ (_the_watchdog)->initial = (_units); \
+ _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \
+ } while ( 0 )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_seconds
+ *
+ */
+
+#define _Watchdog_Adjust_seconds( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Adjust_ticks
+ *
+ */
+
+#define _Watchdog_Adjust_ticks( _direction, _units ) \
+ _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) )
+
+/*PAGE
+ *
+ * _Watchdog_Reset
+ *
+ */
+
+#define _Watchdog_Reset( _the_watchdog ) \
+ { \
+ (void) _Watchdog_Remove( (_the_watchdog) ); \
+ _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \
+ }
+
+/*PAGE
+ *
+ * _Watchdog_Next
+ *
+ */
+
+#define _Watchdog_Next( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.next)
+
+/*PAGE
+ *
+ * _Watchdog_Previous
+ *
+ */
+
+#define _Watchdog_Previous( _watchdog ) \
+ ((Watchdog_Control *) (_watchdog)->Node.previous)
+
+/*PAGE
+ *
+ * _Watchdog_First
+ *
+ */
+
+#define _Watchdog_First( _header ) \
+ ((Watchdog_Control *) (_header)->first)
+
+/*PAGE
+ *
+ * _Watchdog_Last
+ *
+ */
+
+#define _Watchdog_Last( _header ) \
+ ((Watchdog_Control *) (_header)->last)
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/macros/rtems/score/wkspace.inl b/cpukit/score/macros/rtems/score/wkspace.inl
new file mode 100644
index 0000000000..5efe247fb1
--- /dev/null
+++ b/cpukit/score/macros/rtems/score/wkspace.inl
@@ -0,0 +1,39 @@
+/* wkspace.inl
+ *
+ * This file contains the macro implementation of the inlined routines
+ * from the RAM Workspace Handler.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __WORKSPACE_inl
+#define __WORKSPACE_inl
+
+/*PAGE
+ *
+ * _Workspace_Allocate
+ *
+ */
+
+#define _Workspace_Allocate( _size ) \
+ _Heap_Allocate( &_Workspace_Area, (_size) )
+
+/*PAGE
+ *
+ * _Workspace_Free
+ *
+ */
+
+#define _Workspace_Free( _block ) \
+ _Heap_Free( &_Workspace_Area, (_block) )
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c
new file mode 100644
index 0000000000..6e82b49a53
--- /dev/null
+++ b/cpukit/score/src/apiext.c
@@ -0,0 +1,105 @@
+/* apiext.c
+ *
+ * XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+
+/*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/cpukit/score/src/chain.c b/cpukit/score/src/chain.c
new file mode 100644
index 0000000000..5ef56ed5ad
--- /dev/null
+++ b/cpukit/score/src/chain.c
@@ -0,0 +1,202 @@
+/*
+ * 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, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*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/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c
new file mode 100644
index 0000000000..05e4fb799d
--- /dev/null
+++ b/cpukit/score/src/coremsg.c
@@ -0,0 +1,432 @@
+/*
+ * 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, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/coremsg.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/mpci.h>
+
+/*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
+ * proxy_extract_callout - remote extract support
+ *
+ * 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,
+ Objects_Classes the_class,
+ CORE_message_queue_Attributes *the_message_queue_attributes,
+ unsigned32 maximum_pending_messages,
+ unsigned32 maximum_message_size,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+ 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,
+ the_class,
+ _CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_MESSAGE,
+ proxy_extract_callout,
+ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+ );
+
+ return TRUE;
+}
+
+/*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
+)
+{
+
+ if ( the_message_queue->number_of_pending_messages != 0 )
+ (void) _CORE_message_queue_Flush_support( the_message_queue );
+ else
+ _Thread_queue_Flush(
+ &the_message_queue->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+ (void) _Workspace_Free( the_message_queue->message_buffers );
+
+}
+
+/*PAGE
+ *
+ * _CORE_message_queue_Flush
+ *
+ * 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
+ */
+
+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;
+}
+
+/*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;
+
+ 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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_message_queue_mp_support) ( the_thread, id );
+
+ }
+ *count = number_broadcasted;
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
+
+/*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;
+
+ 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;
+ _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size );
+ _CORE_message_queue_Free_message_buffer(the_message_queue, the_message );
+ 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;
+ _ISR_Enable( level );
+
+ _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
+}
+
+/*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;
+
+ _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;
+}
+
+/*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
+)
+{
+ 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?
+ */
+
+ 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;
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_message_queue_mp_support) ( the_thread, id );
+
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ }
+
+ /*
+ * No one waiting on this one currently.
+ * Allocate a message buffer and store it away
+ */
+
+ if ( the_message_queue->number_of_pending_messages ==
+ the_message_queue->maximum_pending_messages ) {
+ return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
+ }
+
+ the_message = _CORE_message_queue_Allocate_message_buffer(the_message_queue);
+ if ( the_message == 0)
+ return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
+
+ _CORE_message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size );
+ the_message->Contents.size = size;
+
+ the_message_queue->number_of_pending_messages += 1;
+
+ 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;
+ }
+
+ return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
new file mode 100644
index 0000000000..a0c3fd0264
--- /dev/null
+++ b/cpukit/score/src/coremutex.c
@@ -0,0 +1,269 @@
+/*
+ * Mutex Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the Mutex Handler.
+ * This handler provides synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+
+/*PAGE
+ *
+ * _CORE_mutex_Initialize
+ *
+ * This routine initializes a mutex at create time and set the control
+ * structure according to the values passed.
+ *
+ * Input parameters:
+ * the_mutex - the mutex control block to initialize
+ * the_class - the API class of the object
+ * the_mutex_attributes - the mutex attributes specified at create time
+ * initial_lock - mutex initial lock or unlocked status
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+/* Add this to the RTEMS environment later ?????????
+ rtems_assert( initial_lock == CORE_MUTEX_LOCKED ||
+ initial_lock == CORE_MUTEX_UNLOCKED );
+ */
+
+ the_mutex->Attributes = *the_mutex_attributes;
+ the_mutex->lock = initial_lock;
+
+ if ( initial_lock == CORE_MUTEX_LOCKED ) {
+ the_mutex->nest_count = 1;
+ the_mutex->holder = _Thread_Executing;
+ the_mutex->holder_id = _Thread_Executing->Object.id;
+ _Thread_Executing->resource_count++;
+ } else {
+ the_mutex->nest_count = 0;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+ }
+
+ _Thread_queue_Initialize(
+ &the_mutex->Wait_queue,
+ the_class,
+ _CORE_mutex_Is_priority( the_mutex_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_MUTEX,
+ proxy_extract_callout,
+ CORE_MUTEX_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Seize
+ *
+ * This routine attempts to allocate a mutex to the calling thread.
+ *
+ * Input parameters:
+ * the_mutex - pointer to mutex control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( ! _CORE_mutex_Is_locked( the_mutex ) ) {
+ the_mutex->lock = CORE_MUTEX_LOCKED;
+ the_mutex->holder = executing;
+ the_mutex->holder_id = executing->Object.id;
+ the_mutex->nest_count = 1;
+ executing->resource_count++;
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( _Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
+ if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) )
+ the_mutex->nest_count++;
+ else
+ executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
+
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( !wait ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
+ return;
+ }
+
+ _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue );
+ executing->Wait.queue = &the_mutex->Wait_queue;
+ executing->Wait.id = id;
+ _ISR_Enable( level );
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ the_mutex->holder->current_priority >
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ the_mutex->holder, _Thread_Executing->current_priority );
+ }
+
+ _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
+}
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * id - id of parent mutex
+ * api_mutex_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_MUTEX_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( !_Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) )
+ return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
+
+ the_mutex->nest_count--;
+
+ if ( the_mutex->nest_count != 0 )
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+
+ _Thread_Executing->resource_count--;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+
+ /*
+ * Whether or not someone is waiting for the mutex, an
+ * inherited priority must be lowered if this is the last
+ * mutex (i.e. resource) this task has.
+ */
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ _Thread_Executing->resource_count == 0 &&
+ _Thread_Executing->real_priority !=
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ _Thread_Executing,
+ _Thread_Executing->real_priority
+ );
+ }
+
+ if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
+
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_mutex->nest_count = 1;
+
+ ( *api_mutex_mp_support)( the_thread, id );
+
+ } else {
+
+ the_mutex->holder = the_thread;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_thread->resource_count++;
+ the_mutex->nest_count = 1;
+
+ /*
+ * No special action for priority inheritance because the_thread
+ * is guaranteed to be the highest priority thread waiting for
+ * the mutex.
+ */
+ }
+ } else
+ the_mutex->lock = CORE_MUTEX_UNLOCKED;
+
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Flush
+ *
+ * This function a flushes the mutex's task wait queue.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * remote_extract_callout - function to invoke remotely
+ * status - status to pass to thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+)
+{
+
+ _Thread_queue_Flush(
+ &the_mutex->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+}
diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c
new file mode 100644
index 0000000000..0e55926304
--- /dev/null
+++ b/cpukit/score/src/coresem.c
@@ -0,0 +1,184 @@
+/*
+ * CORE Semaphore Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the CORE Semaphore Handler.
+ * This core object utilizes standard Dijkstra counting semaphores to provide
+ * synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/mpci.h>
+
+/*PAGE
+ *
+ * CORE_semaphore_Initialize
+ *
+ * This function initialize a semaphore and sets the initial value based
+ * on the given count.
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore control block to initialize
+ * the_class - the API class of the object
+ * the_semaphore_attributes - the attributes specified at create time
+ * initial_value - semaphore's initial value
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+ the_semaphore->Attributes = *the_semaphore_attributes;
+ the_semaphore->count = initial_value;
+
+ _Thread_queue_Initialize(
+ &the_semaphore->Wait_queue,
+ the_class,
+ _CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_SEMAPHORE,
+ proxy_extract_callout,
+ CORE_SEMAPHORE_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Surrender
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore to be flushed
+ * id - id of parent semaphore
+ * api_semaphore_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ *
+ * Output parameters:
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_semaphore_mp_support) ( the_thread, id );
+
+ } else
+ the_semaphore->count += 1;
+
+ return( CORE_SEMAPHORE_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Seize
+ *
+ * This routine attempts to allocate a core semaphore to the calling thread.
+ *
+ * Input parameters:
+ * the_semaphore - pointer to semaphore control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( the_semaphore->count != 0 ) {
+ the_semaphore->count -= 1;
+ _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 );
+}
+
+
+/*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/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c
new file mode 100644
index 0000000000..1a11034ceb
--- /dev/null
+++ b/cpukit/score/src/coretod.c
@@ -0,0 +1,235 @@
+/*
+ * Time of Day (TOD) Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdog.h>
+
+/*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_Ticks_since_boot = 0;
+ _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 );
+}
+
+/*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_Activate( ticks_until_next_second );
+
+ _Thread_Enable_dispatch();
+}
+
+/*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;
+}
+
+/*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 );
+}
+
+/*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/cpukit/score/src/heap.c b/cpukit/score/src/heap.c
new file mode 100644
index 0000000000..11d8a31cee
--- /dev/null
+++ b/cpukit/score/src/heap.c
@@ -0,0 +1,537 @@
+/*
+ * Heap Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/heap.h>
+
+/*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 );
+}
+
+/*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 *) (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;
+}
+
+/*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;
+
+ 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 += 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;
+}
+
+/*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 );
+}
+
+/*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 );
+}
+
+/*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 <stdio.h>
+#include <unistd.h>
+
+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: Back - %d, Front - %d",
+ 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: Back - %d, Front - %d",
+ 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/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
new file mode 100644
index 0000000000..04a77fbe37
--- /dev/null
+++ b/cpukit/score/src/interr.c
@@ -0,0 +1,61 @@
+/*
+ * Internal Error Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _Internal_error_Occurred
+ *
+ * This routine will invoke the fatal error handler supplied by the user
+ * followed by the the default one provided by the executive. The default
+ * error handler assumes no hardware is present to help inform the user
+ * of the problem. Halt stores the error code in a known register,
+ * disables interrupts, and halts the CPU. If the CPU does not have a
+ * halt instruction, it will loop to itself.
+ *
+ * Input parameters:
+ * the_source - what subsystem the error originated in
+ * is_internal - if the error was internally generated
+ * the_error - fatal error status code
+ *
+ * Output parameters:
+ * As much information as possible is stored in a CPU dependent fashion.
+ * See the CPU dependent code for more information.
+ *
+ * NOTE: The the_error is not necessarily a directive status code.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+)
+{
+
+ Internal_errors_What_happened.the_source = the_source;
+ Internal_errors_What_happened.is_internal = is_internal;
+ Internal_errors_What_happened.the_error = the_error;
+
+ _User_extensions_Fatal( the_source, is_internal, the_error );
+
+ _System_state_Set( SYSTEM_STATE_FAILED );
+
+ _CPU_Fatal_halt( the_error );
+
+ /* will not return from this routine */
+}
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
new file mode 100644
index 0000000000..afc4cdcf38
--- /dev/null
+++ b/cpukit/score/src/isr.c
@@ -0,0 +1,60 @@
+/*
+ * ISR Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/wkspace.h>
+
+/* _ISR_Handler_initialization
+ *
+ * This routine initializes the ISR handler.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _ISR_Handler_initialization( void )
+{
+ _ISR_Signals_to_thread_executing = FALSE;
+
+ _ISR_Nest_level = 0;
+
+#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
+
+ if ( _CPU_Table.interrupt_stack_size < STACK_MINIMUM_SIZE )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
+ );
+
+ _CPU_Interrupt_stack_low =
+ _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );
+
+ _CPU_Interrupt_stack_high = _Addresses_Add_offset(
+ _CPU_Interrupt_stack_low,
+ _CPU_Table.interrupt_stack_size
+ );
+
+#endif
+
+#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
+ _CPU_Install_interrupt_stack();
+#endif
+
+}
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
new file mode 100644
index 0000000000..c3090aacc1
--- /dev/null
+++ b/cpukit/score/src/mpci.c
@@ -0,0 +1,524 @@
+/*
+ * Multiprocessing Communications Interface (MPCI) Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/mpci.h>
+#include <rtems/score/mppkt.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/coresem.h>
+
+/*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,
+ OBJECTS_NO_CLASS, /* free floating semaphore */
+ &attributes, /* the_semaphore_attributes */
+ 0, /* initial_value */
+ NULL /* proxy_extract_callout */
+ );
+
+ _Thread_queue_Initialize(
+ &_MPCI_Remote_blocked_threads,
+ OBJECTS_NO_CLASS,
+ THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_RPC_REPLY,
+ NULL,
+ 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 */
+ FALSE, /* not timesliced */
+ 0, /* all interrupts enabled */
+ _MPCI_Internal_name
+ );
+
+ _Thread_Start(
+ _MPCI_Receive_server_tcb,
+ THREAD_START_NUMERIC,
+ _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(
+ Objects_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/cpukit/score/src/object.c b/cpukit/score/src/object.c
new file mode 100644
index 0000000000..4f672086fe
--- /dev/null
+++ b/cpukit/score/src/object.c
@@ -0,0 +1,512 @@
+/*
+ * Object Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#include <rtems/score/objectmp.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/sysstate.h>
+
+/*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;
+
+ _Objects_MP_Handler_initialization(
+ node,
+ maximum_nodes,
+ maximum_global_objects
+ );
+}
+
+/*PAGE
+ *
+ * _Objects_Initialize_information
+ *
+ * This routine initializes all object information related data structures.
+ *
+ * Input parameters:
+ * information - object information table
+ * the_class - object class
+ * supports_global - TRUE if this is a global object class
+ * maximum - maximum objects of this class
+ * is_string - TRUE if names for this object are strings
+ * size - size of this object's control block
+ *
+ * Output parameters: NONE
+ */
+
+void _Objects_Initialize_information(
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_thread
+)
+{
+ unsigned32 minimum_index;
+ unsigned32 index;
+ Objects_Control *the_object;
+ unsigned32 name_length;
+ void *name_area;
+
+ information->maximum = maximum;
+ information->the_class = the_class;
+ information->is_string = is_string;
+ information->is_thread = is_thread;
+
+ /*
+ * Set the entry in the object information table.
+ */
+
+ _Objects_Information_table[ the_class ] = information;
+
+ /*
+ * Calculate minimum and maximum Id's
+ */
+
+ if ( maximum == 0 ) minimum_index = 0;
+ else minimum_index = 1;
+
+ information->minimum_id =
+ _Objects_Build_id( the_class, _Objects_Local_node, minimum_index );
+
+ information->maximum_id =
+ _Objects_Build_id( the_class, _Objects_Local_node, maximum );
+
+ /*
+ * Allocate local pointer table
+ */
+
+ information->local_table = _Workspace_Allocate_or_fatal_error(
+ (maximum + 1) * sizeof(Objects_Control *)
+ );
+
+ /*
+ * Allocate name table
+ */
+
+ 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;
+
+ name_area = _Workspace_Allocate_or_fatal_error( (maximum + 1) * name_length );
+ information->name_table = name_area;
+
+ /*
+ * Initialize local pointer table
+ */
+
+ for ( index=0 ; index <= maximum ; index++ ) {
+ information->local_table[ index ] = NULL;
+ }
+
+ /*
+ * Initialize objects .. if there are any
+ */
+
+ if ( maximum == 0 ) {
+ _Chain_Initialize_empty( &information->Inactive );
+ } else {
+
+ _Chain_Initialize(
+ &information->Inactive,
+ _Workspace_Allocate_or_fatal_error( maximum * size ),
+ maximum,
+ size
+ );
+
+ the_object = (Objects_Control *) information->Inactive.first;
+ for ( index=1; index <= maximum ; index++ ) {
+ the_object->id =
+ _Objects_Build_id( the_class, _Objects_Local_node, index );
+
+ the_object->name = (void *) name_area;
+
+ name_area = _Addresses_Add_offset( name_area, name_length );
+
+ the_object = (Objects_Control *) the_object->Node.next;
+ }
+
+ }
+
+ /*
+ * Take care of multiprocessing
+ */
+
+ if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
+
+ information->global_table = _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;
+}
+
+/*PAGE
+ *
+ * _Objects_Clear_name
+ *
+ * XXX
+ */
+
+void _Objects_Clear_name(
+ void *name,
+ unsigned32 length
+)
+{
+ unsigned32 index;
+ unsigned32 maximum = length / OBJECTS_NAME_ALIGNMENT;
+ unsigned32 *name_ptr = name;
+
+ for ( index=0 ; index < maximum ; index++ )
+ *name_ptr++ = 0;
+}
+
+/*PAGE
+ *
+ * _Objects_Copy_name_string
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_string(
+ void *source,
+ void *destination
+)
+{
+ unsigned8 *source_p = source;
+ unsigned8 *destination_p = destination;
+
+ do {
+ *destination_p++ = *source_p;
+ } while ( *source_p++ );
+}
+
+/*PAGE
+ *
+ * _Objects_Copy_name_raw
+ *
+ * XXX
+ */
+
+void _Objects_Copy_name_raw(
+ void *source,
+ void *destination,
+ unsigned32 length
+)
+{
+ unsigned32 *source_p = source;
+ unsigned32 *destination_p = destination;
+ unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT;
+
+ while ( tmp_length-- )
+ *destination_p++ = *source_p++;
+}
+
+/*PAGE
+ *
+ * _Objects_Compare_name_string
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_string(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+)
+{
+ unsigned8 *name_1_p = name_1;
+ unsigned8 *name_2_p = name_2;
+ unsigned32 tmp_length = length;
+
+ do {
+ if ( *name_1_p++ != *name_2_p++ )
+ return FALSE;
+ if ( !tmp_length-- )
+ return FALSE;
+ } while ( *name_1_p );
+
+ return TRUE;
+}
+
+/*PAGE
+ *
+ * _Objects_Compare_name_raw
+ *
+ * XXX
+ */
+
+boolean _Objects_Compare_name_raw(
+ void *name_1,
+ void *name_2,
+ unsigned32 length
+)
+{
+ unsigned32 *name_1_p = name_1;
+ unsigned32 *name_2_p = name_2;
+ unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT;
+
+ while ( tmp_length-- )
+ if ( *name_1_p++ != *name_2_p++ )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*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 **objects;
+ 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 ) {
+ objects = information->local_table;
+
+ 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 = objects[ 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;
+
+ return ( _Objects_MP_Global_name_search( information, name, node, id ) );
+}
+
+/*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;
+
+ index = id - information->minimum_id;
+
+ if ( information->maximum >= index ) {
+ _Thread_Disable_dispatch();
+ if ( (the_object = information->local_table[index+1]) != NULL ) {
+ *location = OBJECTS_LOCAL;
+ return( the_object );
+ }
+ _Thread_Enable_dispatch();
+ *location = OBJECTS_ERROR;
+ return( NULL );
+ }
+ *location = OBJECTS_ERROR;
+ _Objects_MP_Is_remote( information, id, location, &the_object );
+ return the_object;
+}
+
+
+/*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,
+ unsigned32 *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;
+}
+
+/*PAGE
+ *
+ * _Objects_Get_information
+ *
+ * XXX
+ */
+
+Objects_Information *_Objects_Get_information(
+ Objects_Id id
+)
+{
+ Objects_Classes the_class;
+
+ the_class = _Objects_Get_class( id );
+
+ if ( !_Objects_Is_class_valid( the_class ) )
+ return NULL;
+
+ return _Objects_Information_table[ the_class ];
+}
+
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
new file mode 100644
index 0000000000..7546c33585
--- /dev/null
+++ b/cpukit/score/src/objectmp.c
@@ -0,0 +1,275 @@
+/*
+ * Multiprocessing Support for the Object Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/thread.h>
+
+/*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/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
new file mode 100644
index 0000000000..afd36a0fd8
--- /dev/null
+++ b/cpukit/score/src/thread.c
@@ -0,0 +1,1257 @@
+/*
+ * Thread Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+
+/*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
+ */
+
+char *_Thread_Idle_name = "IDLE";
+
+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;
+ _Thread_Allocated_fp = NULL;
+
+ _Thread_Maximum_extensions = maximum_extensions;
+
+ _Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
+ _Thread_Ticks_per_timeslice = ticks_per_timeslice;
+
+ _Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
+ (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
+ );
+
+ for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
+ _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
+
+ _Thread_MP_Handler_initialization( maximum_proxies );
+
+ /*
+ * Initialize this class of objects.
+ */
+
+ _Objects_Initialize_information(
+ &_Thread_Internal_information,
+ OBJECTS_INTERNAL_THREADS,
+ FALSE,
+ ( _System_state_Is_multiprocessing ) ? 2 : 1,
+ sizeof( Thread_Control ),
+ TRUE,
+ 8,
+ TRUE
+ );
+
+}
+
+/*PAGE
+ *
+ * _Thread_Create_idle
+ */
+
+void _Thread_Create_idle( void )
+{
+ void *idle;
+
+ /*
+ * 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 = _CPU_Thread_Idle_body;
+#else
+ idle = _Thread_Idle_body;
+#endif
+
+ if ( _CPU_Table.idle_task )
+ idle = _CPU_Table.idle_task;
+
+ _Thread_Initialize(
+ &_Thread_Internal_information,
+ _Thread_Idle,
+ NULL, /* allocate the stack */
+ THREAD_IDLE_STACK_SIZE,
+ CPU_IDLE_TASK_IS_FP,
+ PRIORITY_MAXIMUM,
+ TRUE, /* preemptable */
+ FALSE, /* not timesliced */
+ 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
+ );
+
+}
+
+/*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;
+
+ _Context_Switch( &_Thread_BSP_context, &_Thread_Executing->Registers );
+}
+
+/*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;
+ _ISR_Enable( level );
+
+ _User_extensions_Thread_switch( executing, heir );
+
+ _Thread_Ticks_remaining_in_timeslice = _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 )
+#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
+ if ( (heir->fp_context != NULL) && !_Thread_Is_allocated_fp( heir ) ) {
+ if ( _Thread_Allocated_fp != NULL )
+ _Context_Save_fp( &_Thread_Allocated_fp->fp_context );
+ _Context_Restore_fp( &heir->fp_context );
+ _Thread_Allocated_fp = heir;
+ }
+#else
+ if ( executing->fp_context != NULL )
+ _Context_Save_fp( &executing->fp_context );
+
+ if ( heir->fp_context != NULL )
+ _Context_Restore_fp( &heir->fp_context );
+#endif
+#endif
+
+ _Context_Switch( &executing->Registers, &heir->Registers );
+
+ executing = _Thread_Executing;
+
+ _ISR_Disable( level );
+ }
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _ISR_Enable( level );
+
+ if ( executing->do_post_task_switch_extension ) {
+ executing->do_post_task_switch_extension = FALSE;
+ _API_extensions_Run_postswitch();
+ }
+
+}
+
+/*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
+ */
+
+static 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;
+}
+
+/*
+ * _Thread_Stack_Free
+ *
+ * Deallocate the Thread's stack.
+ */
+
+static void _Thread_Stack_Free(void *stack_addr)
+{
+ /*
+ * 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)( stack_addr );
+ else
+ _Workspace_Free( stack_addr );
+}
+
+/*PAGE
+ *
+ * _Thread_Initialize
+ *
+ * XXX
+ */
+
+boolean _Thread_Initialize(
+ Objects_Information *information,
+ Thread_Control *the_thread,
+ void *stack_area, /* NULL if to be allocated */
+ unsigned32 stack_size, /* insure it is >= min */
+ boolean is_fp, /* TRUE if thread uses FP */
+ Priority_Control priority,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
+ Objects_Name name
+
+)
+{
+ unsigned32 actual_stack_size;
+ void *stack;
+ void *fp_area;
+ void *extensions_area;
+
+ /*
+ * Allocate and Initialize the stack for this thread.
+ */
+
+ if ( !_Stack_Is_enough( stack_size ) )
+ actual_stack_size = STACK_MINIMUM_SIZE;
+ else
+ actual_stack_size = stack_size;
+
+ actual_stack_size = _Stack_Adjust_size( actual_stack_size );
+ stack = stack_area;
+
+ if ( !stack ) {
+ actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size );
+
+ if ( !actual_stack_size )
+ return FALSE; /* stack allocation failed */
+
+ stack = the_thread->Start.stack;
+ } else
+ the_thread->Start.stack = NULL;
+
+ _Stack_Initialize(
+ &the_thread->Start.Initial_stack,
+ stack,
+ actual_stack_size
+ );
+
+ /*
+ * Allocate the floating point area for this thread
+ */
+
+ if ( is_fp ) {
+
+ fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
+ if ( !fp_area ) {
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+ 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;
+
+
+ /*
+ * 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 ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
+ } else
+ extensions_area = NULL;
+
+ the_thread->extensions = extensions_area;
+
+ /*
+ * General initialization
+ */
+
+ the_thread->Start.is_preemptible = is_preemptible;
+ the_thread->Start.is_timeslice = is_timeslice;
+ the_thread->Start.isr_level = isr_level;
+
+ the_thread->current_state = STATES_DORMANT;
+ the_thread->resource_count = 0;
+ the_thread->real_priority = priority;
+ the_thread->Start.initial_priority = priority;
+
+ _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 ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Thread_Stack_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
+
+ return TRUE;
+
+}
+
+/*
+ * _Thread_Start
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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 = 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;
+
+}
+
+/*
+ * _Thread_Restart
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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 );
+ the_thread->resource_count = 0;
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
+
+ the_thread->Start.pointer_argument = pointer_argument;
+ the_thread->Start.numeric_argument = numeric_argument;
+
+ 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 );
+ }
+
+ _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;
+}
+
+/*
+ * _Thread_Close
+ *
+ * DESCRIPTION:
+ *
+ * XXX
+ */
+
+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_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 );
+
+ if ( the_thread->Start.stack )
+ (void) _Workspace_Free( the_thread->Start.stack );
+
+ if ( the_thread->extensions )
+ (void) _Workspace_Free( the_thread->extensions );
+
+ the_thread->Start.stack = NULL;
+ the_thread->extensions = NULL;
+}
+
+/*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 );
+}
+
+/*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;
+
+ _ISR_Disable( level );
+ the_thread->current_state =
+ _States_Clear( state, the_thread->current_state );
+
+ if ( _States_Is_ready( the_thread->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 );
+}
+
+/*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 );
+}
+
+/*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 );
+
+}
+
+/*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 ) ) {
+ _Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
+ _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 );
+}
+
+/*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 )
+{
+ if ( !_Thread_Executing->is_timeslice ||
+ !_Thread_Executing->is_preemptible ||
+ !_States_Is_ready( _Thread_Executing->current_state ) )
+ return;
+
+ if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
+ _Thread_Reset_timeslice();
+ }
+}
+
+/*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 );
+}
+
+/*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 ( the_thread->Start.fp_context ) {
+ the_thread->fp_context = the_thread->Start.fp_context;
+ _Context_Initialize_fp( &the_thread->fp_context );
+ is_fp = TRUE;
+ }
+
+ the_thread->do_post_task_switch_extension = FALSE;
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
+
+ _Context_Initialize(
+ &the_thread->Registers,
+ the_thread->Start.Initial_stack.area,
+ the_thread->Start.Initial_stack.size,
+ the_thread->Start.isr_level,
+ _Thread_Handler,
+ is_fp
+ );
+
+}
+
+/*PAGE
+ *
+ * _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.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Thread_Handler( void )
+{
+ Thread_Control *executing;
+
+ executing = _Thread_Executing;
+
+ /*
+ * 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();
+
+ switch ( executing->Start.prototype ) {
+ case THREAD_START_NUMERIC:
+ (*executing->Start.entry_point)( executing->Start.numeric_argument );
+ break;
+ case THREAD_START_POINTER:
+ (*executing->Start.entry_point)( executing->Start.pointer_argument );
+ break;
+ case THREAD_START_BOTH_POINTER_FIRST:
+ (*executing->Start.entry_point)(
+ executing->Start.pointer_argument,
+ executing->Start.numeric_argument
+ );
+ break;
+ case THREAD_START_BOTH_NUMERIC_FIRST:
+ (*executing->Start.entry_point)(
+ executing->Start.numeric_argument,
+ executing->Start.pointer_argument
+ );
+ break;
+ }
+
+ _User_extensions_Thread_exitted( executing );
+
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_THREAD_EXITTED
+ );
+}
+
+/*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;
+ }
+}
+
+/*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
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * ready chain
+ * select heir
+ */
+
+void _Thread_Change_priority(
+ Thread_Control *the_thread,
+ Priority_Control new_priority
+)
+{
+ ISR_Level level;
+
+ _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 ) ) {
+ _ISR_Enable( level );
+ return;
+ }
+
+ _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();
+
+ if ( !_Thread_Is_executing_also_the_heir() &&
+ _Thread_Executing->is_preemptible )
+ _Context_Switch_necessary = TRUE;
+
+ _ISR_Enable( level );
+}
+
+/*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 );
+}
+
+/*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;
+}
+
+/*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
+)
+{
+ Objects_Classes the_class;
+ Objects_Information *information;
+
+ if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
+ _Thread_Disable_dispatch();
+ *location = OBJECTS_LOCAL;
+ return( _Thread_Executing );
+ }
+
+ the_class = _Objects_Get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ return (Thread_Control *) _Objects_Get( information, id, location );
+}
+
+#endif
+
+/*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/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
new file mode 100644
index 0000000000..31f7e5ff62
--- /dev/null
+++ b/cpukit/score/src/threadmp.c
@@ -0,0 +1,164 @@
+/*
+ * Multiprocessing Support for the Thread Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/isr.h>
+
+/*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 = _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/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
new file mode 100644
index 0000000000..c02de10ee0
--- /dev/null
+++ b/cpukit/score/src/threadq.c
@@ -0,0 +1,967 @@
+/*
+ * Thread Queue Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/threadq.h>
+#include <rtems/score/tqdata.h>
+
+/*PAGE
+ *
+ * _Thread_queue_Initialize
+ *
+ * This routine initializes the specified threadq.
+ *
+ * Input parameters:
+ * the_thread_queue - pointer to a threadq header
+ * the_class - class of the object to which this belongs
+ * discipline - queueing discipline
+ * state - state of waiting threads
+ * proxy_extract_callout - MP specific callout
+ * timeout_status - return on a timeout
+ *
+ * Output parameters: NONE
+ */
+
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ Objects_Classes the_class,
+ Thread_queue_Disciplines the_discipline,
+ States_Control state,
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
+)
+{
+ unsigned32 index;
+
+ _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
+
+ the_thread_queue->state = state;
+ the_thread_queue->discipline = the_discipline;
+ the_thread_queue->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;
+ }
+
+}
+
+/*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 ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
+ the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );
+ else
+ _Thread_Set_state( the_thread, the_thread_queue->state );
+
+ 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;
+ }
+}
+
+/*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 );
+}
+
+/*PAGE
+ *
+ * _Thread_queue_Extract_with_proxy
+ *
+ * This routine extracts the_thread from the_thread_queue
+ * and insures 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_Classes the_class;
+ 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_class = _Objects_Get_class( the_thread->Wait.id );
+
+ proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
+
+ if ( proxy_extract_callout )
+ (*proxy_extract_callout)( the_thread );
+ }
+ _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*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;
+ }
+}
+
+/*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 ( _Objects_Is_local_id( the_thread->Object.id ) )
+ the_thread->Wait.return_code = status;
+ else
+ ( *remote_extract_callout )( the_thread );
+ }
+}
+
+/*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;
+}
+
+/*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;
+ }
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+ 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 */
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+
+}
+
+/*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;
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+ return( the_thread );
+}
+
+/*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 ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ _Thread_MP_Free_proxy( the_thread );
+ }
+ else
+ _ISR_Enable( level );
+}
+
+/*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/cpukit/score/src/userext.c b/cpukit/score/src/userext.c
new file mode 100644
index 0000000000..6261220d58
--- /dev/null
+++ b/cpukit/score/src/userext.c
@@ -0,0 +1,204 @@
+/*
+ * User Extension Handler
+ *
+ * NOTE: XXX
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*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/cpukit/score/src/watchdog.c b/cpukit/score/src/watchdog.c
new file mode 100644
index 0000000000..0f72bd3d5c
--- /dev/null
+++ b/cpukit/score/src/watchdog.c
@@ -0,0 +1,267 @@
+/*
+ * Watchdog Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/watchdog.h>
+
+/*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;
+ _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
+ _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
+}
+
+/*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;
+ }
+ _ISR_Enable( level );
+ return( previous_state );
+}
+
+/*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;
+ }
+ }
+}
+
+/*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 );
+
+exit_insert:
+ _Watchdog_Sync_level = insert_isr_nest_level;
+ _Watchdog_Sync_count--;
+ _ISR_Enable( level );
+}
+
+/*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/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c
new file mode 100644
index 0000000000..1dda9408bb
--- /dev/null
+++ b/cpukit/score/src/wkspace.c
@@ -0,0 +1,88 @@
+/*
+ * Workspace Handler
+ *
+ * XXX
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/interr.h>
+
+/*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 / 4 ;
+ 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;
+}
diff --git a/testsuites/README b/testsuites/README
new file mode 100644
index 0000000000..f799370569
--- /dev/null
+++ b/testsuites/README
@@ -0,0 +1,44 @@
+#
+# $Id$
+#
+
+This is the directory under which the RTEMS
+test programs provided with the release are located. The
+following is a description of the contents of each file and
+subdirectory directly in this directory:
+
+NOTE: Other than the 'samples' directory these tests are intended
+ only to exercise RTEMS features and are *not* good examples
+ of programming for RTEMS.
+
+ samples
+
+ This directory contains a set of simple sample applications
+ which can be used either to test a board support package
+ or as the starting point for a custom application.
+
+ mptests
+
+ This directory contains the RTEMS Multiprocessor Test Suite.
+ The tests in this directory provide near complete (98%+) test
+ coverage of the multiprocessor specific code in RTEMS.
+
+ psxtests
+
+ This directory contains the RTEMS POSIX API Test Suite.
+ The tests in this directory test the POSIX API support in RTEMS.
+
+ sptests
+
+ This directory contains the RTEMS Single Processor Test Suite.
+ The tests in this directory provide near complete (98%+) test
+ coverage of the non-multiprocessor code in RTEMS.
+
+ tmtests
+
+ This directory contains the RTEMS Timing Test Suite.
+ The tests in this directory are used to measure the execution
+ time of RTEMS directive and some critical internal functions.
+ The results of these test are reported in the Fact Sheets
+ and Supplental Manuals.
+
diff --git a/testsuites/libtests/README b/testsuites/libtests/README
new file mode 100644
index 0000000000..bc4b217832
--- /dev/null
+++ b/testsuites/libtests/README
@@ -0,0 +1,10 @@
+#
+# $Id$
+#
+
+This directory contains tests for some of the items in
+the lib directories. The intent is to be able to
+verify the basic functionality of a library. For example,
+it is important to know that the stack checker successfully
+detects tasks which both stay within and exceed their
+stack limits.
diff --git a/testsuites/libtests/stackchk/blow.c b/testsuites/libtests/stackchk/blow.c
new file mode 100644
index 0000000000..107461b135
--- /dev/null
+++ b/testsuites/libtests/stackchk/blow.c
@@ -0,0 +1,45 @@
+/* task1.c
+ *
+ * This set of three tasks do some simple task switching for about
+ * 15 seconds and then call a routine to "blow the stack".
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+
+void b() {}
+
+void blow_stack( void )
+{
+ volatile unsigned32 *low, *high;
+
+b();
+ /*
+ * Destroy the first and last 16 bytes of our stack... Hope it
+ * does not cause problems :)
+ */
+
+ low = _Thread_Executing->Start.Initial_stack.area + HEAP_OVERHEAD;
+ high = _Thread_Executing->Start.Initial_stack.area +
+ _Thread_Executing->Start.Initial_stack.size - 16;
+
+ low[0] = 0x11111111;
+ low[1] = 0x22222222;
+ low[2] = 0x33333333;
+ low[3] = 0x44444444;
+
+ high[0] = 0x55555555;
+ high[1] = 0x66666666;
+ high[2] = 0x77777777;
+ high[3] = 0x88888888;
+
+}
diff --git a/testsuites/libtests/stackchk/init.c b/testsuites/libtests/stackchk/init.c
new file mode 100644
index 0000000000..0415493243
--- /dev/null
+++ b/testsuites/libtests/stackchk/init.c
@@ -0,0 +1,86 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST STACK CHECKER ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ TASK_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/libtests/stackchk/stackchk.scn b/testsuites/libtests/stackchk/stackchk.scn
new file mode 100644
index 0000000000..84a5c5e342
--- /dev/null
+++ b/testsuites/libtests/stackchk/stackchk.scn
@@ -0,0 +1,9 @@
+*** TEST STACK CHECKER ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+---> error indictation
diff --git a/testsuites/libtests/stackchk/system.h b/testsuites/libtests/stackchk/system.h
new file mode 100644
index 0000000000..56a8e9526a
--- /dev/null
+++ b/testsuites/libtests/stackchk/system.h
@@ -0,0 +1,49 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* macros */
+
+#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+void blow_stack( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/libtests/stackchk/task1.c b/testsuites/libtests/stackchk/task1.c
new file mode 100644
index 0000000000..de31ee1068
--- /dev/null
+++ b/testsuites/libtests/stackchk/task1.c
@@ -0,0 +1,44 @@
+/* task1.c
+ *
+ * This set of three tasks do some simple task switching for about
+ * 15 seconds and then call a routine to "blow the stack".
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 15 && tid == Task_id[ 1 ] ) {
+ blow_stack();
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/testsuites/mptests/README b/testsuites/mptests/README
new file mode 100644
index 0000000000..68cb459b55
--- /dev/null
+++ b/testsuites/mptests/README
@@ -0,0 +1,10 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Multiprocessor Test Suite.
+The tests in this directory provide near complete (98%+) test
+coverage of the multiprocessor specific code in RTEMS.
+
+These tests are designed to test RTEMS in a two node configuration.
+
diff --git a/testsuites/mptests/mp01/init.c b/testsuites/mptests/mp01/init.c
new file mode 100644
index 0000000000..888151761f
--- /dev/null
+++ b/testsuites/mptests/mp01/init.c
@@ -0,0 +1,96 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+ char c;
+
+ printf(
+ "\n\n*** TEST 1 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ if ( Multiprocessing_configuration.node != 1 ) c = 'S';
+ else c = 'M';
+
+ Task_name[ 1 ] = rtems_build_name( c, 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( c, 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( c, 'A', '3', ' ' );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ puts( "Creating task 1 (Global)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 1" );
+
+ puts( "Creating task 2 (Global)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 2" );
+
+ puts( "Creating task 3 (Local)" );
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of Task 3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of Task 3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp01/node1/mp01.doc b/testsuites/mptests/mp01/node1/mp01.doc
new file mode 100644
index 0000000000..83e06e2357
--- /dev/null
+++ b/testsuites/mptests/mp01/node1/mp01.doc
@@ -0,0 +1,53 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test50
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter, t_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of a global task on the local processor.
+
+ i. Verifies that a task can delete itself or a global task on
+ the local processor.
+
+ j. Verifies Shared Memory Locked Queue driver for initialization,
+ getting a packet, broadcasting a packet, and returning a packet.
+
+ k. Can be used to verify that global packet type P_SYSVERIFY,
+ P_OBJCREATE (task), and P_OBJDELETE (task) are sent and
+ correctly processed by a remote node.
diff --git a/testsuites/mptests/mp01/node1/mp01.scn b/testsuites/mptests/mp01/node1/mp01.scn
new file mode 100644
index 0000000000..d399f79b2a
--- /dev/null
+++ b/testsuites/mptests/mp01/node1/mp01.scn
@@ -0,0 +1,15 @@
+*** TEST 1 -- NODE 1 ***
+Creating task 1 (Global)
+Creating task 2 (Global)
+Creating task 3 (Local)
+MA1 - rtems_clock_get - 09:00:00 12/31/1988
+MA2 - rtems_clock_get - 09:00:00 12/31/1988
+MA3 - rtems_clock_get - 09:00:00 12/31/1988
+MA1 - rtems_clock_get - 09:00:05 12/31/1988
+MA1 - deleting self
+MA2 - rtems_clock_get - 09:00:10 12/31/1988
+MA2 - waiting to be deleted by MA3
+MA3 - rtems_clock_get - 09:00:15 12/31/1988
+MA3 - getting TID of MA2
+MA3 - deleting MA2
+*** END OF TEST 1 ***
diff --git a/testsuites/mptests/mp01/node2/mp01.doc b/testsuites/mptests/mp01/node2/mp01.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp01/node2/mp01.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp01/node2/mp01.scn b/testsuites/mptests/mp01/node2/mp01.scn
new file mode 100644
index 0000000000..c9831ff9db
--- /dev/null
+++ b/testsuites/mptests/mp01/node2/mp01.scn
@@ -0,0 +1,15 @@
+*** TEST 1 -- NODE 2 ***
+Creating task 1 (Global)
+Creating task 2 (Global)
+Creating task 3 (Local)
+SA1 - rtems_clock_get - 09:00:00 12/31/1988
+SA2 - rtems_clock_get - 09:00:00 12/31/1988
+SA3 - rtems_clock_get - 09:00:00 12/31/1988
+SA1 - rtems_clock_get - 09:00:05 12/31/1988
+SA1 - deleting self
+SA2 - rtems_clock_get - 09:00:10 12/31/1988
+SA2 - waiting to be deleted by SA3
+SA3 - rtems_clock_get - 09:00:15 12/31/1988
+SA3 - getting TID of SA2
+SA3 - deleting SA2
+*** END OF TEST 1 ***
diff --git a/testsuites/mptests/mp01/system.h b/testsuites/mptests/mp01/system.h
new file mode 100644
index 0000000000..54e0134a7d
--- /dev/null
+++ b/testsuites/mptests/mp01/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_GLOBAL
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp01/task1.c b/testsuites/mptests/mp01/task1.c
new file mode 100644
index 0000000000..7f90bb3165
--- /dev/null
+++ b/testsuites/mptests/mp01/task1.c
@@ -0,0 +1,84 @@
+/* Test_task
+ *
+ * This task is used for three test tasks. It obtains its task id and
+ * based upon that id, performs certain actions.
+ *
+ * Task_1 delays 5 seconds and deletes itself.
+ * Task_2 delays 10 seconds and then loops until
+ * deleted by the third task.
+ * Task 3 delays 15 seconds, then deletes task 2 and itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ if ( task_number(tid) == 1 ) { /* TASK 1 */
+ put_name( Task_name[ 1 ], FALSE );
+ printf( " - deleting self\n" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+ else if ( task_number(tid) == 2 ) { /* TASK 2 */
+ put_name( Task_name[ 2 ], FALSE );
+ printf( " - waiting to be deleted by " );
+ put_name( Task_name[ 3 ], TRUE );
+ while ( FOREVER );
+ }
+ else { /* TASK 3 */
+ put_name( Task_name[ 3 ], FALSE );
+ printf( " - getting TID of " );
+ put_name( Task_name[ 2 ], TRUE );
+ do {
+ status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident" );
+
+ put_name( Task_name[ 3 ], FALSE );
+ printf( " - deleting " );
+ put_name( Task_name[ 2 ], TRUE );
+ status = rtems_task_delete( tid );
+ directive_failed( status, "rtems_task_delete of Task 2" );
+
+ puts( "*** END OF TEST 1 ***" );
+ exit(0);
+ }
+}
diff --git a/testsuites/mptests/mp02/init.c b/testsuites/mptests/mp02/init.c
new file mode 100644
index 0000000000..723e4ff5cd
--- /dev/null
+++ b/testsuites/mptests/mp02/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 2 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp02/node1/mp02.doc b/testsuites/mptests/mp02/node1/mp02.doc
new file mode 100644
index 0000000000..e74807f7f1
--- /dev/null
+++ b/testsuites/mptests/mp02/node1/mp02.doc
@@ -0,0 +1,47 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test51
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter, t_delete, t_restart, t_getreg, t_setreg
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ c. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ d. Verifies executive initialization performed correctly.
+
+ e. Verifies that a task can get the task identification number of itself.
+
+ f. Verifies that a task can get the task identification number
+ of another task.
+
+ g. Verifies that a task can delete itself or another task.
+
+ h. Verifies that errors are returned in the following situations:
+ 1) when attempting to delete a remote task.
+ 2) when attempting to start a remote task.
+ 3) when attempting to restart a remote task.
+
+ i. Verifies that a remote task's registers can be set and read.
diff --git a/testsuites/mptests/mp02/node1/mp02.scn b/testsuites/mptests/mp02/node1/mp02.scn
new file mode 100644
index 0000000000..72fdefe69d
--- /dev/null
+++ b/testsuites/mptests/mp02/node1/mp02.scn
@@ -0,0 +1,14 @@
+*** TEST 2 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task (all nodes)
+Getting TID of remote task (1 node)
+rtems_task_delete of remote task returned the correct error
+rtems_task_start of remote task returned the correct error
+rtems_task_restart of remote task returned the correct error
+Setting notepad 1 of the remote task to 1
+Getting a notepad of the remote task
+Remote notepad set and read correctly
+*** END OF TEST 2 ***
diff --git a/testsuites/mptests/mp02/node2/mp02.doc b/testsuites/mptests/mp02/node2/mp02.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp02/node2/mp02.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp02/node2/mp02.scn b/testsuites/mptests/mp02/node2/mp02.scn
new file mode 100644
index 0000000000..233a910999
--- /dev/null
+++ b/testsuites/mptests/mp02/node2/mp02.scn
@@ -0,0 +1,14 @@
+*** TEST 2 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task (all nodes)
+Getting TID of remote task (1 node)
+rtems_task_delete of remote task returned the correct error
+rtems_task_start of remote task returned the correct error
+rtems_task_restart of remote task returned the correct error
+Setting notepad 2 of the remote task to 2
+Getting a notepad of the remote task
+Remote notepad set and read correctly
+*** END OF TEST 2 ***
diff --git a/testsuites/mptests/mp02/system.h b/testsuites/mptests/mp02/system.h
new file mode 100644
index 0000000000..8e2e95806d
--- /dev/null
+++ b/testsuites/mptests/mp02/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp02/task1.c b/testsuites/mptests/mp02/task1.c
new file mode 100644
index 0000000000..44764486b0
--- /dev/null
+++ b/testsuites/mptests/mp02/task1.c
@@ -0,0 +1,118 @@
+/* Test_task
+ *
+ * This task tests the rtems_task_set_note directive on a remote task and that
+ * errors are returned when attempting to delete, start, or restart
+ * a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_id test_tid;
+ rtems_unsigned32 note;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ printf( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task (all nodes)" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task (1 node)" );
+ status = rtems_task_ident( Task_name[ remote_node ], remote_node, &test_tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ if ( test_tid != remote_tid ) {
+ puts( "rtems_task_ident tid's do not match!!" );
+ rtems_fatal_error_occurred( status );
+ }
+
+ status = rtems_task_delete( remote_tid );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_delete of remote task"
+ );
+ puts( "rtems_task_delete of remote task returned the correct error" );
+
+ status = rtems_task_start( remote_tid, Test_task, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_start of remote task"
+ );
+ puts( "rtems_task_start of remote task returned the correct error" );
+
+ status = rtems_task_restart( remote_tid, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_task_restart of remote task"
+ );
+ puts( "rtems_task_restart of remote task returned the correct error" );
+
+ printf(
+ "Setting notepad %d of the remote task to %d\n",
+ rtems_get_node(tid),
+ rtems_get_node(tid)
+ );
+ status = rtems_task_set_note(
+ remote_tid,
+ rtems_get_node(tid),
+ rtems_get_node(tid)
+ );
+ directive_failed( status, "rtems_task_set_note" );
+
+ puts( "Getting a notepad of the remote task" );
+ status = rtems_task_get_note( remote_tid, rtems_get_node(tid), &note );
+ directive_failed( status, "rtems_task_get_note" );
+
+ if ( note == rtems_get_node(tid) )
+ puts( "Remote notepad set and read correctly" );
+ else
+ printf(
+ "FAILURE!! Remote notepad was not set and read correctly (%d, %d)\n",
+ note,
+ rtems_get_node( tid )
+ );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp03/delay.c b/testsuites/mptests/mp03/delay.c
new file mode 100644
index 0000000000..6a6bb5f25e
--- /dev/null
+++ b/testsuites/mptests/mp03/delay.c
@@ -0,0 +1,31 @@
+/* Delayed_send_event
+ *
+ * This routine is a timer service routine which sends an event to task 1.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+}
diff --git a/testsuites/mptests/mp03/init.c b/testsuites/mptests/mp03/init.c
new file mode 100644
index 0000000000..9be30fd92e
--- /dev/null
+++ b/testsuites/mptests/mp03/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 3 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp03/node1/mp03.doc b/testsuites/mptests/mp03/node1/mp03.doc
new file mode 100644
index 0000000000..348afef85f
--- /dev/null
+++ b/testsuites/mptests/mp03/node1/mp03.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test52
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_wkafter, t_suspend, t_resume
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task (on another node).
+
+ i. Verifies that a task can suspend and resume a remote task.
diff --git a/testsuites/mptests/mp03/node1/mp03.scn b/testsuites/mptests/mp03/node1/mp03.scn
new file mode 100644
index 0000000000..129e5bccba
--- /dev/null
+++ b/testsuites/mptests/mp03/node1/mp03.scn
@@ -0,0 +1,24 @@
+*** TEST 3 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 222
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Suspending remote task
+111 - Resuming remote task
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+
+ ........
+
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+111 - Have I been suspended?????
+*** END OF TEST 3 ***
diff --git a/testsuites/mptests/mp03/node2/mp03.doc b/testsuites/mptests/mp03/node2/mp03.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp03/node2/mp03.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp03/node2/mp03.scn b/testsuites/mptests/mp03/node2/mp03.scn
new file mode 100644
index 0000000000..d77c09e9f7
--- /dev/null
+++ b/testsuites/mptests/mp03/node2/mp03.scn
@@ -0,0 +1,24 @@
+*** TEST 3 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 111
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+
+ ........
+
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Have I been suspended?????
+222 - Suspending remote task
+222 - Resuming remote task
+222 - Suspending remote task
+222 - Resuming remote task
+222 - Suspending remote task
+222 - Resuming remote task
+*** END OF TEST 3 ***
diff --git a/testsuites/mptests/mp03/system.h b/testsuites/mptests/mp03/system.h
new file mode 100644
index 0000000000..39ba36ede3
--- /dev/null
+++ b/testsuites/mptests/mp03/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+TEST_EXTERN rtems_unsigned32 remote_node;
+TEST_EXTERN rtems_id remote_tid;
+
+/* end of include file */
diff --git a/testsuites/mptests/mp03/task1.c b/testsuites/mptests/mp03/task1.c
new file mode 100644
index 0000000000..c1f0f777fd
--- /dev/null
+++ b/testsuites/mptests/mp03/task1.c
@@ -0,0 +1,155 @@
+/* Test_task
+ *
+ * This task suspends and resumes a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+/*PAGE
+ *
+ * Test_Task_Support
+ *
+ */
+
+void Test_Task_Support(
+ rtems_unsigned32 node
+)
+{
+ rtems_event_set events;
+ rtems_status_code status;
+
+ if ( Multiprocessing_configuration.node == node ) {
+
+ for ( ; ; ) {
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive");
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ put_name( Task_name[ node ], FALSE );
+ puts( " - Suspending remote task" );
+
+ status = rtems_task_suspend( remote_tid );
+ directive_failed( status, "rtems_task_suspend" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ put_name( Task_name[ node ], FALSE );
+ puts( " - Resuming remote task" );
+
+ status = rtems_task_resume( remote_tid ) ;
+ directive_failed( status, "rtems_task_resume" );
+
+ }
+
+ } else {
+
+ for ( ; ; ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive");
+
+ put_name( Task_name[ remote_node ], FALSE );
+ puts( " - have I been suspended???" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ }
+
+}
+
+/*PAGE
+ *
+ * Test_task
+ */
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task" );
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ printf( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ Test_Task_Support( 1 );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ Test_Task_Support( 2 );
+
+ puts( "*** END OF TEST 3 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp04/init.c b/testsuites/mptests/mp04/init.c
new file mode 100644
index 0000000000..e3de164f09
--- /dev/null
+++ b/testsuites/mptests/mp04/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 4 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ Multiprocessing_configuration.node,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp04/node1/mp04.doc b/testsuites/mptests/mp04/node1/mp04.doc
new file mode 100644
index 0000000000..39a76d48a0
--- /dev/null
+++ b/testsuites/mptests/mp04/node1/mp04.doc
@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test53
+
+directives:
+ ex_init, ex_start, t_create, t_start, i_return, t_ident, tm_get,
+ tm_wkafter, tm_setpri
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies that the system can get the id of a remote task.
+
+ c. Verifies that the system can change the priority of a remote
+ task.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can delete itself or another task.
diff --git a/testsuites/mptests/mp04/node1/mp04.scn b/testsuites/mptests/mp04/node1/mp04.scn
new file mode 100644
index 0000000000..e9518f3ac2
--- /dev/null
+++ b/testsuites/mptests/mp04/node1/mp04.scn
@@ -0,0 +1,8 @@
+*** TEST 4 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 222
+Local task priority has been set
+*** END OF TEST 4 ***
diff --git a/testsuites/mptests/mp04/node2/mp04.doc b/testsuites/mptests/mp04/node2/mp04.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp04/node2/mp04.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp04/node2/mp04.scn b/testsuites/mptests/mp04/node2/mp04.scn
new file mode 100644
index 0000000000..8ccfcfef79
--- /dev/null
+++ b/testsuites/mptests/mp04/node2/mp04.scn
@@ -0,0 +1,8 @@
+*** TEST 4 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting TID of remote task
+Remote task's name is : 111
+Local task priority has been set
+*** END OF TEST 4 ***
diff --git a/testsuites/mptests/mp04/system.h b/testsuites/mptests/mp04/system.h
new file mode 100644
index 0000000000..f67d16fe53
--- /dev/null
+++ b/testsuites/mptests/mp04/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp04/task1.c b/testsuites/mptests/mp04/task1.c
new file mode 100644
index 0000000000..7e7e0ca849
--- /dev/null
+++ b/testsuites/mptests/mp04/task1.c
@@ -0,0 +1,83 @@
+/* Test_task
+ *
+ * This task tests the rtems_task_set_priority directive on a remote task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_task_priority previous_priority;
+ rtems_task_priority previous_priority_1;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ puts( "Getting TID of remote task" );
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_task_set_priority(
+ remote_tid,
+ Multiprocessing_configuration.node,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ if ( previous_priority != remote_node ) {
+ printf(
+ "Remote priority (0x%x) does not match remote node (0x%x)!!!\n",
+ previous_priority,
+ remote_node
+ );
+ exit( 0xf0000 );
+ }
+
+ do {
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &previous_priority_1
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ } while ( previous_priority_1 != remote_node );
+
+ puts( "Local task priority has been set" );
+
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp05/asr.c b/testsuites/mptests/mp05/asr.c
new file mode 100644
index 0000000000..9f98e42692
--- /dev/null
+++ b/testsuites/mptests/mp05/asr.c
@@ -0,0 +1,37 @@
+/* Process_asr
+ *
+ * This routine performs the processing for task 1's RTEMS_ASR. It is called
+ * by an assembly routine which saves the necessary registers.
+ *
+ * Input parameters:
+ * signal - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set signal
+)
+{
+ if ( signal != expected_signal ) {
+ printf(
+ "ERROR: I was expecting signal 0x%.8x got 0x%.8x\n",
+ expected_signal,
+ signal
+ );
+ rtems_fatal_error_occurred( 0xf0000 );
+ }
+ signal_caught = 1;
+}
diff --git a/testsuites/mptests/mp05/init.c b/testsuites/mptests/mp05/init.c
new file mode 100644
index 0000000000..c6b9bb9f44
--- /dev/null
+++ b/testsuites/mptests/mp05/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 5 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp05/node1/mp05.doc b/testsuites/mptests/mp05/node1/mp05.doc
new file mode 100644
index 0000000000..6b9ccd556d
--- /dev/null
+++ b/testsuites/mptests/mp05/node1/mp05.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test54
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_wkafter, as_catch, as_return
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that a signal can be sent to a remote task.
diff --git a/testsuites/mptests/mp05/node1/mp05.scn b/testsuites/mptests/mp05/node1/mp05.scn
new file mode 100644
index 0000000000..472740ba18
--- /dev/null
+++ b/testsuites/mptests/mp05/node1/mp05.scn
@@ -0,0 +1,11 @@
+*** TEST 5 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+rtems_signal_catch: initializing signal catcher
+Remote task's name is : 222
+Getting TID of remote task
+Sending signal to remote task
+....................................................
+....................................................
+*** END OF TEST 5 ***
diff --git a/testsuites/mptests/mp05/node2/mp05.doc b/testsuites/mptests/mp05/node2/mp05.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp05/node2/mp05.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp05/node2/mp05.scn b/testsuites/mptests/mp05/node2/mp05.scn
new file mode 100644
index 0000000000..0c4b412f65
--- /dev/null
+++ b/testsuites/mptests/mp05/node2/mp05.scn
@@ -0,0 +1,10 @@
+*** TEST 5 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+rtems_signal_catch: initializing signal catcher
+Remote task's name is : 111
+Getting TID of remote task
+....................................................
+....................................................
+*** END OF TEST 5 ***
diff --git a/testsuites/mptests/mp05/system.h b/testsuites/mptests/mp05/system.h
new file mode 100644
index 0000000000..2ebc8b47b5
--- /dev/null
+++ b/testsuites/mptests/mp05/system.h
@@ -0,0 +1,59 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_asr Process_asr( rtems_signal_set );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+TEST_EXTERN rtems_unsigned32 remote_node;
+TEST_EXTERN rtems_id remote_tid;
+TEST_EXTERN rtems_signal_set remote_signal;
+TEST_EXTERN rtems_signal_set expected_signal;
+TEST_EXTERN volatile rtems_unsigned32 signal_count;
+TEST_EXTERN volatile rtems_unsigned32 signal_caught;
+
+/* end of include file */
diff --git a/testsuites/mptests/mp05/task1.c b/testsuites/mptests/mp05/task1.c
new file mode 100644
index 0000000000..6934663850
--- /dev/null
+++ b/testsuites/mptests/mp05/task1.c
@@ -0,0 +1,106 @@
+/* Test_task
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define SIGNALS_PER_DOT 15
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Stop_Test = FALSE;
+
+ signal_caught = 0;
+ signal_count = 0;
+
+ puts( "rtems_signal_catch: initializing signal catcher" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR|RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ if (Multiprocessing_configuration.node == 1) {
+ remote_node = 2;
+ remote_signal = RTEMS_SIGNAL_18;
+ expected_signal = RTEMS_SIGNAL_17;
+ }
+ else {
+ remote_node = 1;
+ remote_signal = RTEMS_SIGNAL_17;
+ expected_signal = RTEMS_SIGNAL_18;
+ }
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 3 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending signal to remote task" );
+ do {
+ status = rtems_signal_send( remote_tid, remote_signal );
+ if ( status == RTEMS_NOT_DEFINED )
+ continue;
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_signal_send" );
+ }
+
+ while ( Stop_Test == FALSE ) {
+ if ( signal_caught ) {
+ signal_caught = 0;
+ if ( ++signal_count >= SIGNALS_PER_DOT ) {
+ signal_count = 0;
+ put_dot( '.' );
+ }
+ status = rtems_signal_send( remote_tid, remote_signal );
+ directive_failed( status, "rtems_signal_send" );
+ }
+ }
+ puts( "\n*** END OF TEST 5 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp06/init.c b/testsuites/mptests/mp06/init.c
new file mode 100644
index 0000000000..f04f834956
--- /dev/null
+++ b/testsuites/mptests/mp06/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 6 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp06/node1/mp06.doc b/testsuites/mptests/mp06/node1/mp06.doc
new file mode 100644
index 0000000000..879c15d705
--- /dev/null
+++ b/testsuites/mptests/mp06/node1/mp06.doc
@@ -0,0 +1,45 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test55
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that events can be sent to a remote task.
diff --git a/testsuites/mptests/mp06/node1/mp06.scn b/testsuites/mptests/mp06/node1/mp06.scn
new file mode 100644
index 0000000000..592777e5d7
--- /dev/null
+++ b/testsuites/mptests/mp06/node1/mp06.scn
@@ -0,0 +1,11 @@
+*** TEST 6 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task
+Sending events to remote task
+....................................................
+....................................................
+*** END OF TEST 6 ***
+
diff --git a/testsuites/mptests/mp06/node2/mp06.doc b/testsuites/mptests/mp06/node2/mp06.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp06/node2/mp06.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp06/node2/mp06.scn b/testsuites/mptests/mp06/node2/mp06.scn
new file mode 100644
index 0000000000..9cb653c2f3
--- /dev/null
+++ b/testsuites/mptests/mp06/node2/mp06.scn
@@ -0,0 +1,12 @@
+*** TEST 6 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task
+Receiving events from remote task
+....................................................
+....................................................
+rtems_event_receive - correctly returned RTEMS_TIMEOUT
+*** END OF TEST 6 ***
+
diff --git a/testsuites/mptests/mp06/system.h b/testsuites/mptests/mp06/system.h
new file mode 100644
index 0000000000..a7c0048cdd
--- /dev/null
+++ b/testsuites/mptests/mp06/system.h
@@ -0,0 +1,50 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+/* end of include file */
diff --git a/testsuites/mptests/mp06/task1.c b/testsuites/mptests/mp06/task1.c
new file mode 100644
index 0000000000..5b63a9ff76
--- /dev/null
+++ b/testsuites/mptests/mp06/task1.c
@@ -0,0 +1,176 @@
+/* Test_task
+ *
+ * This task tests global event operations. If running on node one, it
+ * continuously sends events. If running on node two, it continuously
+ * receives events.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define DOT_COUNT 25
+
+/*PAGE
+ *
+ * Stop_Test_TSR
+ */
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+/*PAGE
+ *
+ * Event_set_table
+ */
+
+rtems_event_set Event_set_table[] = {
+ RTEMS_EVENT_0,
+ RTEMS_EVENT_1,
+ RTEMS_EVENT_2,
+ RTEMS_EVENT_3,
+ RTEMS_EVENT_4,
+ RTEMS_EVENT_5,
+ RTEMS_EVENT_6,
+ RTEMS_EVENT_7,
+ RTEMS_EVENT_8,
+ RTEMS_EVENT_9,
+ RTEMS_EVENT_10,
+ RTEMS_EVENT_11,
+ RTEMS_EVENT_12,
+ RTEMS_EVENT_13,
+ RTEMS_EVENT_14,
+ RTEMS_EVENT_15,
+ RTEMS_EVENT_16,
+ RTEMS_EVENT_17,
+ RTEMS_EVENT_18,
+ RTEMS_EVENT_19,
+ RTEMS_EVENT_20,
+ RTEMS_EVENT_21,
+ RTEMS_EVENT_22,
+ RTEMS_EVENT_23,
+ RTEMS_EVENT_24,
+ RTEMS_EVENT_25,
+ RTEMS_EVENT_26,
+ RTEMS_EVENT_27,
+ RTEMS_EVENT_28,
+ RTEMS_EVENT_29,
+ RTEMS_EVENT_30,
+ RTEMS_EVENT_31
+};
+
+/*PAGE
+ *
+ * Test_task
+ */
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+ rtems_event_set event_for_this_iteration;
+
+ Stop_Test = FALSE;
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( status != RTEMS_SUCCESSFUL );
+ directive_failed( status, "rtems_task_ident FAILED!!" );
+
+ if ( Multiprocessing_configuration.node == 1 )
+ puts( "Sending events to remote task" );
+ else
+ puts( "Receiving events from remote task" );
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ count = 0;
+
+ for ( ; ; ) {
+ if ( Stop_Test == TRUE )
+ break;
+
+ event_for_this_iteration = Event_set_table[ count % 32 ];
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_event_send( remote_tid, event_for_this_iteration );
+ directive_failed( status, "rtems_event_send" );
+
+ status = rtems_task_wake_after( 1 );
+ directive_failed( status, "rtems_task_wake_after" );
+ } else {
+ status = rtems_event_receive(
+ event_for_this_iteration,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND,
+ &event_out
+ );
+ if ( rtems_are_statuses_equal( status, RTEMS_TIMEOUT ) ) {
+ if ( Multiprocessing_configuration.node == 2 )
+ puts( "\nCorrect behavior if the other node exitted." );
+ else
+ puts( "\nERROR... node 1 died" );
+ break;
+ } else
+ directive_failed( status, "rtems_event_receive" );
+ }
+
+ if ( (count % DOT_COUNT) == 0 )
+ put_dot('.');
+
+ count++;
+ }
+
+ putchar( '\n' );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND,
+ &event_out
+ );
+ fatal_directive_status( status, RTEMS_TIMEOUT, "rtems_event_receive" );
+ puts( "rtems_event_receive - correctly returned RTEMS_TIMEOUT" );
+ }
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp07/init.c b/testsuites/mptests/mp07/init.c
new file mode 100644
index 0000000000..a732434ead
--- /dev/null
+++ b/testsuites/mptests/mp07/init.c
@@ -0,0 +1,65 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 7 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp07/node1/mp07.doc b/testsuites/mptests/mp07/node1/mp07.doc
new file mode 100644
index 0000000000..ca09867ab6
--- /dev/null
+++ b/testsuites/mptests/mp07/node1/mp07.doc
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test56
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that two tasks on different processors can alternate
+ sending each other events.
diff --git a/testsuites/mptests/mp07/node1/mp07.scn b/testsuites/mptests/mp07/node1/mp07.scn
new file mode 100644
index 0000000000..d348f48612
--- /dev/null
+++ b/testsuites/mptests/mp07/node1/mp07.scn
@@ -0,0 +1,10 @@
+*** TEST 7 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 222
+Getting TID of remote task
+Sending first event to remote task
+....................................................
+....................................................
+*** END OF TEST 7 ***
diff --git a/testsuites/mptests/mp07/node2/mp07.doc b/testsuites/mptests/mp07/node2/mp07.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp07/node2/mp07.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp07/node2/mp07.scn b/testsuites/mptests/mp07/node2/mp07.scn
new file mode 100644
index 0000000000..9e361d713c
--- /dev/null
+++ b/testsuites/mptests/mp07/node2/mp07.scn
@@ -0,0 +1,9 @@
+*** TEST 7 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Remote task's name is : 111
+Getting TID of remote task
+....................................................
+....................................................
+*** END OF TEST 7 ***
diff --git a/testsuites/mptests/mp07/system.h b/testsuites/mptests/mp07/system.h
new file mode 100644
index 0000000000..a7c0048cdd
--- /dev/null
+++ b/testsuites/mptests/mp07/system.h
@@ -0,0 +1,50 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+
+/* end of include file */
diff --git a/testsuites/mptests/mp07/task1.c b/testsuites/mptests/mp07/task1.c
new file mode 100644
index 0000000000..70fc8c73c5
--- /dev/null
+++ b/testsuites/mptests/mp07/task1.c
@@ -0,0 +1,95 @@
+/* Test_task
+ *
+ * This task continuously sends an event to its counterpart on the
+ * other node, and then waits for it to send an event. The copy
+ * running on node one send the first event.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define DOT_COUNT 100
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+
+ Stop_Test = FALSE;
+
+ remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ do {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending first event to remote task" );
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=DOT_COUNT ; count ; count-- ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ if ( status == RTEMS_TIMEOUT ) {
+ puts( "\nTA1 - RTEMS_TIMEOUT .. probably OK if the other node exits" );
+ break;
+ } else
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+ put_dot('.');
+ }
+ puts( "\n*** END OF TEST 7 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp08/init.c b/testsuites/mptests/mp08/init.c
new file mode 100644
index 0000000000..b16585c99c
--- /dev/null
+++ b/testsuites/mptests/mp08/init.c
@@ -0,0 +1,74 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 8 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', '\0' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Sempahore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ }
+
+ puts( "Creating Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (Global)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp08/node1/mp08.doc b/testsuites/mptests/mp08/node1/mp08.doc
new file mode 100644
index 0000000000..3ec09a3335
--- /dev/null
+++ b/testsuites/mptests/mp08/node1/mp08.doc
@@ -0,0 +1,52 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test57
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ sm_create, sm_ident, sm_p, sm_v, sm_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the identification number of
+ a global sempahore.
+
+ h. Verifies that two tasks on different processors can
+ alternate accessing a semaphore.
+
+ i. Verifies operation of sm_delete on global semaphores
+ for both normal and error case.
+
+ j. Verifies Rpc and Process_pkt for packet types Q_SMP, Q_SMV,
+ P_OBJCREATE (semaphore), P_OBJDELETE (semaphore), P_SMDEL_TQ.
+
diff --git a/testsuites/mptests/mp08/node1/mp08.scn b/testsuites/mptests/mp08/node1/mp08.scn
new file mode 100644
index 0000000000..cde263420c
--- /dev/null
+++ b/testsuites/mptests/mp08/node1/mp08.scn
@@ -0,0 +1,11 @@
+*** TEST 8 -- NODE 1 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting SMID of semaphore
+pvpvpvpvpvp.......
+(continued) pvp
+
+Deleting global semaphore
+*** END OF TEST 8 ***
+
diff --git a/testsuites/mptests/mp08/node2/mp08.doc b/testsuites/mptests/mp08/node2/mp08.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp08/node2/mp08.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp08/node2/mp08.scn b/testsuites/mptests/mp08/node2/mp08.scn
new file mode 100644
index 0000000000..5a613f45e5
--- /dev/null
+++ b/testsuites/mptests/mp08/node2/mp08.scn
@@ -0,0 +1,12 @@
+*** TEST 8 -- NODE 2 ***
+Creating Test_task (Global)
+Starting Test_task (Global)
+Deleting initialization task
+Getting SMID of semaphore
+rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+pvpvpvpvpvp.......
+(continued) pvp
+
+Global semaphore deleted
+*** END OF TEST 8 ***
+
diff --git a/testsuites/mptests/mp08/system.h b/testsuites/mptests/mp08/system.h
new file mode 100644
index 0000000000..42a2287af5
--- /dev/null
+++ b/testsuites/mptests/mp08/system.h
@@ -0,0 +1,49 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp08/task1.c b/testsuites/mptests/mp08/task1.c
new file mode 100644
index 0000000000..dbd1526795
--- /dev/null
+++ b/testsuites/mptests/mp08/task1.c
@@ -0,0 +1,89 @@
+/* Test_task
+ *
+ * This task tests global semaphore operations. It verifies that
+ * global semaphore errors are correctly returned.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_semaphore_delete did not return RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+ puts(
+ "rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+ }
+
+ count = 0; /* number of times node 1 releases semaphore */
+ while ( FOREVER ) {
+ put_dot( 'p' );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain"
+ );
+ puts( "\nGlobal semaphore deleted" );
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+ }
+
+ if ( Multiprocessing_configuration.node == 1 && ++count == 1000 ) {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "\nDeleting global semaphore" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete" );
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+ }
+ else {
+ put_dot( 'v' );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release FAILED!!" );
+ }
+ }
+}
diff --git a/testsuites/mptests/mp09/init.c b/testsuites/mptests/mp09/init.c
new file mode 100644
index 0000000000..b6f5195139
--- /dev/null
+++ b/testsuites/mptests/mp09/init.c
@@ -0,0 +1,74 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 9 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+ }
+
+ puts( "Creating Test_task (local)" );
+ status = rtems_task_create(
+ Task_name[Multiprocessing_configuration.node],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp09/node1/mp09.doc b/testsuites/mptests/mp09/node1/mp09.doc
new file mode 100644
index 0000000000..15e05aae58
--- /dev/null
+++ b/testsuites/mptests/mp09/node1/mp09.doc
@@ -0,0 +1,50 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test58
+
+GLOBAL MESSAGE QUEUE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_wkafter, q_create, q_send, q_broadcast, q_urgent, q_receive,
+ q_delete
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can delete itself.
+
+ i. Verifies Rpc and Process_pkt for message queue related packets.
+
+ j. Verifies normal and error paths for global message queue handling.
+
+NOTE: The SLAVE must be started first for this test to successfully run.
diff --git a/testsuites/mptests/mp09/node1/mp09.scn b/testsuites/mptests/mp09/node1/mp09.scn
new file mode 100644
index 0000000000..74cf06904d
--- /dev/null
+++ b/testsuites/mptests/mp09/node1/mp09.scn
@@ -0,0 +1,22 @@
+*** TEST 9 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Test_task (local)
+Starting Test_task (local)
+Deleting initialization task
+Getting QID of message queue
+Receiving message ...
+Received : 123456789012345
+Receiving message ...
+Received : abcdefghijklmno
+Receiving message ...
+Received : ABCDEFGHIJKLMNO
+Receiver delaying for a second
+rtems_message_queue_send: 123456789012345
+Delaying for a second
+rtems_message_queue_urgent: abcdefghijklmno
+Delaying for a second
+rtems_message_queue_broadcast: ABCDEFGHIJKLMNO
+Delaying for a second
+Delaying for 5 seconds
+Deleting Message queue
+*** END OF TEST 9 ***
diff --git a/testsuites/mptests/mp09/node2/mp09.doc b/testsuites/mptests/mp09/node2/mp09.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp09/node2/mp09.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp09/node2/mp09.scn b/testsuites/mptests/mp09/node2/mp09.scn
new file mode 100644
index 0000000000..1bd17cecd9
--- /dev/null
+++ b/testsuites/mptests/mp09/node2/mp09.scn
@@ -0,0 +1,27 @@
+*** TEST 9 -- NODE 2 ***
+Creating Test_task (local)
+Starting Test_task (local)
+Deleting initialization task
+Getting QID of message queue
+rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+rtems_message_queue_send: 123456789012345
+Delaying for a second
+rtems_message_queue_urgent: abcdefghijklmno
+Delaying for a second
+rtems_message_queue_broadcast: ABCDEFGHIJKLMNO
+Delaying for a second
+Receiving message ...
+Received : 123456789012345
+Receiving message ...
+Received : abcdefghijklmno
+Receiving message ...
+Received : ABCDEFGHIJKLMNO
+Receiver delaying for a second
+Flushing remote empty queue
+0 messages were flushed on the remote queue
+Send messages to be flushed from remote queue
+Flushing remote queue
+1 messages were flushed on the remote queue
+Waiting for message queue to be deleted
+Global message queue deleted
+*** END OF TEST 9 ***
diff --git a/testsuites/mptests/mp09/recvmsg.c b/testsuites/mptests/mp09/recvmsg.c
new file mode 100644
index 0000000000..fcdb75e966
--- /dev/null
+++ b/testsuites/mptests/mp09/recvmsg.c
@@ -0,0 +1,47 @@
+/* Receive_messages
+ *
+ * This routine receives and prints three messages.
+ * an error condition.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Receive_messages()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_unsigned32 size;
+ char receive_buffer[16];
+
+ for ( index=1 ; index <=3 ; index++ ) {
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "Received : ");
+ puts( receive_buffer );
+ }
+
+ puts( "Receiver delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+}
diff --git a/testsuites/mptests/mp09/sendmsg.c b/testsuites/mptests/mp09/sendmsg.c
new file mode 100644
index 0000000000..ee555af67c
--- /dev/null
+++ b/testsuites/mptests/mp09/sendmsg.c
@@ -0,0 +1,60 @@
+/* Send_messages
+ *
+ * This routine sends a series of three messages.
+ * an error condition.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Send_messages()
+{
+ rtems_status_code status;
+ rtems_unsigned32 broadcast_count;
+
+ puts_nocr( "rtems_message_queue_send: " );
+ puts( buffer1 );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "rtems_message_queue_urgent: " );
+ puts( buffer2 );
+ status = rtems_message_queue_urgent( Queue_id[ 1 ], (long (*)[4])buffer2, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "rtems_message_queue_broadcast: " );
+ puts( buffer3 );
+ status = rtems_message_queue_broadcast(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer3,
+ 16,
+ &broadcast_count
+ );
+ directive_failed( status, "rtems_message_queue_broadcast" );
+
+ puts( "Delaying for a second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+}
diff --git a/testsuites/mptests/mp09/system.h b/testsuites/mptests/mp09/system.h
new file mode 100644
index 0000000000..3060262e8e
--- /dev/null
+++ b/testsuites/mptests/mp09/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+void Receive_messages( void );
+
+void Send_messages( void );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+extern char buffer1[16];
+extern char buffer2[16];
+extern char buffer3[16];
+extern char buffer4[16];
+
+/* end of include file */
diff --git a/testsuites/mptests/mp09/task1.c b/testsuites/mptests/mp09/task1.c
new file mode 100644
index 0000000000..c4818af23a
--- /dev/null
+++ b/testsuites/mptests/mp09/task1.c
@@ -0,0 +1,109 @@
+/* Test_task
+ *
+ * This task tests global message queue operations. It also generates
+ * an error condition.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+char buffer1[16] = "123456789012345";
+char buffer2[16] = "abcdefghijklmno";
+char buffer3[16] = "ABCDEFGHIJKLMNO";
+char buffer4[16] = "PQRSTUVWXYZ(){}";
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 size;
+ char receive_buffer[16];
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_message_queue_delete"
+ );
+ puts(
+ "rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+
+ Send_messages();
+ Receive_messages();
+
+ puts( "Flushing remote empty queue" );
+ status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
+ directive_failed( status, "rtems_message_queue_flush" );
+ printf( "%d messages were flushed on the remote queue\n", count );
+
+ puts( "Send messages to be flushed from remote queue" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "Flushing remote queue" );
+ status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
+ directive_failed( status, "rtems_message_queue_flush" );
+ printf( "%d messages were flushed on the remote queue\n", count );
+
+ puts( "Waiting for message queue to be deleted" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_message_queue_receive"
+ );
+ puts( "\nGlobal message queue deleted" );
+ }
+ else { /* node == 1 */
+ Receive_messages();
+ Send_messages();
+
+ puts( "Delaying for 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Message queue" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp10/init.c b/testsuites/mptests/mp10/init.c
new file mode 100644
index 0000000000..1413c7b897
--- /dev/null
+++ b/testsuites/mptests/mp10/init.c
@@ -0,0 +1,143 @@
+/* Init
+ *
+ * This routine is the initialization routine for this test program.
+ * Other than creating all objects needed by this test, if this routine
+ * is running on node one, it acquires a global semaphore to
+ * force all other tasks to pend. If running on node two, this task
+ * sleeps for a while, and then deletes two local tasks which are
+ * waiting on a remote message queue or a semaphore.
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 10 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'S', 'A', '3', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 0,
+ RTEMS_GLOBAL | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ } else {
+
+ puts( "Creating Test_task 1 (local)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 1 (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 2 (local)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 2 (local)" );
+ status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 3 (local)" );
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 3 (local)" );
+ status = rtems_task_start( Task_id[ 3 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Sleeping for 1 seconds ..." );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Test_task2" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of Task 2" );
+
+ puts( "Deleting Test_task1" );
+ status = rtems_task_delete( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_delete of Task 1" );
+
+ puts( "Restarting Test_task3" );
+ status = rtems_task_restart( Task_id[ 3 ], 1 );
+ directive_failed( status, "rtems_task_restart of Task 3" );
+
+ }
+ puts( "*** END OF TEST 10 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp10/node1/mp10.doc b/testsuites/mptests/mp10/node1/mp10.doc
new file mode 100644
index 0000000000..d75b176f8d
--- /dev/null
+++ b/testsuites/mptests/mp10/node1/mp10.doc
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test59
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+ h. Verifies that a task can get the task identification number
+ of another task.
+
+ i. Verifies that a task can delete itself or another task.
diff --git a/testsuites/mptests/mp10/node1/mp10.scn b/testsuites/mptests/mp10/node1/mp10.scn
new file mode 100644
index 0000000000..deeafc0a9a
--- /dev/null
+++ b/testsuites/mptests/mp10/node1/mp10.scn
@@ -0,0 +1,4 @@
+*** TEST 10 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Semaphore (Global)
+*** END OF TEST 10 ***
diff --git a/testsuites/mptests/mp10/node2/mp10.doc b/testsuites/mptests/mp10/node2/mp10.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp10/node2/mp10.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp10/node2/mp10.scn b/testsuites/mptests/mp10/node2/mp10.scn
new file mode 100644
index 0000000000..25c07e6202
--- /dev/null
+++ b/testsuites/mptests/mp10/node2/mp10.scn
@@ -0,0 +1,19 @@
+*** TEST 10 -- NODE 2 ***
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Creating Test_task 3 (local)
+Starting Test_task 3 (local)
+Sleeping for 1 seconds ...
+Getting QID of message queue
+Attempting to receive message ...
+Getting SMID of semaphore
+Attempting to acquire semaphore ...
+Getting SMID of semaphore
+Attempting to acquire semaphore ...
+Deleting Test_task2
+Deleting Test_task1
+Restarting Test_task3
+*** END OF TEST 10 ***
+
diff --git a/testsuites/mptests/mp10/system.h b/testsuites/mptests/mp10/system.h
new file mode 100644
index 0000000000..2c6d54d6a8
--- /dev/null
+++ b/testsuites/mptests/mp10/system.h
@@ -0,0 +1,62 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task3(
+ rtems_task_argument restart
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp10/task1.c b/testsuites/mptests/mp10/task1.c
new file mode 100644
index 0000000000..1c72c34b58
--- /dev/null
+++ b/testsuites/mptests/mp10/task1.c
@@ -0,0 +1,52 @@
+/* Test_task1
+ *
+ * This task attempts to receive a message from a global message queue.
+ * It should never actually receive the message.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+)
+{
+ char receive_buffer[16];
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to receive message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+
+}
diff --git a/testsuites/mptests/mp10/task2.c b/testsuites/mptests/mp10/task2.c
new file mode 100644
index 0000000000..560f3946cf
--- /dev/null
+++ b/testsuites/mptests/mp10/task2.c
@@ -0,0 +1,47 @@
+/* Test_task2
+ *
+ * This task attempts to receive control of a global semaphore.
+ * It should never receive control of the semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to acquire semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+}
diff --git a/testsuites/mptests/mp10/task3.c b/testsuites/mptests/mp10/task3.c
new file mode 100644
index 0000000000..905183268e
--- /dev/null
+++ b/testsuites/mptests/mp10/task3.c
@@ -0,0 +1,50 @@
+/* Test_task3
+ *
+ * This task attempts to receive control of a global semaphore.
+ * It should never receive control of the semaphore.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task3( restart )
+rtems_task_argument restart;
+{
+ rtems_status_code status;
+
+ if ( restart == 1 ) {
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ puts( "Getting SMID of semaphore" );
+
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to acquire semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+}
diff --git a/testsuites/mptests/mp11/init.c b/testsuites/mptests/mp11/init.c
new file mode 100644
index 0000000000..7c89be66c2
--- /dev/null
+++ b/testsuites/mptests/mp11/init.c
@@ -0,0 +1,105 @@
+/* Init
+ *
+ * This routine is the initialization and test routine for
+ * this test program. It attempts to create more global
+ * objects than are configured (zero should be configured).
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id junk_id;
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 11 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Attempting to create Test_task (Global)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_task_create" );
+ puts( "rtems_task_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_create"
+ );
+ puts( "rtems_message_queue_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_semaphore_create" );
+ puts( "rtems_semaphore_create correctly returned RTEMS_TOO_MANY" );
+
+ puts( "Attempting to create Partition (Global)" );
+ status = rtems_partition_create(
+ 1,
+ (rtems_unsigned8 *) my_partition,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &junk_id
+ );
+ fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_partition_create" );
+ puts( "rtems_partition_create correctly returned RTEMS_TOO_MANY" );
+ }
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp11/node1/mp11.doc b/testsuites/mptests/mp11/node1/mp11.doc
new file mode 100644
index 0000000000..05113ec6b6
--- /dev/null
+++ b/testsuites/mptests/mp11/node1/mp11.doc
@@ -0,0 +1,42 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test60
+
+TOO MANY GLOBAL OBJECTS ERROR TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_create, q_create, sm_create, pt_create
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that all object create directives correctly return
+ E_TOOMANYGOBJECTS.
diff --git a/testsuites/mptests/mp11/node1/mp11.scn b/testsuites/mptests/mp11/node1/mp11.scn
new file mode 100644
index 0000000000..fb26583852
--- /dev/null
+++ b/testsuites/mptests/mp11/node1/mp11.scn
@@ -0,0 +1,10 @@
+*** TEST 11 -- NODE 1 ***
+Attempting to create Test_task (Global)
+rtems_task_create correctly returned RTEMS_TOO_MANY
+Attempting to create Message Queue (Global)
+rtems_message_queue_create correctly returned RTEMS_TOO_MANY
+Attempting to create Semaphore (Global)
+rtems_semaphore_create correctly returned RTEMS_TOO_MANY
+Attempting to create Partition (Global)
+rtems_partition_create correctly returned RTEMS_TOO_MANY
+*** END OF TEST 11 ***
diff --git a/testsuites/mptests/mp11/node2/mp11.doc b/testsuites/mptests/mp11/node2/mp11.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp11/node2/mp11.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp11/node2/mp11.scn b/testsuites/mptests/mp11/node2/mp11.scn
new file mode 100644
index 0000000000..49bd8a3219
--- /dev/null
+++ b/testsuites/mptests/mp11/node2/mp11.scn
@@ -0,0 +1,2 @@
+*** TEST 11 -- NODE 2 ***
+*** END OF TEST 11 ***
diff --git a/testsuites/mptests/mp11/system.h b/testsuites/mptests/mp11/system.h
new file mode 100644
index 0000000000..39ab88e08c
--- /dev/null
+++ b/testsuites/mptests/mp11/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 0
+#define CONFIGURE_MP_MAXIMUM_PROXIES 0
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp12/init.c b/testsuites/mptests/mp12/init.c
new file mode 100644
index 0000000000..93d472e6e6
--- /dev/null
+++ b/testsuites/mptests/mp12/init.c
@@ -0,0 +1,113 @@
+/* Init
+ *
+ * This routine is the initialization routine and test code for
+ * global partitions. It creates a global partition, obtains and
+ * releases a buffer, and deletes the partition. The partition
+ * is created on node one, and an attempt is made to delete it
+ * by node two.
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Partition_area[ 1024 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *bufaddr;
+
+ printf(
+ "\n\n*** TEST 12 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
+
+ puts( "Got to initialization task" );
+
+ if ( Multiprocessing_configuration.node == 2 ) {
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting ID of remote Partition (Global)" );
+
+ do {
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Partition_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ puts( "Attempting to delete remote Partition (Global)" );
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
+ "rtems_partition_delete"
+ );
+ puts(
+ "rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
+ );
+
+ puts( "Obtaining a buffer from the global partition" );
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &bufaddr );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ printf( "Address returned was : 0x%p\n", bufaddr );
+
+ puts( "Releasing a buffer to the global partition" );
+ status = rtems_partition_return_buffer( Partition_id[ 1 ], bufaddr );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+ else {
+ puts( "Creating Partition (Global)" );
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+
+ puts( "Sleeping for two seconds" );
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Deleting Partition (Global)" );
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ directive_failed( status, "rtems_partition_delete" );
+ }
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp12/node1/mp12.doc b/testsuites/mptests/mp12/node1/mp12.doc
new file mode 100644
index 0000000000..2bb7bc4518
--- /dev/null
+++ b/testsuites/mptests/mp12/node1/mp12.doc
@@ -0,0 +1,52 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test61
+
+GLOBAL PARTITION TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ pt_create, pt_delete, pt_getbuf, pt_retbuf
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies the Shared Memory Locked Queue Driver.
+
+ h. Verifies _Rpc() and _Process_pkt() for the following packet types:
+ P_OBJCREATE (partitions),
+ P_OBJDELETE (partitions),
+ P_PTGETBUF, and
+ P_PTRETBUF.
+
+ i. Verifies normal and error paths (other than E_TOOMANYGOBJECTS)
+ for global partitions.
+
+ j. Verifies that a task can delete itself.
diff --git a/testsuites/mptests/mp12/node1/mp12.scn b/testsuites/mptests/mp12/node1/mp12.scn
new file mode 100644
index 0000000000..605a2c11db
--- /dev/null
+++ b/testsuites/mptests/mp12/node1/mp12.scn
@@ -0,0 +1,6 @@
+*** TEST 12 -- NODE 1 ***
+Got to initialization task
+Creating Partition (Global)
+Sleeping for two seconds
+Deleting Partition (Global)
+*** END OF TEST 12 ***
diff --git a/testsuites/mptests/mp12/node2/mp12.doc b/testsuites/mptests/mp12/node2/mp12.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp12/node2/mp12.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp12/node2/mp12.scn b/testsuites/mptests/mp12/node2/mp12.scn
new file mode 100644
index 0000000000..ad65e9cb32
--- /dev/null
+++ b/testsuites/mptests/mp12/node2/mp12.scn
@@ -0,0 +1,10 @@
+*** TEST 12 -- NODE 2 ***
+Got to initialization task
+Getting ID of remote Partition (Global)
+Attempting to delete remote Partition (Global)
+rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+Obtaining a buffer from the global partition
+>>>>>>> address returned will differ
+Address returned was : 0x200f0000
+Releasing a buffer to the global partition
+*** END OF TEST 12 ***
diff --git a/testsuites/mptests/mp12/system.h b/testsuites/mptests/mp12/system.h
new file mode 100644
index 0000000000..c743c4a415
--- /dev/null
+++ b/testsuites/mptests/mp12/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+#define PT_NAME rtems_build_name( 'P', 'A', 'R', '\0' )
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 1
+#define CONFIGURE_MP_MAXIMUM_PROXIES 0
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#elif ( NODE_NUMBER == 2 )
+#define CONFIGURE_MAXIMUM_PARTITIONS 2
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */
+TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp13/init.c b/testsuites/mptests/mp13/init.c
new file mode 100644
index 0000000000..1e96d5c69e
--- /dev/null
+++ b/testsuites/mptests/mp13/init.c
@@ -0,0 +1,115 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ printf(
+ "\n\n*** TEST 13 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+ }
+
+ puts( "Creating Test_task 1 (local)" );
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 1 (local)" );
+ status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Test_task 2 (local)" );
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Test_task 2 (local)" );
+ status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+ }
+ puts( "Deleting initialization task" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp13/node1/mp13.doc b/testsuites/mptests/mp13/node1/mp13.doc
new file mode 100644
index 0000000000..abf558b443
--- /dev/null
+++ b/testsuites/mptests/mp13/node1/mp13.doc
@@ -0,0 +1,48 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test62
+
+GLOBAL SEMAPHORE TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ sm_create, q_create, sm_p, q_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies the Shared Memory Locked Queue Driver.
+
+ h. Verifies that E_MESSAGETIMEOUT is when waiting on a
+ remote message queue.
+
+ i. Verifies that E_SEMTIMEOUT is when waiting on a remote semaphore.
+
+ j. Verifies that a task can delete itself.
diff --git a/testsuites/mptests/mp13/node1/mp13.scn b/testsuites/mptests/mp13/node1/mp13.scn
new file mode 100644
index 0000000000..d3bd11f65e
--- /dev/null
+++ b/testsuites/mptests/mp13/node1/mp13.scn
@@ -0,0 +1,14 @@
+*** TEST 13 -- NODE 1 ***
+Creating Message Queue (Global)
+Creating Semaphore (Global)
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Getting QID of message queue
+Receiving message ...
+Getting SMID of semaphore
+Releasing semaphore ...
+Getting semaphore ...
+Getting semaphore ...
+*** END OF TEST 13 ***
diff --git a/testsuites/mptests/mp13/node2/mp13.doc b/testsuites/mptests/mp13/node2/mp13.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp13/node2/mp13.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp13/node2/mp13.scn b/testsuites/mptests/mp13/node2/mp13.scn
new file mode 100644
index 0000000000..e9df202a94
--- /dev/null
+++ b/testsuites/mptests/mp13/node2/mp13.scn
@@ -0,0 +1,16 @@
+*** TEST 13 -- NODE 2 ***
+Creating Test_task 1 (local)
+Starting Test_task 1 (local)
+Creating Test_task 2 (local)
+Starting Test_task 2 (local)
+Deleting initialization task
+Getting QID of message queue
+Getting SMID of semaphore
+Getting semaphore ...
+Receiving message ...
+Releasing semaphore ...
+Getting semaphore ...
+rtems_message_queue_receive correctly returned RTEMS_TIMEOUT
+Deleting self
+rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT
+*** END OF TEST 13 ***
diff --git a/testsuites/mptests/mp13/system.h b/testsuites/mptests/mp13/system.h
new file mode 100644
index 0000000000..c3b0924a18
--- /dev/null
+++ b/testsuites/mptests/mp13/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/testsuites/mptests/mp13/task1.c b/testsuites/mptests/mp13/task1.c
new file mode 100644
index 0000000000..6b599f971a
--- /dev/null
+++ b/testsuites/mptests/mp13/task1.c
@@ -0,0 +1,73 @@
+/* Test_task1
+ *
+ * This task attempts to receive a message from a global message queue.
+ * If running on the node on which the queue resides, the wait is
+ * forever, otherwise it times out on a remote message queue.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task1(
+ rtems_task_argument argument
+)
+{
+ char receive_buffer[16];
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ puts( "Getting QID of message queue" );
+
+ do {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "How did I get back from here????" );
+ directive_failed( status, "rtems_message_queue_receive" );
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Receiving message ..." );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 2 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
+ puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
+
+ puts( "Deleting self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/mptests/mp13/task2.c b/testsuites/mptests/mp13/task2.c
new file mode 100644
index 0000000000..a43b64d3cf
--- /dev/null
+++ b/testsuites/mptests/mp13/task2.c
@@ -0,0 +1,106 @@
+/* Test_task2
+ *
+ * This task attempts to receive control of a global semaphore.
+ * If running on the node on which the semaphore resides, the wait is
+ * forever, otherwise it times out on a remote semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "Getting SMID of semaphore" );
+ do {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ } while ( !rtems_is_status_successful( status ) );
+
+ directive_failed( status, "rtems_semaphore_ident" );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Releasing semaphore ..." );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "How did I get back from here????" );
+ directive_failed( status, "rtems_semaphore_obtain" );
+ }
+
+/*
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+*/
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ puts( "Releasing semaphore ..." );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "Getting semaphore ..." );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 2 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_semaphore_obtain"
+ );
+ puts( "rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT" );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/mptests/mp14/delay.c b/testsuites/mptests/mp14/delay.c
new file mode 100644
index 0000000000..7062c4ad21
--- /dev/null
+++ b/testsuites/mptests/mp14/delay.c
@@ -0,0 +1,34 @@
+/* Delayed_send_event
+ *
+ * This routine is a timer service routine which sends an event to a task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id timer_id,
+ void *ignored
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send(
+ Task_id[ rtems_get_index( timer_id ) ],
+ RTEMS_EVENT_16
+ );
+ directive_failed( status, "rtems_event_send" );
+}
diff --git a/testsuites/mptests/mp14/evtask1.c b/testsuites/mptests/mp14/evtask1.c
new file mode 100644
index 0000000000..f14bb9d2fd
--- /dev/null
+++ b/testsuites/mptests/mp14/evtask1.c
@@ -0,0 +1,87 @@
+/* Test_task
+ *
+ * This task either continuously sends events to a remote task, or
+ * continuously receives events sent by a remote task. This decision
+ * is based upon the local node number.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 remote_node;
+ rtems_id remote_tid;
+ rtems_event_set event_out;
+
+ remote_node = ((Multiprocessing_configuration.node == 1) ? 2 : 1);
+
+ puts( "About to go to sleep!" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ puts( "Waking up!" );
+
+ puts_nocr( "Remote task's name is : " );
+ put_name( Task_name[ remote_node ], TRUE );
+
+ puts( "Getting TID of remote task" );
+ while ( FOREVER ) {
+ status = rtems_task_ident(
+ Task_name[ remote_node ],
+ RTEMS_SEARCH_ALL_NODES,
+ &remote_tid
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_task_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Sending events to remote task" );
+ while ( Stop_Test == FALSE ) {
+ for ( count=EVENT_TASK_DOT_COUNT; Stop_Test == FALSE && count; count-- ) {
+ status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+ }
+ put_dot( 'e' );
+ }
+ }
+
+ puts( "Receiving events from remote task" );
+ while ( Stop_Test == FALSE ) {
+ for ( count=EVENT_TASK_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ directive_failed( status, "rtems_event_receive" );
+ }
+ put_dot( 'e' );
+ }
+
+ Exit_test();
+}
diff --git a/testsuites/mptests/mp14/evtmtask.c b/testsuites/mptests/mp14/evtmtask.c
new file mode 100644
index 0000000000..c540eb98fb
--- /dev/null
+++ b/testsuites/mptests/mp14/evtmtask.c
@@ -0,0 +1,65 @@
+/* Delayed_events_task
+ *
+ * This task continuously sends itself events at one tick
+ * intervals.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Delayed_events_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_unsigned32 previous_mode;
+ rtems_status_code status;
+ rtems_event_set events;
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT | RTEMS_TIMESLICE,
+ RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == FALSE && count; count-- ){
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 1,
+ Delayed_send_event,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_reset" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+ directive_failed( status, "rtems_event_receive" );
+ }
+ put_dot('.');
+ }
+
+ Exit_test();
+}
diff --git a/testsuites/mptests/mp14/exit.c b/testsuites/mptests/mp14/exit.c
new file mode 100644
index 0000000000..65fc0df49f
--- /dev/null
+++ b/testsuites/mptests/mp14/exit.c
@@ -0,0 +1,33 @@
+/* Exit_test
+ *
+ * This routine safely stops the test and prints some information
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Exit_test( void )
+{
+ rtems_status_code status;
+ rtems_mode old_mode;
+
+ status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ MPCI_Print_statistics();
+
+ rtems_shutdown_executive( 0 );
+}
diff --git a/testsuites/mptests/mp14/init.c b/testsuites/mptests/mp14/init.c
new file mode 100644
index 0000000000..ac17a1236b
--- /dev/null
+++ b/testsuites/mptests/mp14/init.c
@@ -0,0 +1,191 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_timer_service_routine Stop_Test_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Stop_Test = TRUE;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ printf(
+ "\n\n*** TEST 14 -- NODE %d ***\n",
+ Multiprocessing_configuration.node
+ );
+
+ Stop_Test = FALSE;
+
+ status = rtems_timer_create(
+ rtems_build_name('S', 'T', 'O', 'P'),
+ &timer_id
+ );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_timer_fire_after(
+ timer_id,
+ MAX_LONG_TEST_DURATION * TICKS_PER_SECOND,
+ Stop_Test_TSR,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
+
+ Queue_task_name[ 1 ] = rtems_build_name( 'M', 'T', '1', ' ' );
+ Queue_task_name[ 2 ] = rtems_build_name( 'M', 'T', '2', ' ' );
+
+ Partition_task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+ Partition_task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );
+
+ Semaphore_task_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_task_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', 'R', ' ' );
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ puts( "Creating Semaphore (Global)" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ puts( "Creating Message Queue (Global)" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 1,
+ 16,
+ RTEMS_GLOBAL,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ puts( "Creating Partition (Global)" );
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ (void *)my_partition,
+ 0x8000,
+ 0x3800,
+ RTEMS_GLOBAL,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+ }
+
+ puts( "Creating Event task (Global)" );
+ status = rtems_task_create(
+ Task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Event_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Event task (Global)" );
+ status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Semaphore task (Global)" );
+ status = rtems_task_create(
+ Semaphore_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Semaphore_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Semaphore task (Global)" );
+ status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Message Queue task (Global)" );
+ status = rtems_task_create(
+ Queue_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Queue_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ /* argument is index into Buffers */
+ puts( "Starting Message Queue task (Global)" );
+ status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 );
+ directive_failed( status, "rtems_task_start" );
+
+ puts( "Creating Partition task (Global)" );
+ status = rtems_task_create(
+ Partition_task_name[ Multiprocessing_configuration.node ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_GLOBAL,
+ &Partition_task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ puts( "Starting Partition task (Global)" );
+ status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_ident(
+ RTEMS_SELF,
+ RTEMS_SEARCH_ALL_NODES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_ident" );
+
+ Delayed_events_task( 1 );
+}
diff --git a/testsuites/mptests/mp14/msgtask1.c b/testsuites/mptests/mp14/msgtask1.c
new file mode 100644
index 0000000000..a8a3ddbd60
--- /dev/null
+++ b/testsuites/mptests/mp14/msgtask1.c
@@ -0,0 +1,107 @@
+/* Message_queue_task
+ *
+ * This task continuously sends messages to and receives messages from
+ * a global message queue. The message buffer is viewed as an array
+ * of two sixty-four bit counts which are incremented when a message is
+ * received.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Message_queue_task(
+ rtems_task_argument index
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 count;
+ rtems_unsigned32 yield_count;
+ rtems_unsigned32 *buffer_count;
+ rtems_unsigned32 *overflow_count;
+ rtems_unsigned32 size;
+
+ Msg_buffer[ index ][0] = 0;
+ Msg_buffer[ index ][1] = 0;
+ Msg_buffer[ index ][2] = 0;
+ Msg_buffer[ index ][3] = 0;
+
+ puts( "Getting ID of msg queue" );
+ while ( FOREVER ) {
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Queue_id[ 1 ]
+ );
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_message_queue_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ if ( Multiprocessing_configuration.node == 1 ) {
+ status = rtems_message_queue_send(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+ overflow_count = &Msg_buffer[ index ][0];
+ buffer_count = &Msg_buffer[ index ][1];
+ } else {
+ overflow_count = &Msg_buffer[ index ][2];
+ buffer_count = &Msg_buffer[ index ][3];
+ }
+
+ while ( Stop_Test == FALSE ) {
+ yield_count = 100;
+
+ for ( count=MESSAGE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+
+ if ( *buffer_count == (rtems_unsigned32)0xffffffff ) {
+ *buffer_count = 0;
+ *overflow_count += 1;
+ } else
+ *buffer_count += 1;
+
+ status = rtems_message_queue_send(
+ Queue_id[ 1 ],
+ (long (*)[4])Msg_buffer[ index ],
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ if (Stop_Test == FALSE)
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ yield_count = 100;
+ }
+ }
+ put_dot( 'm' );
+ }
+
+ Exit_test();
+}
diff --git a/testsuites/mptests/mp14/node1/mp14.doc b/testsuites/mptests/mp14/node1/mp14.doc
new file mode 100644
index 0000000000..5ac3f7e47a
--- /dev/null
+++ b/testsuites/mptests/mp14/node1/mp14.doc
@@ -0,0 +1,50 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test63
+
+INTERRUPT SATURATION TEST
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_ident, tm_tick,
+ tm_evwhen, tm_wkafter, i_return, ev_send, ev_receive
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies printing of strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies printing of strings to the CRT on port 2 of the mvme136 board
+ using Write and Writeln and the TTY driver.
+
+ e. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ f. Verifies executive initialization performed correctly.
+
+ g. Verifies the executive trap handler except for the halt function.
+
+ h. Verifies that a task can get the task identification number of itself.
+
+ i. Verifies that a task can get the task identification number
+ of another task.
+
+ j. Verifies that events can be sent to a remote task.
diff --git a/testsuites/mptests/mp14/node1/mp14.scn b/testsuites/mptests/mp14/node1/mp14.scn
new file mode 100644
index 0000000000..f57c4f47b3
--- /dev/null
+++ b/testsuites/mptests/mp14/node1/mp14.scn
@@ -0,0 +1,41 @@
+*** TEST 14 -- NODE 1 ***
+Creating Semaphore (Global)
+Creating Message Queue (Global)
+Creating Partition (Global)
+Creating Event task (Global)
+Starting Event task (Global)
+Creating Semaphore task (Global)
+About to go to sleep!
+Starting Semaphore task (Global)
+Creating Message Queue task (Global)
+Getting SMID of semaphore
+Starting Message Queue task (Global)
+Creating Partition task (Global)
+Getting ID of msg queue
+Starting Partition task (Global)
+Getting ID of partition
+Waking up!
+Remote task's name is : 222
+Getting TID of remote task
+Sending events to remote task
+<stream of following characters>
+
+. - indicates 100 iterations of
+ tm_evafter of 1 tick and rtems_event_receive.
+
+e - indicates that 100
+ events have been sent to the remote task.
+
+m - indicates 100 iterations of
+ rtems_message_queue_send and rtems_message_queue_receive.
+
+p - indicates 100 iterations of
+ rtems_partition_get_buffer and rtems_partition_return_buffer.
+
+s - indicates 100 iterations of
+ rtems_semaphore_obtain and rtems_semaphore_release.
+
+NOTES: 1. The messages could be interspersed.
+ 2. If one of the nodes exits first, the other may report
+ timeout errors on blocking directives.
+
diff --git a/testsuites/mptests/mp14/node2/mp14.doc b/testsuites/mptests/mp14/node2/mp14.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/mptests/mp14/node2/mp14.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/mptests/mp14/node2/mp14.scn b/testsuites/mptests/mp14/node2/mp14.scn
new file mode 100644
index 0000000000..d128c870e9
--- /dev/null
+++ b/testsuites/mptests/mp14/node2/mp14.scn
@@ -0,0 +1,38 @@
+*** TEST 14 -- NODE 2 ***
+Creating Event task (Global)
+Starting Event task (Global)
+Creating Semaphore task (Global)
+About to go to sleep!
+Starting Semaphore task (Global)
+Creating Message Queue task (Global)
+Getting SMID of semaphore
+Starting Message Queue task (Global)
+Creating Partition task (Global)
+Getting ID of msg queue
+Starting Partition task (Global)
+Getting ID of partition
+Waking up!
+Remote task's name is : 111
+Getting TID of remote task
+Receiving events from remote task
+<stream of following characters>
+
+. - indicates 100 iterations of
+ tm_evafter of 1 tick and rtems_event_receive.
+
+e - indicates that 100
+ events have been sent to the remote task.
+
+m - indicates 100 iterations of
+ rtems_message_queue_send and rtems_message_queue_receive.
+
+p - indicates 100 iterations of
+ rtems_partition_get_buffer and rtems_partition_return_buffer.
+
+s - indicates 100 iterations of
+ rtems_semaphore_obtain and rtems_semaphore_release.
+
+NOTES: 1. The messages could be interspersed.
+ 2. If one of the nodes exits first, the other may report
+ timeout errors on blocking directives.
+
diff --git a/testsuites/mptests/mp14/pttask1.c b/testsuites/mptests/mp14/pttask1.c
new file mode 100644
index 0000000000..6aa1c714fc
--- /dev/null
+++ b/testsuites/mptests/mp14/pttask1.c
@@ -0,0 +1,71 @@
+/* Partition_task
+ *
+ * This task continuously gets a buffer from and returns that buffer
+ * to a global partition.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Partition_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 yield_count;
+ void *buffer;
+
+ puts( "Getting ID of partition" );
+ while ( FOREVER ) {
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Partition_id[ 1 ]
+ );
+
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+
+ puts( "rtems_partition_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ yield_count = 100;
+
+ while ( Stop_Test == FALSE ) {
+ for ( count=PARTITION_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer );
+ directive_failed( status, "rtems_partition_get_buffer" );
+
+ status = rtems_partition_return_buffer( Partition_id[ 1 ], buffer );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ if (Stop_Test == FALSE)
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( 1 );
+ directive_failed( status, "rtems_task_wake_after" );
+ yield_count = 100;
+ }
+ }
+ put_dot( 'p' );
+ }
+
+ Exit_test();
+}
diff --git a/testsuites/mptests/mp14/smtask1.c b/testsuites/mptests/mp14/smtask1.c
new file mode 100644
index 0000000000..5bb14ee0da
--- /dev/null
+++ b/testsuites/mptests/mp14/smtask1.c
@@ -0,0 +1,73 @@
+/* Sm_test_task
+ *
+ * This task continuously obtains and releases a global semaphore.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+rtems_task Semaphore_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 yield_count;
+
+ puts( "Getting SMID of semaphore" );
+ while ( FOREVER ) {
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &Semaphore_id[ 1 ]
+ );
+ if ( status == RTEMS_SUCCESSFUL )
+ break;
+ puts( "rtems_semaphore_ident FAILED!!" );
+ rtems_task_wake_after(2);
+ }
+
+ yield_count = 100;
+
+ while ( Stop_Test == FALSE ) {
+
+ for ( count=SEMAPHORE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) {
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ if ( Stop_Test == FALSE )
+ if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ yield_count = 100;
+ }
+ }
+ put_dot( 's' );
+ }
+
+ Exit_test();
+}
diff --git a/testsuites/mptests/mp14/system.h b/testsuites/mptests/mp14/system.h
new file mode 100644
index 0000000000..051727e854
--- /dev/null
+++ b/testsuites/mptests/mp14/system.h
@@ -0,0 +1,115 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_timer_service_routine Delayed_send_event(
+ rtems_id timer_id,
+ void *ignored_address
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Delayed_events_task(
+ rtems_task_argument argument
+);
+
+rtems_task Message_queue_task(
+ rtems_task_argument index
+);
+
+rtems_task Partition_task(
+ rtems_task_argument argument
+);
+
+rtems_task Semaphore_task(
+ rtems_task_argument argument
+);
+
+void Exit_test( void );
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 1
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
+
+#if ( NODE_NUMBER == 1 )
+#define CONFIGURE_MAXIMUM_TIMERS 12
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#elif ( NODE_NUMBER == 2 )
+#define CONFIGURE_MAXIMUM_TIMERS 2
+#endif
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Event_task_id[ 2 ]; /* event task ids */
+
+TEST_EXTERN rtems_id Semaphore_task_id[ 2 ]; /* semaphore task ids */
+TEST_EXTERN rtems_name Semaphore_task_name[ 2 ]; /* semaphore task names */
+
+TEST_EXTERN rtems_id Queue_task_id[ 3 ]; /* message queue task ids */
+TEST_EXTERN rtems_name Queue_task_name[ 3 ]; /* message queue task names */
+
+TEST_EXTERN rtems_id Partition_task_id[ 4 ]; /* partition task ids */
+TEST_EXTERN rtems_name Partition_task_name[ 4 ]; /* partition task names */
+
+TEST_EXTERN rtems_id Partition_id[ 3 ]; /* partition ids */
+TEST_EXTERN rtems_name Partition_name[ 3 ]; /* partition names */
+
+TEST_EXTERN rtems_id Semaphore_id[ 3 ]; /* semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 3 ]; /* semaphore names */
+
+TEST_EXTERN rtems_id Queue_id[ 3 ]; /* message queue ids */
+TEST_EXTERN rtems_name Queue_name[ 3 ]; /* message queue names */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* remote event task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* remote event task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* event timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* event timer names */
+
+TEST_EXTERN rtems_unsigned32 Msg_buffer[ 4 ][ 4 ];
+
+extern rtems_multiprocessing_table Multiprocessing_configuration;
+
+TEST_EXTERN volatile rtems_boolean Stop_Test;
+TEST_EXTERN rtems_id timer_id;
+
+#define EVENT_TASK_DOT_COUNT 100
+#define EVENT_SEND_DOT_COUNT 100
+#define DELAYED_EVENT_DOT_COUNT 1000
+#define MESSAGE_DOT_COUNT 200
+#define PARTITION_DOT_COUNT 200
+#define SEMAPHORE_DOT_COUNT 200
+
+/* end of include file */
diff --git a/testsuites/samples/README b/testsuites/samples/README
new file mode 100644
index 0000000000..10f1c1d7bb
--- /dev/null
+++ b/testsuites/samples/README
@@ -0,0 +1,73 @@
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+# $Id$
+#
+
+This directory contains the RTEMS Sample Application Suite.
+The tests in this directory perform two functions:
+
+ + provide simple examples of applications which can be
+ used as a starting point for your application.
+
+ + help test a new board support package
+
+The hello and ticker applications are useful when first bringing up
+a new board support package. The base_mp test is useful when
+performing initial checkout on a new MPCI layer.
+
+The following describes each of the sample applications:
+
+ base_mp
+
+ This is a very simple two node multiprocessor application. It consists
+ of a single initialization task on each node which print out
+ their respective node numbers and task IDs. This test can be
+ used as a simple test of a new MPCI layer because it minimizes
+ the number of packets sent by RTEMS.
+
+ This is intended as a starting point for custom developed multiprocessor
+ applications.
+
+ base_sp
+
+ This is a simple single processor application which consists of
+ an initialization task which creates another task.
+
+ This is intended as a starting point for custom developed single
+ processor applications.
+
+ cdtest
+
+ A very simple C++ application which demonstrates that it is
+ possible to use C++ contructors and destructors in an RTEMS
+ application. Also does a perfunctory iostream test.
+
+ hello
+
+ This is the RTEMS version of the classic hello world program.
+ It consists of single initialization task which prints out
+ a few messages.
+
+ This test does not include a Clock Tick device driver and can
+ be used to test the startup code of the board support package
+ as well as console output.
+
+ paranoia
+
+ A public domain test of the floating point and math library
+ capabilities of a toolset. It reports discrepancies between
+ actual and expected results. It is a large test.
+
+ ticker
+
+ This is a simple test of the user's Clock Tick device driver.
+ This test has an initialization task create three application
+ tasks which sleep and periodically wake up and print the time.
+
diff --git a/testsuites/samples/base_mp/apptask.c b/testsuites/samples/base_mp/apptask.c
new file mode 100644
index 0000000000..4f0bc72c74
--- /dev/null
+++ b/testsuites/samples/base_mp/apptask.c
@@ -0,0 +1,37 @@
+/* Application_task
+ *
+ * This routine is as an example of an application task which
+ * prints a message including its RTEMS task id. This task
+ * then invokes exit to return to the monitor.
+ *
+ * Input parameters:
+ * node - processor's node number
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Application_task(
+ rtems_task_argument node
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ printf( "This task was invoked with the node argument (%d)\n", node );
+ printf( "This task has the id of 0x%x\n", tid );
+ printf( "*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ exit( 0 );
+}
diff --git a/testsuites/samples/base_mp/init.c b/testsuites/samples/base_mp/init.c
new file mode 100644
index 0000000000..1e73fd0e56
--- /dev/null
+++ b/testsuites/samples/base_mp/init.c
@@ -0,0 +1,46 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the application, the current time might be
+ * set by this task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_name task_name;
+ rtems_id tid;
+ rtems_status_code status;
+
+ printf( "\n\n*** SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ printf( "Creating and starting an application task\n" );
+ task_name = rtems_build_name( 'T', 'A', '1', ' ' );
+ status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
+ status = rtems_task_start(
+ tid,
+ Application_task,
+ Multiprocessing_configuration.node
+ );
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/testsuites/samples/base_mp/node1/base_mp.doc b/testsuites/samples/base_mp/node1/base_mp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/base_mp/node1/base_mp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/base_mp/node1/base_mp.scn b/testsuites/samples/base_mp/node1/base_mp.scn
new file mode 100644
index 0000000000..a2d2f359be
--- /dev/null
+++ b/testsuites/samples/base_mp/node1/base_mp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE MULTIPROCESSOR APPLICATION ***
+Creating and starting an application task
+This task was invoked with the node argument (1)
+This task has the id of 0x10002
+*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
diff --git a/testsuites/samples/base_mp/node2/base_mp.doc b/testsuites/samples/base_mp/node2/base_mp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/base_mp/node2/base_mp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/base_mp/node2/base_mp.scn b/testsuites/samples/base_mp/node2/base_mp.scn
new file mode 100644
index 0000000000..95bc96a808
--- /dev/null
+++ b/testsuites/samples/base_mp/node2/base_mp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE MULTIPROCESSOR APPLICATION ***
+Creating and starting an application task
+This task was invoked with the node argument (2)
+This task has the id of 0x20002
+*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
diff --git a/testsuites/samples/base_mp/system.h b/testsuites/samples/base_mp/system.h
new file mode 100644
index 0000000000..ec07193b72
--- /dev/null
+++ b/testsuites/samples/base_mp/system.h
@@ -0,0 +1,46 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Application_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_MPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+/*
+ * Put the overrides of default configuration parameters here.
+ */
+
+#include <confdefs.h>
+
+/* variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c
new file mode 100644
index 0000000000..03c406f9ff
--- /dev/null
+++ b/testsuites/samples/base_sp/apptask.c
@@ -0,0 +1,38 @@
+/* Application_task
+ *
+ * This routine is as an example of an application task which
+ * prints a message including its RTEMS task id. This task
+ * then invokes exit to return to the monitor.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Application_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+
+ printf( "Application task was invoked with argument (%d) "
+ "and has id of 0x%x\n", argument, tid );
+
+ printf( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ exit( 0 );
+}
diff --git a/testsuites/samples/base_sp/base_sp.doc b/testsuites/samples/base_sp/base_sp.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/base_sp/base_sp.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/base_sp/base_sp.scn b/testsuites/samples/base_sp/base_sp.scn
new file mode 100644
index 0000000000..117ddaecb8
--- /dev/null
+++ b/testsuites/samples/base_sp/base_sp.scn
@@ -0,0 +1,5 @@
+*** SAMPLE SINGLE PROCESSOR APPLICATION ***
+Creating and starting an application task
+Application task was invoked with argument (0) and has id of 0x10002
+*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
+
diff --git a/testsuites/samples/base_sp/init.c b/testsuites/samples/base_sp/init.c
new file mode 100644
index 0000000000..e40d5e008a
--- /dev/null
+++ b/testsuites/samples/base_sp/init.c
@@ -0,0 +1,48 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the application, the current time might be
+ * set by this task.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+#define ARGUMENT 0
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_name task_name;
+ rtems_id tid;
+ rtems_status_code status;
+
+ printf( "\n\n*** SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ printf( "Creating and starting an application task\n" );
+
+ task_name = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
+
+ status = rtems_task_start( tid, Application_task, ARGUMENT );
+
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/testsuites/samples/base_sp/system.h b/testsuites/samples/base_sp/system.h
new file mode 100644
index 0000000000..172ced543d
--- /dev/null
+++ b/testsuites/samples/base_sp/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Application_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/testsuites/samples/cdtest/cdtest.scn b/testsuites/samples/cdtest/cdtest.scn
new file mode 100644
index 0000000000..a832a72372
--- /dev/null
+++ b/testsuites/samples/cdtest/cdtest.scn
@@ -0,0 +1,31 @@
+Hey I'm in base class constructor number 1 for 0x400010cc.
+Hey I'm in base class constructor number 2 for 0x400010d4.
+Hey I'm in derived class constructor number 3 for 0x400010d4.
+
+
+*** CONSTRUCTOR/DESTRUCTOR TEST ***
+Hey I'm in base class constructor number 4 for 0x4009ee08.
+Hey I'm in base class constructor number 5 for 0x4009ee10.
+Hey I'm in base class constructor number 6 for 0x4009ee18.
+Hey I'm in base class constructor number 7 for 0x4009ee20.
+Hey I'm in derived class constructor number 8 for 0x4009ee20.
+Testing a C++ I/O stream
+Hey I'm in derived class destructor number 8 for 0x4009ee20.
+Derived class - Instantiation order 8
+Hey I'm in base class destructor number 7 for 0x4009ee20.
+Instantiation order 8
+Hey I'm in base class destructor number 6 for 0x4009ee18.
+Instantiation order 6
+Hey I'm in base class destructor number 5 for 0x4009ee10.
+Instantiation order 5
+Hey I'm in base class destructor number 4 for 0x4009ee08.
+Instantiation order 5
+*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***
+
+
+Hey I'm in derived class destructor number 3 for 0x400010d4.
+Derived class - Instantiation order 3
+Hey I'm in base class destructor number 2 for 0x400010d4.
+Instantiation order 3
+Hey I'm in base class destructor number 1 for 0x400010cc.
+Instantiation order 1
diff --git a/testsuites/samples/cdtest/init.c b/testsuites/samples/cdtest/init.c
new file mode 100644
index 0000000000..6f3736550c
--- /dev/null
+++ b/testsuites/samples/cdtest/init.c
@@ -0,0 +1,26 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+#include <stdio.h>
diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc
new file mode 100644
index 0000000000..d6b7126e5c
--- /dev/null
+++ b/testsuites/samples/cdtest/main.cc
@@ -0,0 +1,145 @@
+/* main
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1994 by Division Incorporated
+ *
+ * Based in part on OAR works.
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Division Incorporated not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Division Incorporated makes no representations about the
+ * suitability of this software for any purpose.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+#include <iostream.h>
+
+extern "C" {
+extern rtems_task main_task(rtems_task_argument);
+}
+
+static int num_inst = 0;
+
+class A {
+public:
+ A(void)
+ {
+ num_inst++;
+ printf(
+ "Hey I'm in base class constructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+
+ /*
+ * Make sure we use some space
+ */
+
+ string = new char[50];
+ sprintf(string, "Instantiation order %d", num_inst);
+ };
+
+ virtual ~A()
+ {
+ printf(
+ "Hey I'm in base class destructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+ print();
+ num_inst--;
+ };
+
+ virtual void print() { printf("%s\n", string); };
+
+protected:
+ char *string;
+};
+
+class B : public A {
+public:
+ B(void)
+ {
+ num_inst++;
+ printf(
+ "Hey I'm in derived class constructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+
+ /*
+ * Make sure we use some space
+ */
+
+ string = new char[50];
+ sprintf(string, "Instantiation order %d", num_inst);
+ };
+
+ ~B()
+ {
+ printf(
+ "Hey I'm in derived class destructor number %d for %p.\n",
+ num_inst,
+ this
+ );
+ print();
+ num_inst--;
+ };
+
+ void print() { printf("Derived class - %s\n", string); }
+};
+
+
+A foo;
+B foobar;
+
+void
+cdtest(void)
+{
+ A bar, blech, blah;
+ B bleak;
+
+ cout << "Testing a C++ I/O stream" << endl;
+
+ bar = blech;
+}
+
+//
+// main equivalent
+// It can not be called 'main' since the bsp owns that name
+// in many implementations in order to get global constructors
+// run.
+//
+// Ref: c/src/lib/libbsp/hppa1_1/pxfl/startup/bspstart.c
+//
+
+
+rtems_task main_task(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** CONSTRUCTOR/DESTRUCTOR TEST ***\n" );
+
+ cdtest();
+
+ printf( "*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***\n\n\n" );
+
+ exit(0);
+}
diff --git a/testsuites/samples/cdtest/system.h b/testsuites/samples/cdtest/system.h
new file mode 100644
index 0000000000..2400478ed9
--- /dev/null
+++ b/testsuites/samples/cdtest/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task main_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
+#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' )
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/testsuites/samples/hello/hello.doc b/testsuites/samples/hello/hello.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/hello/hello.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/hello/hello.scn b/testsuites/samples/hello/hello.scn
new file mode 100644
index 0000000000..d9e92d81d5
--- /dev/null
+++ b/testsuites/samples/hello/hello.scn
@@ -0,0 +1,3 @@
+*** HELLO WORLD TEST ***
+Hello World
+*** END OF HELLO WORLD TEST ***
diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
new file mode 100644
index 0000000000..c1c25bf045
--- /dev/null
+++ b/testsuites/samples/hello/init.c
@@ -0,0 +1,36 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+#include <stdio.h>
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** HELLO WORLD TEST ***\n" );
+ printf( "Hello World\n" );
+ printf( "*** END OF HELLO WORLD TEST ***\n" );
+ exit( 0 );
+}
diff --git a/testsuites/samples/hello/system.h b/testsuites/samples/hello/system.h
new file mode 100644
index 0000000000..8af4376e0f
--- /dev/null
+++ b/testsuites/samples/hello/system.h
@@ -0,0 +1,35 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c
new file mode 100644
index 0000000000..9c54e0d416
--- /dev/null
+++ b/testsuites/samples/paranoia/init.c
@@ -0,0 +1,39 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+extern int paranoia(int, char **);
+
+char *args[2] = { "paranoia", 0 };
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ printf( "\n\n*** PARANOIA TEST ***\n" );
+ paranoia(1, args);
+ printf( "*** END OF PARANOIA TEST ***\n" );
+ exit( 0 );
+}
diff --git a/testsuites/samples/paranoia/paranoia.c b/testsuites/samples/paranoia/paranoia.c
new file mode 100644
index 0000000000..3b860c3b4a
--- /dev/null
+++ b/testsuites/samples/paranoia/paranoia.c
@@ -0,0 +1,2300 @@
+/*
+ * $Id$
+ *
+ * A C version of Kahan's Floating Point Test "Paranoia"
+ *
+ * Thos Sumner, UCSF, Feb. 1985
+ * David Gay, BTL, Jan. 1986
+ *
+ * This is a rewrite from the Pascal version by
+ *
+ * B. A. Wichmann, 18 Jan. 1985
+ *
+ * (and does NOT exhibit good C programming style).
+ *
+ * Sun May 16 18:21:51 MDT 1993 Jeffrey Wheat (cassidy@cygnus.com)
+ * Removed KR_headers defines, removed ANSI prototyping
+ * Cleaned up and reformated code. Added special CYGNUS
+ * "verbose" mode type messages (-DCYGNUS).
+ * Note: This code is VERY NASTY.
+ *
+ * Adjusted to use Standard C headers 19 Jan. 1992 (dmg);
+ * compile with -DKR_headers or insert
+ * #define KR_headers
+ * at the beginning if you have an old-style C compiler.
+ *
+ * (C) Apr 19 1983 in BASIC version by:
+ * Professor W. M. Kahan,
+ * 567 Evans Hall
+ * Electrical Engineering & Computer Science Dept.
+ * University of California
+ * Berkeley, California 94720
+ * USA
+ *
+ * converted to Pascal by:
+ * B. A. Wichmann
+ * National Physical Laboratory
+ * Teddington Middx
+ * TW11 OLW
+ * UK
+ *
+ * converted to C by:
+ *
+ * David M. Gay and Thos Sumner
+ * AT&T Bell Labs Computer Center, Rm. U-76
+ * 600 Mountain Avenue University of California
+ * Murray Hill, NJ 07974 San Francisco, CA 94143
+ * USA USA
+ *
+ * with simultaneous corrections to the Pascal source (reflected
+ * in the Pascal source available over netlib).
+ * [A couple of bug fixes from dgh = sun!dhough incorporated 31 July 1986.]
+ *
+ * Reports of results on various systems from all the versions
+ * of Paranoia are being collected by Richard Karpinski at the
+ * same address as Thos Sumner. This includes sample outputs,
+ * bug reports, and criticisms.
+ *
+ * You may copy this program freely if you acknowledge its source.
+ * Comments on the Pascal version to NPL, please.
+ *
+ *
+ * The C version catches signals from floating-point exceptions.
+ * If signal(SIGFPE,...) is unavailable in your environment, you may
+ * #define NOSIGNAL to comment out the invocations of signal.
+ *
+ * This source file is too big for some C compilers, but may be split
+ * into pieces. Comments containing "SPLIT" suggest convenient places
+ * for this splitting. At the end of these comments is an "ed script"
+ * (for the UNIX(tm) editor ed) that will do this splitting.
+ *
+ * By #defining SINGLE_PRECISION when you compile this source, you may
+ * obtain a single-precision C version of Paranoia.
+ *
+ * The following is from the introductory commentary from Wichmann's work:
+ *
+ * The BASIC program of Kahan is written in Microsoft BASIC using many
+ * facilities which have no exact analogy in Pascal. The Pascal
+ * version below cannot therefore be exactly the same. Rather than be
+ * a minimal transcription of the BASIC program, the Pascal coding
+ * follows the conventional style of block-structured languages. Hence
+ * the Pascal version could be useful in producing versions in other
+ * structured languages.
+ *
+ * Rather than use identifiers of minimal length (which therefore have
+ * little mnemonic significance), the Pascal version uses meaningful
+ * identifiers as follows [Note: A few changes have been made for C]:
+ *
+ *
+ * BASIC C BASIC C BASIC C
+ *
+ * A J S StickyBit
+ * A1 AInverse J0 NoErrors T
+ * B Radix [Failure] T0 Underflow
+ * B1 BInverse J1 NoErrors T2 ThirtyTwo
+ * B2 RadixD2 [SeriousDefect] T5 OneAndHalf
+ * B9 BMinusU2 J2 NoErrors T7 TwentySeven
+ * C [Defect] T8 TwoForty
+ * C1 CInverse J3 NoErrors U OneUlp
+ * D [Flaw] U0 UnderflowThreshold
+ * D4 FourD K PageNo U1
+ * E0 L Milestone U2
+ * E1 M V
+ * E2 Exp2 N V0
+ * E3 N1 V8
+ * E5 MinSqEr O Zero V9
+ * E6 SqEr O1 One W
+ * E7 MaxSqEr O2 Two X
+ * E8 O3 Three X1
+ * E9 O4 Four X8
+ * F1 MinusOne O5 Five X9 Random1
+ * F2 Half O8 Eight Y
+ * F3 Third O9 Nine Y1
+ * F6 P Precision Y2
+ * F9 Q Y9 Random2
+ * G1 GMult Q8 Z
+ * G2 GDiv Q9 Z0 PseudoZero
+ * G3 GAddSub R Z1
+ * H R1 RMult Z2
+ * H1 HInverse R2 RDiv Z9
+ * I R3 RAddSub
+ * IO NoTrials R4 RSqrt
+ * I3 IEEE R9 Random9
+ *
+ * SqRWrng
+ *
+ * All the variables in BASIC are true variables and in consequence,
+ * the program is more difficult to follow since the "constants" must
+ * be determined (the glossary is very helpful). The Pascal version
+ * uses Real constants, but checks are added to ensure that the values
+ * are correctly converted by the compiler.
+ *
+ * The major textual change to the Pascal version apart from the
+ * identifiersis that named procedures are used, inserting parameters
+ * wherehelpful. New procedures are also introduced. The
+ * correspondence is as follows:
+ *
+ *
+ * BASIC Pascal
+ * lines
+ *
+ * 90- 140 Pause
+ * 170- 250 Instructions
+ * 380- 460 Heading
+ * 480- 670 Characteristics
+ * 690- 870 History
+ * 2940-2950 Random
+ * 3710-3740 NewD
+ * 4040-4080 DoesYequalX
+ * 4090-4110 PrintIfNPositive
+ * 4640-4850 TestPartialUnderflow
+ *
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * To compile this on host using only libm from newlib (and using host libc)
+ * do:
+ * gcc -g -DNEED_REENT -DCYGNUS paranoia.c .../newlib-1.6/newlib/libm.a
+ */
+
+#ifdef NEED_REENT
+#include <reent.h>
+struct _reent libm_reent = _REENT_INIT(libm_reent);
+struct _reent *_impure_ptr = &libm_reent;
+#endif
+
+#ifndef NOSIGNAL
+#include <signal.h>
+#include <setjmp.h>
+#else /* NOSIGNAL */
+#define longjmp(e,v)
+#define setjmp(e) 0
+#define jmp_buf int
+#endif /* NOSIGNAL */
+
+#ifdef SINGLE_PRECISION
+#define FLOAT float
+#define FABS(x) (float)fabs((double)(x))
+#define FLOOR(x) (float)floor((double)(x))
+#define LOG(x) (float)log((double)(x))
+#define POW(x,y) (float)pow((double)(x),(double)(y))
+#define SQRT(x) (float)sqrt((double)(x))
+#else /* !SINGLE_PRECISION */
+#define FLOAT double
+#define FABS(x) fabs(x)
+#define FLOOR(x) floor(x)
+#define LOG(x) log(x)
+#define POW(x,y) pow(x,y)
+#define SQRT(x) sqrt(x)
+#endif /* SINGLE_PRECISION */
+
+jmp_buf ovfl_buf;
+extern double fabs (), floor (), log (), pow (), sqrt ();
+extern void exit ();
+typedef void (*Sig_type) ();
+FLOAT Sign (), Random ();
+extern void BadCond ();
+extern void SqXMinX ();
+extern void TstCond ();
+extern void notify ();
+extern int read ();
+extern void Characteristics ();
+extern void Heading ();
+extern void History ();
+extern void Instructions ();
+extern void IsYeqX ();
+extern void NewD ();
+extern void Pause ();
+extern void PrintIfNPositive ();
+extern void SR3750 ();
+extern void SR3980 ();
+extern void TstPtUf ();
+
+Sig_type sigsave;
+
+#define KEYBOARD 0
+
+FLOAT Radix, BInvrse, RadixD2, BMinusU2;
+
+/*Small floating point constants.*/
+FLOAT Zero = 0.0;
+FLOAT Half = 0.5;
+FLOAT One = 1.0;
+FLOAT Two = 2.0;
+FLOAT Three = 3.0;
+FLOAT Four = 4.0;
+FLOAT Five = 5.0;
+FLOAT Eight = 8.0;
+FLOAT Nine = 9.0;
+FLOAT TwentySeven = 27.0;
+FLOAT ThirtyTwo = 32.0;
+FLOAT TwoForty = 240.0;
+FLOAT MinusOne = -1.0;
+FLOAT OneAndHalf = 1.5;
+
+/*Integer constants*/
+int NoTrials = 20; /*Number of tests for commutativity. */
+#define False 0
+#define True 1
+
+/*
+ * Definitions for declared types
+ * Guard == (Yes, No);
+ * Rounding == (Chopped, Rounded, Other);
+ * Message == packed array [1..40] of char;
+ * Class == (Flaw, Defect, Serious, Failure);
+ */
+#define Yes 1
+#define No 0
+#define Chopped 2
+#define Rounded 1
+#define Other 0
+#define Flaw 3
+#define Defect 2
+#define Serious 1
+#define Failure 0
+typedef int Guard, Rounding, Class;
+typedef char Message;
+
+/* Declarations of Variables */
+int Indx;
+char ch[8];
+FLOAT AInvrse, A1;
+FLOAT C, CInvrse;
+FLOAT D, FourD;
+FLOAT E0, E1, Exp2, E3, MinSqEr;
+FLOAT SqEr, MaxSqEr, E9;
+FLOAT Third;
+FLOAT F6, F9;
+FLOAT H, HInvrse;
+int I;
+FLOAT StickyBit, J;
+FLOAT MyZero;
+FLOAT Precision;
+FLOAT Q, Q9;
+FLOAT R, Random9;
+FLOAT T, Underflow, S;
+FLOAT OneUlp, UfThold, U1, U2;
+FLOAT V, V0, V9;
+FLOAT W;
+FLOAT X, X1, X2, X8, Random1;
+FLOAT Y, Y1, Y2, Random2;
+FLOAT Z, PseudoZero, Z1, Z2, Z9;
+int ErrCnt[4];
+int fpecount;
+int Milestone;
+int PageNo;
+int M, N, N1;
+Guard GMult, GDiv, GAddSub;
+Rounding RMult, RDiv, RAddSub, RSqrt;
+int Break, Done, NotMonot, Monot, Anomaly, IEEE, SqRWrng, UfNGrad;
+
+/* Computed constants.
+ * U1 gap below 1.0, i.e, 1.0 - U1 is next number below 1.0
+ * U2 gap above 1.0, i.e, 1.0 + U2 is next number above 1.0
+ */
+
+int batchmode; /* global batchmode test */
+
+/* program name and version variables and macro */
+char *temp;
+char *program_name;
+char *program_vers;
+
+#ifndef VERSION
+#define VERSION "1.1 [cygnus]"
+#endif /* VERSION */
+
+#define basename(cp) ((temp=(char *)strrchr((cp), '/')) ? temp+1 : (cp))
+
+#ifndef BATCHMODE
+# ifdef CYGNUS
+# define BATCHMODE
+# endif
+#endif
+
+/* floating point exception receiver */
+void
+_sigfpe (x)
+int x;
+{
+ fpecount++;
+ printf ("\n* * * FLOATING-POINT ERROR %d * * *\n", x);
+ fflush (stdout);
+ if (sigsave) {
+#ifndef NOSIGNAL
+ signal (SIGFPE, sigsave);
+#endif /* NOSIGNAL */
+ sigsave = 0;
+ longjmp (ovfl_buf, 1);
+ }
+ exit (1);
+}
+
+#ifdef NOMAIN
+#define main paranoia
+#endif
+
+int
+main (argc, argv)
+int argc;
+char **argv;
+{
+ /* First two assignments use integer right-hand sides. */
+ Zero = 0;
+ One = 1;
+ Two = One + One;
+ Three = Two + One;
+ Four = Three + One;
+ Five = Four + One;
+ Eight = Four + Four;
+ Nine = Three * Three;
+ TwentySeven = Nine * Three;
+ ThirtyTwo = Four * Eight;
+ TwoForty = Four * Five * Three * Four;
+ MinusOne = -One;
+ Half = One / Two;
+ OneAndHalf = One + Half;
+ ErrCnt[Failure] = 0;
+ ErrCnt[Serious] = 0;
+ ErrCnt[Defect] = 0;
+ ErrCnt[Flaw] = 0;
+ PageNo = 1;
+
+#ifdef BATCHMODE
+ batchmode = 1; /* run test in batchmode? */
+#else /* !BATCHMODE */
+ batchmode = 0; /* run test interactively */
+#endif /* BATCHMODE */
+
+ program_name = basename (argv[0]);
+ program_vers = VERSION;
+
+ printf ("%s version %s\n", program_name, program_vers);
+
+ /*=============================================*/
+ Milestone = 0;
+ /*=============================================*/
+#ifndef NOSIGNAL
+ signal (SIGFPE, _sigfpe);
+#endif
+
+ if (!batchmode) {
+ Instructions ();
+ Pause ();
+ Heading ();
+ Instructions ();
+ Pause ();
+ Heading ();
+ Pause ();
+ Characteristics ();
+ Pause ();
+ History ();
+ Pause ();
+ }
+
+ /*=============================================*/
+ Milestone = 7;
+ /*=============================================*/
+ printf ("Program is now RUNNING tests on small integers:\n");
+ TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero)
+ && (One > Zero) && (One + One == Two),
+ "0+0 != 0, 1-1 != 0, 1 <= 0, or 1+1 != 2");
+ Z = -Zero;
+ if (Z != 0.0) {
+ ErrCnt[Failure] = ErrCnt[Failure] + 1;
+ printf ("Comparison alleges that -0.0 is Non-zero!\n");
+ U1 = 0.001;
+ Radix = 1;
+ TstPtUf ();
+ }
+ TstCond (Failure, (Three == Two + One) && (Four == Three + One)
+ && (Four + Two * (-Two) == Zero)
+ && (Four - Three - One == Zero),
+ "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0");
+ TstCond (Failure, (MinusOne == (0 - One))
+ && (MinusOne + One == Zero) && (One + MinusOne == Zero)
+ && (MinusOne + FABS (One) == Zero)
+ && (MinusOne + MinusOne * MinusOne == Zero),
+ "-1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0");
+ TstCond (Failure, Half + MinusOne + Half == Zero,
+ "1/2 + (-1) + 1/2 != 0");
+ /*=============================================*/
+ Milestone = 10;
+ /*=============================================*/
+ TstCond (Failure, (Nine == Three * Three)
+ && (TwentySeven == Nine * Three) && (Eight == Four + Four)
+ && (ThirtyTwo == Eight * Four)
+ && (ThirtyTwo - TwentySeven - Four - One == Zero),
+ "9 != 3*3, 27 != 9*3, 32 != 8*4, or 32-27-4-1 != 0");
+ TstCond (Failure, (Five == Four + One) &&
+ (TwoForty == Four * Five * Three * Four)
+ && (TwoForty / Three - Four * Four * Five == Zero)
+ && (TwoForty / Four - Five * Three * Four == Zero)
+ && (TwoForty / Five - Four * Three * Four == Zero),
+ "5 != 4+1, 240/3 != 80, 240/4 != 60, or 240/5 != 48");
+ if (ErrCnt[Failure] == 0) {
+ printf ("-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.\n");
+ printf ("\n");
+ }
+ printf ("Searching for Radix and Precision.\n");
+ W = One;
+ do {
+ W = W + W;
+ Y = W + One;
+ Z = Y - W;
+ Y = Z - One;
+ }
+ while (MinusOne + FABS (Y) < Zero);
+ /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/
+ Precision = Zero;
+ Y = One;
+ do {
+ Radix = W + Y;
+ Y = Y + Y;
+ Radix = Radix - W;
+ }
+ while (Radix == Zero);
+ if (Radix < Two)
+ Radix = One;
+ printf ("Radix = %f .\n", Radix);
+ if (Radix != 1) {
+ W = One;
+ do {
+ Precision = Precision + One;
+ W = W * Radix;
+ Y = W + One;
+ }
+ while ((Y - W) == One);
+ }
+ /*... now W == Radix^Precision is barely too big to satisfy (W+1)-W == 1
+ ...*/
+ U1 = One / W;
+ U2 = Radix * U1;
+ printf ("Closest relative separation found is U1 = %.7e .\n\n", U1);
+ printf ("Recalculating radix and precision\n ");
+
+ /*save old values*/
+ E0 = Radix;
+ E1 = U1;
+ E9 = U2;
+ E3 = Precision;
+
+ X = Four / Three;
+ Third = X - One;
+ F6 = Half - Third;
+ X = F6 + F6;
+ X = FABS (X - Third);
+ if (X < U2)
+ X = U2;
+
+ /*... now X = (unknown no.) ulps of 1+...*/
+ do {
+ U2 = X;
+ Y = Half * U2 + ThirtyTwo * U2 * U2;
+ Y = One + Y;
+ X = Y - One;
+ }
+ while (!((U2 <= X) || (X <= Zero)));
+
+ /*... now U2 == 1 ulp of 1 + ... */
+ X = Two / Three;
+ F6 = X - Half;
+ Third = F6 + F6;
+ X = Third - Half;
+ X = FABS (X + F6);
+ if (X < U1)
+ X = U1;
+
+ /*... now X == (unknown no.) ulps of 1 -... */
+ do {
+ U1 = X;
+ Y = Half * U1 + ThirtyTwo * U1 * U1;
+ Y = Half - Y;
+ X = Half + Y;
+ Y = Half - X;
+ X = Half + Y;
+ }
+ while (!((U1 <= X) || (X <= Zero)));
+ /*... now U1 == 1 ulp of 1 - ... */
+ if (U1 == E1)
+ printf ("confirms closest relative separation U1 .\n");
+ else
+ printf ("gets better closest relative separation U1 = %.7e .\n", U1);
+ W = One / U1;
+ F9 = (Half - U1) + Half;
+ Radix = FLOOR (0.01 + U2 / U1);
+ if (Radix == E0)
+ printf ("Radix confirmed.\n");
+ else
+ printf ("MYSTERY: recalculated Radix = %.7e .\n", Radix);
+ TstCond (Defect, Radix <= Eight + Eight,
+ "Radix is too big: roundoff problems");
+ TstCond (Flaw, (Radix == Two) || (Radix == 10)
+ || (Radix == One), "Radix is not as good as 2 or 10");
+ /*=============================================*/
+ Milestone = 20;
+ /*=============================================*/
+ TstCond (Failure, F9 - Half < Half,
+ "(1-U1)-1/2 < 1/2 is FALSE, prog. fails?");
+ X = F9;
+ I = 1;
+ Y = X - Half;
+ Z = Y - Half;
+ TstCond (Failure, (X != One)
+ || (Z == Zero), "Comparison is fuzzy,X=1 but X-1/2-1/2 != 0");
+ X = One + U2;
+ I = 0;
+ /*=============================================*/
+ Milestone = 25;
+ /*=============================================*/
+ /*... BMinusU2 = nextafter(Radix, 0) */
+ BMinusU2 = Radix - One;
+ BMinusU2 = (BMinusU2 - U2) + One;
+ /* Purify Integers */
+ if (Radix != One) {
+ X = -TwoForty * LOG (U1) / LOG (Radix);
+ Y = FLOOR (Half + X);
+ if (FABS (X - Y) * Four < One)
+ X = Y;
+ Precision = X / TwoForty;
+ Y = FLOOR (Half + Precision);
+ if (FABS (Precision - Y) * TwoForty < Half)
+ Precision = Y;
+ }
+ if ((Precision != FLOOR (Precision)) || (Radix == One)) {
+ printf ("Precision cannot be characterized by an Integer number\n");
+ printf ("of significant digits but, by itself, this is a minor flaw.\n");
+ }
+ if (Radix == One)
+ printf ("logarithmic encoding has precision characterized solely by U1.\n");
+ else
+ printf ("The number of significant digits of the Radix is %f .\n",
+ Precision);
+ TstCond (Serious, U2 * Nine * Nine * TwoForty < One,
+ "Precision worse than 5 decimal figures ");
+ /*=============================================*/
+ Milestone = 30;
+ /*=============================================*/
+ /* Test for extra-precise subepressions */
+ X = FABS (((Four / Three - One) - One / Four) * Three - One / Four);
+ do {
+ Z2 = X;
+ X = (One + (Half * Z2 + ThirtyTwo * Z2 * Z2)) - One;
+ }
+ while (!((Z2 <= X) || (X <= Zero)));
+ X = Y = Z = FABS ((Three / Four - Two / Three) * Three - One / Four);
+ do {
+ Z1 = Z;
+ Z = (One / Two - ((One / Two - (Half * Z1 + ThirtyTwo * Z1 * Z1))
+ + One / Two)) + One / Two;
+ }
+ while (!((Z1 <= Z) || (Z <= Zero)));
+ do {
+ do {
+ Y1 = Y;
+ Y = (Half - ((Half - (Half * Y1 + ThirtyTwo * Y1 * Y1)) + Half
+ )) + Half;
+ }
+ while (!((Y1 <= Y) || (Y <= Zero)));
+ X1 = X;
+ X = ((Half * X1 + ThirtyTwo * X1 * X1) - F9) + F9;
+ }
+ while (!((X1 <= X) || (X <= Zero)));
+ if ((X1 != Y1) || (X1 != Z1)) {
+ BadCond (Serious, "Disagreements among the values X1, Y1, Z1,\n");
+ printf ("respectively %.7e, %.7e, %.7e,\n", X1, Y1, Z1);
+ printf ("are symptoms of inconsistencies introduced\n");
+ printf ("by extra-precise evaluation of arithmetic subexpressions.\n");
+ notify ("Possibly some part of this");
+ if ((X1 == U1) || (Y1 == U1) || (Z1 == U1))
+ printf (
+ "That feature is not tested further by this program.\n");
+ } else {
+ if ((Z1 != U1) || (Z2 != U2)) {
+ if ((Z1 >= U1) || (Z2 >= U2)) {
+ BadCond (Failure, "");
+ notify ("Precision");
+ printf ("\tU1 = %.7e, Z1 - U1 = %.7e\n", U1, Z1 - U1);
+ printf ("\tU2 = %.7e, Z2 - U2 = %.7e\n", U2, Z2 - U2);
+ } else {
+ if ((Z1 <= Zero) || (Z2 <= Zero)) {
+ printf ("Because of unusual Radix = %f", Radix);
+ printf (", or exact rational arithmetic a result\n");
+ printf ("Z1 = %.7e, or Z2 = %.7e ", Z1, Z2);
+ notify ("of an\nextra-precision");
+ }
+ if (Z1 != Z2 || Z1 > Zero) {
+ X = Z1 / U1;
+ Y = Z2 / U2;
+ if (Y > X)
+ X = Y;
+ Q = -LOG (X);
+ printf ("Some subexpressions appear to be calculated extra\n");
+ printf ("precisely with about %g extra B-digits, i.e.\n",
+ (Q / LOG (Radix)));
+ printf ("roughly %g extra significant decimals.\n",
+ Q / LOG (10.));
+ }
+ printf ("That feature is not tested further by this program.\n");
+ }
+ }
+ }
+ Pause ();
+ /*=============================================*/
+ Milestone = 35;
+ /*=============================================*/
+ if (Radix >= Two) {
+ X = W / (Radix * Radix);
+ Y = X + One;
+ Z = Y - X;
+ T = Z + U2;
+ X = T - Z;
+ TstCond (Failure, X == U2,
+ "Subtraction is not normalized X=Y,X+Z != Y+Z!");
+ if (X == U2)
+ printf (
+ "Subtraction appears to be normalized, as it should be.");
+ }
+ printf ("\nChecking for guard digit in *, /, and -.\n");
+ Y = F9 * One;
+ Z = One * F9;
+ X = F9 - Half;
+ Y = (Y - Half) - X;
+ Z = (Z - Half) - X;
+ X = One + U2;
+ T = X * Radix;
+ R = Radix * X;
+ X = T - Radix;
+ X = X - Radix * U2;
+ T = R - Radix;
+ T = T - Radix * U2;
+ X = X * (Radix - One);
+ T = T * (Radix - One);
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero))
+ GMult = Yes;
+ else {
+ GMult = No;
+ TstCond (Serious, False,
+ "* lacks a Guard Digit, so 1*X != X");
+ }
+ Z = Radix * U2;
+ X = One + Z;
+ Y = FABS ((X + Z) - X * X) - U2;
+ X = One - U2;
+ Z = FABS ((X - U2) - X * X) - U1;
+ TstCond (Failure, (Y <= Zero)
+ && (Z <= Zero), "* gets too many final digits wrong.\n");
+ Y = One - U2;
+ X = One + U2;
+ Z = One / Y;
+ Y = Z - X;
+ X = One / Three;
+ Z = Three / Nine;
+ X = X - Z;
+ T = Nine / TwentySeven;
+ Z = Z - T;
+ TstCond (Defect, X == Zero && Y == Zero && Z == Zero,
+ "Division lacks a Guard Digit, so error can exceed 1 ulp\n\
+or 1/3 and 3/9 and 9/27 may disagree");
+ Y = F9 / One;
+ X = F9 - Half;
+ Y = (Y - Half) - X;
+ X = One + U2;
+ T = X / One;
+ X = T - X;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero))
+ GDiv = Yes;
+ else {
+ GDiv = No;
+ TstCond (Serious, False,
+ "Division lacks a Guard Digit, so X/1 != X");
+ }
+ X = One / (One + U2);
+ Y = X - Half - Half;
+ TstCond (Serious, Y < Zero,
+ "Computed value of 1/1.000..1 >= 1");
+ X = One - U2;
+ Y = One + Radix * U2;
+ Z = X * Radix;
+ T = Y * Radix;
+ R = Z / Radix;
+ StickyBit = T / Radix;
+ X = R - X;
+ Y = StickyBit - Y;
+ TstCond (Failure, X == Zero && Y == Zero,
+ "* and/or / gets too many last digits wrong");
+ Y = One - U1;
+ X = One - F9;
+ Y = One - Y;
+ T = Radix - U2;
+ Z = Radix - BMinusU2;
+ T = Radix - T;
+ if ((X == U1) && (Y == U1) && (Z == U2) && (T == U2))
+ GAddSub = Yes;
+ else {
+ GAddSub = No;
+ TstCond (Serious, False,
+ "- lacks Guard Digit, so cancellation is obscured");
+ }
+ if (F9 != One && F9 - One >= Zero) {
+ BadCond (Serious, "comparison alleges (1-U1) < 1 although\n");
+ printf (" subtraction yields (1-U1) - 1 = 0 , thereby vitiating\n");
+ printf (" such precautions against division by zero as\n");
+ printf (" ... if (X == 1.0) {.....} else {.../(X-1.0)...}\n");
+ }
+ if (GMult == Yes && GDiv == Yes && GAddSub == Yes)
+ printf (
+ " *, /, and - appear to have guard digits, as they should.\n");
+ /*=============================================*/
+ Milestone = 40;
+ /*=============================================*/
+ Pause ();
+ printf ("Checking rounding on multiply, divide and add/subtract.\n");
+ RMult = Other;
+ RDiv = Other;
+ RAddSub = Other;
+ RadixD2 = Radix / Two;
+ A1 = Two;
+ Done = False;
+ do {
+ AInvrse = Radix;
+ do {
+ X = AInvrse;
+ AInvrse = AInvrse / A1;
+ }
+ while (!(FLOOR (AInvrse) != AInvrse));
+ Done = (X == One) || (A1 > Three);
+ if (!Done)
+ A1 = Nine + One;
+ }
+ while (!(Done));
+ if (X == One)
+ A1 = Radix;
+ AInvrse = One / A1;
+ X = A1;
+ Y = AInvrse;
+ Done = False;
+ do {
+ Z = X * Y - Half;
+ TstCond (Failure, Z == Half,
+ "X * (1/X) differs from 1");
+ Done = X == Radix;
+ X = Radix;
+ Y = One / X;
+ }
+ while (!(Done));
+ Y2 = One + U2;
+ Y1 = One - U2;
+ X = OneAndHalf - U2;
+ Y = OneAndHalf + U2;
+ Z = (X - U2) * Y2;
+ T = Y * Y1;
+ Z = Z - X;
+ T = T - X;
+ X = X * Y2;
+ Y = (Y + U2) * Y1;
+ X = X - OneAndHalf;
+ Y = Y - OneAndHalf;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T <= Zero)) {
+ X = (OneAndHalf + U2) * Y2;
+ Y = OneAndHalf - U2 - U2;
+ Z = OneAndHalf + U2 + U2;
+ T = (OneAndHalf - U2) * Y1;
+ X = X - (Z + U2);
+ StickyBit = Y * Y1;
+ S = Z * Y2;
+ T = T - Y;
+ Y = (U2 - Y) + StickyBit;
+ Z = S - (Z + U2 + U2);
+ StickyBit = (Y2 + U2) * Y1;
+ Y1 = Y2 * Y1;
+ StickyBit = StickyBit - Y2;
+ Y1 = Y1 - Half;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)
+ && (StickyBit == Zero) && (Y1 == Half)) {
+ RMult = Rounded;
+ printf ("Multiplication appears to round correctly.\n");
+ } else if ((X + U2 == Zero) && (Y < Zero) && (Z + U2 == Zero)
+ && (T < Zero) && (StickyBit + U2 == Zero)
+ && (Y1 < Half)) {
+ RMult = Chopped;
+ printf ("Multiplication appears to chop.\n");
+ } else
+ printf ("* is neither chopped nor correctly rounded.\n");
+ if ((RMult == Rounded) && (GMult == No))
+ notify ("Multiplication");
+ } else
+ printf ("* is neither chopped nor correctly rounded.\n");
+ /*=============================================*/
+ Milestone = 45;
+ /*=============================================*/
+ Y2 = One + U2;
+ Y1 = One - U2;
+ Z = OneAndHalf + U2 + U2;
+ X = Z / Y2;
+ T = OneAndHalf - U2 - U2;
+ Y = (T - U2) / Y1;
+ Z = (Z + U2) / Y2;
+ X = X - OneAndHalf;
+ Y = Y - T;
+ T = T / Y1;
+ Z = Z - (OneAndHalf + U2);
+ T = (U2 - OneAndHalf) + T;
+ if (!((X > Zero) || (Y > Zero) || (Z > Zero) || (T > Zero))) {
+ X = OneAndHalf / Y2;
+ Y = OneAndHalf - U2;
+ Z = OneAndHalf + U2;
+ X = X - Y;
+ T = OneAndHalf / Y1;
+ Y = Y / Y1;
+ T = T - (Z + U2);
+ Y = Y - Z;
+ Z = Z / Y2;
+ Y1 = (Y2 + U2) / Y2;
+ Z = Z - OneAndHalf;
+ Y2 = Y1 - Y2;
+ Y1 = (F9 - U1) / F9;
+ if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)
+ && (Y2 == Zero) && (Y2 == Zero)
+ && (Y1 - Half == F9 - Half)) {
+ RDiv = Rounded;
+ printf ("Division appears to round correctly.\n");
+ if (GDiv == No)
+ notify ("Division");
+ } else if ((X < Zero) && (Y < Zero) && (Z < Zero) && (T < Zero)
+ && (Y2 < Zero) && (Y1 - Half < F9 - Half)) {
+ RDiv = Chopped;
+ printf ("Division appears to chop.\n");
+ }
+ }
+ if (RDiv == Other)
+ printf ("/ is neither chopped nor correctly rounded.\n");
+ BInvrse = One / Radix;
+ TstCond (Failure, (BInvrse * Radix - Half == Half),
+ "Radix * ( 1 / Radix ) differs from 1");
+ /*=============================================*/
+ Milestone = 50;
+ /*=============================================*/
+ TstCond (Failure, ((F9 + U1) - Half == Half)
+ && ((BMinusU2 + U2) - One == Radix - One),
+ "Incomplete carry-propagation in Addition");
+ X = One - U1 * U1;
+ Y = One + U2 * (One - U2);
+ Z = F9 - Half;
+ X = (X - Half) - Z;
+ Y = Y - One;
+ if ((X == Zero) && (Y == Zero)) {
+ RAddSub = Chopped;
+ printf ("Add/Subtract appears to be chopped.\n");
+ }
+ if (GAddSub == Yes) {
+ X = (Half + U2) * U2;
+ Y = (Half - U2) * U2;
+ X = One + X;
+ Y = One + Y;
+ X = (One + U2) - X;
+ Y = One - Y;
+ if ((X == Zero) && (Y == Zero)) {
+ X = (Half + U2) * U1;
+ Y = (Half - U2) * U1;
+ X = One - X;
+ Y = One - Y;
+ X = F9 - X;
+ Y = One - Y;
+ if ((X == Zero) && (Y == Zero)) {
+ RAddSub = Rounded;
+ printf ("Addition/Subtraction appears to round correctly.\n");
+ if (GAddSub == No)
+ notify ("Add/Subtract");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ } else
+ printf ("Addition/Subtraction neither rounds nor chops.\n");
+ S = One;
+ X = One + Half * (One + Half);
+ Y = (One + U2) * Half;
+ Z = X - Y;
+ T = Y - X;
+ StickyBit = Z + T;
+ if (StickyBit != Zero) {
+ S = Zero;
+ BadCond (Flaw, "(X - Y) + (Y - X) is non zero!\n");
+ }
+ StickyBit = Zero;
+ if ((GMult == Yes) && (GDiv == Yes) && (GAddSub == Yes)
+ && (RMult == Rounded) && (RDiv == Rounded)
+ && (RAddSub == Rounded) && (FLOOR (RadixD2) == RadixD2)) {
+ printf ("Checking for sticky bit.\n");
+ X = (Half + U1) * U2;
+ Y = Half * U2;
+ Z = One + Y;
+ T = One + X;
+ if ((Z - One <= Zero) && (T - One >= U2)) {
+ Z = T + Y;
+ Y = Z - X;
+ if ((Z - T >= U2) && (Y - T == Zero)) {
+ X = (Half + U1) * U1;
+ Y = Half * U1;
+ Z = One - Y;
+ T = One - X;
+ if ((Z - One == Zero) && (T - F9 == Zero)) {
+ Z = (Half - U1) * U1;
+ T = F9 - Z;
+ Q = F9 - Y;
+ if ((T - F9 == Zero) && (F9 - U1 - Q == Zero)) {
+ Z = (One + U2) * OneAndHalf;
+ T = (OneAndHalf + U2) - Z + U2;
+ X = One + Half / Radix;
+ Y = One + Radix * U2;
+ Z = X * Y;
+ if (T == Zero && X + Radix * U2 - Z == Zero) {
+ if (Radix != Two) {
+ X = Two + U2;
+ Y = X / Two;
+ if ((Y - One == Zero))
+ StickyBit = S;
+ } else
+ StickyBit = S;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (StickyBit == One)
+ printf ("Sticky bit apparently used correctly.\n");
+ else
+ printf ("Sticky bit used incorrectly or not at all.\n");
+ TstCond (Flaw, !(GMult == No || GDiv == No || GAddSub == No ||
+ RMult == Other || RDiv == Other || RAddSub == Other),
+ "lack(s) of guard digits or failure(s) to correctly round or chop\n\
+(noted above) count as one flaw in the final tally below");
+ /*=============================================*/
+ Milestone = 60;
+ /*=============================================*/
+ printf ("\n");
+ printf ("Does Multiplication commute? ");
+ printf ("Testing on %d random pairs.\n", NoTrials);
+ Random9 = SQRT (3.0);
+ Random1 = Third;
+ I = 1;
+ do {
+ X = Random ();
+ Y = Random ();
+ Z9 = Y * X;
+ Z = X * Y;
+ Z9 = Z - Z9;
+ I = I + 1;
+ }
+ while (!((I > NoTrials) || (Z9 != Zero)));
+ if (I == NoTrials) {
+ Random1 = One + Half / Three;
+ Random2 = (U2 + U1) + One;
+ Z = Random1 * Random2;
+ Y = Random2 * Random1;
+ Z9 = (One + Half / Three) * ((U2 + U1) + One) - (One + Half /
+ Three) * ((U2 + U1) + One);
+ }
+ if (!((I == NoTrials) || (Z9 == Zero)))
+ BadCond (Defect, "X * Y == Y * X trial fails.\n");
+ else
+ printf (" No failures found in %d integer pairs.\n", NoTrials);
+ /*=============================================*/
+ Milestone = 70;
+ /*=============================================*/
+ printf ("\nRunning test of square root(x).\n");
+ TstCond (Failure, (Zero == SQRT (Zero))
+ && (-Zero == SQRT (-Zero))
+ && (One == SQRT (One)), "Square root of 0.0, -0.0 or 1.0 wrong");
+ MinSqEr = Zero;
+ MaxSqEr = Zero;
+ J = Zero;
+ X = Radix;
+ OneUlp = U2;
+ SqXMinX (Serious);
+ X = BInvrse;
+ OneUlp = BInvrse * U1;
+ SqXMinX (Serious);
+ X = U1;
+ OneUlp = U1 * U1;
+ SqXMinX (Serious);
+ if (J != Zero)
+ Pause ();
+ printf ("Testing if sqrt(X * X) == X for %d Integers X.\n", NoTrials);
+ J = Zero;
+ X = Two;
+ Y = Radix;
+ if ((Radix != One))
+ do {
+ X = Y;
+ Y = Radix * Y;
+ }
+ while (!((Y - X >= NoTrials)));
+ OneUlp = X * U2;
+ I = 1;
+ while (I <= NoTrials) {
+ X = X + One;
+ SqXMinX (Defect);
+ if (J > Zero)
+ break;
+ I = I + 1;
+ }
+ printf ("Test for sqrt monotonicity.\n");
+ I = -1;
+ X = BMinusU2;
+ Y = Radix;
+ Z = Radix + Radix * U2;
+ NotMonot = False;
+ Monot = False;
+ while (!(NotMonot || Monot)) {
+ I = I + 1;
+ X = SQRT (X);
+ Q = SQRT (Y);
+ Z = SQRT (Z);
+ if ((X > Q) || (Q > Z))
+ NotMonot = True;
+ else {
+ Q = FLOOR (Q + Half);
+ if ((I > 0) || (Radix == Q * Q))
+ Monot = True;
+ else if (I > 0) {
+ if (I > 1)
+ Monot = True;
+ else {
+ Y = Y * BInvrse;
+ X = Y - U1;
+ Z = Y + U1;
+ }
+ } else {
+ Y = Q;
+ X = Y - U2;
+ Z = Y + U2;
+ }
+ }
+ }
+ if (Monot)
+ printf ("sqrt has passed a test for Monotonicity.\n");
+ else {
+ BadCond (Defect, "");
+ printf ("sqrt(X) is non-monotonic for X near %.7e .\n", Y);
+ }
+ /*=============================================*/
+ Milestone = 80;
+ /*=============================================*/
+ MinSqEr = MinSqEr + Half;
+ MaxSqEr = MaxSqEr - Half;
+ Y = (SQRT (One + U2) - One) / U2;
+ SqEr = (Y - One) + U2 / Eight;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ SqEr = Y + U2 / Eight;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ Y = ((SQRT (F9) - U2) - (One - U2)) / U1;
+ SqEr = Y + U1 / Eight;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ SqEr = (Y + One) + U1 / Eight;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ OneUlp = U2;
+ X = OneUlp;
+ for (Indx = 1; Indx <= 3; ++Indx) {
+ Y = SQRT ((X + U1 + X) + F9);
+ Y = ((Y - U2) - ((One - U2) + X)) / OneUlp;
+ Z = ((U1 - X) + F9) * Half * X * X / OneUlp;
+ SqEr = (Y + Half) + Z;
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ SqEr = (Y - Half) + Z;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ if (((Indx == 1) || (Indx == 3)))
+ X = OneUlp * Sign (X) * FLOOR (Eight / (Nine * SQRT (OneUlp)));
+ else {
+ OneUlp = U1;
+ X = -OneUlp;
+ }
+ }
+ /*=============================================*/
+ Milestone = 85;
+ /*=============================================*/
+ SqRWrng = False;
+ Anomaly = False;
+ RSqrt = Other; /* ~dgh */
+ if (Radix != One) {
+ printf ("Testing whether sqrt is rounded or chopped.\n");
+ D = FLOOR (Half + POW (Radix, One + Precision - FLOOR (Precision)));
+ /* ... == Radix^(1 + fract) if (Precision == Integer + fract. */
+ X = D / Radix;
+ Y = D / A1;
+ if ((X != FLOOR (X)) || (Y != FLOOR (Y))) {
+ Anomaly = True;
+ } else {
+ X = Zero;
+ Z2 = X;
+ Y = One;
+ Y2 = Y;
+ Z1 = Radix - One;
+ FourD = Four * D;
+ do {
+ if (Y2 > Z2) {
+ Q = Radix;
+ Y1 = Y;
+ do {
+ X1 = FABS (Q + FLOOR (Half - Q / Y1) * Y1);
+ Q = Y1;
+ Y1 = X1;
+ }
+ while (!(X1 <= Zero));
+ if (Q <= One) {
+ Z2 = Y2;
+ Z = Y;
+ }
+ }
+ Y = Y + Two;
+ X = X + Eight;
+ Y2 = Y2 + X;
+ if (Y2 >= FourD)
+ Y2 = Y2 - FourD;
+ }
+ while (!(Y >= D));
+ X8 = FourD - Z2;
+ Q = (X8 + Z * Z) / FourD;
+ X8 = X8 / Eight;
+ if (Q != FLOOR (Q))
+ Anomaly = True;
+ else {
+ Break = False;
+ do {
+ X = Z1 * Z;
+ X = X - FLOOR (X / Radix) * Radix;
+ if (X == One)
+ Break = True;
+ else
+ Z1 = Z1 - One;
+ }
+ while (!(Break || (Z1 <= Zero)));
+ if ((Z1 <= Zero) && (!Break))
+ Anomaly = True;
+ else {
+ if (Z1 > RadixD2)
+ Z1 = Z1 - Radix;
+ do {
+ NewD ();
+ }
+ while (!(U2 * D >= F9));
+ if (D * Radix - D != W - D)
+ Anomaly = True;
+ else {
+ Z2 = D;
+ I = 0;
+ Y = D + (One + Z) * Half;
+ X = D + Z + Q;
+ SR3750 ();
+ Y = D + (One - Z) * Half + D;
+ X = D - Z + D;
+ X = X + Q + X;
+ SR3750 ();
+ NewD ();
+ if (D - Z2 != W - Z2)
+ Anomaly = True;
+ else {
+ Y = (D - Z2) + (Z2 + (One - Z) * Half);
+ X = (D - Z2) + (Z2 - Z + Q);
+ SR3750 ();
+ Y = (One + Z) * Half;
+ X = Q;
+ SR3750 ();
+ if (I == 0)
+ Anomaly = True;
+ }
+ }
+ }
+ }
+ }
+ if ((I == 0) || Anomaly) {
+ BadCond (Failure, "Anomalous arithmetic with Integer < ");
+ printf ("Radix^Precision = %.7e\n", W);
+ printf (" fails test whether sqrt rounds or chops.\n");
+ SqRWrng = True;
+ }
+ }
+ if (!Anomaly) {
+ if (!((MinSqEr < Zero) || (MaxSqEr > Zero))) {
+ RSqrt = Rounded;
+ printf ("Square root appears to be correctly rounded.\n");
+ } else {
+ if ((MaxSqEr + U2 > U2 - Half) || (MinSqEr > Half)
+ || (MinSqEr + Radix < Half))
+ SqRWrng = True;
+ else {
+ RSqrt = Chopped;
+ printf ("Square root appears to be chopped.\n");
+ }
+ }
+ }
+ if (SqRWrng) {
+ printf ("Square root is neither chopped nor correctly rounded.\n");
+ printf ("Observed errors run from %.7e ", MinSqEr - Half);
+ printf ("to %.7e ulps.\n", Half + MaxSqEr);
+ TstCond (Serious, MaxSqEr - MinSqEr < Radix * Radix,
+ "sqrt gets too many last digits wrong");
+ }
+ /*=============================================*/
+ Milestone = 90;
+ /*=============================================*/
+ Pause ();
+ printf ("Testing powers Z^i for small Integers Z and i.\n");
+ N = 0;
+ /* ... test powers of zero. */
+ I = 0;
+ Z = -Zero;
+ M = 3;
+ Break = False;
+ do {
+ X = One;
+ SR3980 ();
+ if (I <= 10) {
+ I = 1023;
+ SR3980 ();
+ }
+ if (Z == MinusOne)
+ Break = True;
+ else {
+ Z = MinusOne;
+ /* .. if(-1)^N is invalid, replace MinusOne by One. */
+ I = -4;
+ }
+ }
+ while (!Break);
+ PrintIfNPositive ();
+ N1 = N;
+ N = 0;
+ Z = A1;
+ M = (int) FLOOR (Two * LOG (W) / LOG (A1));
+ Break = False;
+ do {
+ X = Z;
+ I = 1;
+ SR3980 ();
+ if (Z == AInvrse)
+ Break = True;
+ else
+ Z = AInvrse;
+ }
+ while (!(Break));
+ /*=============================================*/
+ Milestone = 100;
+ /*=============================================*/
+ /* Powers of Radix have been tested, */
+ /* next try a few primes */
+ M = NoTrials;
+ Z = Three;
+ do {
+ X = Z;
+ I = 1;
+ SR3980 ();
+ do {
+ Z = Z + Two;
+ }
+ while (Three * FLOOR (Z / Three) == Z);
+ }
+ while (Z < Eight * Three);
+ if (N > 0) {
+ printf ("Errors like this may invalidate financial calculations\n");
+ printf ("\tinvolving interest rates.\n");
+ }
+ PrintIfNPositive ();
+ N += N1;
+ if (N == 0)
+ printf ("... no discrepancies found.\n");
+ if (N > 0)
+ Pause ();
+ else
+ printf ("\n");
+ /*=============================================*/
+ Milestone = 110;
+ /*=============================================*/
+ printf ("Seeking Underflow thresholds UfThold and E0.\n");
+ D = U1;
+ if (Precision != FLOOR (Precision)) {
+ D = BInvrse;
+ X = Precision;
+ do {
+ D = D * BInvrse;
+ X = X - One;
+ }
+ while (X > Zero);
+ }
+ Y = One;
+ Z = D;
+ /* ... D is power of 1/Radix < 1. */
+ do {
+ C = Y;
+ Y = Z;
+ Z = Y * Y;
+ }
+ while ((Y > Z) && (Z + Z > Z));
+ Y = C;
+ Z = Y * D;
+ do {
+ C = Y;
+ Y = Z;
+ Z = Y * D;
+ }
+ while ((Y > Z) && (Z + Z > Z));
+ if (Radix < Two)
+ HInvrse = Two;
+ else
+ HInvrse = Radix;
+ H = One / HInvrse;
+ /* ... 1/HInvrse == H == Min(1/Radix, 1/2) */
+ CInvrse = One / C;
+ E0 = C;
+ Z = E0 * H;
+ /* ...1/Radix^(BIG Integer) << 1 << CInvrse == 1/C */
+ do {
+ Y = E0;
+ E0 = Z;
+ Z = E0 * H;
+ }
+ while ((E0 > Z) && (Z + Z > Z));
+ UfThold = E0;
+ E1 = Zero;
+ Q = Zero;
+ E9 = U2;
+ S = One + E9;
+ D = C * S;
+ if (D <= C) {
+ E9 = Radix * U2;
+ S = One + E9;
+ D = C * S;
+ if (D <= C) {
+ BadCond (Failure, "multiplication gets too many last digits wrong.\n");
+ Underflow = E0;
+ Y1 = Zero;
+ PseudoZero = Z;
+ Pause ();
+ }
+ } else {
+ Underflow = D;
+ PseudoZero = Underflow * H;
+ UfThold = Zero;
+ do {
+ Y1 = Underflow;
+ Underflow = PseudoZero;
+ if (E1 + E1 <= E1) {
+ Y2 = Underflow * HInvrse;
+ E1 = FABS (Y1 - Y2);
+ Q = Y1;
+ if ((UfThold == Zero) && (Y1 != Y2))
+ UfThold = Y1;
+ }
+ PseudoZero = PseudoZero * H;
+ }
+ while ((Underflow > PseudoZero)
+ && (PseudoZero + PseudoZero > PseudoZero));
+ }
+ /* Comment line 4530 .. 4560 */
+ if (PseudoZero != Zero) {
+ printf ("\n");
+ Z = PseudoZero;
+ /* ... Test PseudoZero for "phoney- zero" violates */
+ /* ... PseudoZero < Underflow or PseudoZero < PseudoZero + PseudoZero
+ ... */
+ if (PseudoZero <= Zero) {
+ BadCond (Failure, "Positive expressions can underflow to an\n");
+ printf ("allegedly negative value\n");
+ printf ("PseudoZero that prints out as: %g .\n", PseudoZero);
+ X = -PseudoZero;
+ if (X <= Zero) {
+ printf ("But -PseudoZero, which should be\n");
+ printf ("positive, isn't; it prints out as %g .\n", X);
+ }
+ } else {
+ BadCond (Flaw, "Underflow can stick at an allegedly positive\n");
+ printf ("value PseudoZero that prints out as %g .\n", PseudoZero);
+ }
+ TstPtUf ();
+ }
+ /*=============================================*/
+ Milestone = 120;
+ /*=============================================*/
+ if (CInvrse * Y > CInvrse * Y1) {
+ S = H * S;
+ E0 = Underflow;
+ }
+ if (!((E1 == Zero) || (E1 == E0))) {
+ BadCond (Defect, "");
+ if (E1 < E0) {
+ printf ("Products underflow at a higher");
+ printf (" threshold than differences.\n");
+ if (PseudoZero == Zero)
+ E0 = E1;
+ } else {
+ printf ("Difference underflows at a higher");
+ printf (" threshold than products.\n");
+ }
+ }
+ printf ("Smallest strictly positive number found is E0 = %g .\n", E0);
+ Z = E0;
+ TstPtUf ();
+ Underflow = E0;
+ if (N == 1)
+ Underflow = Y;
+ I = 4;
+ if (E1 == Zero)
+ I = 3;
+ if (UfThold == Zero)
+ I = I - 2;
+ UfNGrad = True;
+ switch (I) {
+ case 1:
+ UfThold = Underflow;
+ if ((CInvrse * Q) != ((CInvrse * Y) * S)) {
+ UfThold = Y;
+ BadCond (Failure, "Either accuracy deteriorates as numbers\n");
+ printf ("approach a threshold = %.17e\n", UfThold);;
+ printf (" coming down from %.17e\n", C);
+ printf (" or else multiplication gets too many last digits wrong.\n");
+ }
+ Pause ();
+ break;
+
+ case 2:
+ BadCond (Failure, "Underflow confuses Comparison, which alleges that\n");
+ printf ("Q == Y while denying that |Q - Y| == 0; these values\n");
+ printf ("print out as Q = %.17e, Y = %.17e .\n", Q, Y2);
+ printf ("|Q - Y| = %.17e .\n", FABS (Q - Y2));
+ UfThold = Q;
+ break;
+
+ case 3:
+ X = X;
+ break;
+
+ case 4:
+ if ((Q == UfThold) && (E1 == E0)
+ && (FABS (UfThold - E1 / E9) <= E1)) {
+ UfNGrad = False;
+ printf ("Underflow is gradual; it incurs Absolute Error =\n");
+ printf ("(roundoff in UfThold) < E0.\n");
+ Y = E0 * CInvrse;
+ Y = Y * (OneAndHalf + U2);
+ X = CInvrse * (One + U2);
+ Y = Y / X;
+ IEEE = (Y == E0);
+ }
+ }
+ if (UfNGrad) {
+ printf ("\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf)) {
+ printf ("Underflow / UfThold failed!\n");
+ R = H + H;
+ } else
+ R = SQRT (Underflow / UfThold);
+ sigsave = 0;
+ if (R <= H) {
+ Z = R * UfThold;
+ X = Z * (One + R * H * (One + H));
+ } else {
+ Z = UfThold;
+ X = Z * (One + H * H * (One + H));
+ }
+ if (!((X == Z) || (X - Z != Zero))) {
+ BadCond (Flaw, "");
+ printf ("X = %.17e\n\tis not equal to Z = %.17e .\n", X, Z);
+ Z9 = X - Z;
+ printf ("yet X - Z yields %.17e .\n", Z9);
+ printf (" Should this NOT signal Underflow, ");
+ printf ("this is a SERIOUS DEFECT\nthat causes ");
+ printf ("confusion when innocent statements like\n");;
+ printf (" if (X == Z) ... else");
+ printf (" ... (f(X) - f(Z)) / (X - Z) ...\n");
+ printf ("encounter Division by Zero although actually\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ printf ("X / Z fails!\n");
+ else
+ printf ("X / Z = 1 + %g .\n", (X / Z - Half) - Half);
+ sigsave = 0;
+ }
+ }
+ printf ("The Underflow threshold is %.17e, %s\n", UfThold,
+ " below which");
+ printf ("calculation may suffer larger Relative error than ");
+ printf ("merely roundoff.\n");
+ Y2 = U1 * U1;
+ Y = Y2 * Y2;
+ Y2 = Y * U1;
+ if (Y2 <= UfThold) {
+ if (Y > E0) {
+ BadCond (Defect, "");
+ I = 5;
+ } else {
+ BadCond (Serious, "");
+ I = 4;
+ }
+ printf ("Range is too narrow; U1^%d Underflows.\n", I);
+ }
+ /*=============================================*/
+ Milestone = 130;
+ /*=============================================*/
+ Y = -FLOOR (Half - TwoForty * LOG (UfThold) / LOG (HInvrse)) / TwoForty;
+ Y2 = Y + Y;
+ printf ("Since underflow occurs below the threshold\n");
+ printf ("UfThold = (%.17e) ^ (%.17e)\nonly underflow ", HInvrse, Y);
+ printf ("should afflict the expression\n\t(%.17e) ^ (%.17e);\n",
+ HInvrse, Y2);
+ printf ("actually calculating yields:");
+ if (setjmp (ovfl_buf)) {
+ sigsave = 0;
+ BadCond (Serious, "trap on underflow.\n");
+ } else {
+ sigsave = _sigfpe;
+ V9 = POW (HInvrse, Y2);
+ sigsave = 0;
+ printf (" %.17e .\n", V9);
+ if (!((V9 >= Zero) && (V9 <= (Radix + Radix + E9) * UfThold))) {
+ BadCond (Serious, "this is not between 0 and underflow\n");
+ printf (" threshold = %.17e .\n", UfThold);
+ } else if (!(V9 > UfThold * (One + E9)))
+ printf ("This computed value is O.K.\n");
+ else {
+ BadCond (Defect, "this is not between 0 and underflow\n");
+ printf (" threshold = %.17e .\n", UfThold);
+ }
+ }
+ /*=============================================*/
+ Milestone = 140;
+ /*=============================================*/
+ printf ("\n");
+ /* ...calculate Exp2 == exp(2) == 7.389056099... */
+ X = Zero;
+ I = 2;
+ Y = Two * Three;
+ Q = Zero;
+ N = 0;
+ do {
+ Z = X;
+ I = I + 1;
+ Y = Y / (I + I);
+ R = Y + Q;
+ X = Z + R;
+ Q = (Z - X) + R;
+ }
+ while (X > Z);
+ Z = (OneAndHalf + One / Eight) + X / (OneAndHalf * ThirtyTwo);
+ X = Z * Z;
+ Exp2 = X * X;
+ X = F9;
+ Y = X - U1;
+ printf ("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n",
+ Exp2);
+ for (I = 1;;) {
+ Z = X - BInvrse;
+ Z = (X + One) / (Z - (One - BInvrse));
+ Q = POW (X, Z) - Exp2;
+ if (FABS (Q) > TwoForty * U2) {
+ N = 1;
+ V9 = (X - BInvrse) - (One - BInvrse);
+ BadCond (Defect, "Calculated");
+ printf (" %.17e for\n", POW (X, Z));
+ printf ("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z);
+ printf ("\tdiffers from correct value by %.17e .\n", Q);
+ printf ("\tThis much error may spoil financial\n");
+ printf ("\tcalculations involving tiny interest rates.\n");
+ break;
+ } else {
+ Z = (Y - X) * Two + Y;
+ X = Y;
+ Y = Z;
+ Z = One + (X - F9) * (X - F9);
+ if (Z > One && I < NoTrials)
+ I++;
+ else {
+ if (X > One) {
+ if (N == 0)
+ printf ("Accuracy seems adequate.\n");
+ break;
+ } else {
+ X = One + U2;
+ Y = U2 + U2;
+ Y += X;
+ I = 1;
+ }
+ }
+ }
+ }
+ /*=============================================*/
+ Milestone = 150;
+ /*=============================================*/
+ printf ("Testing powers Z^Q at four nearly extreme values.\n");
+ N = 0;
+ Z = A1;
+ Q = FLOOR (Half - LOG (C) / LOG (A1));
+ Break = False;
+ do {
+ X = CInvrse;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ Q = -Q;
+ X = C;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ if (Z < One)
+ Break = True;
+ else
+ Z = AInvrse;
+ }
+ while (!(Break));
+ PrintIfNPositive ();
+ if (N == 0)
+ printf (" ... no discrepancies found.\n");
+ printf ("\n");
+
+ /*=============================================*/
+ Milestone = 160;
+ /*=============================================*/
+ Pause ();
+ printf ("Searching for Overflow threshold:\n");
+ printf ("This may generate an error.\n");
+ Y = -CInvrse;
+ V9 = HInvrse * Y;
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf)) {
+ I = 0;
+ V9 = Y;
+ goto overflow;
+ }
+ do {
+ V = Y;
+ Y = V9;
+ V9 = HInvrse * Y;
+ }
+ while (V9 < Y);
+ I = 1;
+ overflow:
+ sigsave = 0;
+ Z = V9;
+ printf ("Can `Z = -Y' overflow?\n");
+ printf ("Trying it on Y = %.17e .\n", Y);
+ V9 = -Y;
+ V0 = V9;
+ if (V - Y == V + V0)
+ printf ("Seems O.K.\n");
+ else {
+ printf ("finds a ");
+ BadCond (Flaw, "-(-Y) differs from Y.\n");
+ }
+ if (Z != Y) {
+ BadCond (Serious, "");
+ printf ("overflow past %.17e\n\tshrinks to %.17e .\n", Y, Z);
+ }
+ if (I) {
+ Y = V * (HInvrse * U2 - HInvrse);
+ Z = Y + ((One - HInvrse) * U2) * V;
+ if (Z < V0)
+ Y = Z;
+ if (Y < V0)
+ V = Y;
+ if (V0 - V < V0)
+ V = V0;
+ } else {
+ V = Y * (HInvrse * U2 - HInvrse);
+ V = V + ((One - HInvrse) * U2) * Y;
+ }
+ printf ("Overflow threshold is V = %.17e .\n", V);
+ if (I)
+ printf ("Overflow saturates at V0 = %.17e .\n", V0);
+ else
+ printf ("There is no saturation value because \
+the system traps on overflow.\n");
+ V9 = V * One;
+ printf ("No Overflow should be signaled for V * 1 = %.17e\n", V9);
+ V9 = V / One;
+ printf (" nor for V / 1 = %.17e .\n", V9);
+ printf ("Any overflow signal separating this * from the one\n");
+ printf ("above is a DEFECT.\n");
+ /*=============================================*/
+ Milestone = 170;
+ /*=============================================*/
+ if (!(-V < V && -V0 < V0 && -UfThold < V && UfThold < V)) {
+ BadCond (Failure, "Comparisons involving ");
+ printf ("+-%g, +-%g\nand +-%g are confused by Overflow.",
+ V, V0, UfThold);
+ }
+ /*=============================================*/
+ Milestone = 175;
+ /*=============================================*/
+ printf ("\n");
+ for (Indx = 1; Indx <= 3; ++Indx) {
+ switch (Indx) {
+ case 1:
+ Z = UfThold;
+ break;
+ case 2:
+ Z = E0;
+ break;
+ case 3:
+ Z = PseudoZero;
+ break;
+ }
+ if (Z != Zero) {
+ V9 = SQRT (Z);
+ Y = V9 * V9;
+ if (Y / (One - Radix * E9) < Z
+ || Y > (One + Radix * E9) * Z) { /* dgh: + E9 --> * E9 */
+ if (V9 > U1)
+ BadCond (Serious, "");
+ else
+ BadCond (Defect, "");
+ printf ("Comparison alleges that what prints as Z = %.17e\n", Z);
+ printf (" is too far from sqrt(Z) ^ 2 = %.17e .\n", Y);
+ }
+ }
+ }
+ /*=============================================*/
+ Milestone = 180;
+ /*=============================================*/
+ for (Indx = 1; Indx <= 2; ++Indx) {
+ if (Indx == 1)
+ Z = V;
+ else
+ Z = V0;
+ V9 = SQRT (Z);
+ X = (One - Radix * E9) * V9;
+ V9 = V9 * X;
+ if (((V9 < (One - Two * Radix * E9) * Z) || (V9 > Z))) {
+ Y = V9;
+ if (X < W)
+ BadCond (Serious, "");
+ else
+ BadCond (Defect, "");
+ printf ("Comparison alleges that Z = %17e\n", Z);
+ printf (" is too far from sqrt(Z) ^ 2 (%.17e) .\n", Y);
+ }
+ }
+ /*=============================================*/
+ Milestone = 190;
+ /*=============================================*/
+ Pause ();
+ X = UfThold * V;
+ Y = Radix * Radix;
+ if (X * Y < One || X > Y) {
+ if (X * Y < U1 || X > Y / U1)
+ BadCond (Defect, "Badly");
+ else
+ BadCond (Flaw, "");
+
+ printf (" unbalanced range; UfThold * V = %.17e\n\t%s\n",
+ X, "is too far from 1.\n");
+ }
+ /*=============================================*/
+ Milestone = 200;
+ /*=============================================*/
+ for (Indx = 1; Indx <= 5; ++Indx) {
+ X = F9;
+ switch (Indx) {
+ case 2:
+ X = One + U2;
+ break;
+ case 3:
+ X = V;
+ break;
+ case 4:
+ X = UfThold;
+ break;
+ case 5:
+ X = Radix;
+ }
+ Y = X;
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ printf (" X / X traps when X = %g\n", X);
+ else {
+ V9 = (Y / X - Half) - Half;
+ if (V9 == Zero)
+ continue;
+ if (V9 == -U1 && Indx < 5)
+ BadCond (Flaw, "");
+ else
+ BadCond (Serious, "");
+ printf (" X / X differs from 1 when X = %.17e\n", X);
+ printf (" instead, X / X - 1/2 - 1/2 = %.17e .\n", V9);
+ }
+ sigsave = 0;
+ }
+ /*=============================================*/
+ Milestone = 210;
+ /*=============================================*/
+ MyZero = Zero;
+ printf ("\n");
+ printf ("What message and/or values does Division by Zero produce?\n");
+#ifndef BATCHMODE
+ printf ("This can interupt your program. You can ");
+ printf ("skip this part if you wish.\n");
+ printf ("Do you wish to compute 1 / 0? ");
+ fflush (stdout);
+ read (KEYBOARD, ch, 8);
+ if ((ch[0] == 'Y') || (ch[0] == 'y')) {
+#endif /* !BATCHMODE */
+ sigsave = _sigfpe;
+ printf (" Trying to compute 1 / 0 produces ...");
+ if (!setjmp (ovfl_buf))
+ printf (" %.7e .\n", One / MyZero);
+ sigsave = 0;
+#ifndef BATCHMODE
+ } else
+ printf ("O.K.\n");
+ printf ("\nDo you wish to compute 0 / 0? ");
+ fflush (stdout);
+ read (KEYBOARD, ch, 80);
+ if ((ch[0] == 'Y') || (ch[0] == 'y')) {
+#endif /* !BATCHMODE */
+ sigsave = _sigfpe;
+ printf ("\n Trying to compute 0 / 0 produces ...");
+ if (!setjmp (ovfl_buf))
+ printf (" %.7e .\n", Zero / MyZero);
+ sigsave = 0;
+#ifndef BATCHMODE
+ } else
+ printf ("O.K.\n");
+#endif /* !BATCHMODE */
+ /*=============================================*/
+ Milestone = 220;
+ /*=============================================*/
+
+ Pause ();
+ printf ("\n");
+ {
+ static char *msg[] =
+ {
+ "FAILUREs encountered =",
+ "SERIOUS DEFECTs discovered =",
+ "DEFECTs discovered =",
+ "FLAWs discovered ="};
+ int i;
+ for (i = 0; i < 4; i++)
+ if (ErrCnt[i])
+ printf ("The number of %-29s %d.\n",
+ msg[i], ErrCnt[i]);
+ }
+
+ printf ("\n");
+ if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[Defect]
+ + ErrCnt[Flaw]) > 0) {
+ if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[
+ Defect] == 0) && (ErrCnt[Flaw] > 0)) {
+ printf ("The arithmetic diagnosed seems ");
+ printf ("Satisfactory though flawed.\n");
+ }
+ if ((ErrCnt[Failure] + ErrCnt[Serious] == 0)
+ && (ErrCnt[Defect] > 0)) {
+ printf ("The arithmetic diagnosed may be Acceptable\n");
+ printf ("despite inconvenient Defects.\n");
+ }
+ if ((ErrCnt[Failure] + ErrCnt[Serious]) > 0) {
+ printf ("The arithmetic diagnosed has ");
+ printf ("unacceptable Serious Defects.\n");
+ }
+ if (ErrCnt[Failure] > 0) {
+ printf ("Potentially fatal FAILURE may have spoiled this");
+ printf (" program's subsequent diagnoses.\n");
+ }
+ } else {
+
+ printf ("No failures, defects nor flaws have been discovered.\n");
+ if (!((RMult == Rounded) && (RDiv == Rounded)
+ && (RAddSub == Rounded) && (RSqrt == Rounded)))
+ printf ("The arithmetic diagnosed seems Satisfactory.\n");
+ else {
+ if (StickyBit >= One &&
+ (Radix - Two) * (Radix - Nine - One) == Zero) {
+ printf ("Rounding appears to conform to ");
+ printf ("the proposed IEEE standard P");
+ if ((Radix == Two) &&
+ ((Precision - Four * Three * Two) *
+ (Precision - TwentySeven -
+ TwentySeven + One) == Zero))
+ printf ("754");
+ else
+ printf ("854");
+ if (IEEE)
+ printf (".\n");
+ else {
+ printf (",\nexcept for possibly Double Rounding");
+ printf (" during Gradual Underflow.\n");
+ }
+ }
+ printf ("The arithmetic diagnosed appears to be Excellent!\n");
+ }
+ }
+
+ if (fpecount)
+ printf ("\nA total of %d floating point exceptions were registered.\n",
+ fpecount);
+ printf ("END OF TEST.\n");
+ return 0;
+}
+
+FLOAT
+Sign (X)
+ FLOAT X;
+{
+ return X >= 0. ? 1.0 : -1.0;
+}
+
+void
+Pause ()
+{
+#ifndef BATCHMODE
+ char ch[8];
+
+ printf ("\nTo continue, press RETURN");
+ fflush (stdout);
+ read (KEYBOARD, ch, 8);
+#endif /* !BATCHMODE */
+#ifndef CYGNUS
+ printf ("\nDiagnosis resumes after milestone Number %d", Milestone);
+ printf (" Page: %d\n\n", PageNo);
+ ++Milestone;
+ ++PageNo;
+#endif /* !CYGNUS */
+}
+
+void
+TstCond (K, Valid, T)
+ int K, Valid;
+ char *T;
+{
+#ifdef CYGNUS
+ printf ("TEST: %s\n", T);
+#endif /* CYGNUS */
+ if (!Valid) {
+ BadCond (K, T);
+ printf (".\n");
+ }
+#ifdef CYGNUS
+ printf ("PASS: %s\n", T);
+#endif /* CYGNUS */
+}
+
+void
+BadCond (K, T)
+ int K;
+ char *T;
+{
+ static char *msg[] =
+ {"FAILURE", "SERIOUS DEFECT", "DEFECT", "FLAW"};
+
+ ErrCnt[K] = ErrCnt[K] + 1;
+#ifndef CYGNUS
+ printf ("%s: %s", msg[K], T);
+#else
+ printf ("ERROR: Severity: %s: %s", msg[K], T);
+#endif /* CYGNUS */
+}
+
+/*
+ * Random computes
+ * X = (Random1 + Random9)^5
+ * Random1 = X - FLOOR(X) + 0.000005 * X;
+ * and returns the new value of Random1
+*/
+FLOAT
+Random ()
+{
+ FLOAT X, Y;
+
+ X = Random1 + Random9;
+ Y = X * X;
+ Y = Y * Y;
+ X = X * Y;
+ Y = X - FLOOR (X);
+ Random1 = Y + X * 0.000005;
+ return (Random1);
+}
+
+void
+SqXMinX (ErrKind)
+ int ErrKind;
+{
+ FLOAT XA, XB;
+
+ XB = X * BInvrse;
+ XA = X - XB;
+ SqEr = ((SQRT (X * X) - XB) - XA) / OneUlp;
+ if (SqEr != Zero) {
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ J = J + 1.0;
+ BadCond (ErrKind, "\n");
+ printf ("sqrt( %.17e) - %.17e = %.17e\n", X * X, X, OneUlp * SqEr);
+ printf ("\tinstead of correct value 0 .\n");
+ }
+}
+
+void
+NewD ()
+{
+ X = Z1 * Q;
+ X = FLOOR (Half - X / Radix) * Radix + X;
+ Q = (Q - X * Z) / Radix + X * X * (D / Radix);
+ Z = Z - Two * X * D;
+ if (Z <= Zero) {
+ Z = -Z;
+ Z1 = -Z1;
+ }
+ D = Radix * D;
+}
+
+void
+SR3750 ()
+{
+ if (!((X - Radix < Z2 - Radix) || (X - Z2 > W - Z2))) {
+ I = I + 1;
+ X2 = SQRT (X * D);
+ Y2 = (X2 - Z2) - (Y - Z2);
+ X2 = X8 / (Y - Half);
+ X2 = X2 - Half * X2 * X2;
+ SqEr = (Y2 + Half) + (Half - X2);
+ if (SqEr < MinSqEr)
+ MinSqEr = SqEr;
+ SqEr = Y2 - X2;
+ if (SqEr > MaxSqEr)
+ MaxSqEr = SqEr;
+ }
+}
+
+void
+IsYeqX ()
+{
+ if (Y != X) {
+ if (N <= 0) {
+ if (Z == Zero && Q <= Zero)
+ printf ("WARNING: computing\n");
+ else
+ BadCond (Defect, "computing\n");
+ printf ("\t(%.17e) ^ (%.17e)\n", Z, Q);
+ printf ("\tyielded %.17e;\n", Y);
+ printf ("\twhich compared unequal to correct %.17e ;\n",
+ X);
+ printf ("\t\tthey differ by %.17e .\n", Y - X);
+ }
+ N = N + 1; /* ... count discrepancies. */
+ }
+}
+
+void
+SR3980 ()
+{
+ do {
+ Q = (FLOAT) I;
+ Y = POW (Z, Q);
+ IsYeqX ();
+ if (++I > M)
+ break;
+ X = Z * X;
+ }
+ while (X < W);
+}
+
+void
+PrintIfNPositive ()
+{
+ if (N > 0)
+ printf ("Similar discrepancies have occurred %d times.\n", N);
+}
+
+void
+TstPtUf ()
+{
+ N = 0;
+ if (Z != Zero) {
+ printf ("Since comparison denies Z = 0, evaluating ");
+ printf ("(Z + Z) / Z should be safe.\n");
+ sigsave = _sigfpe;
+ if (setjmp (ovfl_buf))
+ goto very_serious;
+ Q9 = (Z + Z) / Z;
+ printf ("What the machine gets for (Z + Z) / Z is %.17e .\n",
+ Q9);
+ if (FABS (Q9 - Two) < Radix * U2) {
+ printf ("This is O.K., provided Over/Underflow");
+ printf (" has NOT just been signaled.\n");
+ } else {
+ if ((Q9 < One) || (Q9 > Two)) {
+ very_serious:
+ N = 1;
+ ErrCnt[Serious] = ErrCnt[Serious] + 1;
+ printf ("This is a VERY SERIOUS DEFECT!\n");
+ } else {
+ N = 1;
+ ErrCnt[Defect] = ErrCnt[Defect] + 1;
+ printf ("This is a DEFECT!\n");
+ }
+ }
+ sigsave = 0;
+ V9 = Z * One;
+ Random1 = V9;
+ V9 = One * Z;
+ Random2 = V9;
+ V9 = Z / One;
+ if ((Z == Random1) && (Z == Random2) && (Z == V9)) {
+ if (N > 0)
+ Pause ();
+ } else {
+ N = 1;
+ BadCond (Defect, "What prints as Z = ");
+ printf ("%.17e\n\tcompares different from ", Z);
+ if (Z != Random1)
+ printf ("Z * 1 = %.17e ", Random1);
+ if (!((Z == Random2)
+ || (Random2 == Random1)))
+ printf ("1 * Z == %g\n", Random2);
+ if (!(Z == V9))
+ printf ("Z / 1 = %.17e\n", V9);
+ if (Random2 != Random1) {
+ ErrCnt[Defect] = ErrCnt[Defect] + 1;
+ BadCond (Defect, "Multiplication does not commute!\n");
+ printf ("\tComparison alleges that 1 * Z = %.17e\n",
+ Random2);
+ printf ("\tdiffers from Z * 1 = %.17e\n", Random1);
+ }
+ Pause ();
+ }
+ }
+}
+
+void
+notify (s)
+ char *s;
+{
+ printf ("%s test appears to be inconsistent...\n", s);
+ printf (" PLEASE NOTIFY KARPINKSI!\n");
+}
+
+void
+msglist (s)
+ char **s;
+{
+ while (*s)
+ printf ("%s\n", *s++);
+}
+
+void
+Instructions ()
+{
+ static char *instr[] =
+ {
+ "Lest this program stop prematurely, i.e. before displaying\n",
+ " `END OF TEST',\n",
+ "try to persuade the computer NOT to terminate execution when an",
+ "error like Over/Underflow or Division by Zero occurs, but rather",
+ "to persevere with a surrogate value after, perhaps, displaying some",
+ "warning. If persuasion avails naught, don't despair but run this",
+ "program anyway to see how many milestones it passes, and then",
+ "amend it to make further progress.\n",
+ "Answer questions with Y, y, N or n (unless otherwise indicated).\n",
+ 0};
+
+ msglist (instr);
+}
+
+void
+Heading ()
+{
+ static char *head[] =
+ {
+ "Users are invited to help debug and augment this program so it will",
+ "cope with unanticipated and newly uncovered arithmetic pathologies.\n",
+ "Please send suggestions and interesting results to",
+ "\tRichard Karpinski",
+ "\tComputer Center U-76",
+ "\tUniversity of California",
+ "\tSan Francisco, CA 94143-0704, USA\n",
+ "In doing so, please include the following information:",
+#ifdef SINGLE_PRECISION
+ "\tPrecision:\tsingle;",
+#else /* !SINGLE_PRECISION */
+ "\tPrecision:\tdouble;",
+#endif /* SINGLE_PRECISION */
+ "\tVersion:\t10 February 1989;",
+ "\tComputer:\n",
+ "\tCompiler:\n",
+ "\tOptimization level:\n",
+ "\tOther relevant compiler options:",
+ 0};
+
+ msglist (head);
+}
+
+void
+Characteristics ()
+{
+ static char *chars[] =
+ {
+ "Running this program should reveal these characteristics:",
+ " Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...",
+ " Precision = number of significant digits carried.",
+ " U2 = Radix/Radix^Precision = One Ulp",
+ "\t(OneUlpnit in the Last Place) of 1.000xxx .",
+ " U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .",
+ " Adequacy of guard digits for Mult., Div. and Subt.",
+ " Whether arithmetic is chopped, correctly rounded, or something else",
+ "\tfor Mult., Div., Add/Subt. and Sqrt.",
+ " Whether a Sticky Bit used correctly for rounding.",
+ " UnderflowThreshold = an underflow threshold.",
+ " E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.",
+ " V = an overflow threshold, roughly.",
+ " V0 tells, roughly, whether Infinity is represented.",
+ " Comparisions are checked for consistency with subtraction",
+ "\tand for contamination with pseudo-zeros.",
+ " Sqrt is tested. Y^X is not tested.",
+ " Extra-precise subexpressions are revealed but NOT YET tested.",
+ " Decimal-Binary conversion is NOT YET tested for accuracy.",
+ 0};
+
+ msglist (chars);
+}
+
+void
+History ()
+{ /* History */
+ /* Converted from Brian Wichmann's Pascal version to C by Thos Sumner,
+ with further massaging by David M. Gay. */
+
+ static char *hist[] =
+ {
+ "The program attempts to discriminate among",
+ " FLAWs, like lack of a sticky bit,",
+ " Serious DEFECTs, like lack of a guard digit, and",
+ " FAILUREs, like 2+2 == 5 .",
+ "Failures may confound subsequent diagnoses.\n",
+ "The diagnostic capabilities of this program go beyond an earlier",
+ "program called `MACHAR', which can be found at the end of the",
+ "book `Software Manual for the Elementary Functions' (1980) by",
+ "W. J. Cody and W. Waite. Although both programs try to discover",
+ "the Radix, Precision and range (over/underflow thresholds)",
+ "of the arithmetic, this program tries to cope with a wider variety",
+ "of pathologies, and to say how well the arithmetic is implemented.",
+ "\nThe program is based upon a conventional radix representation for",
+ "floating-point numbers, but also allows logarithmic encoding",
+ "as used by certain early WANG machines.\n",
+ "BASIC version of this program (C) 1983 by Prof. W. M. Kahan;",
+ "see source comments for more history.",
+ 0};
+
+ msglist (hist);
+}
diff --git a/testsuites/samples/paranoia/paranoia.doc b/testsuites/samples/paranoia/paranoia.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/paranoia/paranoia.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/paranoia/system.h b/testsuites/samples/paranoia/system.h
new file mode 100644
index 0000000000..3837d9d902
--- /dev/null
+++ b/testsuites/samples/paranoia/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
+
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Global_variable; /* example global variable */
+
+/* end of include file */
diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c
new file mode 100644
index 0000000000..d4d1f0176a
--- /dev/null
+++ b/testsuites/samples/ticker/init.c
@@ -0,0 +1,61 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ puts( "\n\n*** CLOCK TICK TEST ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
+ );
+ status = rtems_task_create(
+ Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
+ );
+ status = rtems_task_create(
+ Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
+ );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
+ status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
+ status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
+
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/testsuites/samples/ticker/system.h b/testsuites/samples/ticker/system.h
new file mode 100644
index 0000000000..51a9c082df
--- /dev/null
+++ b/testsuites/samples/ticker/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c
new file mode 100644
index 0000000000..ec7c6baa2e
--- /dev/null
+++ b/testsuites/samples/ticker/tasks.c
@@ -0,0 +1,44 @@
+/* Test_task
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument unused
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ task_index = task_number( tid );
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ if ( time.second >= 35 ) {
+ puts( "*** END OF CLOCK TICK TEST ***" );
+ exit( 0 );
+ }
+ put_name( Task_name[ task_index ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+ status = rtems_task_wake_after( task_index * 5 * TICKS_PER_SECOND );
+ }
+}
diff --git a/testsuites/samples/ticker/ticker.doc b/testsuites/samples/ticker/ticker.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/samples/ticker/ticker.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/samples/ticker/ticker.scn b/testsuites/samples/ticker/ticker.scn
new file mode 100644
index 0000000000..35952e6170
--- /dev/null
+++ b/testsuites/samples/ticker/ticker.scn
@@ -0,0 +1,16 @@
+*** CLOCK TICK TEST ***
+TA1 - tm_get - 09:00:00 12/31/1988
+TA2 - tm_get - 09:00:00 12/31/1988
+TA3 - tm_get - 09:00:00 12/31/1988
+TA1 - tm_get - 09:00:05 12/31/1988
+TA1 - tm_get - 09:00:10 12/31/1988
+TA2 - tm_get - 09:00:10 12/31/1988
+TA1 - tm_get - 09:00:15 12/31/1988
+TA3 - tm_get - 09:00:15 12/31/1988
+TA1 - tm_get - 09:00:20 12/31/1988
+TA2 - tm_get - 09:00:20 12/31/1988
+TA1 - tm_get - 09:00:25 12/31/1988
+TA1 - tm_get - 09:00:30 12/31/1988
+TA2 - tm_get - 09:00:30 12/31/1988
+TA3 - tm_get - 09:00:30 12/31/1988
+*** END OF CLOCK TICK TEST ***
diff --git a/testsuites/sptests/README b/testsuites/sptests/README
new file mode 100644
index 0000000000..2843063c31
--- /dev/null
+++ b/testsuites/sptests/README
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Single Processor Test Suite.
+The tests in this directory provide near complete (98%+) test
+coverage of the non-multiprocessor code in RTEMS.
+
+
diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c
new file mode 100644
index 0000000000..894cc3e890
--- /dev/null
+++ b/testsuites/sptests/sp01/init.c
@@ -0,0 +1,86 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 1 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_INTERRUPT_LEVEL(31),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 3,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp01/sp01.doc b/testsuites/sptests/sp01/sp01.doc
new file mode 100644
index 0000000000..79b1aaaa87
--- /dev/null
+++ b/testsuites/sptests/sp01/sp01.doc
@@ -0,0 +1,43 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test1
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ tm_set, tm_get, tm_wkafter
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ c. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ d. Verifies interrupt handler can handle a task switch from an interrupt
+ as specified with the i_return directive.
+
+ e. Verifies executive initialization performed correctly.
+
+ f. Verifies the executive trap handler except for the halt function.
+
+ g. Verifies that a task can get the task identification number of itself.
+
+output:
+ "TA1" is printed once every 5 seconds. "TA2" is printed once
+ every 10 seconds. "TA3" is printed once every 15 seconds.
diff --git a/testsuites/sptests/sp01/sp01.scn b/testsuites/sptests/sp01/sp01.scn
new file mode 100644
index 0000000000..d4fcc4561b
--- /dev/null
+++ b/testsuites/sptests/sp01/sp01.scn
@@ -0,0 +1,18 @@
+*** TEST 1 ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA2 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:25 12/31/1988
+TA3 - rtems_clock_get - 09:00:30 12/31/1988
+TA1 - rtems_clock_get - 09:00:30 12/31/1988
+TA2 - rtems_clock_get - 09:00:30 12/31/1988
+*** END OF TEST 1 ***
+
+NOTE: The order of the prints at each time interval is irrelevant.
diff --git a/testsuites/sptests/sp01/system.h b/testsuites/sptests/sp01/system.h
new file mode 100644
index 0000000000..08e71c4bb8
--- /dev/null
+++ b/testsuites/sptests/sp01/system.h
@@ -0,0 +1,43 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp01/task1.c b/testsuites/sptests/sp01/task1.c
new file mode 100644
index 0000000000..b45d3abce6
--- /dev/null
+++ b/testsuites/sptests/sp01/task1.c
@@ -0,0 +1,50 @@
+/* Task_1_through_3
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 35 ) {
+ puts( "*** END OF TEST 1 ***" );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/testsuites/sptests/sp02/init.c b/testsuites/sptests/sp02/init.c
new file mode 100644
index 0000000000..b7be2dd680
--- /dev/null
+++ b/testsuites/sptests/sp02/init.c
@@ -0,0 +1,152 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 2 ***" );
+
+ Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' );
+
+ status = rtems_task_create(
+ Preempt_task_name,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Preempt_task_id
+ );
+ directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
+
+ status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
+ directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
+
+ puts( "INIT - rtems_task_wake_after - yielding processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ puts( "INIT - suspending TA2 while middle task on a ready chain" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ status = rtems_task_delete( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_delete of TA1" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp02/preempt.c b/testsuites/sptests/sp02/preempt.c
new file mode 100644
index 0000000000..7e93f7af57
--- /dev/null
+++ b/testsuites/sptests/sp02/preempt.c
@@ -0,0 +1,32 @@
+/* Preempt_task
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "PREEMPT - rtems_task_delete - deleting self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_PREEMPT" );
+}
diff --git a/testsuites/sptests/sp02/sp02.doc b/testsuites/sptests/sp02/sp02.doc
new file mode 100644
index 0000000000..00f2e0e7b3
--- /dev/null
+++ b/testsuites/sptests/sp02/sp02.doc
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test2
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ t_delete, tm_wkafter, t_setpri, t_suspend
+
+concepts:
+
+ a. Verifies that a task can delete another task and also delete itself.
+
+ b. Verifies that memory is freed back to the heap correctly.
+
+ c. Verifies that TCBs are freed back to the inactive chain correctly.
+
+ d. Verifies that a task can get the task identification number of
+ another task.
+
+ e. Verifies the _Set_state routine where the task is not READY.
+
+ f. Verifies the break statement in the _Block_activate routine.
+
+ g. Verifies the while loop in the _Prev_tcb routine.
diff --git a/testsuites/sptests/sp02/sp02.scn b/testsuites/sptests/sp02/sp02.scn
new file mode 100644
index 0000000000..d3f3d61cd1
--- /dev/null
+++ b/testsuites/sptests/sp02/sp02.scn
@@ -0,0 +1,15 @@
+*** TEST 2 ***
+INIT - rtems_task_wake_after - yielding processor
+PREEMPT - rtems_task_delete - deleting self
+INIT - suspending TA2 while middle task on a ready chain
+TA1 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 minute
+TA3 - rtems_task_wake_after - sleep 5 seconds
+TA1 - rtems_task_ident - tid of TA2 (0x08010007)
+TA1 - rtems_task_ident - tid of TA3 (0x08010008)
+TA1 - rtems_task_set_priority - set TA3's priority to 2
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_delete - delete TA2
+TA1 - rtems_task_wake_after - sleep for 5 seconds
+TA3 - rtems_task_delete - delete self
+*** END OF TEST 2 ***
diff --git a/testsuites/sptests/sp02/system.h b/testsuites/sptests/sp02/system.h
new file mode 100644
index 0000000000..95cae6c0e2
--- /dev/null
+++ b/testsuites/sptests/sp02/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Preempt_task_id; /* preempt task id */
+TEST_EXTERN rtems_name Preempt_task_name; /* preempt task name */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp02/task1.c b/testsuites/sptests/sp02/task1.c
new file mode 100644
index 0000000000..0f6152dbb2
--- /dev/null
+++ b/testsuites/sptests/sp02/task1.c
@@ -0,0 +1,66 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid2;
+ rtems_id tid3;
+ rtems_status_code status;
+ rtems_unsigned32 previous_priority;
+
+ puts( "TA1 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 );
+ directive_failed( status, "rtems_task_ident of TA2" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA2 (0x%.8x)\n", tid2 );
+
+ status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 );
+ directive_failed( status, "rtems_task_ident of TA3" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA3 (0x%.8x)\n", tid3 );
+
+ status = rtems_task_set_priority( tid3, 2, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" );
+
+
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( tid2 );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_delete - delete TA2" );
+ status = rtems_task_delete( tid2 );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp02/task2.c b/testsuites/sptests/sp02/task2.c
new file mode 100644
index 0000000000..f39cc5b9fc
--- /dev/null
+++ b/testsuites/sptests/sp02/task2.c
@@ -0,0 +1,34 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It sleeps for 1 minute but
+ * does not expect to wake up. Task 1 should suspend then delete it
+ * so that it appears to never wake up.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
+ status = rtems_task_wake_after( 60*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA2" );
+}
diff --git a/testsuites/sptests/sp02/task3.c b/testsuites/sptests/sp02/task3.c
new file mode 100644
index 0000000000..89bda38b7c
--- /dev/null
+++ b/testsuites/sptests/sp02/task3.c
@@ -0,0 +1,37 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply sleeps for 5 seconds
+ * and then deletes itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA3" );
+
+ puts( "TA3 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA3" );
+}
diff --git a/testsuites/sptests/sp03/init.c b/testsuites/sptests/sp03/init.c
new file mode 100644
index 0000000000..0de15f689c
--- /dev/null
+++ b/testsuites/sptests/sp03/init.c
@@ -0,0 +1,67 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 3 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp03/sp03.doc b/testsuites/sptests/sp03/sp03.doc
new file mode 100644
index 0000000000..96d6d41d94
--- /dev/null
+++ b/testsuites/sptests/sp03/sp03.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test3
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter,
+ tm_wkwhen, tm_set, tm_get
+
+concepts:
+
+ a. Verifies conversion routines - _Utd_to_etd and _Etd_to_utd
diff --git a/testsuites/sptests/sp03/sp03.scn b/testsuites/sptests/sp03/sp03.scn
new file mode 100644
index 0000000000..496982e86f
--- /dev/null
+++ b/testsuites/sptests/sp03/sp03.scn
@@ -0,0 +1,26 @@
+*** TEST 3 ***
+TA1 sets clock: 09:15:00 12/31/1988
+TA1 going to sleep: 09:15:00 12/31/1988
+TA2 09:15:01 12/31/1988
+TA2 09:15:02 12/31/1988
+TA2 09:15:03 12/31/1988
+TA2 09:15:04 12/31/1988
+TA1 awakened: 09:15:05 12/31/1988
+TA1 going to sleep: 09:15:05 12/31/1988
+TA2 09:15:05 12/31/1988
+TA2 09:15:06 12/31/1988
+TA2 09:15:07 12/31/1988
+TA2 09:15:08 12/31/1988
+TA2 09:15:09 12/31/1988
+TA1 awakened: 09:15:10 12/31/1988
+TA1 going to sleep: 09:15:10 12/31/1988
+TA2 09:15:10 12/31/1988
+TA2 09:15:11 12/31/1988
+TA2 09:15:12 12/31/1988
+TA2 09:15:13 12/31/1988
+TA2 09:15:14 12/31/1988
+TA1 awakened: 09:15:15 12/31/1988
+TA1 going to sleep: 09:15:15 12/31/1988
+TA2 09:15:15 12/31/1988
+TA2 09:15:16 12/31/1988
+*** END OF TEST 3 ***
diff --git a/testsuites/sptests/sp03/system.h b/testsuites/sptests/sp03/system.h
new file mode 100644
index 0000000000..d83cb3f510
--- /dev/null
+++ b/testsuites/sptests/sp03/system.h
@@ -0,0 +1,47 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp03/task1.c b/testsuites/sptests/sp03/task1.c
new file mode 100644
index 0000000000..e59fad45cf
--- /dev/null
+++ b/testsuites/sptests/sp03/task1.c
@@ -0,0 +1,59 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the capability to
+ * set and read the executives calender and clock.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " sets clock: ", &time, "\n" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " going to sleep: ", &time, "\n" );
+
+ time.second += 5;
+ time.minute += ( time.second / 60 );
+ time.second %= 60;
+ time.hour += ( time.minute / 60 );
+ time.minute %= 60;
+ time.hour %= 24;
+
+ status = rtems_task_wake_when( &time );
+ directive_failed( status, "rtems_task_wake_when" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( " awakened: ", &time, "\n" );
+ }
+}
diff --git a/testsuites/sptests/sp03/task2.c b/testsuites/sptests/sp03/task2.c
new file mode 100644
index 0000000000..8838c1db67
--- /dev/null
+++ b/testsuites/sptests/sp03/task2.c
@@ -0,0 +1,46 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It repeatedly gets the system time
+ * and date, converts it to printable form, and print it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ while( FOREVER ) {
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 17 ) {
+ puts( "*** END OF TEST 3 *** " );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ 2 ], FALSE );
+ print_time( " ", &time, "\n" );
+ }
+}
diff --git a/testsuites/sptests/sp04/init.c b/testsuites/sptests/sp04/init.c
new file mode 100644
index 0000000000..c14e0ce918
--- /dev/null
+++ b/testsuites/sptests/sp04/init.c
@@ -0,0 +1,110 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_extensions_table Extensions = {
+ NULL, /* task create user extension */
+ NULL, /* task start user extension */
+ NULL, /* task restart user extension */
+ NULL, /* task delete user extension */
+ Task_switch, /* task switch user extension */
+ NULL, /* task begin user extension */
+ NULL, /* task exitted user extension */
+ NULL /* fatal error user extension */
+};
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ puts( "\n\n*** TEST 4 ***" );
+ build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
+
+ status = rtems_extension_create(
+ Extension_name[ 1 ],
+ &Extensions,
+ &Extension_id[ 1 ]
+ );
+ directive_failed( status, "rtems_extension_create" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Run_count[ 1 ] = 0;
+ Run_count[ 2 ] = 0;
+ Run_count[ 3 ] = 0;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_TIMESLICE,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp04/sp04.doc b/testsuites/sptests/sp04/sp04.doc
new file mode 100644
index 0000000000..6f6355abfa
--- /dev/null
+++ b/testsuites/sptests/sp04/sp04.doc
@@ -0,0 +1,38 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test4
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_set, tm_get, ev_receive, t_mode
+
+concepts:
+
+ a. Verifies timeslicing ( all tasks are in timeslice mode ).
+
+ b. Verifies the tswitch user extension.
+
+ c. Verifies the no preemption mode.
+
+ d. Verifies time-slice gets reset even if only one task ready.
+
+output:
+ The task name and the current time are printed out each time that a new
+ task is being dispatched. The configured timeslice is 100 ticks
+ ( 1 second ); therefore, a task name and the time are printed once
+ every second. After each task runs 3 times, task 1 changes its mode to
+ no preempt and runs for about 6 seconds and then changes its mode back to
+ preempt mode.
diff --git a/testsuites/sptests/sp04/sp04.scn b/testsuites/sptests/sp04/sp04.scn
new file mode 100644
index 0000000000..f104c0c482
--- /dev/null
+++ b/testsuites/sptests/sp04/sp04.scn
@@ -0,0 +1,24 @@
+*** TEST 4 ***
+TA1 - 09:15:00 12/31/1988
+TA1 - rtems_task_suspend - on Task 2
+TA1 - rtems_task_suspend - on Task 3
+TA1 - killing time
+TA1 - rtems_task_resume - on Task 2
+TA1 - rtems_task_resume - on Task 3
+TA2 - 09:15:03 12/31/1988
+TA3 - 09:15:04 12/31/1988
+TA1 - 09:15:05 12/31/1988
+TA2 - 09:15:06 12/31/1988
+TA3 - 09:15:07 12/31/1988
+TA1 - 09:15:08 12/31/1988
+TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT
+TA1 - 09:15:09 12/31/1988
+TA1 - 09:15:10 12/31/1988
+TA1 - 09:15:11 12/31/1988
+TA1 - 09:15:12 12/31/1988
+TA1 - 09:15:13 12/31/1988
+TA1 - 09:15:14 12/31/1988
+TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT
+TA2 - 09:15:15 12/31/1988
+TA3 - 09:15:16 12/31/1988
+*** END OF TEST 4 ***
diff --git a/testsuites/sptests/sp04/system.h b/testsuites/sptests/sp04/system.h
new file mode 100644
index 0000000000..27e716a701
--- /dev/null
+++ b/testsuites/sptests/sp04/system.h
@@ -0,0 +1,65 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+void Task_switch(
+ rtems_tcb *unused,
+ rtems_tcb *heir
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Extension_id[ 4 ];
+TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
+
+/* array of task run counts */
+TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ];
+
+/* end of include file */
diff --git a/testsuites/sptests/sp04/task1.c b/testsuites/sptests/sp04/task1.c
new file mode 100644
index 0000000000..671ae5483d
--- /dev/null
+++ b/testsuites/sptests/sp04/task1.c
@@ -0,0 +1,103 @@
+/* Task_1
+ *
+ * This test serves as a test task. It verifies timeslicing activities
+ * and tswitch extension processing.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 seconds;
+ rtems_unsigned32 old_seconds;
+ rtems_mode previous_mode;
+ rtems_time_of_day time;
+ rtems_status_code status;
+ rtems_unsigned32 start_time;
+ rtems_unsigned32 end_time;
+
+ puts( "TA1 - rtems_task_suspend - on Task 2" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_suspend - on Task 3" );
+ status = rtems_task_suspend( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_suspend of TA3" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start_time );
+ directive_failed( status, "rtems_clock_get" );
+
+ puts( "TA1 - killing time" );
+
+ for ( ; ; ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end_time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( end_time > (start_time + 2) )
+ break;
+ }
+
+ puts( "TA1 - rtems_task_resume - on Task 2" );
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_resume of TA2" );
+
+ puts( "TA1 - rtems_task_resume - on Task 3" );
+ status = rtems_task_resume( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_resume of TA3" );
+
+ while ( FOREVER ) {
+ if ( Run_count[ 1 ] == 3 ) {
+ puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ old_seconds = time.second;
+
+ for ( seconds = 0 ; seconds < 6 ; ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second != old_seconds ) {
+ old_seconds = time.second;
+ seconds++;
+ print_time( "TA1 - ", &time, "\n" );
+ }
+ }
+
+ puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" );
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ while ( FOREVER );
+ }
+ }
+}
diff --git a/testsuites/sptests/sp04/task2.c b/testsuites/sptests/sp04/task2.c
new file mode 100644
index 0000000000..7574e7dc9f
--- /dev/null
+++ b/testsuites/sptests/sp04/task2.c
@@ -0,0 +1,29 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It is just a CPU bound task
+ * requiring timesliced operation.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ while( FOREVER );
+}
diff --git a/testsuites/sptests/sp04/task3.c b/testsuites/sptests/sp04/task3.c
new file mode 100644
index 0000000000..a0e7482944
--- /dev/null
+++ b/testsuites/sptests/sp04/task3.c
@@ -0,0 +1,29 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It is just a CPU bound task
+ * requiring timesliced operation.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ while( FOREVER );
+}
diff --git a/testsuites/sptests/sp04/tswitch.c b/testsuites/sptests/sp04/tswitch.c
new file mode 100644
index 0000000000..766d09e93b
--- /dev/null
+++ b/testsuites/sptests/sp04/tswitch.c
@@ -0,0 +1,59 @@
+/* Task_switch
+ *
+ * This routine is the tswitch user extension. It determines which
+ * task is being switched to and displays a message indicating the
+ * time and date that it gained control.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * heir - pointer to heir TCB
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_switch(
+ rtems_tcb *unused,
+ rtems_tcb *heir
+)
+{
+ rtems_unsigned32 index;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ index = task_number( heir->Object.id );
+
+ switch( index ) {
+ case 1:
+ case 2:
+ case 3:
+ Run_count[ index ] += 1;
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ index ], FALSE );
+ print_time( "- ", &time, "\n" );
+
+ if ( time.second >= 16 ) {
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+ }
+ break;
+
+ case 0:
+ default:
+ break;
+ }
+}
diff --git a/testsuites/sptests/sp05/init.c b/testsuites/sptests/sp05/init.c
new file mode 100644
index 0000000000..5c1dbc0236
--- /dev/null
+++ b/testsuites/sptests/sp05/init.c
@@ -0,0 +1,81 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 5 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp05/sp05.doc b/testsuites/sptests/sp05/sp05.doc
new file mode 100644
index 0000000000..583381a37e
--- /dev/null
+++ b/testsuites/sptests/sp05/sp05.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test5
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident
+ tm_wkafter, t_suspend, t_resume
+
+concepts:
+
+ a. Verifies that a task can be suspended and resumed.
+
+ b. Verifies that a task can suspend itself.
diff --git a/testsuites/sptests/sp05/sp05.scn b/testsuites/sptests/sp05/sp05.scn
new file mode 100644
index 0000000000..40afb2d4b2
--- /dev/null
+++ b/testsuites/sptests/sp05/sp05.scn
@@ -0,0 +1,47 @@
+*** TEST 5 ***
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_suspend - suspend self
+TA3 - rtems_task_suspend - suspend self
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA3 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA3
+TA1 - rtems_task_resume - resume TA2
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 second
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_resume - resume TA3
+*** END OF TEST 5 ***
diff --git a/testsuites/sptests/sp05/system.h b/testsuites/sptests/sp05/system.h
new file mode 100644
index 0000000000..8f8cd58a30
--- /dev/null
+++ b/testsuites/sptests/sp05/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp05/task1.c b/testsuites/sptests/sp05/task1.c
new file mode 100644
index 0000000000..9b99586fc8
--- /dev/null
+++ b/testsuites/sptests/sp05/task1.c
@@ -0,0 +1,78 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies that tasks can
+ * be suspended and resumed.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: The rtems_task_suspend() directives fail on the first iteration.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid2;
+ rtems_id tid3;
+ rtems_unsigned32 pass;
+ rtems_status_code status;
+
+ status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 );
+ directive_failed( status, "rtems_task_ident of TA2" );
+
+ status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 );
+ directive_failed( status, "rtems_task_ident of TA3" );
+
+ for ( pass=1 ; pass <= 3 ; pass++ ) {
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA1" );
+
+ puts( "TA1 - rtems_task_suspend - suspend TA3" );
+ status = rtems_task_suspend( tid3 );
+ if ( pass == 1 ) {
+ fatal_directive_status(
+ status,
+ RTEMS_ALREADY_SUSPENDED,
+ "rtems_task_suspend of TA3"
+ );
+ } else {
+ directive_failed( status, "rtems_task_suspend of TA3" );
+ }
+
+ puts( "TA1 - rtems_task_resume - resume TA2" );
+ status = rtems_task_resume( tid2 );
+ directive_failed( status, "rtems_task_resume of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( tid2 );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_resume - resume TA3" );
+ status = rtems_task_resume( tid3 );
+ directive_failed( status, "rtems_task_resume" );
+ }
+
+ puts( "*** END OF TEST 5 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp05/task2.c b/testsuites/sptests/sp05/task2.c
new file mode 100644
index 0000000000..3878d8106d
--- /dev/null
+++ b/testsuites/sptests/sp05/task2.c
@@ -0,0 +1,39 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Makes sure a task can suspend
+ * itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_task_suspend - suspend self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ while( FOREVER ) {
+ puts( "TA2 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA2" );
+ }
+}
diff --git a/testsuites/sptests/sp05/task3.c b/testsuites/sptests/sp05/task3.c
new file mode 100644
index 0000000000..c03c6de75b
--- /dev/null
+++ b/testsuites/sptests/sp05/task3.c
@@ -0,0 +1,39 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Makes sure a task can suspend
+ * itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_task_suspend - suspend self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA3" );
+
+ while( FOREVER ) {
+ puts( "TA3 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after of TA3" );
+ }
+}
diff --git a/testsuites/sptests/sp06/init.c b/testsuites/sptests/sp06/init.c
new file mode 100644
index 0000000000..6d8af5f01d
--- /dev/null
+++ b/testsuites/sptests/sp06/init.c
@@ -0,0 +1,87 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ puts( "\n\n*** TEST 6 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Argument = 0;
+ Restart_argument = 1;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, Argument );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, Argument );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_set_priority( Task_id[ 3 ], 5, &previous_priority );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp06/sp06.doc b/testsuites/sptests/sp06/sp06.doc
new file mode 100644
index 0000000000..e8b96f1f6b
--- /dev/null
+++ b/testsuites/sptests/sp06/sp06.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test6
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ tm_wkafter, t_restart
+
+concepts:
+
+ a. Verifies that a task can restart a task other than itself.
+
+ b. Verifies that a task can restart itself.
diff --git a/testsuites/sptests/sp06/sp06.scn b/testsuites/sptests/sp06/sp06.scn
new file mode 100644
index 0000000000..64f6489dc8
--- /dev/null
+++ b/testsuites/sptests/sp06/sp06.scn
@@ -0,0 +1,40 @@
+*** TEST 6 ***
+TA1 - is beginning to run
+TA1 - restarting TA3
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA2 - rtems_task_wake_after - sleep 1/2 second
+TA1 - rtems_task_restart - restarting self
+TA1 - is beginning to run
+*** END OF TEST 6 ***
+
+NOTE: The prints from TA2 may not be as regular as indicated in the screen.
+ The important point is that TA2 is running and gets restarted.
diff --git a/testsuites/sptests/sp06/system.h b/testsuites/sptests/sp06/system.h
new file mode 100644
index 0000000000..aa75d36f06
--- /dev/null
+++ b/testsuites/sptests/sp06/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_task_argument Argument; /* generic task argument */
+TEST_EXTERN rtems_task_argument Restart_argument; /* task 1 restart argument */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp06/task1.c b/testsuites/sptests/sp06/task1.c
new file mode 100644
index 0000000000..6d0f67f395
--- /dev/null
+++ b/testsuites/sptests/sp06/task1.c
@@ -0,0 +1,61 @@
+/* Task_1
+ *
+ * This task serves as a test task. Verifies that a task can restart
+ * both itself and other tasks.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1( argument )
+rtems_unsigned32 argument;
+{
+ rtems_unsigned32 pass;
+ rtems_status_code status;
+
+ puts( "TA1 - is beginning to run" );
+
+ pass = argument + 1;
+
+ if ( pass == 5 ) {
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+ }
+
+ if ( pass == 1 ) {
+ puts( "TA1 - restarting TA3" );
+ status = rtems_task_restart( Task_id[ 3 ], Restart_argument );
+ directive_failed( status, "rtems_task_restart of TA3" );
+
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_restart - restarting TA2" );
+ status = rtems_task_restart( Task_id[ 2 ], Restart_argument );
+ directive_failed( status, "rtems_task_restart TA2" );
+
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_restart - restarting self" );
+ status = rtems_task_restart( Task_id[ 1 ], pass );
+ directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp06/task2.c b/testsuites/sptests/sp06/task2.c
new file mode 100644
index 0000000000..0c9e10bc07
--- /dev/null
+++ b/testsuites/sptests/sp06/task2.c
@@ -0,0 +1,40 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It simply runs forever so
+ * another task can restart it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2( argument )
+rtems_task_argument argument;
+{
+ rtems_status_code status;
+
+ puts( "TA2 - is beginning to run" );
+ if ( argument == Argument ) {
+ status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+
+ while( FOREVER ) {
+ puts( "TA2 - rtems_task_wake_after - sleep 1/2 second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/testsuites/sptests/sp06/task3.c b/testsuites/sptests/sp06/task3.c
new file mode 100644
index 0000000000..379ef8de92
--- /dev/null
+++ b/testsuites/sptests/sp06/task3.c
@@ -0,0 +1,32 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It is started, has its priority
+ * changed, and when it runs it deletes itself.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp07/init.c b/testsuites/sptests/sp07/init.c
new file mode 100644
index 0000000000..d0fb6975af
--- /dev/null
+++ b/testsuites/sptests/sp07/init.c
@@ -0,0 +1,128 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_extensions_table Extensions = {
+ Task_create_extension, /* task create user extension */
+ Task_start_extension, /* task start user extension */
+ Task_restart_extension, /* task restart user extension */
+ Task_delete_extension, /* task delete user extension */
+ NULL, /* task switch user extension */
+ NULL, /* begin user extension */
+ Task_exit_extension, /* task exitted user extension */
+ NULL /* fatal error extension */
+};
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 7 ***" );
+
+ Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
+
+ status = rtems_extension_create(
+ Extension_name[ 1 ],
+ &Extensions,
+ &Extension_id[ 1 ]
+ );
+ directive_failed( status, "rtems_extension_create" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_restart( Task_id[ 3 ], 0 );
+ directive_failed( status, "rtems_task_restart of TA3" );
+
+ status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 );
+ directive_failed( status, "task_set_node of TA1" );
+ printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " );
+ puts ( "to TA1's priority: 04" );
+
+ status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, 4 );
+ directive_failed( status, "task_set_node of TA2" );
+ printf( "INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 " );
+ puts ( "to TA2's priority: 04");
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp07/sp07.doc b/testsuites/sptests/sp07/sp07.doc
new file mode 100644
index 0000000000..47411194c6
--- /dev/null
+++ b/testsuites/sptests/sp07/sp07.doc
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test7
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_delete, t_setreg, t_getreg, t_setpri, t_suspend
+
+concepts:
+
+ a. Verifies that tasks can communicate with each other via the
+ t_setreg and t_getreg directives.
+
+ b. Verifies that the highest priority task is dispatched to execute.
+
+ c. Verifies setting the priority of both a ready and a blocked task.
+
+ d. Verifies the deletion of ready and blocked tasks.
+
+ e. Verifies the tcreate user extension.
+
+ f. Verifies the tstart user extension.
+
+ g. Verifies the tdelete user extension.
diff --git a/testsuites/sptests/sp07/sp07.scn b/testsuites/sptests/sp07/sp07.scn
new file mode 100644
index 0000000000..1f6de2d93d
--- /dev/null
+++ b/testsuites/sptests/sp07/sp07.scn
@@ -0,0 +1,33 @@
+*** TEST 7 ***
+TASK_CREATE - TA1 - created.
+TASK_CREATE - TA2 - created.
+TASK_CREATE - TA3 - created.
+TASK_CREATE - TA4 - created.
+TASK_START - TA1 - started.
+TASK_START - TA2 - started.
+TASK_START - TA3 - started.
+TASK_START - TA4 - started.
+TASK_RESTART - TA3 - restarted.
+INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 to TA1's priority: 04
+INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 to TA2's priority: 04
+<pause>
+TA1 - rtems_task_set_priority - get initial priority of self: 04
+TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 04
+TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 03
+TA1 - rtems_task_set_priority - set TA2's priority: 03
+TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 03
+TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: 02
+TA2 - rtems_task_set_priority - set TA1's priority: 02
+TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 02
+TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 01
+TA1 - rtems_task_set_priority - set TA2's priority: 01
+TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 01
+TA2 - rtems_task_suspend - suspend TA1
+TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )
+TASK_DELETE - TA2 deleting TA1
+TASK_DELETE - TA2 deleting TA3
+TASK_DELETE - TA2 deleting TA2
+TA4 - exitting task
+RTEMS_TASK_EXITTED - extension invoked for TA4
+*** END OF TEST 7 ***
+TASK_DELETE - TA4 deleting TA4 <---- may not appear
diff --git a/testsuites/sptests/sp07/system.h b/testsuites/sptests/sp07/system.h
new file mode 100644
index 0000000000..3bd1ee69b5
--- /dev/null
+++ b/testsuites/sptests/sp07/system.h
@@ -0,0 +1,85 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_boolean Task_create_extension(
+ rtems_tcb *unused,
+ rtems_tcb *created_task
+);
+
+rtems_extension Task_delete_extension(
+ rtems_tcb *running_task,
+ rtems_tcb *deleted_task
+);
+
+rtems_extension Task_restart_extension(
+ rtems_tcb *unused,
+ rtems_tcb *restarted_task
+);
+
+rtems_extension Task_start_extension(
+ rtems_tcb *unused,
+ rtems_tcb *started_task
+);
+
+rtems_extension Task_exit_extension(
+ rtems_tcb *running_task
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Extension_id[ 4 ];
+TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp07/task1.c b/testsuites/sptests/sp07/task1.c
new file mode 100644
index 0000000000..f5abb10fa5
--- /dev/null
+++ b/testsuites/sptests/sp07/task1.c
@@ -0,0 +1,85 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies intertask communication
+ * using task notepads and verifies the the user extensions (tcreate, etc).
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority the_priority;
+ rtems_task_priority previous_priority;
+
+ rtems_test_pause();
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &the_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ printf(
+ "TA1 - rtems_task_set_priority - get initial priority of self: %02d\n",
+ the_priority
+ );
+
+ while( FOREVER ) {
+ status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
+ directive_failed( status, "rtems_task_get_note" );
+ printf(
+"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n",
+ the_priority
+ );
+
+ if ( --the_priority == 0 ) {
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" );
+ status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+
+ printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, the_priority );
+ directive_failed( status, "rtems_task_set_note" );
+
+ printf( "TA1 - rtems_task_set_priority - set TA2's priority: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_priority(
+ Task_id[ 2 ],
+ the_priority,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ }
+}
diff --git a/testsuites/sptests/sp07/task2.c b/testsuites/sptests/sp07/task2.c
new file mode 100644
index 0000000000..622bdd8e3d
--- /dev/null
+++ b/testsuites/sptests/sp07/task2.c
@@ -0,0 +1,78 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Plays with priorities to verify
+ * that the highest priority task is always executed.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority the_priority;
+ rtems_task_priority previous_priority;
+
+ while( FOREVER ) {
+
+ status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
+ directive_failed( status, "rtems_task_get_note" );
+ printf(
+"TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n",
+ the_priority
+ );
+
+ if ( --the_priority == 0 ) {
+ puts( "TA2 - rtems_task_suspend - suspend TA1" );
+ status = rtems_task_suspend( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" );
+ status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */
+ directive_failed( status, "rtems_task_delete of TA1" );
+
+ status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of SELD" );
+
+ } else {
+
+ printf( "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_note(Task_id[ 1 ], RTEMS_NOTEPAD_8, the_priority);
+ directive_failed( status, "rtems_task_set_note" );
+
+ printf( "TA2 - rtems_task_set_priority - set TA1's priority: %02d\n",
+ the_priority
+ );
+ status = rtems_task_set_priority(
+ Task_id[ 1 ],
+ the_priority,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+ }
+ }
+}
diff --git a/testsuites/sptests/sp07/task3.c b/testsuites/sptests/sp07/task3.c
new file mode 100644
index 0000000000..dce44b283b
--- /dev/null
+++ b/testsuites/sptests/sp07/task3.c
@@ -0,0 +1,34 @@
+/* Task_3
+ *
+ * This routine serves as a low priority test task that should never
+ * execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ while( FOREVER ) {
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/testsuites/sptests/sp07/task4.c b/testsuites/sptests/sp07/task4.c
new file mode 100644
index 0000000000..cc9de6d4c3
--- /dev/null
+++ b/testsuites/sptests/sp07/task4.c
@@ -0,0 +1,30 @@
+/* Task_4
+ *
+ * This routine serves as a low priority test task that should exit
+ * a soon as it runs to test the taskexitted user extension.
+ * execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ puts( "TA4 - exitting task" );
+}
diff --git a/testsuites/sptests/sp07/taskexit.c b/testsuites/sptests/sp07/taskexit.c
new file mode 100644
index 0000000000..ad52d1f3a7
--- /dev/null
+++ b/testsuites/sptests/sp07/taskexit.c
@@ -0,0 +1,33 @@
+/* Task_exit_extension
+ *
+ * This routine is the task exitted user extension.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_exit_extension(
+ rtems_tcb *running_task
+)
+{
+ if ( task_number( running_task->Object.id ) > 0 ) {
+ puts_nocr( "RTEMS_TASK_EXITTED - extension invoked for " );
+ put_name( Task_name[ task_number( running_task->Object.id ) ], TRUE );
+ }
+
+ puts("*** END OF TEST 7 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp07/tcreate.c b/testsuites/sptests/sp07/tcreate.c
new file mode 100644
index 0000000000..aff47ed191
--- /dev/null
+++ b/testsuites/sptests/sp07/tcreate.c
@@ -0,0 +1,35 @@
+/* Task_create_extension
+ *
+ * This routine is the tcreate user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * created_task - pointer to new TCB being created
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_boolean Task_create_extension(
+ rtems_tcb *unused,
+ rtems_tcb *created_task
+)
+{
+ if ( task_number( created_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_CREATE - " );
+ put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE );
+ puts( " - created." );
+ }
+ return TRUE;
+}
diff --git a/testsuites/sptests/sp07/tdelete.c b/testsuites/sptests/sp07/tdelete.c
new file mode 100644
index 0000000000..9d7c5749c1
--- /dev/null
+++ b/testsuites/sptests/sp07/tdelete.c
@@ -0,0 +1,37 @@
+/* Task_delete_extension
+ *
+ * This routine is the delete user extension.
+ *
+ * Input parameters:
+ * running_task - pointer to running TCB
+ * deleted_task - pointer to TCB deleted
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_delete_extension(
+ rtems_tcb *running_task,
+ rtems_tcb *deleted_task
+)
+{
+ if ( task_number( running_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_DELETE - " );
+ put_name( Task_name[ task_number( running_task->Object.id ) ], FALSE );
+ }
+ if ( task_number( deleted_task->Object.id ) > 0 ) {
+ puts_nocr( " deleting " );
+ put_name( Task_name[ task_number( deleted_task->Object.id ) ], TRUE );
+ }
+}
diff --git a/testsuites/sptests/sp07/trestart.c b/testsuites/sptests/sp07/trestart.c
new file mode 100644
index 0000000000..6cefb485a6
--- /dev/null
+++ b/testsuites/sptests/sp07/trestart.c
@@ -0,0 +1,34 @@
+/* Task_restart_extension
+ *
+ * This routine is the trestart user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * restarted_task - pointer to new TCB being started
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Task_restart_extension(
+ rtems_tcb *unused,
+ rtems_tcb *restarted_task
+)
+{
+ if ( task_number( restarted_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_RESTART - " );
+ put_name( Task_name[ task_number( restarted_task->Object.id ) ], FALSE );
+ puts( " - restarted." );
+ }
+}
diff --git a/testsuites/sptests/sp07/tstart.c b/testsuites/sptests/sp07/tstart.c
new file mode 100644
index 0000000000..1b1fc795b7
--- /dev/null
+++ b/testsuites/sptests/sp07/tstart.c
@@ -0,0 +1,34 @@
+/* Task_start_extension
+ *
+ * This routine is the tstart user extension.
+ *
+ * Input parameters:
+ * unused - pointer to currently running TCB
+ * started_task - pointer to new TCB being started
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_extension Task_start_extension(
+ rtems_tcb *unused,
+ rtems_tcb *started_task
+)
+{
+ if ( task_number( started_task->Object.id ) > 0 ) {
+ puts_nocr( "TASK_START - " );
+ put_name( Task_name[ task_number( started_task->Object.id ) ], FALSE );
+ puts( " - started." );
+ }
+}
diff --git a/testsuites/sptests/sp08/init.c b/testsuites/sptests/sp08/init.c
new file mode 100644
index 0000000000..7d6e63e00f
--- /dev/null
+++ b/testsuites/sptests/sp08/init.c
@@ -0,0 +1,53 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 8 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp08/sp08.doc b/testsuites/sptests/sp08/sp08.doc
new file mode 100644
index 0000000000..2b152779d7
--- /dev/null
+++ b/testsuites/sptests/sp08/sp08.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test8
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return,
+ t_mode
+
+concepts:
+
+ a. Verifies every mode change possible.
+
+ b. Verifies the fatal error handler.
diff --git a/testsuites/sptests/sp08/sp08.scn b/testsuites/sptests/sp08/sp08.scn
new file mode 100644
index 0000000000..d85ccc384f
--- /dev/null
+++ b/testsuites/sptests/sp08/sp08.scn
@@ -0,0 +1,22 @@
+*** TEST 8 ***
+TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400
+TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400
+TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200
+TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200
+TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100
+TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100
+TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000
+TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003
+TA1 - rtems_task_mode - set all modes - previous mode: 00000005
+TA1 - rtems_task_mode - set all modes - previous mode: 00000703
+TA1 - rtems_task_mode - clear all modes - previous mode: 00000703
+TA1 - rtems_task_mode - get current mode - previous mode: 00000000
+*** END OF TEST 8 ***
+
+NOTE: The interrupt level lines will be different on CPUs with few levels.
diff --git a/testsuites/sptests/sp08/system.h b/testsuites/sptests/sp08/system.h
new file mode 100644
index 0000000000..85cb0c7dcd
--- /dev/null
+++ b/testsuites/sptests/sp08/system.h
@@ -0,0 +1,48 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+#define put_mode( _comment, _output_mode ) \
+ printf( "%s %08x\n", _comment, _output_mode );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp08/task1.c b/testsuites/sptests/sp08/task1.c
new file mode 100644
index 0000000000..eddcb11191
--- /dev/null
+++ b/testsuites/sptests/sp08/task1.c
@@ -0,0 +1,256 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies all combinations of
+ * task mode changes.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+/* BEGINNING OF RTEMS_ASR */
+
+ status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_ASR,
+ RTEMS_ASR_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_ASR */
+
+/* BEGINNING OF RTEMS_TIMESLICE */
+
+ status = rtems_task_mode(
+ RTEMS_NO_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_TIMESLICE,
+ RTEMS_TIMESLICE_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_TIMESLICE */
+
+/* BEGINNING OF RTEMS_PREEMPT */
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_PREEMPT */
+
+/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3),
+ RTEMS_INTERRUPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(5),
+ RTEMS_INTERRUPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ",
+ previous_mode
+ );
+
+/* END OF RTEMS_INTERRUPT_LEVEL */
+
+/* BEGINNING OF COMBINATIONS */
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
+ RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - set all modes - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
+ RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - set all modes - previous mode: ",
+ previous_mode
+ );
+
+ status = rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT,
+ RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
+ RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - clear all modes - previous mode: ",
+ previous_mode
+ );
+
+/* END OF COMBINATIONS */
+
+/* BEGINNING OF CURRENT MODE */
+
+ status = rtems_task_mode(
+ RTEMS_CURRENT_MODE,
+ RTEMS_CURRENT_MODE,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+ put_mode(
+ "TA1 - rtems_task_mode - get current mode - previous mode: ",
+ previous_mode
+ );
+
+/* END OF CURRENT MODE */
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp09/delay.c b/testsuites/sptests/sp09/delay.c
new file mode 100644
index 0000000000..dd78610be8
--- /dev/null
+++ b/testsuites/sptests/sp09/delay.c
@@ -0,0 +1,28 @@
+/* Delayed_routine
+ *
+ * This routine is used as the timer routine for Timer Manager tests.
+ *
+ * Input parameters:
+ * ignored - this parameter is ignored
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_routine(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+}
diff --git a/testsuites/sptests/sp09/init.c b/testsuites/sptests/sp09/init.c
new file mode 100644
index 0000000000..b879eff42e
--- /dev/null
+++ b/testsuites/sptests/sp09/init.c
@@ -0,0 +1,120 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 9 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+ Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' );
+ Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' );
+ Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' );
+ Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' );
+ Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+ Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' );
+
+ Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' );
+ Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+
+ Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' );
+
+ Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' );
+
+ Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+#if 0
+ status = rtems_task_create(
+ Task_name[1],
+ 4,
+ 10,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_task_create with illegal stack size"
+ );
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE" );
+#endif
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED" );
+
+ status = rtems_task_create(
+ Task_name[1],
+ 0,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_PRIORITY,
+ "rtems_task_create with illegal priority"
+ );
+ puts( "INIT - rtems_task_create - RTEMS_INVALID_PRIORITY" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 3,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_restart( Task_id[ 1 ], 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_restart of DORMANT task"
+ );
+ puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp09/isr.c b/testsuites/sptests/sp09/isr.c
new file mode 100644
index 0000000000..292e9c0225
--- /dev/null
+++ b/testsuites/sptests/sp09/isr.c
@@ -0,0 +1,27 @@
+/* Service_routine
+ *
+ * This routine is used as the timer routine for Interrupt Manager tests.
+ *
+ * Input parameters:
+ * ignored - this parameter is ignored
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_isr Service_routine(
+ rtems_vector_number ignored
+)
+{
+}
diff --git a/testsuites/sptests/sp09/screen01.c b/testsuites/sptests/sp09/screen01.c
new file mode 100644
index 0000000000..39012f5051
--- /dev/null
+++ b/testsuites/sptests/sp09/screen01.c
@@ -0,0 +1,168 @@
+/* Screen1
+ *
+ * This routine generates error screen 1 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen1()
+{
+ rtems_unsigned32 notepad_value;
+ rtems_id self_id;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ status = rtems_task_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_delete with illegal id"
+ );
+ puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" );
+
+ status = rtems_task_get_note( RTEMS_SELF, 100, &notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_task_get_note with illegal notepad"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, &notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_get_note with illegal id"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ if ( self_id != Task_id[ 1 ] ) {
+ puts( "ERROR - rtems_task_ident - incorrect ID returned!" );
+ }
+ puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_ident with illegal name (local)"
+ );
+ puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" );
+
+ status = rtems_task_ident( 100, 1, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_ident with illegal name (global)"
+ );
+ puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" );
+
+ status = rtems_task_ident( 100, 2, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NODE,
+ "rtems_task_ident with illegal node"
+ );
+ puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" );
+
+ status = rtems_task_restart( 100, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_restart with illegal id"
+ );
+ puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" );
+
+ status = rtems_task_resume( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_resume with illegal id"
+ );
+ puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" );
+
+ status = rtems_task_resume( RTEMS_SELF );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_resume of ready task"
+ );
+ puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_PRIORITY,
+ "rtems_task_set_priority with illegal priority"
+ );
+ puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" );
+
+ status = rtems_task_set_priority( 100, 8, &previous_priority );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_set_priority with illegal id"
+ );
+ puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" );
+
+ status = rtems_task_set_note(
+ RTEMS_SELF,
+ RTEMS_NOTEPAD_LAST+10,
+ notepad_value
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_task_set_note with illegal notepad"
+ );
+ puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_set_note with illegal id"
+ );
+ puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" );
+
+ status = rtems_task_start( 100, Task_1, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_start with illegal id"
+ );
+ puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" );
+
+ status = rtems_task_start( 0, Task_1, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INCORRECT_STATE,
+ "rtems_task_start of ready task"
+ );
+ puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" );
+
+ status = rtems_task_suspend( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_suspend with illegal id"
+ );
+ puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" );
+}
diff --git a/testsuites/sptests/sp09/screen02.c b/testsuites/sptests/sp09/screen02.c
new file mode 100644
index 0000000000..5f2ef82205
--- /dev/null
+++ b/testsuites/sptests/sp09/screen02.c
@@ -0,0 +1,192 @@
+/* Screen2
+ *
+ * This routine generates error screen 2 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen2()
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+/* errors before clock is set */
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+ "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_clock_get before clock is set"
+ );
+ puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" );
+ }
+
+ status = rtems_task_wake_when( &time );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_task_wake_when before clock is set"
+ );
+ puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" );
+ }
+
+ status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ puts(
+ "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
+ );
+ } else {
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "task_fire_when before clock is set"
+ );
+ puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" );
+ }
+
+ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid year"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 15, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid month"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 32, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid day"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 25, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid hour"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 61, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid minute"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 61, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid second"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_clock_set with invalid ticks per second"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set successful" );
+ puts( " - RTEMS_SUCCESSFUL" );
+
+/* rtems_task_wake_when */
+
+ build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 );
+ time.second += 3;
+ puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" );
+
+ status = rtems_task_wake_when( &time );
+ directive_failed(
+ status,
+ "rtems_task_wake_when with invalid ticks per second"
+ );
+ puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" );
+
+ build_time( &time, 2, 5, 1961, 8, 30, 48, 0 );
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when with invalid year"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ build_time( &time, 2, 5, 1988, 25, 30, 48, 0 );
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when with invalid hour"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+
+ rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ print_time( "TA1 - current time - ", &time, "\n" );
+
+ time.month = 1;
+ print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
+ status = rtems_task_wake_when( &time );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_task_wake_when before current time"
+ );
+ puts( " - RTEMS_INVALID_CLOCK" );
+}
diff --git a/testsuites/sptests/sp09/screen03.c b/testsuites/sptests/sp09/screen03.c
new file mode 100644
index 0000000000..eecab6066a
--- /dev/null
+++ b/testsuites/sptests/sp09/screen03.c
@@ -0,0 +1,217 @@
+/* Screen3
+ *
+ * This routine generates error screen 3 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+extern rtems_configuration_table BSP_Configuration;
+extern rtems_cpu_table _CPU_Table;
+
+void Screen3()
+{
+ rtems_name task_name;
+ rtems_status_code status;
+
+ task_name = 1;
+ status = rtems_task_create(
+ 0,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_task_create with illegal name"
+ );
+ puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" );
+
+ /*
+ * If the bsp provides its own stack allocator, then
+ * skip the test that tries to allocate a stack that is too big.
+ */
+
+ if (_CPU_Table.stack_allocate_hook)
+ {
+ puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED -- SKIPPED" );
+ }
+ else
+ {
+ status = rtems_task_create(
+ task_name,
+ 1,
+ BSP_Configuration.work_space_size,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_task_create with a stack size larger than the workspace"
+ );
+ puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" );
+ }
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+ puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+ puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_ALREADY_SUSPENDED,
+ "rtems_task_suspend of suspended TA2"
+ );
+ puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" );
+
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_resume of TA2" );
+ puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+ puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+ puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+ puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 6 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 6 ]
+ );
+ directive_failed( status, "rtems_task_create of TA6" );
+ puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 7 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 7 ]
+ );
+ directive_failed( status, "rtems_task_create of TA7" );
+ puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 8 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 8 ]
+ );
+ directive_failed( status, "rtems_task_create of TA8" );
+ puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 9 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 9 ]
+ );
+ directive_failed( status, "rtems_task_create of TA9" );
+ puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ Task_name[ 10 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 10 ]
+ );
+ directive_failed( status, "rtems_task_create of TA10" );
+ puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" );
+
+ status = rtems_task_create(
+ task_name,
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_task_create for too many tasks"
+ );
+ puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" );
+
+ status = rtems_task_create(
+ task_name,
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_task_create of global task in a single cpu system"
+ );
+ puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" );
+}
diff --git a/testsuites/sptests/sp09/screen04.c b/testsuites/sptests/sp09/screen04.c
new file mode 100644
index 0000000000..6e3866cb05
--- /dev/null
+++ b/testsuites/sptests/sp09/screen04.c
@@ -0,0 +1,85 @@
+/* Screen4
+ *
+ * This routine generates error screen 4 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen4()
+{
+ rtems_event_set event_out;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive unsatisfied (ALL)"
+ );
+ puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_EVENT_ANY | RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive unsatisfied (ANY)"
+ );
+ puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )" );
+
+ puts( "TA1 - rtems_event_receive - timeout in 3 seconds" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND,
+ &event_out
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_event_receive"
+ );
+ puts( "TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_event_send( 100, RTEMS_EVENT_16 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_event_send with illegal id"
+ );
+ puts( "TA1 - rtems_event_send - RTEMS_INVALID_ID" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
+ print_time( "TA1 - rtems_clock_set - ", &time, "" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ puts( " - RTEMS_SUCCESSFUL" );
+}
diff --git a/testsuites/sptests/sp09/screen05.c b/testsuites/sptests/sp09/screen05.c
new file mode 100644
index 0000000000..c47a25f89d
--- /dev/null
+++ b/testsuites/sptests/sp09/screen05.c
@@ -0,0 +1,164 @@
+/* Screen5
+ *
+ * This routine generates error screen 5 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen5()
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_create(
+ 0,
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_create with illegal name"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" );
+
+ do {
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ } while (status == RTEMS_SUCCESSFUL);
+
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_semaphore_create of too many"
+ );
+ puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 2,
+ RTEMS_BINARY_SEMAPHORE,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_semaphore_create of binary semaphore with count > 1"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_semaphore_create of mp not configured"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_semaphore_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_delete( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with local illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (local)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_ident( 100, 1, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (global)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
+}
diff --git a/testsuites/sptests/sp09/screen06.c b/testsuites/sptests/sp09/screen06.c
new file mode 100644
index 0000000000..40ad75d606
--- /dev/null
+++ b/testsuites/sptests/sp09/screen06.c
@@ -0,0 +1,125 @@
+/* Screen6
+ *
+ * This routine generates error screen 6 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen6()
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ 100,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_obtain with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain successful" );
+ puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_semaphore_obtain not available"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_semaphore_obtain timeout"
+ );
+ puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_semaphore_release and not owner"
+ );
+ puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ status = rtems_semaphore_release( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_release with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
+
+ puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+ puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain");
+
+ puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_semaphore_delete of SM2"
+ );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_task_delete after the task has been deleted"
+ );
+}
diff --git a/testsuites/sptests/sp09/screen07.c b/testsuites/sptests/sp09/screen07.c
new file mode 100644
index 0000000000..2c58160edd
--- /dev/null
+++ b/testsuites/sptests/sp09/screen07.c
@@ -0,0 +1,192 @@
+/* Screen7
+ *
+ * This routine generates error screen 7 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen7()
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ status = rtems_message_queue_broadcast( 100, (long (*)[4]) buffer, 16, &count );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_broadcast with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_create(
+ 0,
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_message_queue_create with illegal name"
+ );
+
+ puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 1,
+ 16,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_message_queue_create of mp not configured"
+ );
+ puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 2 ],
+ 1,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_create of too many"
+ );
+ puts( "TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY" );
+
+ status = rtems_message_queue_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_create with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_delete with local illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_message_queue_ident with illegal name"
+ );
+ puts( "TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_message_queue_flush( 100, &count );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_flush with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_receive(
+ 100,
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 0
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_receive wit illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_message_queue_receive unsatisfied"
+ );
+ puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4]) buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_message_queue_receive 3 second timeout"
+ );
+
+ puts(
+ "TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT"
+ );
+
+ status = rtems_message_queue_send( 100, (long (*)[4]) buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_message_queue_send with illegal id"
+ );
+ puts( "TA1 - rtems_message_queue_send - RTEMS_INVALID_ID" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to a limited queue"
+ );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" );
+}
diff --git a/testsuites/sptests/sp09/screen08.c b/testsuites/sptests/sp09/screen08.c
new file mode 100644
index 0000000000..cc80bd2635
--- /dev/null
+++ b/testsuites/sptests/sp09/screen08.c
@@ -0,0 +1,128 @@
+/* Screen8
+ *
+ * This routine generates error screen 8 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen8()
+{
+ long buffer[ 4 ];
+ rtems_status_code status;
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to limited queue"
+ );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" );
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send successful" );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer, 16 );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_message_queue_send too many to limited queue"
+ );
+ puts(
+ "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY"
+ );
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+ puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 3,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create successful" );
+ puts(
+ "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL"
+ );
+
+ puts( "TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL" );
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+
+ puts( "TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete successful" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after (yield)" );
+}
diff --git a/testsuites/sptests/sp09/screen09.c b/testsuites/sptests/sp09/screen09.c
new file mode 100644
index 0000000000..c6fd1d3d72
--- /dev/null
+++ b/testsuites/sptests/sp09/screen09.c
@@ -0,0 +1,144 @@
+/* Screen9
+ *
+ * This routine generates error screen 9 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen9()
+{
+ void *converted;
+ rtems_status_code status;
+ rtems_isr_entry old_service_routine;
+
+ status = rtems_interrupt_catch(
+ Service_routine,
+ ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 10,
+ &old_service_routine
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_interrupt_catch with invalid vector"
+ );
+ puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_interrupt_catch( NULL, 3, &old_service_routine );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_interrupt_catch with invalid handler"
+ );
+ puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_signal_send( 100, RTEMS_SIGNAL_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_signal_send with illegal id"
+ );
+ puts( "TA1 - rtems_signal_send - RTEMS_INVALID_ID" );
+
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_signal_send with no handler"
+ );
+ puts( "TA1 - rtems_signal_send - RTEMS_NOT_DEFINED" );
+
+ status = rtems_port_create(
+ 0,
+ Internal_port_area,
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_port_create with illegal name"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ &((char *)Internal_port_area)[ 1 ],
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_port_create with illegal address"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ Internal_port_area,
+ External_port_area,
+ sizeof( Internal_port_area ),
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_port_create of too many"
+ );
+ puts( "TA1 - rtems_port_create - RTEMS_TOO_MANY" );
+
+ status = rtems_port_delete( 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_delete with illegal id"
+ );
+ puts( "TA1 - rtems_port_delete - RTEMS_INVALID_ID" );
+
+ status = rtems_port_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_port_ident with illegal name"
+ );
+ puts( "TA1 - rtems_port_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_port_external_to_internal(
+ 100,
+ Internal_port_area,
+ &converted
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_external_to_internal with illegal id"
+ );
+ puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID" );
+ status = rtems_port_internal_to_external(
+ 100,
+ Internal_port_area,
+ &converted
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_port_internal_to_external with illegal id"
+ );
+ puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" );
+}
diff --git a/testsuites/sptests/sp09/screen10.c b/testsuites/sptests/sp09/screen10.c
new file mode 100644
index 0000000000..53a5a8d6dc
--- /dev/null
+++ b/testsuites/sptests/sp09/screen10.c
@@ -0,0 +1,164 @@
+/* Screen10
+ *
+ * This routine generates error screen 10 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen10()
+{
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_rate_monotonic_create with illegal name"
+ );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_create successful" );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_rate_monotonic_create of too many"
+ );
+ puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" );
+
+ status = rtems_rate_monotonic_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_rate_monotonic_ident with illegal name"
+ );
+ puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_rate_monotonic_period( 100, 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_period with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_period( 0x10100, 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_period with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_rate_monotonic_period status not defined"
+ );
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED"
+ );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 );
+ directive_failed( status, "rtems_rate_monotonic_period successful" );
+ puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
+ directive_failed( status, "rtems_rate_monotonic_period status" );
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL"
+ );
+
+ while ( FOREVER ) {
+
+ status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS);
+
+ if ( status == RTEMS_TIMEOUT ) break;
+
+ directive_failed(
+ status,
+ "rtems_rate_monotonic_period waiting for timeout"
+ );
+ }
+ puts(
+ "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT"
+ );
+
+ status = rtems_rate_monotonic_cancel( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_cancel with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_cancel( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_cancel will illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_cancel" );
+ puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ directive_failed( status, "rtems_rate_monotonic_period restart" );
+
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_rate_monotonic_period"
+ );
+ puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ puts( "TA1 - yielding to TA4" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ status = rtems_rate_monotonic_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_delete with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_rate_monotonic_delete with illegal id"
+ );
+ puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_rate_monotonic_delete( Period_id[ 1 ] );
+ directive_failed( status, "rtems_rate_monotonic_delete" );
+ puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" );
+}
diff --git a/testsuites/sptests/sp09/screen11.c b/testsuites/sptests/sp09/screen11.c
new file mode 100644
index 0000000000..8c13cd2490
--- /dev/null
+++ b/testsuites/sptests/sp09/screen11.c
@@ -0,0 +1,250 @@
+/* Screen11
+ *
+ * This routine generates error screen 11 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen11()
+{
+ void *buffer_address_1;
+ void *buffer_address_2;
+ void *buffer_address_3;
+ rtems_status_code status;
+
+ status = rtems_partition_create(
+ 0,
+ Partition_good_area,
+ 128,
+ 40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_partition_create with illegal name"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 0,
+ 80,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with illegal length"
+ );
+ puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with illegal buffer size"
+ );
+ puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 256,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with buffer_size > length"
+ );
+ puts(
+ "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE"
+ );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_partition_create of global"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_bad_area,
+ 128,
+ 64,
+ RTEMS_GLOBAL,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_create with bad address"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 34,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_partition_create with unaligned buffer_size"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" );
+
+ status = rtems_partition_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_delete with illegal id"
+ );
+ puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_partition_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_delete with illegal id"
+ );
+ puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_partition_get_buffer( 100, &buffer_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_get_buffer with illegal id"
+ );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" );
+
+ status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_partition_ident with illegal name"
+ );
+ puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_partition_return_buffer( 100, buffer_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_partition_return_buffer with illegal id"
+ );
+ puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 64,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create" );
+ puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Partition_good_area,
+ 128,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_partition_create of too many"
+ );
+ puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 );
+ directive_failed( status, "rtems_partition_get_buffer");
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
+
+ status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_partition_get_buffer unsatisfied"
+ );
+ puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" );
+
+ status = rtems_partition_delete( Partition_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_partition_delete with buffers in use"
+ );
+ puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" );
+
+ status = rtems_partition_return_buffer(
+ Partition_id[ 1 ],
+ Region_good_area /* NOTE: Region Memory */
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_return_buffer with buffer address out of partition"
+ );
+ puts(
+ "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range"
+ );
+
+ status = rtems_partition_return_buffer(
+ Partition_id[ 1 ],
+ &Partition_good_area[ 7 ]
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_partition_return_buffer with buffer address not on boundary"
+ );
+ puts_nocr( "TA1 - rtems_partition_return_buffer - " );
+ puts ( "RTEMS_INVALID_ADDRESS - not on boundary");
+}
diff --git a/testsuites/sptests/sp09/screen12.c b/testsuites/sptests/sp09/screen12.c
new file mode 100644
index 0000000000..75212d5fc2
--- /dev/null
+++ b/testsuites/sptests/sp09/screen12.c
@@ -0,0 +1,337 @@
+/* Screen12
+ *
+ * This routine generates error screen 12 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen12()
+{
+ void *segment_address_1;
+ void *segment_address_2;
+ void *segment_address_3;
+ rtems_unsigned32 offset;
+ rtems_unsigned32 good_front_flag;
+ rtems_unsigned32 good_back_flag;
+ rtems_status_code status;
+
+ status = rtems_region_create(
+ 0,
+ Region_good_area,
+ 0x40,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_region_create with illegal name"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_bad_area,
+ 0x40,
+ 32,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_create with illegal address"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_good_area,
+ 0x40,
+ 34,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_region_create with illegal size"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET ],
+ REGION_LENGTH,
+ 0x40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create" );
+ puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Region_good_area,
+ 512,
+ 0x40,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_region_create of too many"
+ );
+ puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" );
+
+ status = rtems_region_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_delete with illegal id"
+ );
+ puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" );
+
+ status = rtems_region_delete( 0x10100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_delete with illegal id"
+ );
+ puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_region_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_region_ident with illegal name"
+ );
+ puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_region_get_segment(
+ 100,
+ 0x40,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_get_segment with illegal id"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ sizeof( Region_good_area ) * 2,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_SIZE,
+ "rtems_region_get_segment with illegal size"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 384,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" );
+
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ REGION_LENGTH / 2,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_region_get_segment unsatisfied"
+ );
+ puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 128,
+ RTEMS_DEFAULT_OPTIONS,
+ 3 * TICKS_PER_SECOND,
+ &segment_address_3
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_region_get_segment timeout"
+ );
+ puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" );
+
+ status = rtems_region_delete( Region_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_RESOURCE_IN_USE,
+ "rtems_region_delete with buffers in use"
+ );
+ puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" );
+
+ status = rtems_region_return_segment( 100, segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_return_segment with illegal id"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with illegal segment"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+/*
+ * The following generate internal heap errors. Thus this code
+ * is subject to change if the heap code changes.
+ */
+
+ puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" );
+ rtems_debug_disable( RTEMS_DEBUG_REGION );
+
+#if 0
+
+ offset = (segment_address_1 - (void *)Region_good_area) / 4;
+
+/* bad FRONT_FLAG error */
+
+ good_front_flag = Region_good_area[ offset - 1 ];
+ Region_good_area[ offset - 1 ] = good_front_flag + 2;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with back_flag != front_flag"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+ Region_good_area[ offset - 1 ] = good_front_flag;
+
+/* bad FRONT_FLAG error */
+
+ good_back_flag = Region_good_area[ offset - 2 ];
+ Region_good_area[ offset - 2 ] = 1024;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_return_segment with back_flag != front_flag"
+ );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
+
+ Region_good_area[ offset - 2 ] = good_back_flag;
+
+#else
+ offset = 0;
+ good_front_flag = 0;
+ good_back_flag = 0;
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
+ puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
+#endif
+
+ puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" );
+ rtems_debug_enable( RTEMS_DEBUG_REGION );
+
+ status = rtems_region_extend(
+ 100,
+ Region_good_area,
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_region_extend with illegal id"
+ );
+ puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET + 16 ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_region_extend with illegal starting address"
+ );
+ puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ Region_bad_area,
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED"
+ );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED"
+ );
+
+ status = rtems_region_extend(
+ Region_id[ 1 ],
+ &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ],
+ 128
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_IMPLEMENTED,
+ "rtems_region_extend with unsupported starting address"
+ );
+ puts(
+ "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED"
+ );
+
+}
diff --git a/testsuites/sptests/sp09/screen13.c b/testsuites/sptests/sp09/screen13.c
new file mode 100644
index 0000000000..f58f42998d
--- /dev/null
+++ b/testsuites/sptests/sp09/screen13.c
@@ -0,0 +1,114 @@
+/* Screen13
+ *
+ * This routine generates error screen 13 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen13()
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_io_close( 0xffff, 0x0000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_control( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_initialize( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_initialize with bad major number"
+ );
+ puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_open( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_open with bad major number"
+ );
+ puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_read( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_read with bad major number"
+ );
+ puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_write( 0xffff, 0x0ffff, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_write with bad major number"
+ );
+ puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" );
+
+ build_time( &time, 12, 31, 2000, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1999, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2100, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1991, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" );
+}
diff --git a/testsuites/sptests/sp09/screen14.c b/testsuites/sptests/sp09/screen14.c
new file mode 100644
index 0000000000..c0e75b1b98
--- /dev/null
+++ b/testsuites/sptests/sp09/screen14.c
@@ -0,0 +1,154 @@
+/* Screen14
+ *
+ * This routine generates error screen 14 for test 9.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Screen14()
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+
+ status = rtems_timer_create( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_timer_create with illegal name"
+ );
+ puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+ puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_timer_create( 2, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_timer_create for too many"
+ );
+ puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" );
+
+ status = rtems_timer_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_delete with illegal id"
+ );
+ puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_timer_delete( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_delete with illegal id"
+ );
+ puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" );
+
+ status = rtems_timer_ident( 0, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_timer_ident with illegal name"
+ );
+ puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" );
+
+ status = rtems_timer_cancel( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_cancel with illegal id"
+ );
+ puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_reset( 0x010100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_reset with illegal id"
+ );
+ puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_reset( Timer_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_timer_reset before initiated"
+ );
+ puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" );
+
+ status = rtems_timer_fire_after(
+ 0x010100,
+ 5 * TICKS_PER_SECOND,
+ Delayed_routine,
+ NULL
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_fire_after illegal id"
+ );
+ puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" );
+
+ build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
+ status = rtems_timer_fire_when( 0x010100, &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_timer_fire_when with illegal id"
+ );
+ puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" );
+
+ status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_timer_fire_after with 0 ticks"
+ );
+ puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" );
+
+ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+ status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_timer_fire_when with illegal time"
+ );
+ print_time(
+ "TA1 - rtems_timer_fire_when - ",
+ &time,
+ " - RTEMS_INVALID_CLOCK\n"
+ );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+ build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
+ status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_CLOCK,
+ "rtems_timer_fire_when before current time"
+ );
+ print_time(
+ "TA1 - rtems_timer_fire_when - ",
+ &time,
+ " - before RTEMS_INVALID_CLOCK\n"
+ );
+}
diff --git a/testsuites/sptests/sp09/sp09.doc b/testsuites/sptests/sp09/sp09.doc
new file mode 100644
index 0000000000..f4e8391c47
--- /dev/null
+++ b/testsuites/sptests/sp09/sp09.doc
@@ -0,0 +1,36 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test9
+
+directives:
+ ex_init, ex_start, tm_tick, i_return,
+ t_create,t_delete, t_getreg, t_ident, t_restart, t_resume, t_setpri,
+ t_setreg, t_start, t_suspend, tm_delete, tm_get,
+ tm_set, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete,
+ sm_ident, sm_p, sm_v, q_broadcast, q_create, q_delete, q_ident, q_receive,
+ q_send, q_urgent, as_catch, as_send, as_return, rn_create, rn_delete,
+ rn_getseg, rn_ident, rn_retseg, pt_create, pt_delete, pt_getbug, pt_ident,
+ pt_retbuf, de_close, de_cntrl, de_init, de_open, de_read, de_write
+
+concepts:
+
+ a. Verifies all error codes returned by the executive in single
+ processor configurations.
+
+ b. Verifies error conditions in the following kernel routines or macros:
+ _Ck_date_time, _Expired, _Q_submit, _Get_mnodes, _Get_node,
+ _Free_mem, _Get_mem, _Valid_block, _Set_tcb, _Set_resource,
+ _In_range, _On_boundary
diff --git a/testsuites/sptests/sp09/sp09.scn b/testsuites/sptests/sp09/sp09.scn
new file mode 100644
index 0000000000..e1c59f6397
--- /dev/null
+++ b/testsuites/sptests/sp09/sp09.scn
@@ -0,0 +1,249 @@
+*** TEST 9 ***
+INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED
+INIT - rtems_task_create - RTEMS_INVALID_PRIORITY
+INIT - rtems_task_restart - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_delete - RTEMS_INVALID_ID
+TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER
+TA1 - rtems_task_get_note - RTEMS_INVALID_ID
+TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL
+TA1 - rtems_task_ident - global RTEMS_INVALID_NAME
+TA1 - rtems_task_ident - local RTEMS_INVALID_NAME
+TA1 - rtems_task_ident - RTEMS_INVALID_NODE
+TA1 - rtems_task_restart - RTEMS_INVALID_ID
+TA1 - rtems_task_resume - RTEMS_INVALID_ID
+TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY
+TA1 - rtems_task_set_priority - RTEMS_INVALID_ID
+TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER
+TA1 - rtems_task_set_note - RTEMS_INVALID_ID
+TA1 - rtems_task_start - RTEMS_INVALID_ID
+TA1 - rtems_task_start - RTEMS_INCORRECT_STATE
+TA1 - rtems_task_suspend - RTEMS_INVALID_ID
+<pause - screen 2>
+TA1 - rtems_clock_get - RTEMS_NOT_DEFINED
+TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED
+TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED
+TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds
+TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK
+TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK
+TA1 - current time - 08:30:51 02/05/1988
+TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK
+<pause - screen 3>
+TA1 - rtems_task_create - RTEMS_INVALID_NAME
+TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED
+TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED
+TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY
+TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED
+<pause - screen 4>
+TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )
+TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )
+TA1 - rtems_event_receive - timeout in 3 seconds
+TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT
+TA1 - rtems_event_send - RTEMS_INVALID_ID
+TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL
+<pause - screen 5>
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY
+TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER
+TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID
+TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME
+<pause - screen 6>
+TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID
+TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED
+TA1 - rtems_semaphore_obtain - timeout in 3 seconds
+TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT
+TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE
+TA1 - rtems_semaphore_release - RTEMS_INVALID_ID
+TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER
+TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - binary semaphore
+TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED
+TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+<pause - screen 7>
+TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME
+TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID
+TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME
+TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED
+TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds
+TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT
+TA1 - rtems_message_queue_send - RTEMS_INVALID_ID
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY
+<pause - screen 8>
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY
+TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL
+TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER
+TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED
+TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+<pause - screen 9>
+TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER
+TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS
+TA1 - rtems_signal_send - RTEMS_INVALID_ID
+TA1 - rtems_signal_send - RTEMS_NOT_DEFINED
+TA1 - rtems_port_create - RTEMS_INVALID_NAME
+TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_port_create - RTEMS_TOO_MANY
+TA1 - rtems_port_delete - RTEMS_INVALID_ID
+TA1 - rtems_port_ident - RTEMS_INVALID_NAME
+TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID
+TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID
+<pause - screen 10>
+TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME
+TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY
+TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME
+TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED
+TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT
+TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT
+TA1 - yielding to TA4
+TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE
+TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE
+TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID
+TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL
+<pause - screen 11>
+TA1 - rtems_partition_create - RTEMS_INVALID_NAME
+TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_partition_create - RTEMS_INVALID_SIZE
+TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_partition_delete - local RTEMS_INVALID_ID
+TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID
+TA1 - rtems_partition_ident - RTEMS_INVALID_NAME
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID
+TA1 - rtems_partition_create - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_create - RTEMS_TOO_MANY
+TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL
+TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED
+TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range
+TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - not on boundary
+<pause - screen 12>
+TA1 - rtems_region_create - RTEMS_INVALID_NAME
+TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_create - RTEMS_INVALID_SIZE
+TA1 - rtems_region_create - RTEMS_SUCCESSFUL
+TA1 - rtems_region_create - RTEMS_TOO_MANY
+TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID
+TA1 - rtems_region_delete - local RTEMS_INVALID_ID
+TA1 - rtems_region_ident - RTEMS_INVALID_NAME
+TA1 - rtems_region_get_segment - RTEMS_INVALID_ID
+TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE
+TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL
+TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED
+TA1 - rtems_region_get_segment - timeout in 3 seconds
+TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT
+TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ID
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS
+TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION
+TA1 - rtems_region_extend - RTEMS_INVALID_ID
+TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS
+TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED
+TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED
+TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED
+<pause - screen 13>
+TA1 - rtems_io_close - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_control - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_open - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_read - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_write - RTEMS_INVALID_NUMBER
+TA1 - rtems_clock_set - 23:59:59 12/31/2000 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2001 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/1999 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2000 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/2100 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2101 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/2099 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/2100 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_set - 23:59:59 12/31/1991 - RTEMS_SUCCESSFUL
+TA1 - rtems_clock_get - 00:00:00 01/01/1992 - RTEMS_SUCCESSFUL
+<pause - screen 14>
+TA1 - rtems_timer_create - RTEMS_INVALID_NAME
+TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY
+TA1 - rtems_timer_delete - local RTEMS_INVALID_ID
+TA1 - rtems_timer_delete - global RTEMS_INVALID_ID
+TA1 - rtems_timer_ident - RTEMS_INVALID_NAME
+TA1 - rtems_timer_cancel - RTEMS_INVALID_ID
+TA1 - rtems_timer_reset - RTEMS_INVALID_ID
+TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED
+TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID
+TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID
+TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
+TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_get - 00:00:00 01/01/1992
+TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
+*** END OF TEST 9 ***
diff --git a/testsuites/sptests/sp09/system.h b/testsuites/sptests/sp09/system.h
new file mode 100644
index 0000000000..f688cf729a
--- /dev/null
+++ b/testsuites/sptests/sp09/system.h
@@ -0,0 +1,139 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_routine(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_isr Service_routine(
+ rtems_vector_number ignored
+);
+
+rtems_timer_service_routine Io_during_interrupt(
+ rtems_id ignored
+);
+
+void Screen1( void );
+
+void Screen2( void );
+
+void Screen3( void );
+
+void Screen4( void );
+
+void Screen5( void );
+
+void Screen6( void );
+
+void Screen7( void );
+
+void Screen8( void );
+
+void Screen9( void );
+
+void Screen10( void );
+
+void Screen11( void );
+
+void Screen12( void );
+
+void Screen13( void );
+
+void Screen14( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES 2
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_REGIONS 1
+#define CONFIGURE_MAXIMUM_PERIODS 1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */
+
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+
+TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
+TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */
+
+TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */
+TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */
+
+TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
+TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */
+
+TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */
+TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */
+
+TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */
+TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */
+
+TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */
+TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */
+
+TEST_EXTERN rtems_id Junk_id; /* id used to return errors */
+
+#define Internal_port_area (void *) 0x00001000
+#define External_port_area (void *) 0x00002000
+
+TEST_EXTERN rtems_unsigned8 Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT;
+#define Partition_bad_area (void *) 0x00000006
+
+TEST_EXTERN rtems_unsigned32 Region_good_area[4096] CPU_STRUCTURE_ALIGNMENT;
+#define Region_bad_area (void *) 0x00000006
+#define REGION_START_OFFSET 1024
+#define REGION_LENGTH 512
+
+/* end of include file */
diff --git a/testsuites/sptests/sp09/task1.c b/testsuites/sptests/sp09/task1.c
new file mode 100644
index 0000000000..c9e40851cc
--- /dev/null
+++ b/testsuites/sptests/sp09/task1.c
@@ -0,0 +1,70 @@
+/* Task_1
+ *
+ * This task generates all possible errors for the RTEMS executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ Screen1();
+ rtems_test_pause_and_screen_number( 2 );
+
+ Screen2();
+ rtems_test_pause_and_screen_number( 3 );
+
+ Screen3();
+ rtems_test_pause_and_screen_number( 4 );
+
+ Screen4();
+ rtems_test_pause_and_screen_number( 5 );
+
+ Screen5();
+ rtems_test_pause_and_screen_number( 6 );
+
+ Screen6();
+ rtems_test_pause_and_screen_number( 7 );
+
+ Screen7();
+ rtems_test_pause_and_screen_number( 8 );
+
+ Screen8();
+ rtems_test_pause_and_screen_number( 9 );
+
+ Screen9();
+ rtems_test_pause_and_screen_number( 10 );
+
+ Screen10();
+ rtems_test_pause_and_screen_number( 11 );
+
+ Screen11();
+ rtems_test_pause_and_screen_number( 12 );
+
+ Screen12();
+ rtems_test_pause_and_screen_number( 13 );
+
+ Screen13();
+ rtems_test_pause_and_screen_number( 14 );
+
+ Screen14();
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp09/task2.c b/testsuites/sptests/sp09/task2.c
new file mode 100644
index 0000000000..e9bda81fa3
--- /dev/null
+++ b/testsuites/sptests/sp09/task2.c
@@ -0,0 +1,48 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Its only purpose is to generate the
+ * error where a semaphore is deleted while a task is waiting for it.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain waiting to be deleted"
+ );
+ puts(
+ "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED"
+ );
+
+ puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/testsuites/sptests/sp09/task3.c b/testsuites/sptests/sp09/task3.c
new file mode 100644
index 0000000000..3ec1b0162c
--- /dev/null
+++ b/testsuites/sptests/sp09/task3.c
@@ -0,0 +1,53 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Its only purpose in life is to
+ * generate the error where a message queue is deleted while a task
+ * is waiting there for a message.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+
+ puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_message_queue_receive waiting to be deleted"
+ );
+ puts(
+ "TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED"
+ );
+
+ puts( "TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA3" );
+}
diff --git a/testsuites/sptests/sp09/task4.c b/testsuites/sptests/sp09/task4.c
new file mode 100644
index 0000000000..73cd63373c
--- /dev/null
+++ b/testsuites/sptests/sp09/task4.c
@@ -0,0 +1,50 @@
+/* Task_4
+ *
+ * This routine serves as a test task. Its only purpose in life is to
+ * generate the error where a rate monotonic period is accessed by a
+ * task other than its creator.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_rate_monotonic_cancel not the owner"
+ );
+ puts( "TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_OWNER_OF_RESOURCE,
+ "rtems_rate_monotonic_period not the owner"
+ );
+ puts( "TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+ puts( "TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA4" );
+}
diff --git a/testsuites/sptests/sp11/init.c b/testsuites/sptests/sp11/init.c
new file mode 100644
index 0000000000..9524f3ff82
--- /dev/null
+++ b/testsuites/sptests/sp11/init.c
@@ -0,0 +1,92 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 11 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+ Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
+ Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' );
+ Timer_name[ 4 ] = rtems_build_name( 'T', 'M', '4', ' ' );
+ Timer_name[ 5 ] = rtems_build_name( 'T', 'M', '5', ' ' );
+ Timer_name[ 6 ] = rtems_build_name( 'T', 'M', '6', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create of TM1" );
+
+ status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] );
+ directive_failed( status, "rtems_timer_create of TM2" );
+
+ status = rtems_timer_create( Timer_name[ 3 ], &Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_create of TM3" );
+
+ status = rtems_timer_create( Timer_name[ 4 ], &Timer_id[ 4 ] );
+ directive_failed( status, "rtems_timer_create of TM4" );
+
+ status = rtems_timer_create( Timer_name[ 5 ], &Timer_id[ 5 ] );
+ directive_failed( status, "rtems_timer_create of TM5" );
+
+ status = rtems_timer_create( Timer_name[ 6 ], &Timer_id[ 6 ] );
+ directive_failed( status, "rtems_timer_create of TM6" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp11/sp11.doc b/testsuites/sptests/sp11/sp11.doc
new file mode 100644
index 0000000000..d88f5eb86d
--- /dev/null
+++ b/testsuites/sptests/sp11/sp11.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test11
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ ev_send, ev_receive
+ tm_wkafter, tm_set, tm_get
+
+concepts:
+
+ a. This test checks out the event manager along with the associated
+ event directives contained in the time manager.
diff --git a/testsuites/sptests/sp11/sp11.scn b/testsuites/sptests/sp11/sp11.scn
new file mode 100644
index 0000000000..db0469eb60
--- /dev/null
+++ b/testsuites/sptests/sp11/sp11.scn
@@ -0,0 +1,74 @@
+*** TEST 11 ***
+TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_14 and RTEMS_EVENT_15
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16
+TA2 - RTEMS_EVENT_16 received - eventout => 00010000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1
+TA2 - rtems_event_receive - RTEMS_EVENT_17 or RTEMS_EVENT_18 - forever and ANY
+TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => 0000c000
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2
+TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14
+TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => 00040000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1
+TA2 - rtems_clock_set - 08:15:00 02/12/1988
+TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 4 seconds
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10
+TA1 - RTEMS_EVENT_14 received - eventout => 00004000
+TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2
+TA1 - rtems_clock_get - 08:15:00 02/12/1988
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18
+TA2 - RTEMS_EVENT_10 received - eventout => 00000400
+TA2 - rtems_clock_get - 08:15:05 02/12/1988
+TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS
+TA2 - eventout => 00080000
+TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT
+TA2 - RTEMS_EVENT_19 received - eventout => 00080000
+TA2 - rtems_task_delete - deletes self
+TA1 - RTEMS_EVENT_18 received - eventout => 00040000
+TA1 - rtems_clock_get - 08:15:05 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_3 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY
+TA1 - RTEMS_EVENT_3 received - eventout => 00000008
+TA1 - rtems_event_send - send RTEMS_EVENT_4 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY
+TA1 - RTEMS_EVENT_4 received - eventout => 00000010
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18
+TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_1 every second
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:01 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:02 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:03 02/12/1988
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1
+<pause>
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 08:15:03 02/15/1988
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11
+TA1 - RTEMS_EVENT_11 received - eventout => 00000800
+<pause>
+TA1 - rtems_event_send/rtems_event_receive combination
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_receive all outstanding events
+TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 07:15:00 02/12/1988
+TA1 - set time backwards
+TA1 - no events received
+TA1 - rtems_clock_set - 07:15:00 02/14/1988
+TA1 - set time forwards (leave a timer)
+TA1 - RTEMS_EVENT_10 received
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks
+*** END OF TEST 11 ***
diff --git a/testsuites/sptests/sp11/system.h b/testsuites/sptests/sp11/system.h
new file mode 100644
index 0000000000..983ed077b5
--- /dev/null
+++ b/testsuites/sptests/sp11/system.h
@@ -0,0 +1,88 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine TA1_send_18_to_self_5_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_8_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_9_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_1_to_self_every_second(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA1_send_11_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_timer_service_routine TA2_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 6
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 7 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 7 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp11/task1.c b/testsuites/sptests/sp11/task1.c
new file mode 100644
index 0000000000..6384789b43
--- /dev/null
+++ b/testsuites/sptests/sp11/task1.c
@@ -0,0 +1,410 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the event maager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting forever on "
+ "RTEMS_EVENT_14 and RTEMS_EVENT_15"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14 | RTEMS_EVENT_15,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 );
+ directive_failed( status, "rtems_event_send" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_18,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 18" );
+ printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08x\n", eventout );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "TA1 rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_3 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_3 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - RTEMS_EVENT_3 or "
+ "RTEMS_EVENT_22 - NO_WAIT and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_3 | RTEMS_EVENT_22,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 3 and 22" );
+ printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts (
+ "TA1 - rtems_event_receive - RTEMS_EVENT_4 or "
+ "RTEMS_EVENT_5 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_4 | RTEMS_EVENT_5,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08x\n", eventout );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_8_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 2 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_9_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts(
+ "TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds"
+ );
+ status = rtems_timer_fire_after(
+ Timer_id[ 3 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_1 every second" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ TICKS_PER_SECOND,
+ TA1_send_1_to_self_every_second,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 1 second" );
+
+ for ( index = 0; index < 3; index++ ) {
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_1,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08x - ", eventout );
+ print_time( "at ", &time, "\n" );
+
+ if ( index < 2 ) {
+ status = rtems_timer_reset( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_reset" );
+ };
+
+ }
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+rtems_test_pause();
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 7;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 8; /* so code below has correct time/date */
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_cancel( Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ time.day = 15;
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA1 rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08x\n", eventout );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_event_send/rtems_event_receive combination" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 10,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 10 ticks" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_receive all outstanding events" );
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ 0,
+ &eventout
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ build_time( &time, 2, 12, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time backwards" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout ) printf( "ERROR -0x%08x events received\n", eventout );
+ else puts( "TA1 - no events received" );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ build_time( &time, 2, 14, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time forwards (leave a timer)" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" );
+ else printf( "ERROR -0x%08x events received\n", eventout );
+ directive_failed( status, "rtems_event_receive all events" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 100,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 100 ticks" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 200,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 200 ticks" );
+
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp11/task2.c b/testsuites/sptests/sp11/task2.c
new file mode 100644
index 0000000000..d5ac476dac
--- /dev/null
+++ b/testsuites/sptests/sp11/task2.c
@@ -0,0 +1,126 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Multiple tasks are required to
+ * verify all capabilities of the event manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout );
+
+ puts(
+ "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1"
+ );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA2 - rtems_event_receive - RTEMS_EVENT_17 or "
+ "RTEMS_EVENT_18 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_17 | RTEMS_EVENT_18,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 );
+ directive_failed( status, "rtems_event_send" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+ print_time( "TA2 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA2 rtems_clock_set" );
+
+ time.second += 4;
+ puts(
+ "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 4 seconds"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 5 ],
+ &time,
+ TA2_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when after 4 seconds" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_10,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout );
+ print_time( "TA2 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" );
+ status = rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_19,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_task_delete - deletes self" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/testsuites/sptests/sp11/timer.c b/testsuites/sptests/sp11/timer.c
new file mode 100644
index 0000000000..3ec11b7345
--- /dev/null
+++ b/testsuites/sptests/sp11/timer.c
@@ -0,0 +1,97 @@
+/* Timer_functions
+ *
+ * These routines are the timer service routines used by this test.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine TA1_send_18_to_self_5_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send of 18" );
+}
+
+rtems_timer_service_routine TA1_send_8_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_8 );
+ directive_failed( status, "rtems_event_send of 8" );
+}
+
+rtems_timer_service_routine TA1_send_9_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_9 );
+ directive_failed( status, "rtems_event_send of 9" );
+}
+
+rtems_timer_service_routine TA1_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}
+
+rtems_timer_service_routine TA1_send_1_to_self_every_second(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_1 );
+ directive_failed( status, "rtems_event_send of 1" );
+}
+
+rtems_timer_service_routine TA1_send_11_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_11 );
+ directive_failed( status, "rtems_event_send of 11" );
+}
+
+rtems_timer_service_routine TA2_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}
diff --git a/testsuites/sptests/sp12/init.c b/testsuites/sptests/sp12/init.c
new file mode 100644
index 0000000000..159382ca94
--- /dev/null
+++ b/testsuites/sptests/sp12/init.c
@@ -0,0 +1,179 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 12 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
+ Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
+ Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
+ Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
+ Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
+
+ Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+ Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
+ Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 3 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM3" );
+
+ puts( "INIT - Forward priority queue test" );
+ Priority_test_driver( 0 );
+
+ puts( "INIT - Backward priority queue test" );
+ Priority_test_driver( 32 );
+
+rtems_test_pause();
+
+ puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ Priority_test_driver( 64 );
+
+rtems_test_pause();
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority SM2" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp12/pridrv.c b/testsuites/sptests/sp12/pridrv.c
new file mode 100644
index 0000000000..7d6e1f9dc4
--- /dev/null
+++ b/testsuites/sptests/sp12/pridrv.c
@@ -0,0 +1,131 @@
+/* Priority_test_driver
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * priority_base - priority_base switch
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Priority_test_driver(
+ rtems_unsigned32 priority_base
+)
+{
+ rtems_task_priority previous_priority;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ switch ( index ) {
+ case 1:
+ case 2:
+ case 3:
+ Task_priority[ index ] = priority_base + index;
+ break;
+ default:
+ Task_priority[ index ] = priority_base + 3;
+ break;
+ }
+
+ status = rtems_task_create(
+ Priority_task_name[ index ],
+ Task_priority[ index ],
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Priority_task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ }
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+ } else {
+ for ( index = 5 ; index >= 1 ; index-- ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after loop" );
+
+ if ( priority_base == 64 ) {
+ if ( index == 4 ) {
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ priority_base + 4,
+ &previous_priority
+ );
+ printf( "PDRV - change priority of PRI5 from %d to %d\n",
+ previous_priority,
+ priority_base + 4
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority" );
+ }
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ RTEMS_CURRENT_PRIORITY,
+ &previous_priority
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority CURRENT" );
+ printf( "PDRV - priority of PRI5 is %d\n", previous_priority );
+ }
+ }
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after after loop" );
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release loop" );
+ }
+ }
+
+ if ( priority_base == 64 ) {
+ puts( "PDRV - rtems_task_resume - PRI5" );
+ status = rtems_task_resume( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_resume" );
+
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after so PRI5 can run" );
+
+ status = rtems_task_delete( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_delete of PRI5" );
+ }
+ else {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+ }
+}
diff --git a/testsuites/sptests/sp12/pritask.c b/testsuites/sptests/sp12/pritask.c
new file mode 100644
index 0000000000..155ef345cd
--- /dev/null
+++ b/testsuites/sptests/sp12/pritask.c
@@ -0,0 +1,91 @@
+/* Priority_task
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * its_index - priority index
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Priority_task(
+ rtems_task_argument its_index
+)
+{
+ rtems_interval timeout;
+ rtems_task_priority its_priority;
+ rtems_task_priority current_priority;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ its_priority = Task_priority[ its_index ];
+
+ if ( its_priority < 3 )
+ timeout = 5 * TICKS_PER_SECOND;
+ else
+ timeout = RTEMS_NO_TIMEOUT;
+
+ put_name( Priority_task_name[ its_index ], FALSE );
+ puts( " - rtems_semaphore_obtain - wait forever on SM2" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+
+ if ( its_priority < 64 ) {
+ printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority );
+ exit( 0 );
+ }
+
+ if ( its_index == 5 )
+ puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" );
+ for ( index = 1 ; index < 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+
+ puts( "PRI5 - rtems_semaphore_obtain - nested" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain nested" );
+
+ puts( "PRI5 - rtems_semaphore_release - nested" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release nested " );
+
+ puts( "PRI5 - rtems_semaphore_release - restore priority" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &current_priority
+ );
+ directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" );
+ printf( "PRI5 - priority of PRI5 is %d\n", current_priority );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
diff --git a/testsuites/sptests/sp12/sp12.doc b/testsuites/sptests/sp12/sp12.doc
new file mode 100644
index 0000000000..fc19d92ed7
--- /dev/null
+++ b/testsuites/sptests/sp12/sp12.doc
@@ -0,0 +1,27 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test12
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ sm_create, sm_ident, sm_delete, sm_p, sm_v, tm_wkafter, t_setpri
+
+concepts:
+
+ a. This test checks out the semaphore manager.
+
+ b. This test forces _Flush_taskq() to unblock a task waiting
+ on a deleted object.
diff --git a/testsuites/sptests/sp12/sp12.scn b/testsuites/sptests/sp12/sp12.scn
new file mode 100644
index 0000000000..e87a729259
--- /dev/null
+++ b/testsuites/sptests/sp12/sp12.scn
@@ -0,0 +1,78 @@
+*** TEST 12 ***
+INIT - Forward priority queue test
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+INIT - Backward priority queue test
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+INIT - Binary Semaphore and Priority Inheritance Test
+INIT - rtems_semaphore_create - allocated binary semaphore
+INIT - rtems_semaphore_release - allocated binary semaphore
+INIT - rtems_semaphore_delete - allocated binary semaphore
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_task_suspend - until all priority tasks blocked
+PDRV - priority of PRI5 is 67
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - change priority of PRI5 from 67 to 68
+PDRV - priority of PRI5 is 67
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 67
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 66
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 65
+PDRV - rtems_task_resume - PRI5
+PRI5 - rtems_task_delete - all tasks waiting on SM2
+PRI5 - rtems_semaphore_obtain - nested
+PRI5 - rtems_semaphore_release - nested
+PRI5 - rtems_semaphore_release - restore priority
+PRI5 - priority of PRI5 is 68
+<pause>
+TA1 - rtems_semaphore_ident - smid => 14010002
+TA1 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM2
+TA1 - rtems_semaphore_obtain - wait forever on SM3
+TA1 - got SM3
+TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT
+TA1 - got SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_semaphore_obtain - wait forever on SM1
+TA3 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout
+TA2 - got SM1
+TA2 - rtems_semaphore_release - release SM1
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM1
+TA1 - rtems_semaphore_release - release SM2
+TA2 - got SM2
+TA2 - rtems_semaphore_release - release SM2
+TA2 - rtems_task_delete - delete self
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - got SM2
+TA3 - rtems_semaphore_release - release SM2
+TA3 - rtems_semaphore_obtain - wait forever on SM3
+<pause>
+TA1 - rtems_task_delete - delete TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA4 - rtems_semaphore_obtain - wait forever on SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_task_delete - delete TA4
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA5 - got SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_semaphore_delete - delete SM1
+TA1 - rtems_semaphore_delete - delete SM3
+TA1 - rtems_task_delete - delete self
+TA5 - SM1 deleted by TA1
+*** END OF TEST 12 ***
diff --git a/testsuites/sptests/sp12/system.h b/testsuites/sptests/sp12/system.h
new file mode 100644
index 0000000000..81af1abbd9
--- /dev/null
+++ b/testsuites/sptests/sp12/system.h
@@ -0,0 +1,80 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void Priority_test_driver(
+ rtems_unsigned32 priority_base
+);
+
+rtems_task Priority_task(
+ rtems_task_argument its_index
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_task Task5(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
+#define CONFIGURE_MAXIMUM_SEMAPHORES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Priority_task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Priority_task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN rtems_task_priority Task_priority[ 6 ];
+
+TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */
+TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp12/task1.c b/testsuites/sptests/sp12/task1.c
new file mode 100644
index 0000000000..ab133cc782
--- /dev/null
+++ b/testsuites/sptests/sp12/task1.c
@@ -0,0 +1,153 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id smid;
+ rtems_status_code status;
+
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &smid
+ );
+ printf( "TA1 - rtems_semaphore_ident - smid => %08x\n", smid );
+ directive_failed( status, "rtems_semaphore_ident of SM1" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+ puts( "TA1 - got SM2" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM3" );
+ puts( "TA1 - got SM3" );
+
+ puts( "TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release of SM1" );
+
+ puts(
+ "TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout"
+ );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_task_delete - delete TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], Task5, 0 );
+ directive_failed( status, "rtems_task_start of TA5" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA4" );
+ status = rtems_task_delete( Task_id[ 4 ] );
+ directive_failed( status, "rtems_task_delete of TA4" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM1" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM3" );
+ status = rtems_semaphore_delete( Semaphore_id[ 3 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM3" );
+
+ puts( "TA1 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA1" );
+}
diff --git a/testsuites/sptests/sp12/task2.c b/testsuites/sptests/sp12/task2.c
new file mode 100644
index 0000000000..41d6735162
--- /dev/null
+++ b/testsuites/sptests/sp12/task2.c
@@ -0,0 +1,65 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It simply obtains semaphores
+ * 1 and 2, the later when it is a high priority task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM1" );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority on TA2" );
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM2" );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA2 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/testsuites/sptests/sp12/task3.c b/testsuites/sptests/sp12/task3.c
new file mode 100644
index 0000000000..7340b84ce6
--- /dev/null
+++ b/testsuites/sptests/sp12/task3.c
@@ -0,0 +1,50 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply obtains semaphore
+ * 2 and waits forever attempting to obtain semaphore 3.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+ puts( "TA3 - got SM2" );
+
+ puts( "TA3 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM3" );
+}
diff --git a/testsuites/sptests/sp12/task4.c b/testsuites/sptests/sp12/task4.c
new file mode 100644
index 0000000000..9a0e952613
--- /dev/null
+++ b/testsuites/sptests/sp12/task4.c
@@ -0,0 +1,37 @@
+/* Task_4
+ *
+ * This routine serves as a test task. It waits forever attempting
+ * to obtain semaphore 1. However, it should never get the semaphore!
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA4 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+}
diff --git a/testsuites/sptests/sp12/task5.c b/testsuites/sptests/sp12/task5.c
new file mode 100644
index 0000000000..ccf10cd11a
--- /dev/null
+++ b/testsuites/sptests/sp12/task5.c
@@ -0,0 +1,55 @@
+/* Task5
+ *
+ * This routine serves as a test task. It obtains semaphore 1 correctly
+ * once, then waits for semaphore 1 again. Task 1 should delete the
+ * semaphore, thus waking this task up.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task5(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+ puts( "TA5 - got SM1" );
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain on SM1"
+ );
+ puts( "TA5 - SM1 deleted by TA1" );
+
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp13/fillbuff.c b/testsuites/sptests/sp13/fillbuff.c
new file mode 100644
index 0000000000..43ccd86803
--- /dev/null
+++ b/testsuites/sptests/sp13/fillbuff.c
@@ -0,0 +1,31 @@
+/* Fill_buffer
+ *
+ * This test routine copies a given source string to a given destination
+ * buffer.
+ *
+ * Input parameters:
+ * source - pointer to string to be copied
+ * buffer - pointer to message buffer to be filled
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Fill_buffer(
+ char *source,
+ long *buffer
+)
+{
+ memcpy( buffer, source, 16 );
+}
diff --git a/testsuites/sptests/sp13/init.c b/testsuites/sptests/sp13/init.c
new file mode 100644
index 0000000000..9a778f2fff
--- /dev/null
+++ b/testsuites/sptests/sp13/init.c
@@ -0,0 +1,112 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 13 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ Queue_name[ 1 ] = rtems_build_name( 'Q', '1', ' ', ' ' );
+ Queue_name[ 2 ] = rtems_build_name( 'Q', '2', ' ', ' ' );
+ Queue_name[ 3 ] = rtems_build_name( 'Q', '3', ' ', ' ' );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 2 ],
+ 10,
+ 16,
+ RTEMS_PRIORITY,
+ &Queue_id[ 2 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q2" );
+
+ status = rtems_message_queue_create(
+ Queue_name[ 3 ],
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 3 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp13/putbuff.c b/testsuites/sptests/sp13/putbuff.c
new file mode 100644
index 0000000000..ed75a54fa4
--- /dev/null
+++ b/testsuites/sptests/sp13/putbuff.c
@@ -0,0 +1,29 @@
+/* Put_buffer
+ *
+ * This test routine prints the given buffer.
+ * buffer.
+ *
+ * Input parameters:
+ * buffer - pointer to message buffer to be printer
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Put_buffer(
+ long *buffer
+)
+{
+ printf( "%16s", (char *)buffer );
+}
diff --git a/testsuites/sptests/sp13/sp13.doc b/testsuites/sptests/sp13/sp13.doc
new file mode 100644
index 0000000000..4a0c9d24a0
--- /dev/null
+++ b/testsuites/sptests/sp13/sp13.doc
@@ -0,0 +1,25 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test13
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ q_create, q_ident, q_delete, q_send, q_urgent, q_broadcast, q_receive,
+ tm_wkafter, t_setpri
+
+concepts:
+
+ a. This test checks out the message manager.
diff --git a/testsuites/sptests/sp13/sp13.scn b/testsuites/sptests/sp13/sp13.scn
new file mode 100644
index 0000000000..11adfb8eb3
--- /dev/null
+++ b/testsuites/sptests/sp13/sp13.scn
@@ -0,0 +1,72 @@
+*** TEST 13 ***
+TA1 - rtems_message_queue_ident - qid => 18010001
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT
+TA2 - buffer received: BUFFER 1 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER
+TA2 - buffer received: BUFFER 2 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER
+TA3 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+<pause>
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2
+TA2 - buffer received: BUFFER 1 TO Q 2
+TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2
+TA2 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout
+TA1 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout
+TA3 - buffer received: BUFFER 2 TO Q 2
+TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA3 - number of tasks awakened = 02
+TA3 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 1
+TA1 - rtems_task_delete - delete TA2
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - buffer received: BUFFER 1 TO Q 3
+TA3 - rtems_task_delete - delete self
+<pause>
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3
+TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 5 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 4 TO Q 3
+TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 2
+<pause>
+TA1 - rtems_message_queue_delete - delete queue 1
+TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - rtems_message_queue_delete - delete queue 2
+TA1 - rtems_message_queue_flush - empty Q 3
+TA1 - 0 messages were flushed from Q 3
+TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3
+TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3
+TA1 - rtems_message_queue_flush - Q 3
+TA1 - 3 messages were flushed from Q 3
+TA1 - rtems_message_queue_send until all message buffers consumed
+TA1 - all message buffers consumed
+TA1 - rtems_message_queue_flush - Q 3
+TA1 - 100 messages were flushed from Q 3
+<pause>
+TA1 - create message queue of 20 bytes on queue 1
+TA1 - rtems_message_queue_delete - delete queue 1
+<pause>
+TA1 - rtems_message_queue_create - variable sizes
+TA1 - rtems_message_queue_create and send - variable sizes
+*** END OF TEST 13 ***
diff --git a/testsuites/sptests/sp13/system.h b/testsuites/sptests/sp13/system.h
new file mode 100644
index 0000000000..cb4b81bb63
--- /dev/null
+++ b/testsuites/sptests/sp13/system.h
@@ -0,0 +1,66 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void Fill_buffer(
+ char source[],
+ long *buffer
+);
+
+void Put_buffer(
+ long *buffer
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Queue_id[ 4 ]; /* array of queue ids */
+TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp13/task1.c b/testsuites/sptests/sp13/task1.c
new file mode 100644
index 0000000000..e84bfc5b2e
--- /dev/null
+++ b/testsuites/sptests/sp13/task1.c
@@ -0,0 +1,344 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the message manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include <string.h> /* for memcmp */
+
+extern rtems_configuration_table BSP_Configuration;
+
+char big_send_buffer[2048];
+char big_receive_buffer[2048];
+
+long buffer[ 4 ];
+
+void dope_buffer(unsigned char *buff,
+ int buff_size,
+ unsigned32 v)
+{
+ int i;
+ unsigned char ch;
+
+ ch = (' ' + (v % (0x7f - ' ')));
+
+ for (i=0; i<buff_size; i++)
+ {
+ *buff++ = ch++;
+ if (ch >= 0x7f)
+ ch = ' ';
+ }
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id qid;
+ rtems_unsigned32 index;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+ rtems_unsigned32 size;
+ rtems_unsigned32 queue_size;
+ char *cp;
+
+ status = rtems_message_queue_ident(
+ Queue_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &qid
+ );
+ printf( "TA1 - rtems_message_queue_ident - qid => %08x\n", qid );
+ directive_failed( status, "rtems_message_queue_ident" );
+
+ Fill_buffer( "BUFFER 1 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 2 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Fill_buffer( "BUFFER 3 TO Q 1", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1" );
+ status = rtems_message_queue_send( Queue_id[ 1 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ Fill_buffer( "BUFFER 1 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2" );
+ status = rtems_message_queue_send( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts_nocr( "TA1 - rtems_message_queue_receive - receive from queue 1 - " );
+ puts ( "10 second timeout" );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA1 - rtems_task_delete - delete TA2" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete" );
+
+ Fill_buffer( "BUFFER 1 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ Fill_buffer( "BUFFER 2 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 3 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 4 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 5 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3" );
+ status = rtems_message_queue_urgent( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ for ( index = 1 ; index <= 4 ; index++ ) {
+ puts(
+ "TA1 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+ }
+
+ Fill_buffer( "BUFFER 3 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" );
+ status = rtems_message_queue_urgent( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts(
+ "TA1 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA1 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 1" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+ Fill_buffer( "BUFFER 3 TO Q 2", buffer );
+ puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" );
+ status = rtems_message_queue_urgent( Queue_id[ 2 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_urgent" );
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 2" );
+ status = rtems_message_queue_delete( Queue_id[ 2 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+ puts( "TA1 - rtems_message_queue_flush - empty Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+ Fill_buffer( "BUFFER 1 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 2 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Fill_buffer( "BUFFER 3 TO Q 3", buffer );
+ puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts( "TA1 - rtems_message_queue_flush - Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+ puts( "TA1 - rtems_message_queue_send until all message buffers consumed" );
+ while ( FOREVER ) {
+ status = rtems_message_queue_send( Queue_id[ 3 ], buffer, 16 );
+ if ( status == RTEMS_TOO_MANY ) break;
+ directive_failed( status, "rtems_message_queue_send loop" );
+ }
+
+ puts( "TA1 - all message buffers consumed" );
+ puts( "TA1 - rtems_message_queue_flush - Q 3" );
+ status = rtems_message_queue_flush( Queue_id[ 3 ], &count );
+ printf( "TA1 - %d messages were flushed from Q 3\n", count );
+
+rtems_test_pause();
+
+ puts( "TA1 - create message queue of 20 bytes on queue 1" );
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 100,
+ 20,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ directive_failed( status, "rtems_message_queue_create of Q1; 20 bytes each" );
+ status = rtems_message_queue_send( Queue_id[ 3 ], big_send_buffer, 40 );
+ fatal_directive_status(status, RTEMS_INVALID_SIZE, "expected RTEMS_INVALID_SIZE");
+
+ puts( "TA1 - rtems_message_queue_delete - delete queue 1" );
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_message_queue_create - variable sizes " );
+ for (queue_size = 1; queue_size < 1030; queue_size++)
+ {
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2, /* just 2 msgs each */
+ queue_size,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ printf("TA1 - msq que size: %d\n", queue_size);
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+ }
+
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "TA1 - rtems_message_queue_create and send - variable sizes " );
+ for (queue_size = 1; queue_size < 1030; queue_size++)
+ {
+ /* printf("TA1 - message queue size: %d\n", queue_size); */
+
+ status = rtems_message_queue_create(
+ Queue_name[ 1 ],
+ 2, /* just 2 msgs each */
+ queue_size,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id[ 1 ]
+ );
+
+ directive_failed( status, "rtems_message_queue_create of Q1" );
+
+ dope_buffer(big_send_buffer, sizeof(big_send_buffer), queue_size);
+ memset(big_receive_buffer, 'Z', sizeof(big_receive_buffer));
+
+ /* send a msg too big */
+ status = rtems_message_queue_send( Queue_id[ 1 ],
+ big_send_buffer,
+ queue_size + 1 );
+
+ fatal_directive_status(status,
+ RTEMS_INVALID_SIZE,
+ "rtems_message_queue_send too large");
+
+ /* send a msg that is just right */
+ status = rtems_message_queue_send(Queue_id[ 1 ],
+ big_send_buffer,
+ queue_size);
+ directive_failed(status, "rtems_message_queue_send exact size");
+
+ /* now read and verify the message just sent */
+ status = rtems_message_queue_receive(Queue_id[ 1 ],
+ big_receive_buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 1 * TICKS_PER_SECOND);
+ directive_failed(status, "rtems_message_queue_receive exact size");
+ if (size != queue_size)
+ {
+ puts("TA1 - exact size size match failed");
+ exit(1);
+ }
+
+ if (memcmp(big_send_buffer, big_receive_buffer, size) != 0)
+ {
+ puts("TA1 - exact size data match failed");
+ exit(1);
+ }
+
+ for (cp = (big_receive_buffer + size);
+ cp < (big_receive_buffer + sizeof(big_receive_buffer));
+ cp++)
+ if (*cp != 'Z')
+ {
+ puts("TA1 - exact size overrun match failed");
+ exit(1);
+ }
+
+ /* all done with this one; delete it */
+ status = rtems_message_queue_delete( Queue_id[ 1 ] );
+ directive_failed( status, "rtems_message_queue_delete" );
+ }
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp13/task2.c b/testsuites/sptests/sp13/task2.c
new file mode 100644
index 0000000000..1541d6c8bd
--- /dev/null
+++ b/testsuites/sptests/sp13/task2.c
@@ -0,0 +1,139 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Multiple tasks are required to
+ * verify all message manager capabilities.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer );
+ puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer, 16 );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 1 - "
+ "10 second timeout"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts(
+ "TA2 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA2 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+}
diff --git a/testsuites/sptests/sp13/task3.c b/testsuites/sptests/sp13/task3.c
new file mode 100644
index 0000000000..f86f91a463
--- /dev/null
+++ b/testsuites/sptests/sp13/task3.c
@@ -0,0 +1,78 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Its major function is to
+ * broadcast a messge to all the other tasks.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ long buffer[ 4 ];
+ rtems_unsigned32 size;
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ puts(
+ "TA3 - rtems_message_queue_receive - receive from queue 2 - "
+ "RTEMS_WAIT FOREVER"
+ );
+ status = rtems_message_queue_receive(
+ Queue_id[ 2 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA3 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer );
+ puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" );
+ status = rtems_message_queue_broadcast(
+ Queue_id[ 1 ],
+ (long (*)[4])buffer,
+ 16,
+ &count
+ );
+ printf( "TA3 - number of tasks awakened = %02d\n", count );
+ puts(
+ "TA3 - rtems_message_queue_receive - receive from queue 3 - "
+ "RTEMS_WAIT FOREVER"
+ );
+
+ status = rtems_message_queue_receive(
+ Queue_id[ 3 ],
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_message_queue_receive" );
+ puts_nocr( "TA3 - buffer received: " );
+ Put_buffer( buffer );
+ new_line;
+
+ puts( "TA3 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c
new file mode 100644
index 0000000000..af7e212877
--- /dev/null
+++ b/testsuites/sptests/sp14/asr.c
@@ -0,0 +1,47 @@
+/* Process_asr
+ *
+ * This is the asynchronous signal routine (asr) for task 1.
+ * It demonstrates that ASRs can block execute and block.
+ *
+ * Input parameters:
+ * the_signal_set - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set the_signal_set
+)
+{
+ rtems_status_code status;
+
+ printf( "ASR - ENTRY - signal => %08x\n", the_signal_set );
+ switch( the_signal_set ) {
+ case RTEMS_SIGNAL_16:
+ case RTEMS_SIGNAL_17:
+ case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19:
+ break;
+ case RTEMS_SIGNAL_0:
+ case RTEMS_SIGNAL_1:
+ puts( "ASR - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after yield" );
+ break;
+ case RTEMS_SIGNAL_3:
+ Asr_fired = TRUE;
+ break;
+ }
+ printf( "ASR - EXIT - signal => %08x\n", the_signal_set );
+}
diff --git a/testsuites/sptests/sp14/init.c b/testsuites/sptests/sp14/init.c
new file mode 100644
index 0000000000..dd3a593229
--- /dev/null
+++ b/testsuites/sptests/sp14/init.c
@@ -0,0 +1,72 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 14 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create of TM1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp14/sp14.doc b/testsuites/sptests/sp14/sp14.doc
new file mode 100644
index 0000000000..16aa420183
--- /dev/null
+++ b/testsuites/sptests/sp14/sp14.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test14
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ as_catch, as_return, as_send, tm_wkafter
+
+concepts:
+
+ a. This test checks out the signal manager.
diff --git a/testsuites/sptests/sp14/sp14.scn b/testsuites/sptests/sp14/sp14.scn
new file mode 100644
index 0000000000..31e6d067d2
--- /dev/null
+++ b/testsuites/sptests/sp14/sp14.scn
@@ -0,0 +1,33 @@
+*** TEST 14 ***
+TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )
+TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self
+ASR - ENTRY - signal => 00010000
+ASR - EXIT - signal => 00010000
+TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self
+ASR - ENTRY - signal => 00000001
+ASR - rtems_task_wake_after - yield processor
+TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1
+TA2 - rtems_task_wake_after - yield processor
+ASR - ENTRY - signal => 00020000
+ASR - EXIT - signal => 00020000
+ASR - EXIT - signal => 00000001
+TA1 - rtems_signal_catch - RTEMS_NO_ASR
+<pause>
+TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self
+ASR - ENTRY - signal => 00000002
+ASR - rtems_task_wake_after - yield processor
+TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1
+TA2 - rtems_task_wake_after - yield processor
+ASR - EXIT - signal => 00000002
+ASR - ENTRY - signal => 000c0000
+ASR - EXIT - signal => 000c0000
+TA1 - rtems_task_mode - disable ASRs
+TA1 - sending signal to RTEMS_SELF from timer
+TA1 - waiting for signal to arrive
+TA1 - timer routine got the correct arguments
+TA1 - rtems_task_mode - enable ASRs
+ASR - ENTRY - signal => 00000008
+ASR - EXIT - signal => 00000008
+TA1 - rtems_signal_catch - asraddr of NULL
+TA1 - rtems_task_delete - delete self
+*** END OF TEST 14 ***
diff --git a/testsuites/sptests/sp14/system.h b/testsuites/sptests/sp14/system.h
new file mode 100644
index 0000000000..7193f893f2
--- /dev/null
+++ b/testsuites/sptests/sp14/system.h
@@ -0,0 +1,76 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Signal_3_to_task_1(
+ rtems_id id,
+ void *pointer
+);
+
+rtems_asr Process_asr(
+ rtems_signal_set the_signal_set
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */
+
+TEST_EXTERN volatile rtems_unsigned32 Signals_sent;
+ /* set to TRUE to indicate that a */
+ /* signal set has been sent from */
+ /* an ISR to the executing task */
+
+TEST_EXTERN volatile rtems_unsigned32 Asr_fired;
+ /* set to TRUE to indicate that the */
+ /* RTEMS_ASR has executed and was */
+ /* passed the correct signal set */
+
+TEST_EXTERN volatile rtems_id Timer_got_this_id;
+
+TEST_EXTERN volatile void *Timer_got_this_pointer;
+
+/* end of include file */
diff --git a/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c
new file mode 100644
index 0000000000..50dff2b9d8
--- /dev/null
+++ b/testsuites/sptests/sp14/task1.c
@@ -0,0 +1,116 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It establishes an RTEMS_ASR and
+ * sends signal to itself to determine if the RTEMS_ASR gets to execute.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Signal_3_to_task_1(
+ rtems_id id,
+ void *pointer
+)
+{
+ rtems_status_code status;
+
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 );
+ directive_failed( status, "rtems_signal_send of 3" );
+
+ Timer_got_this_id = id;
+ Timer_got_this_pointer = pointer;
+
+ Signals_sent = TRUE;
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+ puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
+ status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
+ directive_failed( status, "rtems_signal_catch" );
+
+rtems_test_pause();
+
+ puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
+ status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA1 - rtems_task_mode - disable ASRs" );
+ status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ Timer_got_this_id = 0;
+ Timer_got_this_pointer = NULL;
+
+ puts( "TA1 - sending signal to RTEMS_SELF from timer" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ TICKS_PER_SECOND / 2,
+ Signal_3_to_task_1,
+ Task_1
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - waiting for signal to arrive" );
+
+ Signals_sent = FALSE;
+ Asr_fired = FALSE;
+
+ while ( Signals_sent == FALSE )
+ ;
+
+ if ( Timer_got_this_id == Timer_id[ 1 ] &&
+ Timer_got_this_pointer == Task_1 )
+ puts( "TA1 - timer routine got the correct arguments" );
+ else
+ printf(
+ "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n",
+ Timer_got_this_id,
+ Timer_got_this_pointer,
+ Timer_id[ 1 ],
+ Task_1
+ );
+
+ puts( "TA1 - rtems_task_mode - enable ASRs" );
+ status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
+ status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp14/task2.c b/testsuites/sptests/sp14/task2.c
new file mode 100644
index 0000000000..bf1e7cc224
--- /dev/null
+++ b/testsuites/sptests/sp14/task2.c
@@ -0,0 +1,48 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It verifies that one task can
+ * send signals to another task ( invoking the other task's RTEMS_ASR ).
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" );
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_17 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA2 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1");
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 );
+ directive_failed( status, "rtems_signal_send" );
+
+ puts( "TA2 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 14 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp15/init.c b/testsuites/sptests/sp15/init.c
new file mode 100644
index 0000000000..7c4d301e45
--- /dev/null
+++ b/testsuites/sptests/sp15/init.c
@@ -0,0 +1,78 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 15 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
+ Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ puts("INIT - rtems_partition_create - partition 1");
+ status = rtems_partition_create(
+ Partition_name[ 1 ],
+ Area_1,
+ 4096,
+ 512,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 1 ]
+ );
+ directive_failed( status, "rtems_partition_create of PT1" );
+
+ puts("INIT - rtems_partition_create - partition 2");
+ status = rtems_partition_create(
+ Partition_name[ 2 ],
+ Area_2,
+ 274,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id[ 2 ]
+ );
+ directive_failed( status, "rtems_partition_create of PT2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp15/sp15.doc b/testsuites/sptests/sp15/sp15.doc
new file mode 100644
index 0000000000..3ec20ae92b
--- /dev/null
+++ b/testsuites/sptests/sp15/sp15.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test15
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ pt_create, pt_ident, pt_getbuf, pt_retbuf, pt_delete
+
+concepts:
+
+ a. This test checks out the partition manager.
diff --git a/testsuites/sptests/sp15/sp15.scn b/testsuites/sptests/sp15/sp15.scn
new file mode 100644
index 0000000000..f1a800dc0d
--- /dev/null
+++ b/testsuites/sptests/sp15/sp15.scn
@@ -0,0 +1,16 @@
+*** TEST 15 ***
+INIT - rtems_partition_create - partition 1
+INIT - rtems_partition_create - partition 2
+TA1 - rtems_partition_ident - partition 1 id = 1c010001
+TA1 - rtems_partition_ident - partition 2 id = 1c010002
+TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - 0x00000000
+TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - 0x00000200
+TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - 0x00000000
+TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - 0x00000080
+TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - 0x00000000
+TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - 0x00000200
+TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - 0x00000000
+TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - 0x00000080
+TA1 - rtems_partition_delete - delete partition 1
+TA1 - rtems_partition_delete - delete partition 2
+*** END OF TEST 15 ***
diff --git a/testsuites/sptests/sp15/system.h b/testsuites/sptests/sp15/system.h
new file mode 100644
index 0000000000..c06714e3fc
--- /dev/null
+++ b/testsuites/sptests/sp15/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_PARTITIONS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_name Partition_id[ 4 ]; /* array of partition ids */
+TEST_EXTERN rtems_name Partition_name[ 4 ]; /* array of partition names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_2[274] CPU_STRUCTURE_ALIGNMENT;
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+#define Put_address_from_area_2( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 )
+
+/* end of include file */
diff --git a/testsuites/sptests/sp15/task1.c b/testsuites/sptests/sp15/task1.c
new file mode 100644
index 0000000000..f22d27efe3
--- /dev/null
+++ b/testsuites/sptests/sp15/task1.c
@@ -0,0 +1,129 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the partition manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id ptid_1;
+ rtems_id ptid_2;
+ void *buffer_address_1;
+ void *buffer_address_2;
+ void *buffer_address_3;
+ void *buffer_address_4;
+ rtems_status_code status;
+
+ puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " );
+ status = rtems_partition_ident(
+ Partition_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &ptid_1
+ );
+ directive_failed( status, "rtems_partition_ident of PT1" );
+ printf( "%08x\n", ptid_1 );
+
+ puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " );
+ status = rtems_partition_ident(
+ Partition_name[ 2 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &ptid_2
+ );
+ directive_failed( status, "rtems_partition_ident of PT2" );
+ printf( "%08x\n", ptid_2 );
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - "
+ );
+ status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_1( buffer_address_1 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - "
+ );
+ status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_1( buffer_address_2 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - "
+ );
+ status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_2( buffer_address_3 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - "
+ );
+ status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 );
+ directive_failed( status, "rtems_partition_get_buffer" );
+ Put_address_from_area_2( buffer_address_4 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - "
+ );
+ Put_address_from_area_1( buffer_address_1 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_1, buffer_address_1 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - "
+ );
+ Put_address_from_area_1( buffer_address_2 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_1, buffer_address_2 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - "
+ );
+ Put_address_from_area_2( buffer_address_3 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_2, buffer_address_3 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts_nocr(
+ "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - "
+ );
+ Put_address_from_area_2( buffer_address_4 );
+ new_line;
+ status = rtems_partition_return_buffer( ptid_2, buffer_address_4 );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ puts( "TA1 - rtems_partition_delete - delete partition 1"
+ );
+ status = rtems_partition_delete( ptid_1 );
+ directive_failed( status, "rtems_partition_delete" );
+
+ puts( "TA1 - rtems_partition_delete - delete partition 2"
+ );
+ status = rtems_partition_delete( ptid_2 );
+ directive_failed( status, "rtems_partition_delete" );
+
+ puts( "*** END OF TEST 15 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp16/init.c b/testsuites/sptests/sp16/init.c
new file mode 100644
index 0000000000..3b57b78c51
--- /dev/null
+++ b/testsuites/sptests/sp16/init.c
@@ -0,0 +1,128 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 16 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' );
+ Region_name[ 2 ] = rtems_build_name( 'R', 'N', '2', ' ' );
+ Region_name[ 3 ] = rtems_build_name( 'R', 'N', '3', ' ' );
+ Region_name[ 4 ] = rtems_build_name( 'R', 'N', '4', ' ' );
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Area_1,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create of RN1" );
+
+ status = rtems_region_create(
+ Region_name[ 2 ],
+ Area_2,
+ 4096,
+ 128,
+ RTEMS_PRIORITY,
+ &Region_id[ 2 ]
+ );
+ directive_failed( status, "rtems_region_create of RN2" );
+
+ status = rtems_region_create(
+ Region_name[ 3 ],
+ Area_3,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 3 ]
+ );
+ directive_failed( status, "rtems_region_create of RN3" );
+
+ status = rtems_region_create(
+ Region_name[ 4 ],
+ Area_4,
+ 4096,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 4 ]
+ );
+ directive_failed( status, "rtems_region_create of RN4" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp16/sp16.doc b/testsuites/sptests/sp16/sp16.doc
new file mode 100644
index 0000000000..c5512af051
--- /dev/null
+++ b/testsuites/sptests/sp16/sp16.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test16
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ rn_create, rn_ident, rn_getbuf, rn_retbuf, rn_delete
+
+concepts:
+
+ a. This test checks out the region manager.
diff --git a/testsuites/sptests/sp16/sp16.scn b/testsuites/sptests/sp16/sp16.scn
new file mode 100644
index 0000000000..36d533c2b4
--- /dev/null
+++ b/testsuites/sptests/sp16/sp16.scn
@@ -0,0 +1,58 @@
+*** TEST 16 ***
+TA1 - rtems_region_ident - rnid => 20010002
+TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2
+TA1 - got segment from region 2 - 0x00000f78
+TA1 - rtems_region_get_segment - wait on 3K segment from region 3
+TA1 - got segment from region 3 - 0x000003f8
+TA1 - rtems_region_get_segment - get 3080 byte segment from region 1 - NO_WAIT
+TA1 - got segment from region 1 - 0x00000378
+TA1 - rtems_task_wake_after - yield processor
+TA2 - rtems_region_get_segment - wait on 2K segment from region 1
+TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2
+<pause>
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x00000378
+TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1
+TA2 - got segment from region 1 - 0x000007f8
+TA2 - rtems_region_return_segment - return segment to region 1 - 0x000007f8
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_region_get_segment - wait on 3968 byte segment
+TA1 - got segment from region 1 - 0x000003f8
+TA1 - rtems_region_return_segment - return segment to region 2 - 0x00000f78
+TA2 - got segment from region 2 - 0x00000008
+TA2 - rtems_region_return_segment - return segment to region 2 - 0x00000008
+TA2 - rtems_task_delete - delete self
+TA1 - rtems_task_wake_after - yield processor
+TA3 - got segment from region 2 - 0x00000008
+TA3 - rtems_region_get_segment - wait on 2K segment from region 3
+TA1 - rtems_task_delete - delete TA3
+<pause>
+TA1 - rtems_task_wake_after - yield processor
+TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1
+TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA4 - got and returned 0x000009f8
+TA5 - got and returned 0x000003f0
+TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1
+TA1 - got segment from region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA4 - rtems_region_get_segment - wait on 3K segment from region 1
+TA5 - rtems_region_get_segment - wait on 3K segment from region 1
+TA1 - rtems_task_delete - delete TA4
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA1 - rtems_task_wake_after - yield processor
+TA5 - got segment from region 1 - 0x000003f8
+TA5 - rtems_region_return_segment - return segment to region 1 - 0x000003f8
+TA5 - rtems_task_delete - delete self
+TA1 - rtems_region_delete - delete region 1
+TA1 - rtems_region_get_segment - get 3K segment from region 4
+TA1 - got segment from region 4 - 0x000003f8
+TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4
+TA1 - rtems_task_get_note - RTEMS_UNSATISFIED
+TA1 - rtems_region_extend - extend region 4 by 4K
+TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4
+TA1 - got 3K segment from region 4 - 0x00001400
+TA1 - rtems_region_return_segment - return segment to region 4 - 0x000003f8
+TA1 - rtems_region_return_segment - return segment to region 4 - 0x00001400
+TA1 - rtems_region_delete - delete region 4
+*** END OF TEST 16 ***
diff --git a/testsuites/sptests/sp16/system.h b/testsuites/sptests/sp16/system.h
new file mode 100644
index 0000000000..f28780be08
--- /dev/null
+++ b/testsuites/sptests/sp16/system.h
@@ -0,0 +1,83 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Task_4(
+ rtems_task_argument argument
+);
+
+rtems_task Task5(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_REGIONS 4
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+TEST_EXTERN rtems_id Region_id[ 5 ]; /* array of region ids */
+TEST_EXTERN rtems_name Region_name[ 5 ]; /* array of region names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_2[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_3[4096] CPU_STRUCTURE_ALIGNMENT;
+TEST_EXTERN rtems_unsigned8 Area_4[8192] CPU_STRUCTURE_ALIGNMENT;
+
+#define BASE_PRIORITY 140
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+#define Put_address_from_area_2( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 )
+
+#define Put_address_from_area_3( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_3 )
+
+#define Put_address_from_area_4( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_4 )
+
+/* end of include file */
diff --git a/testsuites/sptests/sp16/task1.c b/testsuites/sptests/sp16/task1.c
new file mode 100644
index 0000000000..a9ef6548b9
--- /dev/null
+++ b/testsuites/sptests/sp16/task1.c
@@ -0,0 +1,282 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the region manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id rnid;
+ void *segment_address_1;
+ void *segment_address_2;
+ void *segment_address_3;
+ void *segment_address_4;
+ rtems_status_code status;
+
+ status = rtems_region_ident( Region_name[ 1 ], &rnid );
+ printf( "TA1 - rtems_region_ident - rnid => %08x\n", rnid );
+ directive_failed( status, "rtems_region_ident of RN1" );
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 100,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 2 - " );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+
+ puts( "TA1 - rtems_region_get_segment - wait on 3K segment from region 3" );
+ status = rtems_region_get_segment(
+ Region_id[ 3 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 3 - " );
+ Put_address_from_area_3( segment_address_2 );
+ new_line;
+
+ puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " );
+ puts ( "from region 1 - NO_WAIT" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3080,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_3 );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+rtems_test_pause();
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_3 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait 10 seconds for 3K "
+ "segment from region 1"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &segment_address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_4 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 2 - "
+ );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+ status = rtems_region_return_segment( Region_id[ 2 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+rtems_test_pause();
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], Task5, 0 );
+ directive_failed( status, "rtems_task_start of TA5" );
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " );
+ puts ( "segment from region 1");
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &segment_address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_4 );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA4" );
+ status = rtems_task_delete( Task_id[ 4 ] );
+ directive_failed( status, "rtems_task_delete of TA4" );
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_task_wake_after - yield processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ puts( "TA1 - rtems_region_delete - delete region 1" );
+ status = rtems_region_delete( Region_id[ 1 ] );
+ directive_failed( status, "rtems_region_delete" );
+
+ puts( "TA1 - rtems_region_get_segment - get 3K segment from region 4" );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 4 - " );
+ Put_address_from_area_4( segment_address_1 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_task_get_segment with no memory left"
+ );
+ puts( "TA1 - rtems_task_get_note - RTEMS_UNSATISFIED" );
+
+ puts( "TA1 - rtems_region_extend - extend region 4 by 4K" );
+ status = rtems_region_extend(
+ Region_id[ 4 ],
+ &Area_4[4096],
+ 4096
+ );
+ directive_failed( status, "rtems_region_extend" );
+
+ puts(
+ "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 4 ],
+ 3072,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got 3K segment from region 4 - " );
+ Put_address_from_area_4( segment_address_3 );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 4 - "
+ );
+ Put_address_from_area_4( segment_address_1 );
+ status = rtems_region_return_segment( Region_id[ 4 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 4 - "
+ );
+ Put_address_from_area_4( segment_address_3 );
+ status = rtems_region_return_segment( Region_id[ 4 ], segment_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA1 - rtems_region_delete - delete region 4" );
+ status = rtems_region_delete( Region_id[ 4 ] );
+ directive_failed( status, "rtems_region_delete" );
+
+ puts( "*** END OF TEST 16 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp16/task2.c b/testsuites/sptests/sp16/task2.c
new file mode 100644
index 0000000000..d5bc312b27
--- /dev/null
+++ b/testsuites/sptests/sp16/task2.c
@@ -0,0 +1,86 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA2 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ puts_nocr(
+ "TA2 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_1 );
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ BASE_PRIORITY-1,
+ &previous_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts("TA2 - rtems_region_get_segment - wait on 3968 byte segment");
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 3968,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA2 - got segment from region 2 - ");
+ Put_address_from_area_2( segment_address_2 );
+ new_line;
+
+ puts_nocr(
+ "TA2 - rtems_region_return_segment - return segment to region 2 - "
+ );
+ Put_address_from_area_2( segment_address_2 );
+ status = rtems_region_return_segment( Region_id[ 2 ], segment_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+
+ puts( "TA2 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp16/task3.c b/testsuites/sptests/sp16/task3.c
new file mode 100644
index 0000000000..292e5824f6
--- /dev/null
+++ b/testsuites/sptests/sp16/task3.c
@@ -0,0 +1,57 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts(
+ "TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2"
+ );
+ status = rtems_region_get_segment(
+ Region_id[ 2 ],
+ 3968,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA3 - got segment from region 2 - " );
+ Put_address_from_area_2( segment_address_1 );
+ new_line;
+ directive_failed( status, "rtems_region_return_segment" );
+
+ puts( "TA3 - rtems_region_get_segment - wait on 2K segment from region 3" );
+ status = rtems_region_get_segment(
+ Region_id[ 3 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+}
diff --git a/testsuites/sptests/sp16/task4.c b/testsuites/sptests/sp16/task4.c
new file mode 100644
index 0000000000..f3da89b72e
--- /dev/null
+++ b/testsuites/sptests/sp16/task4.c
@@ -0,0 +1,60 @@
+/* Task_4
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ void *segment_address_1;
+ void *segment_address_2;
+
+ puts( "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1536,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ puts_nocr( "TA4 - got and returned " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA4 - rtems_region_get_segment - wait on 3K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+}
diff --git a/testsuites/sptests/sp16/task5.c b/testsuites/sptests/sp16/task5.c
new file mode 100644
index 0000000000..5defa75f9c
--- /dev/null
+++ b/testsuites/sptests/sp16/task5.c
@@ -0,0 +1,73 @@
+/* Task5
+ *
+ * This routine serves as a test task. It competes with the other tasks
+ * for region resources.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task5(
+ rtems_task_argument argument
+)
+{
+ void *segment_address_1;
+ void *segment_address_2;
+ rtems_status_code status;
+
+ puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1536,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ puts_nocr( "TA5 - got and returned " );
+ Put_address_from_area_1( segment_address_1 );
+ new_line;
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" );
+ status = rtems_region_get_segment(
+ Region_id[ 1 ],
+ 3072,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &segment_address_2
+ );
+ puts_nocr( "TA5 - got segment from region 1 - " );
+ Put_address_from_area_1( segment_address_2 );
+ new_line;
+
+ status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 );
+ puts_nocr(
+ "TA5 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( segment_address_2 );
+ new_line;
+
+ puts( "TA5 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp17/asr.c b/testsuites/sptests/sp17/asr.c
new file mode 100644
index 0000000000..1795bbd522
--- /dev/null
+++ b/testsuites/sptests/sp17/asr.c
@@ -0,0 +1,32 @@
+/* Process_asr
+ *
+ * This routine performs the processing for task 1's RTEMS_ASR. It is called
+ * by an assembly routine which saves the necessary registers.
+ *
+ * Input parameters:
+ * signal - signal set
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_asr Process_asr(
+ rtems_signal_set signal_set
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 2 ] );
+ directive_failed( status, "RTEMS_ASR - rtems_task_resume of TA2" );
+}
diff --git a/testsuites/sptests/sp17/init.c b/testsuites/sptests/sp17/init.c
new file mode 100644
index 0000000000..92c8812a8d
--- /dev/null
+++ b/testsuites/sptests/sp17/init.c
@@ -0,0 +1,69 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 17 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ Task_2_preempted = FALSE;
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp17/sp17.doc b/testsuites/sptests/sp17/sp17.doc
new file mode 100644
index 0000000000..b4258461cf
--- /dev/null
+++ b/testsuites/sptests/sp17/sp17.doc
@@ -0,0 +1,35 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test17
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ as_catch, as_return
+
+concepts:
+
+ a. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ b. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ c. Verifies executive initialization performed correctly.
+
+ d. Verifies that a task can get the task identification number
+ of another task.
+
+ e. Verifies that a signal can be sent to a remote task.
diff --git a/testsuites/sptests/sp17/sp17.scn b/testsuites/sptests/sp17/sp17.scn
new file mode 100644
index 0000000000..47fd140e2a
--- /dev/null
+++ b/testsuites/sptests/sp17/sp17.scn
@@ -0,0 +1,8 @@
+*** TEST 17 ***
+TA2 - Suspending self
+TA1 - rtems_signal_catch: initializing signal catcher
+TA1 - Sending signal to self
+TA2 - signal_return preempted correctly
+TA1 - TA2 correctly preempted me
+TA1 - Got Back!!!
+*** END OF TEST 17 ***
diff --git a/testsuites/sptests/sp17/system.h b/testsuites/sptests/sp17/system.h
new file mode 100644
index 0000000000..e95b27635b
--- /dev/null
+++ b/testsuites/sptests/sp17/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_asr Process_asr(
+ rtems_signal_set signal_set
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(25)
+#define CONFIGURE_TICKS_PER_TIMESLICE 1000
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_unsigned32 Task_2_preempted;
+
+/* end of include file */
diff --git a/testsuites/sptests/sp17/task1.c b/testsuites/sptests/sp17/task1.c
new file mode 100644
index 0000000000..282c161a39
--- /dev/null
+++ b/testsuites/sptests/sp17/task1.c
@@ -0,0 +1,48 @@
+/* Task_1
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA1 - rtems_signal_catch: initializing signal catcher" );
+ status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR | RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ puts( "TA1 - Sending signal to self" );
+ status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_16 );
+ directive_failed( status, "rtems_signal_send" );
+
+ if ( Task_2_preempted == TRUE )
+ puts( "TA1 - TA2 correctly preempted me" );
+
+ puts("TA1 - Got Back!!!");
+
+ puts( "*** END OF TEST 17 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp17/task2.c b/testsuites/sptests/sp17/task2.c
new file mode 100644
index 0000000000..cd3e16c7c0
--- /dev/null
+++ b/testsuites/sptests/sp17/task2.c
@@ -0,0 +1,45 @@
+/* Task_2
+ *
+ * This task initializes the signal catcher, sends the first signal
+ * if running on the first node, and loops while waiting for signals.
+ *
+ * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
+ * be a part of its execution mode.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Task_2_preempted = FALSE;
+
+ puts( "TA2 - Suspending self" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA2 - signal_return preempted correctly" );
+
+ Task_2_preempted = TRUE;
+
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+}
diff --git a/testsuites/sptests/sp19/first.c b/testsuites/sptests/sp19/first.c
new file mode 100644
index 0000000000..94bdedd5ad
--- /dev/null
+++ b/testsuites/sptests/sp19/first.c
@@ -0,0 +1,66 @@
+/* First_FP_task
+ *
+ * This routine serves as a floating point test task. It verifies the
+ * basic task switching capabilities of the executive when floating
+ * point is configured.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "fptest.h"
+#include "inttest.h"
+
+rtems_task First_FP_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+ FP_LOAD( FP_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+ put_name( Task_name[ task_index ], FALSE );
+#if ( RTEMS_HAS_HARDWARE_FP == 1 )
+ printf( " - float base = (%g)\n", FP_factors[ task_index ] );
+#else
+ printf( " - float base = (NA)\n" );
+#endif
+
+ if ( argument == 0 ) {
+ status = rtems_task_restart( RTEMS_SELF, 1 );
+ directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
+ } else {
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+ }
+}
diff --git a/testsuites/sptests/sp19/fptask.c b/testsuites/sptests/sp19/fptask.c
new file mode 100644
index 0000000000..b8e881e6cd
--- /dev/null
+++ b/testsuites/sptests/sp19/fptask.c
@@ -0,0 +1,98 @@
+/* FP_task
+ *
+ * This routine serves as a floating point test task. It verifies the
+ * basic task switching capabilities of the executive when floating
+ * point is configured.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "fptest.h"
+#include "inttest.h"
+
+rtems_task FP_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ rtems_unsigned32 previous_seconds;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+ FP_LOAD( FP_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+ put_name( Task_name[ task_index ], FALSE );
+#if ( RTEMS_HAS_HARDWARE_FP == 1 )
+ printf( " - float base = (%g)\n", FP_factors[ task_index ] );
+#else
+ printf( " - float base = (NA)\n" );
+#endif
+
+ previous_seconds = -1;
+
+ while( FOREVER ) {
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ if ( time.second >= 16 ) {
+
+ if ( task_number( tid ) == 4 ) {
+ puts( "TA4 - rtems_task_delete - self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA4" );
+ }
+ puts( "TA5 - rtems_task_delete - TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ puts( "*** END OF TEST 19 *** " );
+ exit( 0 );
+ }
+
+ if (previous_seconds != time.second)
+ {
+ put_name( Task_name[ task_index ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+ previous_seconds = time.second;
+ }
+
+ INTEGER_CHECK( INTEGER_factors[ task_index ] );
+ FP_CHECK( FP_factors[ task_index ] );
+
+ /* for the first 4 seconds we spin as fast as possible
+ * so that we likely are interrupted
+ * After that, we go to sleep for a second at a time
+ */
+ if (time.second >= 4)
+ {
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+ }
+}
diff --git a/testsuites/sptests/sp19/fptest.h b/testsuites/sptests/sp19/fptest.h
new file mode 100644
index 0000000000..a8f3a925cb
--- /dev/null
+++ b/testsuites/sptests/sp19/fptest.h
@@ -0,0 +1,165 @@
+/* fptest.h
+ *
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * FP_load( &context )
+ * FP_check( &context )
+ *
+ * FP_load - loads the specified floating point context
+ * FP_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * fptest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __FPTEST_h
+#define __FPTEST_h
+
+#include <stdio.h>
+
+#ifndef RTEMS_HAS_HARDWARE_FP
+#error "This CPU does not have RTEMS_HAS_HARDWARE_FP defined"
+#endif
+
+#if ( RTEMS_HAS_HARDWARE_FP == FALSE )
+
+#define FP_DECLARE ;
+#define FP_LOAD( _factor )
+#define FP_CHECK( _factor ) 0
+
+#else
+
+#define FP_DECLARE \
+ double fp01 = 1.0; \
+ double fp02 = 2.0; \
+ double fp03 = 3.0; \
+ double fp04 = 4.0; \
+ double fp05 = 5.0; \
+ double fp06 = 6.0; \
+ double fp07 = 7.0; \
+ double fp08 = 8.0; \
+ double fp09 = 9.0; \
+ double fp10 = 10.0; \
+ double fp11 = 11.0; \
+ double fp12 = 12.0; \
+ double fp13 = 13.0; \
+ double fp14 = 14.0; \
+ double fp15 = 15.0; \
+ double fp16 = 16.0; \
+ double fp17 = 17.0; \
+ double fp18 = 18.0; \
+ double fp19 = 19.0; \
+ double fp20 = 20.0; \
+ double fp21 = 21.0; \
+ double fp22 = 22.0; \
+ double fp23 = 23.0; \
+ double fp24 = 24.0; \
+ double fp25 = 25.0; \
+ double fp26 = 26.0; \
+ double fp27 = 27.0; \
+ double fp28 = 28.0; \
+ double fp29 = 29.0; \
+ double fp30 = 30.0; \
+ double fp31 = 31.0; \
+ double fp32 = 32.0
+
+#define FP_LOAD( _factor ) \
+ do { \
+ fp01 += _factor; \
+ fp02 += _factor; \
+ fp03 += _factor; \
+ fp04 += _factor; \
+ fp05 += _factor; \
+ fp06 += _factor; \
+ fp07 += _factor; \
+ fp08 += _factor; \
+ fp09 += _factor; \
+ fp10 += _factor; \
+ fp11 += _factor; \
+ fp12 += _factor; \
+ fp13 += _factor; \
+ fp14 += _factor; \
+ fp15 += _factor; \
+ fp16 += _factor; \
+ fp17 += _factor; \
+ fp18 += _factor; \
+ fp19 += _factor; \
+ fp20 += _factor; \
+ fp21 += _factor; \
+ fp22 += _factor; \
+ fp23 += _factor; \
+ fp24 += _factor; \
+ fp25 += _factor; \
+ fp26 += _factor; \
+ fp27 += _factor; \
+ fp28 += _factor; \
+ fp29 += _factor; \
+ fp30 += _factor; \
+ fp31 += _factor; \
+ fp32 += _factor; \
+ } while (0)
+
+#define EPSILON (0.0005)
+#define FPABS(d) (((d) < 0.0) ? -(d) : (d))
+#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON)
+
+#define FP_CHECK_ONE( _v, _base, _factor ) \
+ if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \
+ printf("%d: " #_v " wrong -- (%g not %g)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define FP_CHECK( _factor ) \
+ do { \
+ FP_CHECK_ONE( fp01, 1.0, (_factor) ); \
+ FP_CHECK_ONE( fp02, 2.0, (_factor) ); \
+ FP_CHECK_ONE( fp03, 3.0, (_factor) ); \
+ FP_CHECK_ONE( fp04, 4.0, (_factor) ); \
+ FP_CHECK_ONE( fp05, 5.0, (_factor) ); \
+ FP_CHECK_ONE( fp06, 6.0, (_factor) ); \
+ FP_CHECK_ONE( fp07, 7.0, (_factor) ); \
+ FP_CHECK_ONE( fp08, 8.0, (_factor) ); \
+ FP_CHECK_ONE( fp09, 9.0, (_factor) ); \
+ FP_CHECK_ONE( fp10, 10.0, (_factor) ); \
+ FP_CHECK_ONE( fp11, 11.0, (_factor) ); \
+ FP_CHECK_ONE( fp12, 12.0, (_factor) ); \
+ FP_CHECK_ONE( fp13, 13.0, (_factor) ); \
+ FP_CHECK_ONE( fp14, 14.0, (_factor) ); \
+ FP_CHECK_ONE( fp15, 15.0, (_factor) ); \
+ FP_CHECK_ONE( fp16, 16.0, (_factor) ); \
+ FP_CHECK_ONE( fp17, 17.0, (_factor) ); \
+ FP_CHECK_ONE( fp18, 18.0, (_factor) ); \
+ FP_CHECK_ONE( fp19, 19.0, (_factor) ); \
+ FP_CHECK_ONE( fp20, 20.0, (_factor) ); \
+ FP_CHECK_ONE( fp21, 21.0, (_factor) ); \
+ FP_CHECK_ONE( fp22, 22.0, (_factor) ); \
+ FP_CHECK_ONE( fp23, 23.0, (_factor) ); \
+ FP_CHECK_ONE( fp24, 24.0, (_factor) ); \
+ FP_CHECK_ONE( fp25, 25.0, (_factor) ); \
+ FP_CHECK_ONE( fp26, 26.0, (_factor) ); \
+ FP_CHECK_ONE( fp27, 27.0, (_factor) ); \
+ FP_CHECK_ONE( fp28, 28.0, (_factor) ); \
+ FP_CHECK_ONE( fp29, 29.0, (_factor) ); \
+ FP_CHECK_ONE( fp30, 30.0, (_factor) ); \
+ FP_CHECK_ONE( fp31, 31.0, (_factor) ); \
+ FP_CHECK_ONE( fp32, 32.0, (_factor) ); \
+ } while (0)
+
+#endif
+
+#endif
diff --git a/testsuites/sptests/sp19/init.c b/testsuites/sptests/sp19/init.c
new file mode 100644
index 0000000000..0d1cce26ef
--- /dev/null
+++ b/testsuites/sptests/sp19/init.c
@@ -0,0 +1,150 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 19 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+ Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_create(
+ Task_name[ 6 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &Task_id[ 6 ]
+ );
+ directive_failed( status, "rtems_task_create of FP1" );
+
+ status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 );
+ directive_failed( status, "rtems_task_start of FP1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_start( Task_id[ 4 ], FP_task, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], FP_task, 0 );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ /*
+ * Load "task dependent factors" in the context areas
+ */
+
+
+ FP_factors[0] = 0.0;
+ FP_factors[1] = 1000.1;
+ FP_factors[2] = 2000.2;
+ FP_factors[3] = 3000.3;
+ FP_factors[4] = 4000.4;
+ FP_factors[5] = 5000.5;
+ FP_factors[6] = 6000.6;
+ FP_factors[7] = 7000.7;
+ FP_factors[8] = 8000.8;
+ FP_factors[9] = 9000.9;
+
+ INTEGER_factors[0] = 0x0000;
+ INTEGER_factors[1] = 0x1000;
+ INTEGER_factors[2] = 0x2000;
+ INTEGER_factors[3] = 0x3000;
+ INTEGER_factors[4] = 0x4000;
+ INTEGER_factors[5] = 0x5000;
+ INTEGER_factors[6] = 0x6000;
+ INTEGER_factors[7] = 0x7000;
+ INTEGER_factors[8] = 0x8000;
+ INTEGER_factors[9] = 0x9000;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA1" );
+}
diff --git a/testsuites/sptests/sp19/inttest.h b/testsuites/sptests/sp19/inttest.h
new file mode 100644
index 0000000000..5dfb0af636
--- /dev/null
+++ b/testsuites/sptests/sp19/inttest.h
@@ -0,0 +1,149 @@
+/* inttest.h
+ *
+ * XXX: ???
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * INTEGER_load( &context )
+ * INTEGER_check( &context )
+ *
+ * INTEGER_load - loads the specified floating point context
+ * INTEGER_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * inttest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __INTEGER_TEST_h
+#define __INTEGER_TEST_h
+
+#include <stdio.h>
+#define REG_VARIABLE rtems_unsigned32
+
+#define INTEGER_DECLARE \
+ REG_VARIABLE int01 = 1; \
+ REG_VARIABLE int02 = 2; \
+ REG_VARIABLE int03 = 3; \
+ REG_VARIABLE int04 = 4; \
+ REG_VARIABLE int05 = 5; \
+ REG_VARIABLE int06 = 6; \
+ REG_VARIABLE int07 = 7; \
+ REG_VARIABLE int08 = 8; \
+ REG_VARIABLE int09 = 9; \
+ REG_VARIABLE int10 = 10; \
+ REG_VARIABLE int11 = 11; \
+ REG_VARIABLE int12 = 12; \
+ REG_VARIABLE int13 = 13; \
+ REG_VARIABLE int14 = 14; \
+ REG_VARIABLE int15 = 15; \
+ REG_VARIABLE int16 = 16; \
+ REG_VARIABLE int17 = 17; \
+ REG_VARIABLE int18 = 18; \
+ REG_VARIABLE int19 = 19; \
+ REG_VARIABLE int20 = 20; \
+ REG_VARIABLE int21 = 21; \
+ REG_VARIABLE int22 = 22; \
+ REG_VARIABLE int23 = 23; \
+ REG_VARIABLE int24 = 24; \
+ REG_VARIABLE int25 = 25; \
+ REG_VARIABLE int26 = 26; \
+ REG_VARIABLE int27 = 27; \
+ REG_VARIABLE int28 = 28; \
+ REG_VARIABLE int29 = 29; \
+ REG_VARIABLE int30 = 30; \
+ REG_VARIABLE int31 = 31; \
+ REG_VARIABLE int32 = 32
+
+#define INTEGER_LOAD( _factor ) \
+ do { \
+ int01 += _factor; \
+ int02 += _factor; \
+ int03 += _factor; \
+ int04 += _factor; \
+ int05 += _factor; \
+ int06 += _factor; \
+ int07 += _factor; \
+ int08 += _factor; \
+ int09 += _factor; \
+ int10 += _factor; \
+ int11 += _factor; \
+ int12 += _factor; \
+ int13 += _factor; \
+ int14 += _factor; \
+ int15 += _factor; \
+ int16 += _factor; \
+ int17 += _factor; \
+ int18 += _factor; \
+ int19 += _factor; \
+ int20 += _factor; \
+ int21 += _factor; \
+ int22 += _factor; \
+ int23 += _factor; \
+ int24 += _factor; \
+ int25 += _factor; \
+ int26 += _factor; \
+ int27 += _factor; \
+ int28 += _factor; \
+ int29 += _factor; \
+ int30 += _factor; \
+ int31 += _factor; \
+ int32 += _factor; \
+ } while (0)
+
+#define INTEGER_CHECK_ONE( _v, _base, _factor ) \
+ if ( (_v) != ((_base) + (_factor)) ) { \
+ printf("%d: " #_v " wrong -- (0x%x not 0x%x)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define INTEGER_CHECK( _factor ) \
+ do { \
+ INTEGER_CHECK_ONE( int01, 1, (_factor) ); \
+ INTEGER_CHECK_ONE( int02, 2, (_factor) ); \
+ INTEGER_CHECK_ONE( int03, 3, (_factor) ); \
+ INTEGER_CHECK_ONE( int04, 4, (_factor) ); \
+ INTEGER_CHECK_ONE( int05, 5, (_factor) ); \
+ INTEGER_CHECK_ONE( int06, 6, (_factor) ); \
+ INTEGER_CHECK_ONE( int07, 7, (_factor) ); \
+ INTEGER_CHECK_ONE( int08, 8, (_factor) ); \
+ INTEGER_CHECK_ONE( int09, 9, (_factor) ); \
+ INTEGER_CHECK_ONE( int10, 10, (_factor) ); \
+ INTEGER_CHECK_ONE( int11, 11, (_factor) ); \
+ INTEGER_CHECK_ONE( int12, 12, (_factor) ); \
+ INTEGER_CHECK_ONE( int13, 13, (_factor) ); \
+ INTEGER_CHECK_ONE( int14, 14, (_factor) ); \
+ INTEGER_CHECK_ONE( int15, 15, (_factor) ); \
+ INTEGER_CHECK_ONE( int16, 16, (_factor) ); \
+ INTEGER_CHECK_ONE( int17, 17, (_factor) ); \
+ INTEGER_CHECK_ONE( int18, 18, (_factor) ); \
+ INTEGER_CHECK_ONE( int19, 19, (_factor) ); \
+ INTEGER_CHECK_ONE( int20, 20, (_factor) ); \
+ INTEGER_CHECK_ONE( int21, 21, (_factor) ); \
+ INTEGER_CHECK_ONE( int22, 22, (_factor) ); \
+ INTEGER_CHECK_ONE( int23, 23, (_factor) ); \
+ INTEGER_CHECK_ONE( int24, 24, (_factor) ); \
+ INTEGER_CHECK_ONE( int25, 25, (_factor) ); \
+ INTEGER_CHECK_ONE( int26, 26, (_factor) ); \
+ INTEGER_CHECK_ONE( int27, 27, (_factor) ); \
+ INTEGER_CHECK_ONE( int28, 28, (_factor) ); \
+ INTEGER_CHECK_ONE( int29, 29, (_factor) ); \
+ INTEGER_CHECK_ONE( int30, 30, (_factor) ); \
+ INTEGER_CHECK_ONE( int31, 31, (_factor) ); \
+ INTEGER_CHECK_ONE( int32, 32, (_factor) ); \
+ } while (0)
+
+#endif
diff --git a/testsuites/sptests/sp19/sp19.doc b/testsuites/sptests/sp19/sp19.doc
new file mode 100644
index 0000000000..78ac463c9f
--- /dev/null
+++ b/testsuites/sptests/sp19/sp19.doc
@@ -0,0 +1,23 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test19
+
+directives:
+
+concepts:
+
+ a. Verifies system can dispatch a mixture of floating point and
+ non-floating point tasks.
diff --git a/testsuites/sptests/sp19/sp19.scn b/testsuites/sptests/sp19/sp19.scn
new file mode 100644
index 0000000000..76ded9f7d0
--- /dev/null
+++ b/testsuites/sptests/sp19/sp19.scn
@@ -0,0 +1,55 @@
+*** TEST 19 ***
+FP1 - integer base = (0x6000)
+FP1 - float base = (6000.6)
+FP1 - integer base = (0x6000)
+FP1 - float base = (6000.6)
+TA1 - integer base = (0x1000)
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - integer base = (0x2000)
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - integer base = (0x3000)
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA4 - integer base = (0x4000)
+TA4 - float base = (4000.4)
+TA4 - rtems_clock_get - 09:00:00 12/31/1988
+TA5 - integer base = (0x5000)
+TA5 - float base = (5000.5)
+TA5 - rtems_clock_get - 09:00:00 12/31/1988
+TA4 - rtems_clock_get - 09:00:01 12/31/1988
+TA5 - rtems_clock_get - 09:00:01 12/31/1988
+TA4 - rtems_clock_get - 09:00:02 12/31/1988
+TA5 - rtems_clock_get - 09:00:02 12/31/1988
+TA4 - rtems_clock_get - 09:00:03 12/31/1988
+TA5 - rtems_clock_get - 09:00:03 12/31/1988
+TA4 - rtems_clock_get - 09:00:04 12/31/1988
+TA5 - rtems_clock_get - 09:00:04 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA4 - rtems_clock_get - 09:00:05 12/31/1988
+TA5 - rtems_clock_get - 09:00:05 12/31/1988
+TA4 - rtems_clock_get - 09:00:06 12/31/1988
+TA5 - rtems_clock_get - 09:00:06 12/31/1988
+TA4 - rtems_clock_get - 09:00:07 12/31/1988
+TA5 - rtems_clock_get - 09:00:07 12/31/1988
+TA4 - rtems_clock_get - 09:00:08 12/31/1988
+TA5 - rtems_clock_get - 09:00:08 12/31/1988
+TA4 - rtems_clock_get - 09:00:09 12/31/1988
+TA5 - rtems_clock_get - 09:00:09 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA4 - rtems_clock_get - 09:00:10 12/31/1988
+TA5 - rtems_clock_get - 09:00:10 12/31/1988
+TA4 - rtems_clock_get - 09:00:11 12/31/1988
+TA5 - rtems_clock_get - 09:00:11 12/31/1988
+TA4 - rtems_clock_get - 09:00:12 12/31/1988
+TA5 - rtems_clock_get - 09:00:12 12/31/1988
+TA4 - rtems_clock_get - 09:00:13 12/31/1988
+TA5 - rtems_clock_get - 09:00:13 12/31/1988
+TA4 - rtems_clock_get - 09:00:14 12/31/1988
+TA5 - rtems_clock_get - 09:00:14 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA4 - rtems_clock_get - 09:00:15 12/31/1988
+TA5 - rtems_clock_get - 09:00:15 12/31/1988
+TA4 - rtems_task_delete - self
+TA5 - rtems_task_delete - TA3
+*** END OF TEST 19 ***
diff --git a/testsuites/sptests/sp19/system.h b/testsuites/sptests/sp19/system.h
new file mode 100644
index 0000000000..6052075250
--- /dev/null
+++ b/testsuites/sptests/sp19/system.h
@@ -0,0 +1,55 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task First_FP_task(
+ rtems_task_argument argument
+);
+
+rtems_task FP_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */
+TEST_EXTERN rtems_id Task_name[ 7 ]; /* array of task names */
+
+TEST_EXTERN rtems_double FP_factors[ 10 ]; /* FP "uniqueness" factors */
+TEST_EXTERN rtems_unsigned32 INTEGER_factors[ 10 ]; /* INT "uniqueness" factors */
+/* end of include file */
diff --git a/testsuites/sptests/sp19/task1.c b/testsuites/sptests/sp19/task1.c
new file mode 100644
index 0000000000..874fbcc614
--- /dev/null
+++ b/testsuites/sptests/sp19/task1.c
@@ -0,0 +1,59 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include "inttest.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_unsigned32 task_index;
+ INTEGER_DECLARE;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ task_index = task_number( tid );
+
+ INTEGER_LOAD( INTEGER_factors[ task_index ] );
+
+ put_name( Task_name[ task_index ], FALSE );
+ printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ INTEGER_CHECK( INTEGER_factors[ task_index ] );
+
+ status = rtems_task_wake_after(
+ ( task_number( tid ) ) * 5 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/testsuites/sptests/sp20/getall.c b/testsuites/sptests/sp20/getall.c
new file mode 100644
index 0000000000..cff3841dff
--- /dev/null
+++ b/testsuites/sptests/sp20/getall.c
@@ -0,0 +1,43 @@
+/* Get_all_counters
+ *
+ * This routine allows TA5 to atomically obtain the iteration counters.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Get_all_counters()
+{
+ rtems_mode previous_mode;
+ rtems_status_code status;
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode to RTEMS_NO_PREEMPT" );
+
+ Temporary_count = Count;
+ Count.count[ 1 ] = 0;
+ Count.count[ 2 ] = 0;
+ Count.count[ 3 ] = 0;
+ Count.count[ 4 ] = 0;
+ Count.count[ 5 ] = 0;
+
+ status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode );
+ directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" );
+}
diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c
new file mode 100644
index 0000000000..d2bc2ec00d
--- /dev/null
+++ b/testsuites/sptests/sp20/init.c
@@ -0,0 +1,68 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 20 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_create(
+ Task_name[ index ],
+ Priorities[ index ],
+ RTEMS_MINIMUM_STACK_SIZE * 4,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+ }
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Count.count[ 1 ] = 0;
+ Count.count[ 2 ] = 0;
+ Count.count[ 3 ] = 0;
+ Count.count[ 4 ] = 0;
+ Count.count[ 5 ] = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp20/sp20.doc b/testsuites/sptests/sp20/sp20.doc
new file mode 100644
index 0000000000..4a029a4b89
--- /dev/null
+++ b/testsuites/sptests/sp20/sp20.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test20
+
+directives:
+
+ rm_create, rm_period
+
+concepts:
+
+ a. Verifies Rate Monotonic Manager behavior.
diff --git a/testsuites/sptests/sp20/sp20.scn b/testsuites/sptests/sp20/sp20.scn
new file mode 100644
index 0000000000..bb4e8814da
--- /dev/null
+++ b/testsuites/sptests/sp20/sp20.scn
@@ -0,0 +1,27 @@
+*** TEST 20 ***
+TA1 - rtems_rate_monotonic_create id = 0x28010001
+TA1 - rtems_rate_monotonic_ident id = 0x28010001
+TA1 - (0x28010001) period 2
+TA2 - rtems_rate_monotonic_create id = 0x28010002
+TA2 - rtems_rate_monotonic_ident id = 0x28010002
+TA2 - (0x28010002) period 2
+TA3 - rtems_rate_monotonic_create id = 0x28010003
+TA3 - rtems_rate_monotonic_ident id = 0x28010003
+TA3 - (0x28010003) period 2
+TA4 - rtems_rate_monotonic_create id = 0x28010004
+TA4 - rtems_rate_monotonic_ident id = 0x28010004
+TA4 - (0x28010004) period 2
+TA5 - rtems_rate_monotonic_create id = 0x28010005
+TA5 - rtems_rate_monotonic_ident id = 0x28010005
+TA5 - (0x28010005) period 100
+TA5 - PERIODS CHECK OK (1)
+TA5 - PERIODS CHECK OK (2)
+TA5 - PERIODS CHECK OK (3)
+TA5 - PERIODS CHECK OK (4)
+TA5 - PERIODS CHECK OK (5)
+TA5 - PERIODS CHECK OK (6)
+TA5 - PERIODS CHECK OK (7)
+TA5 - PERIODS CHECK OK (8)
+TA5 - PERIODS CHECK OK (9)
+TA5 - PERIODS CHECK OK (10)
+*** END OF TEST 20 ***
diff --git a/testsuites/sptests/sp20/system.h b/testsuites/sptests/sp20/system.h
new file mode 100644
index 0000000000..ddd68c336e
--- /dev/null
+++ b/testsuites/sptests/sp20/system.h
@@ -0,0 +1,59 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* types */
+
+struct counters {
+ rtems_unsigned32 count[6];
+};
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1_through_5(
+ rtems_task_argument argument
+);
+
+void Get_all_counters( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INIT_TASK_PRIORITY 10
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+#define CONFIGURE_MAXIMUM_PERIODS 10
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+
+TEST_EXTERN struct counters Count; /* iteration counters */
+TEST_EXTERN struct counters Temporary_count;
+extern rtems_task_priority Priorities[ 6 ];
+
+/* end of include file */
diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c
new file mode 100644
index 0000000000..c5eda1a9ae
--- /dev/null
+++ b/testsuites/sptests/sp20/task1.c
@@ -0,0 +1,116 @@
+/* Task_1_through_5
+ *
+ * This routine serves as a test task for the period capabilities of the
+ * Rate Monotonic Manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 };
+rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 };
+rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
+
+rtems_task Task_1_through_5(
+ rtems_unsigned32 argument
+)
+{
+ rtems_id rmid;
+ rtems_id test_rmid;
+ rtems_unsigned32 index;
+ rtems_unsigned32 pass;
+ rtems_unsigned32 failed;
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( argument, &rmid );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid );
+
+ status = rtems_rate_monotonic_ident( argument, &test_rmid );
+ directive_failed( status, "rtems_rate_monotonic_ident" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid );
+
+ if ( rmid != test_rmid ) {
+ printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] );
+
+ status = rtems_task_wake_after( 2 );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ switch ( argument ) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ while ( FOREVER ) {
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+ Count.count[ argument ]++;
+ }
+ break;
+ case 5:
+ pass = 0;
+ failed = 0;
+
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
+
+ Get_all_counters();
+
+ while ( FOREVER ) {
+
+ status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
+ directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
+
+ Get_all_counters();
+
+ for( index = 1 ; index <= 4 ; index++ ) {
+ if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
+ puts_nocr( "FAIL -- " );
+ put_name ( Task_name[ index ], FALSE );
+ printf ( " Actual=%d, Expected=%d\n",
+ Temporary_count.count[ index ],
+ Iterations[ index ]
+ );
+ failed += 1;
+ }
+ }
+
+ if ( failed == 5 )
+ exit( 0 );
+
+ pass += 1;
+
+ printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
+
+ fflush( stdout );
+
+ if ( pass == 10 ) {
+ puts( "*** END OF TEST 20 ***" );
+ exit( 0 );
+ }
+
+ }
+ break;
+ }
+}
diff --git a/testsuites/sptests/sp21/init.c b/testsuites/sptests/sp21/init.c
new file mode 100644
index 0000000000..a8ea3e7ed2
--- /dev/null
+++ b/testsuites/sptests/sp21/init.c
@@ -0,0 +1,53 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 21 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp21/sp21.doc b/testsuites/sptests/sp21/sp21.doc
new file mode 100644
index 0000000000..55ed6282bc
--- /dev/null
+++ b/testsuites/sptests/sp21/sp21.doc
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test21
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete
+ de_init, de_open, de_close, de_read, de_write, de_cntrl
+
+concepts:
+
+ a. Verifies all I/O manager directives always return successful for
+ null drivers.
+
+ b. Verifies all I/O manager directives call and return from the driver
+ entry points in the driver address table.
diff --git a/testsuites/sptests/sp21/sp21.scn b/testsuites/sptests/sp21/sp21.scn
new file mode 100644
index 0000000000..c6392e3ea3
--- /dev/null
+++ b/testsuites/sptests/sp21/sp21.scn
@@ -0,0 +1,19 @@
+*** TEST 21 ***
+----- TESTING THE NULL DRIVER CHECKS -----
+TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL
+----- TESTING THE I/O MANAGER DIRECTIVES -----
+TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL
+TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL
+----- RETURNING INVALID MAJOR NUMBER -----
+TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER
+TA1 - rtems_io_open - RTEMS_INVALID_NUMBER
+*** END OF TEST 21 ***
diff --git a/testsuites/sptests/sp21/system.h b/testsuites/sptests/sp21/system.h
new file mode 100644
index 0000000000..9c68c795b4
--- /dev/null
+++ b/testsuites/sptests/sp21/system.h
@@ -0,0 +1,44 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_TEST_NEEDS_STUB_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp21/task1.c b/testsuites/sptests/sp21/task1.c
new file mode 100644
index 0000000000..03bde1db75
--- /dev/null
+++ b/testsuites/sptests/sp21/task1.c
@@ -0,0 +1,105 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the I/O manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#define STUB_DRIVER_MAJOR 0x2
+#define NO_DRIVER_MAJOR 0x3
+#define INVALID_DRIVER_MAJOR 0x5
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "----- TESTING THE NULL DRIVER CHECKS -----" );
+
+ status = rtems_io_initialize( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_initialize" );
+ puts( "TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_open( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_open" );
+ puts( "TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_close( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_close" );
+ puts( "TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_read( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_read" );
+ puts( "TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_write( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_write" );
+ puts( "TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_control( NO_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_control" );
+ puts( "TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL" );
+
+ puts( "----- TESTING THE I/O MANAGER DIRECTIVES -----" );
+
+ status = rtems_io_initialize( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_initialize" );
+ puts( "TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_open( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_open" );
+ puts( "TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_close( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_close" );
+ puts( "TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_read( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_read" );
+ puts( "TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_write( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_write" );
+ puts( "TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ status = rtems_io_control( STUB_DRIVER_MAJOR, 0, NULL );
+ directive_failed( status, "rtems_io_control" );
+ puts( "TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL" );
+
+ puts( "----- RETURNING INVALID MAJOR NUMBER -----" );
+
+ status = rtems_io_initialize( INVALID_DRIVER_MAJOR, 0, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_initialize"
+ );
+ puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
+
+ status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_open"
+ );
+ puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
+
+ puts( "*** END OF TEST 21 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp22/delay.c b/testsuites/sptests/sp22/delay.c
new file mode 100644
index 0000000000..bcf9e014a7
--- /dev/null
+++ b/testsuites/sptests/sp22/delay.c
@@ -0,0 +1,32 @@
+/* Delayed_resume
+ *
+ * This routine is scheduled to be fired as a timer service routine.
+ * When fired this subprogram resumes Task_1.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_resume(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_resume of self" );
+}
diff --git a/testsuites/sptests/sp22/init.c b/testsuites/sptests/sp22/init.c
new file mode 100644
index 0000000000..1ebc50bb20
--- /dev/null
+++ b/testsuites/sptests/sp22/init.c
@@ -0,0 +1,66 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 22 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ puts( "INIT - rtems_timer_create - creating timer 1" );
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp22/prtime.c b/testsuites/sptests/sp22/prtime.c
new file mode 100644
index 0000000000..f3871eb9fd
--- /dev/null
+++ b/testsuites/sptests/sp22/prtime.c
@@ -0,0 +1,32 @@
+/* Print_time
+ *
+ * This routine prints the name of Task_1 and the current time of day.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Print_time( void )
+{
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ 1 ], FALSE );
+ print_time( "- rtems_clock_get - ", &time, "\n" );
+}
diff --git a/testsuites/sptests/sp22/sp22.doc b/testsuites/sptests/sp22/sp22.doc
new file mode 100644
index 0000000000..9208d7a695
--- /dev/null
+++ b/testsuites/sptests/sp22/sp22.doc
@@ -0,0 +1,20 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test22
+
+directives:
+
+concepts:
diff --git a/testsuites/sptests/sp22/sp22.scn b/testsuites/sptests/sp22/sp22.scn
new file mode 100644
index 0000000000..6fb08156c5
--- /dev/null
+++ b/testsuites/sptests/sp22/sp22.scn
@@ -0,0 +1,29 @@
+*** TEST 22 ***
+INIT - rtems_timer_create - creating timer 1
+INIT - timer 1 has id (0x10010001)
+TA1 - rtems_timer_ident - identing timer 1
+TA1 - timer 1 has id (0x10010001)
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:03 12/31/1988
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:04 12/31/1988
+TA1 - rtems_timer_reset - timer 1
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:07 12/31/1988
+<pause>
+TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_clock_get - 09:00:07 12/31/1988
+TA1 - rtems_timer_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_timer_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:11 12/31/1988
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_task_wake_after - YIELD (only task at priority)
+TA1 - timer_deleting - timer 1
+*** END OF TEST 22 ***
diff --git a/testsuites/sptests/sp22/system.h b/testsuites/sptests/sp22/system.h
new file mode 100644
index 0000000000..c7d0636ba3
--- /dev/null
+++ b/testsuites/sptests/sp22/system.h
@@ -0,0 +1,55 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Delayed_resume(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+void Print_time( void );
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 2
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp22/task1.c b/testsuites/sptests/sp22/task1.c
new file mode 100644
index 0000000000..547c8391cf
--- /dev/null
+++ b/testsuites/sptests/sp22/task1.c
@@ -0,0 +1,164 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id tmid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+/* Get id */
+
+ puts( "TA1 - rtems_timer_ident - identing timer 1" );
+ status = rtems_timer_ident( Timer_name[ 1 ], &tmid );
+ directive_failed( status, "rtems_timer_ident" );
+ printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
+
+/* after which is allowed to fire */
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+/* after which is reset and allowed to fire */
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_task_wake_after - 1 second" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_reset - timer 1" );
+ status = rtems_timer_reset( tmid );
+ directive_failed( status, "rtems_timer_reset" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+ rtems_test_pause();
+
+ /*
+ * Reset the time since we do not know how long the user waited
+ * before pressing <cr> at the pause. This insures that the
+ * actual output matches the screen.
+ */
+
+ build_time( &time, 12, 31, 1988, 9, 0, 7, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+/* after which is canceled */
+
+ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_after(
+ tmid,
+ 3 * TICKS_PER_SECOND,
+ Delayed_resume,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ puts( "TA1 - rtems_timer_cancel - timer 1" );
+ status = rtems_timer_cancel( tmid );
+ directive_failed( status, "rtems_timer_cancel" );
+
+/* when which is allowed to fire */
+
+ Print_time();
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ time.second += 3;
+
+ puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL );
+ directive_failed( status, "rtems_timer_fire_when" );
+
+ puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ Print_time();
+
+/* when which is canceled */
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ time.second += 3;
+
+ puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" );
+ status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL );
+ directive_failed( status, "rtems_timer_fire_when" );
+
+ puts( "TA1 - rtems_task_wake_after - 1 second" );
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Print_time();
+
+ puts( "TA1 - rtems_timer_cancel - timer 1" );
+ status = rtems_timer_cancel( tmid );
+ directive_failed( status, "rtems_timer_cancel" );
+
+/* delete */
+ puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - timer_deleting - timer 1" );
+ status = rtems_timer_delete( tmid );
+ directive_failed( status, "rtems_timer_delete" );
+
+ puts( "*** END OF TEST 22 *** " );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp23/init.c b/testsuites/sptests/sp23/init.c
new file mode 100644
index 0000000000..9ca4b634c8
--- /dev/null
+++ b/testsuites/sptests/sp23/init.c
@@ -0,0 +1,69 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 23 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' );
+
+ status = rtems_port_create(
+ Port_name[ 1 ],
+ Internal_port_area,
+ External_port_area,
+ 0xff,
+ &Port_id[ 1 ]
+ );
+ directive_failed( status, "rtems_port_create of DP1" );
+
+ printf( "INIT - rtems_port_create - DP1 - int = %p ext = %p\n",
+ Internal_port_area,
+ External_port_area
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp23/sp23.doc b/testsuites/sptests/sp23/sp23.doc
new file mode 100644
index 0000000000..485a4ec466
--- /dev/null
+++ b/testsuites/sptests/sp23/sp23.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test23
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete,
+ m_ext2int, m_int2ext
+
+concepts:
+
+ a. Verifies the dual ported RAM directives work correctly.
+
+output:
diff --git a/testsuites/sptests/sp23/sp23.scn b/testsuites/sptests/sp23/sp23.scn
new file mode 100644
index 0000000000..b8b5633855
--- /dev/null
+++ b/testsuites/sptests/sp23/sp23.scn
@@ -0,0 +1,9 @@
+*** TEST 23 ***
+INIT - rtems_port_create - DP1 - int = 0x00001000 ext = 0x00002000
+TA1 - rtems_port_ident - 0x24010001
+TA1 - rtems_port_external_to_internal - 0x0000200e => 0x0000100e
+TA1 - rtems_port_internal_to_external - 0x0000100e => 0x0000200e
+TA1 - rtems_port_external_to_internal - 0x0000300e => 0x0000300e
+TA1 - rtems_port_internal_to_external - 0x0000050e => 0x0000050e
+TA1 - rtems_port_delete - DP1
+*** END OF TEST 23 ***
diff --git a/testsuites/sptests/sp23/system.h b/testsuites/sptests/sp23/system.h
new file mode 100644
index 0000000000..5a2ad3ff4e
--- /dev/null
+++ b/testsuites/sptests/sp23/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_PORTS 1
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */
+TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */
+
+#define Internal_port_area ((rtems_unsigned8 *) 0x00001000)
+#define External_port_area ((rtems_unsigned8 *) 0x00002000)
+
+#define Below_port_area ((rtems_unsigned8 *) 0x00000500)
+#define Above_port_area ((rtems_unsigned8 *) 0x00003000)
+
+/* end of include file */
diff --git a/testsuites/sptests/sp23/task1.c b/testsuites/sptests/sp23/task1.c
new file mode 100644
index 0000000000..73ebce778c
--- /dev/null
+++ b/testsuites/sptests/sp23/task1.c
@@ -0,0 +1,96 @@
+/* Task_1
+ *
+ * This task verifies that the dual ported RAM directives work
+ * correctly by converting external addresses to internal addresses and
+ * internal addresses to external addresses.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id dpid;
+ void *to_be_converted;
+ void *converted;
+ rtems_status_code status;
+
+ status = rtems_port_ident( Port_name[ 1 ], &dpid );
+ directive_failed( status, "rtems_port_ident" );
+ printf( "TA1 - rtems_port_ident - 0x%08x\n", dpid );
+
+ to_be_converted = &External_port_area[ 0xe ];
+ status = rtems_port_external_to_internal(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_external_to_internal" );
+ printf(
+ "TA1 - rtems_port_external_to_internal - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Internal_port_area[ 0xe ];
+ status = rtems_port_internal_to_external(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_internal_to_external" );
+ printf(
+ "TA1 - rtems_port_internal_to_external - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Above_port_area[ 0xe ];
+ status = rtems_port_external_to_internal(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_external_to_internal" );
+ printf(
+ "TA1 - rtems_port_external_to_internal - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ to_be_converted = &Below_port_area[ 0xe ];
+ status = rtems_port_internal_to_external(
+ Port_id[ 1 ],
+ to_be_converted,
+ &converted
+ );
+ directive_failed( status, "rtems_port_internal_to_external" );
+ printf(
+ "TA1 - rtems_port_internal_to_external - %p => %p\n",
+ to_be_converted,
+ converted
+ );
+
+ status = rtems_port_delete( Port_id[ 1 ] );
+ directive_failed( status, "rtems_port_delete" );
+ puts( "TA1 - rtems_port_delete - DP1" );
+
+ puts( "*** END OF TEST 23 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp24/init.c b/testsuites/sptests/sp24/init.c
new file mode 100644
index 0000000000..74114ab82a
--- /dev/null
+++ b/testsuites/sptests/sp24/init.c
@@ -0,0 +1,76 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 24 ***" );
+
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+ Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
+ Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' );
+
+ for ( index = 1 ; index <= 3 ; index++ ) {
+ status = rtems_task_create(
+ Task_name[ index ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_timer_create(
+ Timer_name[ index ],
+ &Timer_id[ index ]
+ );
+ directive_failed( status, "rtems_timer_create loop" );
+ }
+
+ for ( index = 1 ; index <= 3 ; index++ ) {
+ status = rtems_task_start( Task_id[ index ], Task_1_through_3, index );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp24/resume.c b/testsuites/sptests/sp24/resume.c
new file mode 100644
index 0000000000..c73696c109
--- /dev/null
+++ b/testsuites/sptests/sp24/resume.c
@@ -0,0 +1,34 @@
+/* Resume_task
+ *
+ * This subprogram is scheduled as a timer service routine. When
+ * it fires it resumes the task which is mapped to this timer.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Resume_task(
+ rtems_id timer_id,
+ void *ignored_address
+)
+{
+ rtems_id task_to_resume;
+ rtems_status_code status;
+
+ task_to_resume = Task_id[ rtems_get_index( timer_id ) ];
+ status = rtems_task_resume( task_to_resume );
+ directive_failed( status, "rtems_task_resume" );
+}
diff --git a/testsuites/sptests/sp24/sp24.doc b/testsuites/sptests/sp24/sp24.doc
new file mode 100644
index 0000000000..14b743d588
--- /dev/null
+++ b/testsuites/sptests/sp24/sp24.doc
@@ -0,0 +1,51 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test24
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ ev_receive
+
+concepts:
+
+ a. This test is a cyclic version of test1. The times printed by
+ each test should not skew as in test1 (see output section).
+
+ b. Verifies system can create and start both the executive's system
+ initialization and idle task.
+
+ c. Verifies executive can swap between three application tasks at the
+ same priority and the executive's internal idle task.
+
+ d. Verifies can print strings to the CRT on port 2 of the mvme136 board
+ using Print and Println in the board support package.
+
+ e. Verifies interrupt handler can handler a task switch from an interrupt
+ as specified with the i_return directive.
+
+ f. Verifies executive initialization performed correctly.
+
+ g. Verifies the executive trap handler except for the halt function.
+
+ h. Verifies that a task can get the task identification number of itself.
+
+output:
+ "TA1" is printed once every 5 seconds. "TA2" is printed once
+ every 10 seconds. "TA3" is printed once every 15 seconds.
+
+ The times printed should be multiples of 5 seconds for TA1, 10 seconds
+ for TA2, and 15 seconds for TA3. If this does not happen, the calendar
+ time does not correspond correctly to the number of ticks.
diff --git a/testsuites/sptests/sp24/sp24.scn b/testsuites/sptests/sp24/sp24.scn
new file mode 100644
index 0000000000..577dc4f7b2
--- /dev/null
+++ b/testsuites/sptests/sp24/sp24.scn
@@ -0,0 +1,16 @@
+*** TEST 24 ***
+TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA2 - rtems_clock_get - 09:00:00 12/31/1988
+TA3 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
+TA1 - rtems_clock_get - 09:00:10 12/31/1988
+TA2 - rtems_clock_get - 09:00:10 12/31/1988
+TA1 - rtems_clock_get - 09:00:15 12/31/1988
+TA3 - rtems_clock_get - 09:00:15 12/31/1988
+TA1 - rtems_clock_get - 09:00:20 12/31/1988
+TA2 - rtems_clock_get - 09:00:20 12/31/1988
+TA1 - rtems_clock_get - 09:00:25 12/31/1988
+TA1 - rtems_clock_get - 09:00:30 12/31/1988
+TA2 - rtems_clock_get - 09:00:30 12/31/1988
+TA3 - rtems_clock_get - 09:00:30 12/31/1988
+*** END OF TEST 24 ***
diff --git a/testsuites/sptests/sp24/system.h b/testsuites/sptests/sp24/system.h
new file mode 100644
index 0000000000..b54beb7add
--- /dev/null
+++ b/testsuites/sptests/sp24/system.h
@@ -0,0 +1,53 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Resume_task(
+ rtems_id timer_id,
+ void *ignored_address
+);
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TIMERS 3
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */
+
+/* end of include file */
diff --git a/testsuites/sptests/sp24/task1.c b/testsuites/sptests/sp24/task1.c
new file mode 100644
index 0000000000..bb3540acee
--- /dev/null
+++ b/testsuites/sptests/sp24/task1.c
@@ -0,0 +1,58 @@
+/* Task_1_through_3
+ *
+ * This task is a cyclic version of test1 to asssure that the times
+ * displayed are not skewed as in test1. "TA1" is printed once every
+ * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is
+ * printed once every 15 seconds. The times displayed should be
+ * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively.
+ * If the times are skewed from these values, then the calendar time
+ * does not correspond correctly with the number of ticks.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident of self" );
+
+ while ( FOREVER ) {
+ status = rtems_timer_fire_after(
+ Timer_id[ argument ],
+ task_number( tid ) * 5 * TICKS_PER_SECOND,
+ Resume_task,
+ NULL
+ );
+ directive_failed( status, "tm_fire_after failed" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get failed" );
+
+ if ( time.second >= 35 ) {
+ puts( "*** END OF TEST 24 ***" );
+ exit( 0 );
+ }
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+ }
+}
diff --git a/testsuites/sptests/sp25/init.c b/testsuites/sptests/sp25/init.c
new file mode 100644
index 0000000000..10a3f8cc52
--- /dev/null
+++ b/testsuites/sptests/sp25/init.c
@@ -0,0 +1,66 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 25 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ BASE_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1');
+
+
+ status = rtems_region_create(
+ Region_name[ 1 ],
+ Area_1,
+ sizeof( Area_1 ),
+ 64,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id[ 1 ]
+ );
+ directive_failed( status, "rtems_region_create of RN1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp25/sp25.doc b/testsuites/sptests/sp25/sp25.doc
new file mode 100644
index 0000000000..98684f53b3
--- /dev/null
+++ b/testsuites/sptests/sp25/sp25.doc
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test25
+
+directives:
+ task_create
+ task_start
+ task_delete
+ region_create
+ region_ident
+ region_get_segment
+ region_return_segment
+ region_delete
+
+concepts:
+
+ a. Verifies that the heap maintains it's integrity trhough a series
+ on region_get_segments and region_return_segments.
+
diff --git a/testsuites/sptests/sp25/sp25.scn b/testsuites/sptests/sp25/sp25.scn
new file mode 100644
index 0000000000..af2599663d
--- /dev/null
+++ b/testsuites/sptests/sp25/sp25.scn
@@ -0,0 +1,29 @@
+*** TEST 25 ***
+TA1 - rtems_region_ident - 0x20010002
+TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f9b8
+TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f930
+TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f828
+TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f620
+TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000f218
+TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000ea10
+TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000da08
+TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1
+TA1 - got segment from region 1 - 0x0000ba00
+<pause>
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f828
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f620
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f9b8
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f930
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000da08
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ea10
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ba00
+TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f218
+TA1 - rtems_region_delete - walks heap if debug enabled
+*** END OF TEST 25 ***
diff --git a/testsuites/sptests/sp25/system.h b/testsuites/sptests/sp25/system.h
new file mode 100644
index 0000000000..dfcee7551b
--- /dev/null
+++ b/testsuites/sptests/sp25/system.h
@@ -0,0 +1,54 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_REGIONS 1
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
+TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */
+TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */
+
+TEST_EXTERN rtems_unsigned8 Area_1[64000] CPU_STRUCTURE_ALIGNMENT;
+
+#define BASE_PRIORITY 140
+
+#define Put_address_from_area_1( _to_be_printed ) \
+ printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 )
+
+/* end of include file */
diff --git a/testsuites/sptests/sp25/task1.c b/testsuites/sptests/sp25/task1.c
new file mode 100644
index 0000000000..44a8194efd
--- /dev/null
+++ b/testsuites/sptests/sp25/task1.c
@@ -0,0 +1,241 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It tests the region manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ void *address_1;
+ void *address_2;
+ void *address_3;
+ void *address_4;
+ void *address_5;
+ void *address_6;
+ void *address_7;
+ void *address_8;
+ rtems_status_code status;
+ rtems_id region_id;
+
+ status = rtems_region_ident(Region_name[ 1 ], &region_id);
+ printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id );
+ directive_failed(status, "rtems_region_ident of RN01");
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 64,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_1 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 128,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_2 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 256,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_3
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_3 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 512,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_4
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_4 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 1024,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_5
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_5 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 2048,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_6
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_6 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 4096,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_7
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_7 );
+ new_line;
+
+ puts(
+ "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1"
+ );
+ rtems_region_get_segment(
+ Region_id[ 1 ],
+ 8192,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &address_8
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+ puts_nocr( "TA1 - got segment from region 1 - " );
+ Put_address_from_area_1( address_8 );
+ new_line;
+
+rtems_test_pause();
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_3 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_3 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_4 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_4 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_4 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_1 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_1 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_1 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_2 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_2 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_7 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_7 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_7 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_6 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_6 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_6 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_8 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_8 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_8 = 0;
+
+ puts_nocr(
+ "TA1 - rtems_region_return_segment - return segment to region 1 - "
+ );
+ Put_address_from_area_1( address_5 );
+ status = rtems_region_return_segment( Region_id[ 1 ], address_5 );
+ directive_failed( status, "rtems_region_return_segment" );
+ new_line;
+ address_5 = 0;
+
+ puts( "TA1 - rtems_region_delete - walks heap if debug enabled" );
+ rtems_region_delete(Region_id[ 1 ]);
+
+ puts( "*** END OF TEST 25 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/spfatal/fatal.c b/testsuites/sptests/spfatal/fatal.c
new file mode 100644
index 0000000000..fa3dd547bd
--- /dev/null
+++ b/testsuites/sptests/spfatal/fatal.c
@@ -0,0 +1,135 @@
+/* Fatal Error Test
+ *
+ * NOTE:
+ *
+ * This test actually modifies the Configuration table and restarts
+ * the executive. It is very carefully constructed to do this and
+ * uses the Configuration very carefully.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#include <setjmp.h>
+
+char Workspace[ 64 * 1024 ] CPU_STRUCTURE_ALIGNMENT;
+
+typedef enum {
+ FATAL_WORKSPACE_OF_ZERO,
+ FATAL_NULL_WORKSPACE,
+ FATAL_WORKSPACE_TOO_SMALL,
+ FATAL_TASK_CREATE,
+ FATAL_TASK_START
+} Fatal_errors_t;
+
+#define FATAL_LAST FATAL_TASK_START
+
+volatile Fatal_errors_t Case_in_switch;
+
+rtems_status_code Expected_Errors[] = {
+ RTEMS_UNSATISFIED,
+ RTEMS_INVALID_ADDRESS,
+ RTEMS_UNSATISFIED,
+ RTEMS_INVALID_PRIORITY,
+ RTEMS_TASK_EXITTED
+};
+
+rtems_status_code Error_Happened[ FATAL_LAST + 1];
+
+jmp_buf Restart_Context;
+
+/*
+ * We depend on this being zeroed during initialization. This
+ * occurs automatically because this is part of the BSS.
+ */
+
+rtems_unsigned32 First_Time_Through;
+
+void Process_case();
+
+rtems_extension Fatal_extension(
+ rtems_unsigned32 error,
+ boolean is_internal
+)
+{
+ int index;
+
+ Error_Happened[ Case_in_switch ] = error;
+
+ if ( First_Time_Through == 0 ) {
+ Case_in_switch = FATAL_WORKSPACE_OF_ZERO;
+ First_Time_Through = 1;
+ setjmp( Restart_Context );
+ } else if ( Case_in_switch == FATAL_LAST ) {
+
+ /*
+ * Depending on the C library we use, we cannot get the
+ * task exitted error so do not check for it.
+ */
+
+ puts( "*** TEST FATAL ***" );
+ for ( index=0 ; index< FATAL_LAST ; index++ )
+ put_error( Error_Happened[ index ], Expected_Errors[ index ] );
+ puts( "NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS" );
+ puts( "*** END OF TEST FATAL ***" );
+
+ /*
+ * returns to the default fatal error handler instead of
+ * calling rtems_shutdown_executive
+ */
+ return;
+
+ } else {
+
+ longjmp( Restart_Context, 1 );
+ }
+
+ Process_case();
+}
+
+
+
+void Process_case()
+{
+ switch ( Case_in_switch ) {
+ case FATAL_WORKSPACE_OF_ZERO:
+ New_Configuration = BSP_Configuration;
+ New_Configuration.work_space_start = NULL;
+ Case_in_switch = FATAL_NULL_WORKSPACE;
+ break;
+
+ case FATAL_NULL_WORKSPACE:
+ New_Configuration.work_space_start = Workspace;
+ New_Configuration.work_space_size = 256;
+ Case_in_switch = FATAL_WORKSPACE_TOO_SMALL;
+ break;
+
+ case FATAL_WORKSPACE_TOO_SMALL:
+ Initialization_tasks[ 0 ].initial_priority = RTEMS_CURRENT_PRIORITY;
+ New_Configuration.work_space_size = sizeof( Workspace );
+ Case_in_switch = FATAL_TASK_CREATE;
+ break;
+
+ case FATAL_TASK_CREATE:
+ Initialization_tasks[ 0 ].initial_priority = 1;
+ Initialization_tasks[ 0 ].entry_point = NULL;
+ Case_in_switch = FATAL_TASK_START;
+ break;
+
+ case FATAL_TASK_START:
+ /* this extension exits the test */
+ Initialization_tasks[ 0 ].entry_point = Init;
+ break;
+ }
+ rtems_initialize_executive( &New_Configuration, &Cpu_table );
+}
+
diff --git a/testsuites/sptests/spfatal/init.c b/testsuites/sptests/spfatal/init.c
new file mode 100644
index 0000000000..5abcec46a4
--- /dev/null
+++ b/testsuites/sptests/spfatal/init.c
@@ -0,0 +1,51 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/spfatal/puterr.c b/testsuites/sptests/spfatal/puterr.c
new file mode 100644
index 0000000000..f7d79e5f34
--- /dev/null
+++ b/testsuites/sptests/spfatal/puterr.c
@@ -0,0 +1,68 @@
+/* put_error
+ *
+ * This routine verifies that the given error is the expected error.
+ *
+ * Input parameters:
+ * error - actual error code
+ * expected - expected error code
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+char *Errors[] = {
+ "RTEMS_SUCCESSFUL", /* successful completion */
+ "RTEMS_TASK_EXITTED", /* returned from a task */
+ "RTEMS_MP_NOT_CONFIGURED", /* multiprocessing not configured */
+ "RTEMS_INVALID_NAME", /* invalid object name */
+ "RTEMS_INVALID_ID", /* invalid object id */
+ "RTEMS_TOO_MANY", /* too many */
+ "RTEMS_TIMEOUT", /* timed out waiting */
+ "RTEMS_OBJECT_WAS_DELETED", /* object was deleted while waiting */
+ "RTEMS_INVALID_SIZE", /* specified size was invalid */
+ "RTEMS_INVALID_ADDRESS", /* address specified is invalid */
+ "RTEMS_INVALID_NUMBER", /* number was invalid */
+ "RTEMS_NOT_DEFINED", /* item has not been initialized */
+ "RTEMS_RESOURCE_IN_USE", /* resources still outstanding */
+ "RTEMS_UNSATISFIED", /* request not satisfied */
+ "RTEMS_INCORRECT_STATE", /* task is in wrong state */
+ "RTEMS_ALREADY_SUSPENDED", /* task already in state */
+ "RTEMS_ILLEGAL_ON_SELF", /* illegal operation on calling task */
+ "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
+ "RTEMS_CALLED_FROM_ISR", /* called from ISR */
+ "RTEMS_INVALID_PRIORITY", /* invalid task priority */
+ "RTEMS_INVALID_CLOCK", /* invalid date/time */
+ "RTEMS_INVALID_NODE", /* invalid node id */
+ "RTEMS_NOT_OWNER_OF_RESOURCE", /* not owner of resource */
+ "RTEMS_NOT_CONFIGURED", /* directive not configured */
+ "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */
+};
+
+/* Task states */
+
+void put_error(
+ rtems_unsigned32 error,
+ rtems_status_code expected
+)
+{
+
+ if ( error <= RTEMS_NOT_IMPLEMENTED )
+ printf( "EXPECTED FATAL - error code is correctly %s\n", Errors[ error ] );
+ else
+ printf( "ERROR - out of range error code is %d\n", error );
+
+ if ( error != expected ) {
+ printf( "ERROR - did not get expected code of %d\n", expected );
+ }
+}
diff --git a/testsuites/sptests/spfatal/spfatal.doc b/testsuites/sptests/spfatal/spfatal.doc
new file mode 100644
index 0000000000..501f278670
--- /dev/null
+++ b/testsuites/sptests/spfatal/spfatal.doc
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: testfatal
+
+directives: none
+
+concepts:
+
+ a. Verifies that the proper error is reported by k_fatal when a task
+ exits.
+
+ b. Verifies that the task exitted extension works correctly.
+
+ c. Verifies that the fatal error extension works corectly.
+
diff --git a/testsuites/sptests/spfatal/spfatal.scn b/testsuites/sptests/spfatal/spfatal.scn
new file mode 100644
index 0000000000..ecb9f63597
--- /dev/null
+++ b/testsuites/sptests/spfatal/spfatal.scn
@@ -0,0 +1,8 @@
+*** TEST FATAL ***
+EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED
+EXPECTED FATAL - error code is correctly RTEMS_INVALID_ADDRESS
+EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED
+EXPECTED FATAL - error code is correctly RTEMS_INVALID_PRIORITY
+EXPECTED FATAL - error code is correctly RTEMS_TASK_EXITTED
+NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS
+*** END OF TEST FATAL ***
diff --git a/testsuites/sptests/spfatal/system.h b/testsuites/sptests/spfatal/system.h
new file mode 100644
index 0000000000..a1e3578a64
--- /dev/null
+++ b/testsuites/sptests/spfatal/system.h
@@ -0,0 +1,79 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+void put_error(
+ rtems_unsigned32 error,
+ rtems_status_code expected
+);
+
+rtems_extension Fatal_extension(
+ rtems_unsigned32 error,
+ boolean is_internal
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+extern rtems_extensions_table initial_extensions;
+
+#ifdef TEST_INIT
+rtems_extensions_table initial_extensions = {
+ NULL, /* create */
+ NULL, /* start */
+ NULL, /* restart */
+ NULL, /* delete */
+ NULL, /* switch */
+ NULL, /* begin */
+ NULL, /* exitted */
+ Fatal_extension /* fatal */
+};
+#endif
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(0)
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#define CONFIGURE_INITIAL_EXTENSIONS &initial_extensions
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+TEST_EXTERN rtems_configuration_table New_Configuration;
+
+extern rtems_extensions_table Extensions;
+extern rtems_configuration_table BSP_Configuration;
+extern rtems_cpu_table Cpu_table;
+
+/* end of include file */
diff --git a/testsuites/sptests/spfatal/task1.c b/testsuites/sptests/spfatal/task1.c
new file mode 100644
index 0000000000..d06d25e690
--- /dev/null
+++ b/testsuites/sptests/spfatal/task1.c
@@ -0,0 +1,29 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the task manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ puts( "\n\n*** TEST FATAL ***" );
+ puts( "TA1 - exitting task" );
+}
diff --git a/testsuites/sptests/spsize/getint.c b/testsuites/sptests/spsize/getint.c
new file mode 100644
index 0000000000..43d1f695c9
--- /dev/null
+++ b/testsuites/sptests/spsize/getint.c
@@ -0,0 +1,32 @@
+/* getint
+ *
+ * This routine reads and returns an integer.
+ * It assumes decimal.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters:
+ * returns - number read
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int getint( void )
+{
+ char buff[16];
+
+ gets(buff);
+ return atoi(buff);
+}
diff --git a/testsuites/sptests/spsize/init.c b/testsuites/sptests/spsize/init.c
new file mode 100644
index 0000000000..d0d5490966
--- /dev/null
+++ b/testsuites/sptests/spsize/init.c
@@ -0,0 +1,60 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Test_task();
+void size_rtems( int mode );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int choice;
+
+ setvbuf(stdout, 0, _IONBF, 0);
+
+ puts( "\n*** RTEMS SIZE PROGRAM ***" );
+ size_rtems( 1 );
+ puts( "*** END OF RTEMS SIZE PROGRAM ***" );
+ exit( 0 );
+#if 0
+ do {
+ printf( "\n\nPlease select program mode:\n" );
+ printf( " 1) Print Formulas\n" );
+ printf( " 2) Determine Workspace Size\n" );
+ printf( " 3) Exit\n" );
+ printf( "Enter number of choice (1,2,3) : " );
+
+ choice = getint();
+ switch( choice ) {
+ case 1: size_rtems( 1 ); break;
+ case 2: size_rtems( 0 ); break;
+ case 3: exit( 0 );
+ default: continue;
+ }
+ } while ( FOREVER );
+#endif
+}
diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c
new file mode 100644
index 0000000000..9b1035e5ce
--- /dev/null
+++ b/testsuites/sptests/spsize/size.c
@@ -0,0 +1,648 @@
+/* main
+ *
+ * This program is run to determine the data space and work space
+ * requirements of the current version of RTEMS.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/directives.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/copyrt.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/extension.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/score/isr.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/io.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/mp.h>
+#include <rtems/score/mpci.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/priority.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/timer.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+
+#include <stdlib.h>
+
+/* These are always defined by the executive.
+ *
+ * #include <rtems/copyrt.h>
+ * #include <rtems/tables.h>
+ * #include <rtems/sptables.h>
+ */
+#define HEAP_OVHD 16 /* wasted heap space per task stack */
+#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */
+#define READYCHAINS_SIZE \
+ ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))
+
+#define PER_TASK \
+ (sizeof (Thread_Control) + \
+ NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ))
+#define PER_SEMAPHORE \
+ (sizeof (Semaphore_Control) + NAME_PTR_SIZE)
+#define PER_TIMER \
+ (sizeof (Timer_Control) + NAME_PTR_SIZE)
+#define PER_MSGQ \
+ (sizeof (Message_queue_Control) + NAME_PTR_SIZE)
+#define PER_REGN \
+ (sizeof (Region_Control) + NAME_PTR_SIZE)
+#define PER_PART \
+ (sizeof (Partition_Control) + NAME_PTR_SIZE)
+#define PER_PERIOD \
+ (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE)
+#define PER_PORT \
+ (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE)
+#define PER_EXTENSION \
+ (sizeof (Extension_Control) + NAME_PTR_SIZE)
+
+#define PER_DRV (0)
+#define PER_FPTASK (CONTEXT_FP_SIZE)
+#define PER_GOBTBL (sizeof (Chain_Control)*4)
+#define PER_NODE PER_GOBTBL
+#define PER_GOBJECT (sizeof (Objects_MP_Control))
+#define PER_PROXY (sizeof (Thread_Proxy_control))
+
+#if (CPU_ALL_TASKS_ARE_FP == TRUE)
+#define MPCI_RECEIVE_SERVER_FP (sizeof( Context_Control_fp ))
+#else
+#define MPCI_RECEIVE_SERVER_FP 0
+#endif
+
+#if (CPU_IDLE_TASK_IS_FP == TRUE)
+#define SYSTEM_IDLE_FP (sizeof( Context_Control_fp ))
+#else
+#define SYSTEM_IDLE_FP 0
+#endif
+
+#define SYSTEM_TASKS \
+ (THREAD_IDLE_STACK_SIZE + \
+ MPCI_RECEIVE_SERVER_STACK_SIZE + \
+ (2*sizeof(Thread_Control))) + \
+ MPCI_RECEIVE_SERVER_FP + \
+ SYSTEM_IDLE_FP
+
+#define rtems_unsigned32 unsigned32
+
+rtems_unsigned32 sys_req;
+
+/* to avoid warnings */
+int puts();
+int printf();
+int getint();
+#undef getchar
+int getchar();
+void help_size();
+void print_formula();
+
+void size_rtems(
+ int mode
+)
+{
+int uninitialized = 0;
+int initialized = 0;
+
+/*
+ * The following data is allocated for each Manager:
+ *
+ * + Per Manager Object Information
+ * - local pointer table
+ * - local name table
+ * - the object's control blocks
+ * - global name chains
+ *
+ * The following is the data allocate from the RTEMS Workspace Area.
+ * The order indicates the order in which RTEMS allocates it.
+ *
+ * + Object MP
+ * - Global Object CB's
+ * + Thread
+ * - Ready Chain
+ * + Thread MP
+ * - Proxies Chain
+ * + Interrupt Manager
+ * - Interrupt Stack
+ * + Timer Manager
+ * - per Manager Object Data
+ * + Extension Manager
+ * - per Manager Object Data
+ * + Message Queue Manager
+ * - per Manager Object Data
+ * - Message Buffers
+ * + Semaphore Manager
+ * - per Manager Object Data
+ * + Partition Manager
+ * - per Manager Object Data
+ * + Region Manager
+ * - per Manager Object Data
+ * + Dual Ported Memory Manager
+ * - per Manager Object Data
+ * + Rate Monotonic Manager
+ * - per Manager Object Data
+ * + Internal Threads Handler
+ * - MPCI Receive Server Thread TCB
+ * - IDLE Thread TCB
+ * - MPCI Receive Server Thread stack
+ * - MPCI Receive Server Thread FP area (if CPU requires this)
+ * - IDLE Thread stack
+ * - IDLE Thread FP area (if CPU requires this)
+ *
+ * This does not take into account any CPU dependent alignment requirements.
+ *
+ * The following calculates the overhead needed by RTEMS from the
+ * Workspace Area.
+ */
+sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */
+ NAME_PTR_SIZE + /* Task Overhead */
+ READYCHAINS_SIZE + /* Ready Chains */
+ NAME_PTR_SIZE + /* Timer Overhead */
+ NAME_PTR_SIZE + /* Semaphore Overhead */
+ NAME_PTR_SIZE + /* Message Queue Overhead */
+ NAME_PTR_SIZE + /* Region Overhead */
+ NAME_PTR_SIZE + /* Partition Overhead */
+ NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */
+ NAME_PTR_SIZE + /* Rate Monotonic Overhead */
+ NAME_PTR_SIZE + /* Extension Overhead */
+ PER_NODE; /* Extra Gobject Table */
+
+uninitialized =
+/*address.h*/ 0 +
+
+/*apiext.h*/ (sizeof _API_extensions_List) +
+
+/*asr.h*/ 0 +
+
+/*attr.h*/ 0 +
+
+/*bitfield.h*/ 0 +
+
+/*chain.h*/ 0 +
+
+/*clock.h*/ 0 +
+
+/*config.h*/ (sizeof _Configuration_Table) +
+ (sizeof _Configuration_MP_table) +
+
+/*context.h*/ (sizeof _Context_Switch_necessary) +
+
+/*copyrt.h*/ 0 +
+
+/*debug.h*/ (sizeof _Debug_Level) +
+
+/*dpmem.h*/ (sizeof _Dual_ported_memory_Information) +
+
+/*event.h*/ (sizeof _Event_Sync_state) +
+
+/*eventmp.h*/ 0 +
+
+/*eventset.h*/ 0 +
+
+/*extension.h*/ (sizeof _Extension_Information) +
+
+/*fatal.h*/ 0 +
+
+/*heap.h*/ 0 +
+
+/*init.h*/ 0 +
+
+/*interr.h*/ (sizeof Internal_errors_What_happened) +
+
+/*intr.h*/ 0 +
+
+/*io.h*/ (sizeof _IO_Number_of_drivers) +
+ (sizeof _IO_Driver_address_table) +
+ (sizeof _IO_Number_of_devices) +
+ (sizeof _IO_Driver_name_table) +
+
+/*isr.h*/ (sizeof _ISR_Nest_level) +
+ (sizeof _ISR_Vector_table) +
+ (sizeof _ISR_Signals_to_thread_executing) +
+
+/*message.h*/ (sizeof _Message_queue_Information) +
+
+/*modes.h*/ 0 +
+
+/*mp.h*/ 0 +
+
+/*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) +
+ (sizeof _MPCI_Semaphore) +
+ (sizeof _MPCI_table) +
+ (sizeof _MPCI_Receive_server_tcb) +
+ (sizeof _MPCI_Packet_processors) +
+
+/*mppkt.h*/ 0 +
+
+/*mptables.h*/ 0 +
+
+/*msgmp.h*/ 0 +
+
+/*object.h*/ (sizeof _Objects_Local_node) +
+ (sizeof _Objects_Maximum_nodes) +
+ (sizeof _Objects_Information_table) +
+
+/*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) +
+ (sizeof _Objects_MP_Inactive_global_objects) +
+
+/*options.h*/ 0 +
+
+/*part.h*/ (sizeof _Partition_Information) +
+
+/*partmp.h*/ 0 +
+
+/*priority.h*/ (sizeof _Priority_Major_bit_map) +
+ (sizeof _Priority_Bit_map) +
+
+/*ratemon.h*/ (sizeof _Rate_monotonic_Information) +
+
+/*region.h*/ (sizeof _Region_Information) +
+
+/*regionmp.h*/ 0 +
+
+/*rtems.h*/ /* Not applicable */
+
+/*sem.h*/ (sizeof _Semaphore_Information) +
+
+/*semmp.h*/ 0 +
+
+/*signal.h*/ 0 +
+
+/*signalmp.h*/ 0 +
+
+/*stack.h*/ 0 +
+
+/*states.h*/ 0 +
+
+/*status.h*/ 0 +
+
+/*sysstate.h*/ (sizeof _System_state_Is_multiprocessing) +
+ (sizeof _System_state_Current) +
+
+/*system.h*/ (sizeof _CPU_Table) +
+
+/*taskmp.h*/ 0 +
+
+/*tasks.h*/ (sizeof _RTEMS_tasks_Information) +
+ (sizeof _RTEMS_tasks_User_initialization_tasks) +
+ (sizeof _RTEMS_tasks_Number_of_initialization_tasks) +
+
+/*thread.h*/ (sizeof _Thread_BSP_context) +
+ (sizeof _Thread_Dispatch_disable_level) +
+ (sizeof _Thread_Maximum_extensions) +
+ (sizeof _Thread_Ticks_remaining_in_timeslice) +
+ (sizeof _Thread_Ticks_per_timeslice) +
+ (sizeof _Thread_Ready_chain) +
+ (sizeof _Thread_Executing) +
+ (sizeof _Thread_Heir) +
+ (sizeof _Thread_Allocated_fp) +
+ (sizeof _Thread_Internal_information) +
+ (sizeof _Thread_Idle) +
+
+/*threadmp.h*/ (sizeof _Thread_MP_Receive) +
+ (sizeof _Thread_MP_Active_proxies) +
+ (sizeof _Thread_MP_Inactive_proxies) +
+
+/*threadq.h*/ (sizeof _Thread_queue_Extract_table) +
+
+/*timer.h*/ (sizeof _Timer_Information) +
+
+/*tod.h*/ (sizeof _TOD_Current) +
+ (sizeof _TOD_Seconds_since_epoch) +
+ (sizeof _TOD_Ticks_since_boot) +
+ (sizeof _TOD_Microseconds_per_tick) +
+ (sizeof _TOD_Ticks_per_second) +
+ (sizeof _TOD_Seconds_watchdog) +
+
+/*tqdata.h*/ 0 +
+
+/*types.h*/ 0 +
+
+/*userext.h*/ (sizeof _User_extensions_Initial) +
+ (sizeof _User_extensions_List) +
+
+/*watchdog.h*/ (sizeof _Watchdog_Sync_level) +
+ (sizeof _Watchdog_Sync_count) +
+ (sizeof _Watchdog_Ticks_chain) +
+ (sizeof _Watchdog_Seconds_chain) +
+
+/*wkspace.h*/ (sizeof _Workspace_Area);
+
+uninitialized = 0;
+
+#ifndef unix /* make sure this is not a native compile */
+
+#ifdef i386
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef i960
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef hppa1_1
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+#ifndef RTEMS_UNIX
+ (sizeof _CPU_Default_gr27) +
+#endif
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+#endif
+
+#ifdef m68k
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high);
+
+#endif
+
+#ifdef sparc
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Trap_Table_area);
+
+#ifdef erc32
+uninitialized += (sizeof _ERC32_MEC_Timer_Control_Mirror);
+#endif
+
+
+#endif
+
+
+#ifdef no_cpu
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Null_fp_context) +
+ (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_Thread_dispatch_pointer);
+
+#endif
+
+#ifdef ppc
+
+/* cpu.h */
+uninitialized += (sizeof _CPU_Interrupt_stack_low) +
+ (sizeof _CPU_Interrupt_stack_high) +
+ (sizeof _CPU_IRQ_info);
+
+#endif
+#endif /* !unix */
+
+initialized +=
+/*copyrt.h*/ (strlen(_Copyright_Notice)+1) +
+
+/*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) +
+ (strlen(_RTEMS_version)+1) +
+ (sizeof _Entry_points) +
+
+
+/*tod.h*/ (sizeof _TOD_Days_per_month) +
+ (sizeof _TOD_Days_to_date) +
+ (sizeof _TOD_Days_since_last_leap_year);
+
+#ifndef unix /* make sure this is not native */
+#ifdef sparc
+
+initialized += (sizeof _CPU_Trap_slot_template);
+
+#endif
+#endif /* !unix */
+
+puts( "" );
+
+ if ( mode == 0 ) help_size();
+ else print_formula();
+
+printf( "\n" );
+printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized );
+printf( "RTEMS intialized data consumes %d bytes\n", initialized );
+
+}
+
+void help_size()
+{
+int c = '\0';
+int break_loop;
+int total_size;
+int task_stacks;
+int interrupt_stack;
+int maximum_tasks, size_tasks;
+int maximum_sems, size_sems;
+int maximum_timers, size_timers;
+int maximum_msgqs, size_msgqs;
+int maximum_msgs, size_msgs_overhead;
+int maximum_regns, size_regns;
+int maximum_parts, size_parts;
+int maximum_ports, size_ports;
+int maximum_periods, size_periods;
+int maximum_extensions, size_extensions;
+int maximum_drvs, size_drvs;
+int maximum_fps, size_fps;
+int maximum_nodes, size_nodes;
+int maximum_gobjs, size_gobjs;
+int maximum_proxies, size_proxies;
+
+total_size = sys_req; /* Fixed Overhead */
+printf( "What is maximum_tasks? " );
+maximum_tasks = getint();
+size_tasks = PER_TASK * maximum_tasks;
+total_size += size_tasks;
+
+printf( "What is maximum_semaphores? " );
+maximum_sems = getint();
+size_sems = PER_SEMAPHORE * maximum_sems;
+total_size += size_sems;
+
+printf( "What is maximum_timers? " );
+maximum_timers = getint();
+size_timers = PER_TIMER * maximum_timers;
+total_size += size_timers;
+
+printf( "What is maximum_message_queues? " );
+maximum_msgqs = getint();
+size_msgqs = PER_MSGQ * maximum_msgqs;
+total_size += size_msgqs;
+
+printf( "What is maximum_messages? XXXX " );
+maximum_msgs = getint();
+size_msgs_overhead = 0;
+total_size += size_msgs_overhead;
+
+printf( "What is maximum_regions? " );
+maximum_regns = getint();
+size_regns = PER_REGN * maximum_regns;
+total_size += size_regns;
+
+printf( "What is maximum_partitions? " );
+maximum_parts = getint();
+size_parts = PER_PART * maximum_parts;
+total_size += size_parts;
+
+printf( "What is maximum_ports? " );
+maximum_ports = getint();
+size_ports = PER_PORT * maximum_ports;
+total_size += size_ports;
+
+printf( "What is maximum_periods? " );
+maximum_periods = getint();
+size_periods = PER_PORT * maximum_periods;
+total_size += size_periods;
+
+printf( "What is maximum_extensions? " );
+maximum_extensions = getint();
+size_extensions = PER_EXTENSION * maximum_extensions;
+total_size += size_extensions;
+
+printf( "What is number_of_device_drivers? " );
+maximum_drvs = getint();
+size_drvs = PER_DRV * maximum_drvs;
+total_size += size_drvs;
+
+printf( "What will be total stack requirement for all tasks? " );
+task_stacks = getint();
+total_size += task_stacks;
+
+printf( "What is the size of the interrupt stack? " );
+interrupt_stack = getint();
+total_size += interrupt_stack;
+
+printf( "How many tasks will be created with the FP flag? " );
+maximum_fps = getint();
+size_fps = PER_FPTASK * maximum_fps;
+total_size += size_fps;
+
+printf( "Is this a single processor system? " );
+for ( break_loop=0 ; !break_loop; c = getchar() ) {
+ switch ( c ) {
+ case 'Y': case 'y':
+ case 'N': case 'n':
+ break_loop = 1;
+ break;
+ }
+}
+printf( "%c\n", c );
+if ( c == 'n' || c == 'N' ) {
+ printf( "What is maximum_nodes? " );
+ maximum_nodes = getint();
+ size_nodes = PER_NODE * maximum_nodes;
+ total_size += size_nodes;
+ printf( "What is maximum_global_objects? " );
+ maximum_gobjs = getint();
+ size_gobjs = PER_GOBJECT * maximum_gobjs;
+ total_size += size_gobjs;
+ printf( "What is maximum_proxies? " );
+ maximum_proxies = getint();
+ size_proxies = PER_PROXY * maximum_proxies;
+ total_size += size_proxies;
+} else {
+ maximum_nodes = 0;
+ size_nodes = PER_NODE * 0;
+ maximum_gobjs = 0;
+ size_gobjs = PER_GOBJECT * 0;
+ maximum_proxies = 0;
+ size_proxies = PER_PROXY * 0;
+}
+
+printf( "\n\n" );
+printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );
+printf( " Tasks - %03d * %03d = %d\n",
+ maximum_tasks, PER_TASK, size_tasks );
+printf( " Semaphores - %03d * %03d = %d\n",
+ maximum_sems, PER_SEMAPHORE, size_sems );
+printf( " Timers - %03d * %03d = %d\n",
+ maximum_timers, PER_TIMER, size_timers );
+printf( " Msg Queues - %03d * %03d = %d\n",
+ maximum_msgqs, PER_MSGQ, size_msgqs );
+printf( " Messages Overhead - %03d * %03d = %d\n",
+ maximum_msgs, 0 /* PER_MSG_OVERHEAD */, size_msgs_overhead );
+printf( " Regions - %03d * %03d = %d\n",
+ maximum_regns, PER_REGN, size_regns);
+printf( " Partitions - %03d * %03d = %d\n",
+ maximum_parts, PER_PART, size_parts );
+printf( " Periods - %03d * %03d = %d\n",
+ maximum_periods, PER_PERIOD, size_periods );
+printf( " Extensions - %03d * %03d = %d\n",
+ maximum_extensions, PER_EXTENSION, size_extensions );
+printf( " Device Drivers - %03d * %03d = %d\n",
+ maximum_drvs, PER_DRV, size_drvs );
+
+printf( " System Requirements - %04d = %d\n",
+ sys_req, sys_req );
+
+printf( " Floating Point Tasks - %03d * %03d = %d\n",
+ maximum_fps, PER_FPTASK, size_fps );
+printf( " Application Task Stacks - = %d\n",
+ task_stacks );
+printf( " Interrupt Stacks - = %d\n",
+ task_stacks );
+printf( " \n" );
+printf( " Global object tables - %03d * %03d = %d\n",
+ maximum_nodes, PER_NODE, size_nodes );
+printf( " Global objects - %03d * %03d = %d\n",
+ maximum_gobjs, PER_GOBJECT, size_gobjs );
+printf( " Proxies - %03d * %03d = %d\n",
+ maximum_proxies, PER_PROXY, size_proxies );
+printf( "\n\n" );
+printf( " TOTAL = %d bytes\n",
+ total_size );
+}
+
+void print_formula()
+{
+printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" );
+printf( " Tasks - maximum_tasks * %d\n", PER_TASK );
+printf( " Timers - maximum_timers * %d\n", PER_TIMER );
+printf( " Semaphores - maximum_semaphores * %d\n", PER_SEMAPHORE);
+printf( " Message Queues - maximum_message_queues * %d\n", PER_MSGQ );
+printf( " Messages -\n");
+printf( " Regions - maximum_regions * %d\n", PER_REGN );
+printf( " Partitions - maximum_partitions * %d\n", PER_PART );
+printf( " Ports - maximum_ports * %d\n", PER_PORT );
+printf( " Periods - maximum_periods * %d\n", PER_PORT );
+printf( " Extensions - maximum_extensions * %d\n", PER_EXTENSION );
+printf( " Device Drivers - number_of_device_drivers * %d\n", PER_DRV);
+printf( " System Requirements - %d\n", sys_req );
+printf( " Floating Point Tasks - FPMASK Tasks * %d\n", CONTEXT_FP_SIZE );
+printf( " User's Tasks' Stacks -\n" );
+printf( " Interrupt Stack -\n" );
+printf( " \n" );
+printf( " Global object tables - maximum_nodes * %d\n", PER_NODE );
+printf( " Global objects - maximum_global_objects * %d\n", PER_GOBJECT );
+printf( " Proxies - maximum_proxies * %d\n", PER_PROXY );
+}
diff --git a/testsuites/sptests/spsize/system.h b/testsuites/sptests/spsize/system.h
new file mode 100644
index 0000000000..f55ddf99aa
--- /dev/null
+++ b/testsuites/sptests/spsize/system.h
@@ -0,0 +1,45 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+int getint( void );
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h
new file mode 100644
index 0000000000..f5c5e8bfbf
--- /dev/null
+++ b/testsuites/support/include/tmacros.h
@@ -0,0 +1,127 @@
+/* tmacros.h
+ *
+ * This include file contains macros which are useful in the RTEMS
+ * test suites.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TMACROS_h
+#define __TMACROS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bsp.h> /* includes <rtems.h> */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FOREVER 1 /* infinite loop */
+
+#ifdef TEST_INIT
+#define TEST_EXTERN
+#define CONFIGURE_INIT
+#else
+#define TEST_EXTERN extern
+#endif
+
+#define directive_failed( dirstat, failmsg ) \
+ fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg )
+
+#define fatal_directive_status( stat, desired, msg ) \
+ do { \
+ if ( (stat) != (desired) ) { \
+ printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
+ (msg), (desired), (stat) ); \
+ fflush(stdout); \
+ exit( stat ); \
+ } \
+ } while ( 0 )
+
+#define sprint_time(str,s1,tb,s2) \
+ do { \
+ sprintf( (str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 ); \
+ } while ( 0 )
+
+#define print_time(s1,tb,s2) \
+ do { \
+ printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 ); \
+ fflush(stdout); \
+ } while ( 0 )
+
+#define put_dot( c ) putchar( c ); fflush( stdout )
+
+#define new_line puts( "" )
+
+#define puts_nocr printf
+
+#define rtems_test_pause() \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause>" ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define rtems_test_pause_and_screen_number( _screen ) \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause - screen %d>", (_screen) ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define put_name( name, crlf ) \
+{ rtems_unsigned32 c0, c1, c2, c3; \
+ c0 = (name >> 24) & 0xff; \
+ c1 = (name >> 16) & 0xff; \
+ c2 = (name >> 8) & 0xff; \
+ c3 = name & 0xff; \
+ putchar( (char)c0 ); \
+ if ( c1 ) putchar( (char)c1 ); \
+ if ( c2 ) putchar( (char)c2 ); \
+ if ( c3 ) putchar( (char)c3 ); \
+ if ( crlf ) \
+ putchar( '\n' ); \
+}
+
+#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \
+ { (TB)->year = YR; \
+ (TB)->month = MON; \
+ (TB)->day = DAY; \
+ (TB)->hour = HR; \
+ (TB)->minute = MIN; \
+ (TB)->second = SEC; \
+ (TB)->ticks = TK; }
+
+#define task_number( tid ) \
+ ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks )
+
+static inline rtems_unsigned32 get_ticks_per_second( void )
+{
+ rtems_interval ticks_per_second;
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
+ return ticks_per_second;
+}
+
+#define TICKS_PER_SECOND get_ticks_per_second()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/testsuites/tmtests/README b/testsuites/tmtests/README
new file mode 100644
index 0000000000..c27617d5a3
--- /dev/null
+++ b/testsuites/tmtests/README
@@ -0,0 +1,21 @@
+#
+# $Id$
+#
+
+This directory contains the RTEMS Timing Test Suite.
+The tests in this directory are used to measure the execution
+time of RTEMS directive and some critical internal functions.
+The results of these test are reported in the Fact Sheets
+and Supplental Manuals.
+
+These tests attempt to benchmark RTEMS as the user would. They measure
+the execution time for a directive (under various circumstances)
+from the time RTEMS is entered until it is executed. Where possible,
+the time is the average of at least 100 invocations of the directive.
+
+The accuracy of the times reported by these benchmarks is very dependent
+on the resolution of the timer being used. It is also important to
+insure that all sources of hardware interrupts are disabled during
+execution of the tests. This insures that the directive time reported
+does not include any interrupt time.
+
diff --git a/testsuites/tmtests/include/timesys.h b/testsuites/tmtests/include/timesys.h
new file mode 100644
index 0000000000..22034a2797
--- /dev/null
+++ b/testsuites/tmtests/include/timesys.h
@@ -0,0 +1,58 @@
+/* timesys.h
+ *
+ * This header file contains the global variables for the Time
+ * suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+/*
+ * How many times a particular operation is performed while timed.
+ */
+
+#define OPERATION_COUNT 100
+#define IT_COUNT 100
+
+/* functions */
+
+#define put_time( _message, _total_time, \
+ _iterations, _loop_overhead, _overhead ) \
+ printf( \
+ "%s %d\n", \
+ (_message), \
+ (((_total_time) - (_loop_overhead)) / (_iterations)) - (_overhead) \
+ )
+
+#if defined(STACK_CHECKER_ON) || defined(RTEMS_DEBUG)
+#define Print_Warning() \
+ do { \
+ puts( \
+ "\n" \
+ "THE TIMES REPORTED BY THIS TEST INCLUDE DEBUG CODE!\n" \
+ "\n" \
+ ); \
+ } while (0)
+
+#else
+#define Print_Warning()
+#endif
+
+/* variables */
+
+TEST_EXTERN volatile rtems_unsigned32 end_time; /* ending time variable */
+TEST_EXTERN volatile rtems_unsigned32 overhead; /* loop overhead variable */
+
+TEST_EXTERN rtems_id Task_id[ OPERATION_COUNT+1 ]; /* array of task ids */
+TEST_EXTERN rtems_id Task_name[ OPERATION_COUNT+1 ]; /* array of task names */
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm01/system.h b/testsuites/tmtests/tm01/system.h
new file mode 100644
index 0000000000..190361f77c
--- /dev/null
+++ b/testsuites/tmtests/tm01/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm01/task1.c b/testsuites/tmtests/tm01/task1.c
new file mode 100644
index 0000000000..4e7dae89cd
--- /dev/null
+++ b/testsuites/tmtests/tm01/task1.c
@@ -0,0 +1,189 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 1 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+
+}
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 semaphore_obtain_time;
+ rtems_unsigned32 semaphore_release_time;
+ rtems_unsigned32 semaphore_obtain_no_wait_time;
+ rtems_unsigned32 semaphore_obtain_loop_time;
+ rtems_unsigned32 semaphore_release_loop_time;
+ rtems_unsigned32 index;
+ rtems_unsigned32 iterations;
+ rtems_name name;
+ rtems_id smid;
+ rtems_status_code status;
+
+ name = rtems_build_name( 'S', 'M', '1', ' ' );
+
+ semaphore_obtain_time = 0;
+ semaphore_release_time = 0;
+ semaphore_obtain_no_wait_time = 0;
+ semaphore_obtain_loop_time = 0;
+ semaphore_release_loop_time = 0;
+
+
+ /* Time one invocation of rtems_semaphore_create */
+
+ Timer_initialize();
+ (void) rtems_semaphore_create(
+ name,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_NO_PRIORITY,
+ &smid
+ );
+ end_time = Read_timer();
+ put_time(
+ "rtems_semaphore_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_CREATE
+ );
+
+ /* Time one invocation of rtems_semaphore_delete */
+
+ Timer_initialize();
+ (void) rtems_semaphore_delete( smid );
+ end_time = Read_timer();
+ put_time(
+ "rtems_semaphore_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_CREATE
+ );
+
+ status = rtems_semaphore_create(
+ name,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &smid
+ );
+
+ for ( iterations=OPERATION_COUNT ; iterations ; iterations-- ) {
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ semaphore_obtain_loop_time += end_time;
+ semaphore_release_loop_time += end_time;
+
+ /* rtems_semaphore_obtain (available) */
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_obtain(
+ smid,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ end_time = Read_timer();
+
+ semaphore_obtain_time += end_time;
+
+ /* rtems_semaphore_release */
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_release( smid );
+ end_time = Read_timer();
+
+ semaphore_release_time += end_time;
+
+ /* semaphore obtain (RTEMS_NO_WAIT) */
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ rtems_semaphore_obtain( smid, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT );
+ semaphore_obtain_no_wait_time += Read_timer();
+
+ Timer_initialize();
+ for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
+ rtems_semaphore_release( smid );
+ end_time = Read_timer();
+
+ semaphore_release_time += end_time;
+ }
+
+ put_time(
+ "rtems_semaphore_obtain: available",
+ semaphore_obtain_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ semaphore_obtain_loop_time,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ put_time(
+ "rtems_semaphore_obtain: not available -- NO_WAIT",
+ semaphore_obtain_no_wait_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ semaphore_obtain_loop_time,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ put_time(
+ "rtems_semaphore_release: no waiting tasks",
+ semaphore_release_time,
+ OPERATION_COUNT * OPERATION_COUNT * 2,
+ semaphore_release_loop_time * 2,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ puts( "*** END OF TEST 1 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm01/tm01.doc b/testsuites/tmtests/tm01/tm01.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm01/tm01.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm02/system.h b/testsuites/tmtests/tm02/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm02/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm02/task1.c b/testsuites/tmtests/tm02/task1.c
new file mode 100644
index 0000000000..fed5e63b12
--- /dev/null
+++ b/testsuites/tmtests/tm02/task1.c
@@ -0,0 +1,158 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id High_id;
+rtems_id Low_id;
+rtems_id Semaphore_id;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 2 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_priority priority;
+
+ priority = 5;
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &High_id
+ );
+ directive_failed( status, "rtems_task_create of high task" );
+
+ priority++;
+
+ status = rtems_task_start( High_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of high task" );
+
+ for ( index=2 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Low_id
+ );
+ directive_failed( status, "rtems_task_create middle" );
+
+ priority++;
+
+ status = rtems_task_start( Low_id, Middle_tasks, 0 );
+ directive_failed( status, "rtems_task_start middle" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Low_id
+ );
+ directive_failed( status, "rtems_task_create low" );
+
+ status = rtems_task_start( Low_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start low" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' '),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Timer_initialize(); /* start blocking rtems_semaphore_obtain time */
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_obtain: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_OBTAIN
+ );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm02/tm02.doc b/testsuites/tmtests/tm02/tm02.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm02/tm02.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm03/system.h b/testsuites/tmtests/tm03/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm03/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm03/task1.c b/testsuites/tmtests/tm03/task1.c
new file mode 100644
index 0000000000..f0ad2559bd
--- /dev/null
+++ b/testsuites/tmtests/tm03/task1.c
@@ -0,0 +1,151 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id task_id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 3 ***" );
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 252,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of test_init" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start of test_init" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_id task_id;
+ rtems_task_priority priority;
+
+ priority = 250;
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', '\0'),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ for ( index = 2 ; index <= OPERATION_COUNT ; index ++ ) {
+ rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create middle" );
+
+ priority--;
+
+ rtems_task_start( task_id, Middle_tasks, 0 );
+ directive_failed( status, "rtems_task_start middle" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of high task" );
+
+ status = rtems_task_start( task_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of high task" );
+
+ Timer_initialize(); /* start the timer */
+ status = rtems_semaphore_release( Semaphore_id );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ status = rtems_semaphore_release( Semaphore_id );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ puts( "*** END OF TEST 3 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm03/tm03.doc b/testsuites/tmtests/tm03/tm03.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm03/tm03.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm04/system.h b/testsuites/tmtests/tm04/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/testsuites/tmtests/tm04/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm04/task1.c b/testsuites/tmtests/tm04/task1.c
new file mode 100644
index 0000000000..0b10c92bf0
--- /dev/null
+++ b/testsuites/tmtests/tm04/task1.c
@@ -0,0 +1,388 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+rtems_id Task_id[OPERATION_COUNT+1];
+rtems_unsigned32 task_count;
+rtems_id Highest_id;
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Restart_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 4 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ task_count = OPERATION_COUNT;
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_task_start( Task_id[ index ], Low_tasks, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' ' ),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+}
+
+rtems_task Highest_task(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority old_priority;
+ rtems_status_code status;
+
+ if ( argument == 1 ) {
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: blocked task -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ status = rtems_task_set_priority(
+ RTEMS_CURRENT_PRIORITY,
+ 254,
+ &old_priority
+ );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ } else if ( argument == 2 ) {
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: ready task -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+
+ } else
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_name name;
+ rtems_task_priority old_priority;
+
+ Timer_initialize();
+ (void) rtems_task_restart( Highest_id, 1 );
+ /* preempted by Higher_task */
+
+ Timer_initialize();
+ (void) rtems_task_restart( Highest_id, 2 );
+ /* preempted by Higher_task */
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_semaphore_release( Semaphore_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_SEMAPHORE_RELEASE
+ );
+
+ name = rtems_build_name( 'T', 'I', 'M', 'E' );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_delete( Task_id[index] );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_task_create(
+ name,
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ rtems_task_start( Task_id[ index ], Low_tasks, 0 );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_start",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_START
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_delete( Task_id[ index ] );
+ directive_failed( status, "rtems_task_delete" );
+ }
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ name,
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], Restart_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ status = rtems_task_suspend( Task_id[ index ] );
+ directive_failed( status, "rtems_task_suspend LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: suspended task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_suspend( Task_id[ index ] );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: suspended task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ name,
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], Restart_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: ready task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_set_priority( Task_id[ index ], 5, &old_priority );
+ directive_failed( status, "rtems_task_set_priority loop" );
+ }
+
+ /* yield processor -- tasks block */
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_restart( Task_id[ index ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: blocked task -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ /* yield processor -- tasks block */
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: blocked task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ puts( "*** END OF TEST 4 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ task_count--;
+
+ if ( task_count == 0 ) {
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', ' ', ' ' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create HI" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_start HI" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Highest_id
+ );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ status = rtems_task_start( Highest_id, Highest_task, 0 );
+ directive_failed( status, "rtems_task_start HIGH" );
+
+ }
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Restart_task(
+ rtems_task_argument argument
+)
+{
+ if ( argument == 1 )
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/testsuites/tmtests/tm04/tm04.doc b/testsuites/tmtests/tm04/tm04.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm04/tm04.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm05/system.h b/testsuites/tmtests/tm05/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm05/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm05/task1.c b/testsuites/tmtests/tm05/task1.c
new file mode 100644
index 0000000000..c531bf347b
--- /dev/null
+++ b/testsuites/tmtests/tm05/task1.c
@@ -0,0 +1,132 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[OPERATION_COUNT+1];
+rtems_unsigned32 Task_index;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 5 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_unsigned32 index;
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ priority--;
+
+ if ( index==0 ) task_entry = Low_task;
+ else if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ puts( "*** END OF TEST 5 ***" );
+ exit( 0 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ Task_index++;
+ (void) rtems_task_resume( Task_id[ Task_index ] );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend: calling task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_SUSPEND
+ );
+
+ Task_index = 1;
+ Timer_initialize();
+ (void) rtems_task_resume( Task_id[ Task_index ] );
+}
diff --git a/testsuites/tmtests/tm05/tm05.doc b/testsuites/tmtests/tm05/tm05.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm05/tm05.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm06/system.h b/testsuites/tmtests/tm06/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm06/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm06/task1.c b/testsuites/tmtests/tm06/task1.c
new file mode 100644
index 0000000000..0eb0f2aa3c
--- /dev/null
+++ b/testsuites/tmtests/tm06/task1.c
@@ -0,0 +1,162 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[ OPERATION_COUNT + 1 ];
+
+rtems_unsigned32 Task_restarted;
+
+rtems_task null_task(
+ rtems_task_argument argument
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+void test_init( void );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 6 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init( void )
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Task_restarted = OPERATION_COUNT;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ if ( Task_restarted == OPERATION_COUNT )
+ Timer_initialize();
+
+ Task_restarted--;
+
+ if ( Task_restarted != 0 )
+ (void) rtems_task_restart( RTEMS_SELF, 0 );
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_task_restart: calling task",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ status = rtems_task_start( Task_id[ index ], null_task, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_suspend( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend: returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_SUSPEND
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_resume( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_delete( Task_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: ready task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESUME
+ );
+
+ puts( "*** END OF TEST 6 ***" );
+ exit( 0 );
+}
+
+rtems_task null_task(
+ rtems_task_argument argument
+)
+{
+ while ( FOREVER )
+ ;
+}
diff --git a/testsuites/tmtests/tm06/tm06.doc b/testsuites/tmtests/tm06/tm06.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm06/tm06.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm07/system.h b/testsuites/tmtests/tm07/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm07/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm07/task1.c b/testsuites/tmtests/tm07/task1.c
new file mode 100644
index 0000000000..975a1cbf1a
--- /dev/null
+++ b/testsuites/tmtests/tm07/task1.c
@@ -0,0 +1,120 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Task_id[ OPERATION_COUNT+1 ], task_index;
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 7 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+
+ priority = 250;
+
+ for( index=0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[index]
+ );
+ directive_failed( status, "rtems_task_create" );
+ priority--;
+
+ if ( index == 0 ) task_entry = Low_task;
+ else if ( index == OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[index], task_entry, 0 );
+ directive_failed( status, "rtems_task_start" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ if ( argument != 0 ) {
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart: suspended task -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_RESTART
+ );
+ } else
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ puts( "*** END OF TEST 7 ***" );
+ exit( 0 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ task_index++;
+
+ if ( argument != 0 )
+ (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
+ else
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ task_index = 1;
+
+ Timer_initialize();
+ (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
+}
diff --git a/testsuites/tmtests/tm07/tm07.doc b/testsuites/tmtests/tm07/tm07.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm07/tm07.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm08/system.h b/testsuites/tmtests/tm08/system.h
new file mode 100644
index 0000000000..994d733f4a
--- /dev/null
+++ b/testsuites/tmtests/tm08/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm08/task1.c b/testsuites/tmtests/tm08/task1.c
new file mode 100644
index 0000000000..698317edae
--- /dev/null
+++ b/testsuites/tmtests/tm08/task1.c
@@ -0,0 +1,255 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Test_task_id;
+
+rtems_task test_task(
+ rtems_task_argument argument
+);
+rtems_task test_task1(
+ rtems_task_argument argument
+);
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 8 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_status_code status;
+
+ status = rtems_task_create(
+ 1,
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Test_task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Test_task_id, test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_create(
+ 1,
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Test_task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Test_task_id, test_task1, 0 );
+ directive_failed( status, "rtems_task_start" );
+}
+
+rtems_task test_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_priority old_priority;
+ rtems_time_of_day time;
+ rtems_unsigned32 old_note;
+ rtems_unsigned32 old_mode;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_priority(
+ Test_task_id,
+ RTEMS_CURRENT_PRIORITY,
+ &old_priority
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: obtain current priority",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_priority( Test_task_id, 253, &old_priority );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_mode(
+ RTEMS_CURRENT_MODE,
+ RTEMS_CURRENT_MODE,
+ &old_mode
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: obtain current mode",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ (void) rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(1),
+ RTEMS_INTERRUPT_MASK,
+ &old_mode
+ );
+ (void) rtems_task_mode(
+ RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_INTERRUPT_MASK,
+ &old_mode
+ );
+ }
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: no reschedule",
+ end_time,
+ OPERATION_COUNT * 2,
+ overhead,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ Timer_initialize(); /* must be one host */
+ (void) rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &old_mode );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: reschedule -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_task_set_priority( Test_task_id, 1, &old_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ /* preempted by test_task1 */
+ Timer_initialize();
+ (void) rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_set_note( Test_task_id, 8, 10 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_NOTE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_get_note( Test_task_id, 8, &old_note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_get_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_GET_NOTE
+ );
+
+ build_time( &time, 1, 1, 1988, 0, 0, 0, 0 );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_clock_set( &time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_set",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_CLOCK_SET
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_get",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_CLOCK_GET
+ );
+
+ puts( "*** END OF TEST 8 ***" );
+ exit( 0 );
+}
+
+rtems_task test_task1(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode: reschedule -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_TASK_MODE
+ );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
diff --git a/testsuites/tmtests/tm08/tm08.doc b/testsuites/tmtests/tm08/tm08.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm08/tm08.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm09/system.h b/testsuites/tmtests/tm09/system.h
new file mode 100644
index 0000000000..992484e777
--- /dev/null
+++ b/testsuites/tmtests/tm09/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm09/task1.c b/testsuites/tmtests/tm09/task1.c
new file mode 100644
index 0000000000..4dbc0e14e7
--- /dev/null
+++ b/testsuites/tmtests/tm09/task1.c
@@ -0,0 +1,226 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+void queue_test();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 9 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Test_task (
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+ rtems_message_queue_create(
+ 1,
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE
+ );
+
+ queue_test();
+
+ Timer_initialize();
+ rtems_message_queue_delete( Queue_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE
+ );
+
+ puts( "*** END OF TEST 9 ***" );
+ exit( 0 );
+}
+
+void queue_test()
+{
+ rtems_unsigned32 send_loop_time;
+ rtems_unsigned32 urgent_loop_time;
+ rtems_unsigned32 receive_loop_time;
+ rtems_unsigned32 send_time;
+ rtems_unsigned32 urgent_time;
+ rtems_unsigned32 receive_time;
+ rtems_unsigned32 empty_flush_time;
+ rtems_unsigned32 flush_time;
+ rtems_unsigned32 empty_flush_count;
+ rtems_unsigned32 flush_count;
+ rtems_unsigned32 index;
+ rtems_unsigned32 iterations;
+ long buffer[4];
+ rtems_status_code status;
+ rtems_unsigned32 size;
+
+ send_loop_time = 0;
+ urgent_loop_time = 0;
+ receive_loop_time = 0;
+ send_time = 0;
+ urgent_time = 0;
+ receive_time = 0;
+ empty_flush_time = 0;
+ flush_time = 0;
+ flush_count = 0;
+ empty_flush_count = 0;
+
+ for ( iterations = 1 ; iterations <= OPERATION_COUNT ; iterations++ ) {
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ send_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ urgent_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ receive_loop_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4])buffer, 16 );
+ send_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ receive_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4])buffer, 16 );
+ urgent_time += Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4])buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ receive_time += Read_timer();
+
+ Timer_initialize();
+ rtems_message_queue_flush( Queue_id, &empty_flush_count );
+ empty_flush_time += Read_timer();
+
+ /* send one message to flush */
+ status = rtems_message_queue_send(
+ Queue_id,
+ (long (*)[4])buffer,
+ 16
+ );
+ directive_failed( status, "rtems_message_queue_send" );
+
+ Timer_initialize();
+ rtems_message_queue_flush( Queue_id, &flush_count );
+ flush_time += Read_timer();
+ }
+
+ put_time(
+ "rtems_message_queue_send: no waiting tasks",
+ send_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ send_loop_time,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ put_time(
+ "rtems_message_queue_urgent: no waiting tasks",
+ urgent_time,
+ OPERATION_COUNT * OPERATION_COUNT,
+ urgent_loop_time,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ put_time(
+ "rtems_message_queue_receive: available",
+ receive_time,
+ OPERATION_COUNT * OPERATION_COUNT * 2,
+ receive_loop_time * 2,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+ put_time(
+ "rtems_message_queue_flush: no messages flushed",
+ empty_flush_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
+ );
+
+ put_time(
+ "rtems_message_queue_flush: messages flushed",
+ flush_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
+ );
+
+}
diff --git a/testsuites/tmtests/tm09/tm09.doc b/testsuites/tmtests/tm09/tm09.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm09/tm09.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm10/system.h b/testsuites/tmtests/tm10/system.h
new file mode 100644
index 0000000000..45ec4003bf
--- /dev/null
+++ b/testsuites/tmtests/tm10/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 110
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm10/task1.c b/testsuites/tmtests/tm10/task1.c
new file mode 100644
index 0000000000..a49e61e1ab
--- /dev/null
+++ b/testsuites/tmtests/tm10/task1.c
@@ -0,0 +1,165 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+long Buffer[4];
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 10 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_unsigned32 index;
+ rtems_unsigned32 size;
+ rtems_task_entry task_entry;
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_id task_id;
+
+ priority = 5;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority++;
+
+ if ( index==0 ) task_entry = High_task;
+ else if ( index==OPERATION_COUNT ) task_entry = Low_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_message_queue_create(
+ 1,
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive: not available -- NO_WAIT",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ Timer_initialize();
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
+
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
+ );
+
+ puts( "*** END OF TEST 10 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm10/tm10.doc b/testsuites/tmtests/tm10/tm10.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm10/tm10.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm11/system.h b/testsuites/tmtests/tm11/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm11/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm11/task1.c b/testsuites/tmtests/tm11/task1.c
new file mode 100644
index 0000000000..296b742aea
--- /dev/null
+++ b/testsuites/tmtests/tm11/task1.c
@@ -0,0 +1,155 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+void Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 11 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_message_queue_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index < OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT-1 ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, 16 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, size );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm11/tm11.doc b/testsuites/tmtests/tm11/tm11.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm11/tm11.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm12/system.h b/testsuites/tmtests/tm12/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm12/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm12/task1.c b/testsuites/tmtests/tm12/task1.c
new file mode 100644
index 0000000000..84640165d3
--- /dev/null
+++ b/testsuites/tmtests/tm12/task1.c
@@ -0,0 +1,146 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 12 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Low_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer, 16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
+ );
+
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/testsuites/tmtests/tm12/tm12.doc b/testsuites/tmtests/tm12/tm12.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm12/tm12.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm13/system.h b/testsuites/tmtests/tm13/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm13/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm13/task1.c b/testsuites/tmtests/tm13/task1.c
new file mode 100644
index 0000000000..0499817149
--- /dev/null
+++ b/testsuites/tmtests/tm13/task1.c
@@ -0,0 +1,154 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+void Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id id;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 13 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_message_queue_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index < OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT-1 ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, 16 );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, size );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ puts( "*** END OF TEST 13 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm13/tm13.doc b/testsuites/tmtests/tm13/tm13.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm13/tm13.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm14/system.h b/testsuites/tmtests/tm14/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm14/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm14/task1.c b/testsuites/tmtests/tm14/task1.c
new file mode 100644
index 0000000000..24c40c13b3
--- /dev/null
+++ b/testsuites/tmtests/tm14/task1.c
@@ -0,0 +1,146 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 14 ***" );
+
+ status = rtems_task_create(
+ 1,
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( task_id, test_init, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+ rtems_task_priority priority;
+ rtems_id task_id;
+ rtems_status_code status;
+
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' ' ),
+ OPERATION_COUNT,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ priority = 250;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ priority--;
+
+ if ( index==OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Low_tasks;
+
+ status = rtems_task_start( task_id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, 16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
+ );
+
+ puts( "*** END OF TEST 14 ***" );
+ exit( 0 );
+}
+
+rtems_task Low_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 size;
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+}
diff --git a/testsuites/tmtests/tm14/tm14.doc b/testsuites/tmtests/tm14/tm14.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm14/tm14.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm15/system.h b/testsuites/tmtests/tm15/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm15/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm15/task1.c b/testsuites/tmtests/tm15/task1.c
new file mode 100644
index 0000000000..1cfc554fe8
--- /dev/null
+++ b/testsuites/tmtests/tm15/task1.c
@@ -0,0 +1,222 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 time_set, eventout;
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 15 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_event_set event_out;
+ rtems_status_code status;
+
+ time_set = FALSE;
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( Task_id[ index ], High_tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ {
+ (void) rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ }
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: obtain current events",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ {
+ (void) rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ }
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: not available -- NO_WAIT",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_event_set event_out;
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: not available -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_event_send( RTEMS_SELF, RTEMS_EVENT_16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: no task readied",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ Timer_initialize();
+ (void) rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_EVENT_RECEIVE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_event_send( Task_id[ index ], RTEMS_EVENT_16 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: task readied -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ puts( "*** END OF TEST 15 ***" );
+ exit( 0 );
+}
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ if ( time_set )
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ else {
+ time_set = 1;
+ Timer_initialize(); /* start blocking rtems_event_receive time */
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ }
+}
diff --git a/testsuites/tmtests/tm15/tm15.doc b/testsuites/tmtests/tm15/tm15.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm15/tm15.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm16/system.h b/testsuites/tmtests/tm16/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm16/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm16/task1.c b/testsuites/tmtests/tm16/task1.c
new file mode 100644
index 0000000000..e73d3ea12b
--- /dev/null
+++ b/testsuites/tmtests/tm16/task1.c
@@ -0,0 +1,148 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+
+rtems_task test_init(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 16 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 251,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of test_init" );
+
+ status = rtems_task_start( id, test_init, 0 );
+ directive_failed( status, "rtems_task_start of test_init" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task test_init(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority priority;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+ rtems_task_entry task_entry;
+
+/* As each task is started, it preempts this task and
+ * performs a blocking rtems_event_receive. Upon completion of
+ * this loop all created tasks are blocked.
+ */
+
+ priority = 250;
+
+ for( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ if ( index == OPERATION_COUNT ) task_entry = High_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ priority--;
+ }
+
+ Task_count = 0;
+
+ Timer_initialize();
+ (void) rtems_event_send( Task_id[ Task_count ], RTEMS_EVENT_16 );
+ /* preempts task */
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set event_out;
+
+ (void) rtems_event_receive( /* task blocks */
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+
+ Task_count++;
+
+ (void) rtems_event_send( /* preempts task */
+ Task_id[ Task_count ],
+ RTEMS_EVENT_16
+ );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set event_out;
+
+ (void) rtems_event_receive( /* task blocks */
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_out
+ );
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send: task readied -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_EVENT_SEND
+ );
+
+ puts( "*** END OF TEST 16 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm16/tm16.doc b/testsuites/tmtests/tm16/tm16.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm16/tm16.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm17/system.h b/testsuites/tmtests/tm17/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm17/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm17/task1.c b/testsuites/tmtests/tm17/task1.c
new file mode 100644
index 0000000000..fd7b0780c2
--- /dev/null
+++ b/testsuites/tmtests/tm17/task1.c
@@ -0,0 +1,127 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+rtems_task_priority Task_priority;
+
+rtems_task First_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Last_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 17 ***" );
+
+ Task_priority = 254;
+
+ for( index = 0; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ Task_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ if ( index == OPERATION_COUNT ) task_entry = Last_task;
+ else if ( index == 0 ) task_entry = First_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( Task_id[ index ], task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+ Task_count = 1;
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task First_task(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority previous_priority;
+
+ Timer_initialize();
+
+ Task_priority--;
+ Task_count++;
+
+ (void) rtems_task_set_priority(
+ Task_id[ Task_count ],
+ Task_priority,
+ &previous_priority
+ );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_task_priority previous_priority;
+
+ Task_priority--;
+ Task_count++;
+
+ (void) rtems_task_set_priority(
+ Task_id[ Task_count ],
+ Task_priority,
+ &previous_priority
+ );
+}
+
+rtems_task Last_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority: preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_SET_PRIORITY
+ );
+
+ puts( "*** END OF TEST 17 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm17/tm17.doc b/testsuites/tmtests/tm17/tm17.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm17/tm17.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm18/system.h b/testsuites/tmtests/tm18/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm18/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm18/task1.c b/testsuites/tmtests/tm18/task1.c
new file mode 100644
index 0000000000..ba5ae84a6f
--- /dev/null
+++ b/testsuites/tmtests/tm18/task1.c
@@ -0,0 +1,112 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 taskcount;
+rtems_task_priority taskpri;
+
+rtems_task First_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Last_task(
+ rtems_task_argument argument
+);
+
+
+void test_init();
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 18 ***" );
+
+ test_init();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void test_init()
+{
+ rtems_id id;
+ rtems_task_entry task_entry;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ for ( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ if ( index == OPERATION_COUNT ) task_entry = Last_task;
+ else if ( index == 0 ) task_entry = First_task;
+ else task_entry = Middle_tasks;
+
+
+ status = rtems_task_start( id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+
+}
+
+rtems_task First_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+
+ (void) rtems_task_delete( RTEMS_SELF );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_delete( RTEMS_SELF );
+}
+
+rtems_task Last_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete: calling task",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_DELETE
+ );
+
+ puts( "*** END OF TEST 18 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm18/tm18.doc b/testsuites/tmtests/tm18/tm18.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm18/tm18.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm19/system.h b/testsuites/tmtests/tm19/system.h
new file mode 100644
index 0000000000..99de69201e
--- /dev/null
+++ b/testsuites/tmtests/tm19/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm19/task1.c b/testsuites/tmtests/tm19/task1.c
new file mode 100644
index 0000000000..af25ff9cb2
--- /dev/null
+++ b/testsuites/tmtests/tm19/task1.c
@@ -0,0 +1,208 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_asr Process_asr_for_pass_1(
+ rtems_signal_set signals
+);
+
+rtems_asr Process_asr_for_pass_2(
+ rtems_signal_set signals
+);
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Task_3(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 19 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 127,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TASK2" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 126,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK3" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TASK3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_asr Process_asr_for_pass_1(
+ rtems_signal_set signals
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send: signal to self",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_SEND
+ );
+
+ Timer_initialize();
+}
+
+rtems_asr Process_asr_for_pass_2(
+ rtems_signal_set signals
+)
+{
+ rtems_status_code status;
+
+ status = rtems_task_resume( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_resume" );
+
+ Timer_initialize();
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Timer_initialize();
+ (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_catch",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_CATCH
+ );
+
+ Timer_initialize();
+ rtems_signal_send( Task_id[ 2 ], 1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send: returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_SIGNAL_SEND
+ );
+
+ Timer_initialize();
+ (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+
+ /* end time is done is RTEMS_ASR */
+
+ end_time = Read_timer();
+
+ put_time(
+ "exit ASR overhead: returns to calling task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
+ directive_failed( status, "rtems_signal_catch" );
+
+ Timer_initialize();
+ (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
+}
+
+rtems_asr Process_asr_for_task_2(
+ rtems_signal_set signals
+)
+{
+ ;
+}
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
+ directive_failed( status, "rtems_signal_catch" );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_suspend( RTEMS_SELF );
+
+ end_time = Read_timer();
+
+ put_time(
+ "exit ASR overhead: returns to preempting task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TEST 19 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm19/tm19.doc b/testsuites/tmtests/tm19/tm19.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm19/tm19.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm20/system.h b/testsuites/tmtests/tm20/system.h
new file mode 100644
index 0000000000..f172828ad2
--- /dev/null
+++ b/testsuites/tmtests/tm20/system.h
@@ -0,0 +1,42 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+#define CONFIGURE_TEST_NEEDS_STUB_DRIVER
+
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_REGIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm20/task1.c b/testsuites/tmtests/tm20/task1.c
new file mode 100644
index 0000000000..7eb8506f49
--- /dev/null
+++ b/testsuites/tmtests/tm20/task1.c
@@ -0,0 +1,466 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_device_major_number _STUB_major = 1;
+
+rtems_id Region_id;
+rtems_name Region_name;
+rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_id Partition_id;
+rtems_name Partition_name;
+rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+void *Buffer_address_1;
+void *Buffer_address_2;
+void *Buffer_address_3;
+void *Buffer_address_4;
+
+rtems_unsigned32 buffer_count;
+
+void *Buffer_addresses[ OPERATION_COUNT+1 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 20 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', '1' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', '2' ),
+ 129,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TASK2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TASK2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_mode previous_mode;
+ rtems_task_priority previous_priority;
+ rtems_status_code status;
+
+ Partition_name = rtems_build_name( 'P', 'A', 'R', 'T' );
+
+ Timer_initialize();
+ rtems_partition_create(
+ Partition_name,
+ Partition_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Partition_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_CREATE
+ );
+
+ Region_name = rtems_build_name( 'R', 'E', 'G', 'N' );
+
+ Timer_initialize();
+ rtems_region_create(
+ Region_name,
+ Region_area,
+ 2048,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Region_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_CREATE
+ );
+
+ Timer_initialize();
+ (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_GET_BUFFER
+ );
+
+ buffer_count = 0;
+ while ( FOREVER ) {
+
+ status = rtems_partition_get_buffer(
+ Partition_id,
+ &Buffer_addresses[ buffer_count ]
+ );
+
+ if ( status == RTEMS_UNSATISFIED ) break;
+
+ buffer_count++;
+ }
+
+ Timer_initialize();
+ (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_2 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer: not available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_GET_BUFFER
+ );
+
+ Timer_initialize();
+ (void) rtems_partition_return_buffer( Partition_id, Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_return_buffer",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_RETURN_BUFFER
+ );
+
+ for ( index = 0 ; index < buffer_count ; index++ ) {
+
+ status = rtems_partition_return_buffer(
+ Partition_id,
+ Buffer_addresses[ index ]
+ );
+ directive_failed( status, "rtems_partition_return_buffer" );
+
+ }
+
+ Timer_initialize();
+ (void) rtems_partition_delete( Partition_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PARTITION_DELETE
+ );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+ directive_failed( status, "region_get_semgent" );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_3
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: available",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_4
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: not available -- NO_WAIT",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_3 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_2 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: no waiting tasks",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_1
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+
+ /* execute Task_2 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: task readied -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ status = rtems_task_mode(
+ RTEMS_NO_PREEMPT,
+ RTEMS_PREEMPT_MASK,
+ &previous_mode
+ );
+ directive_failed( status, "rtems_task_mode" );
+
+ status = rtems_task_set_priority( RTEMS_SELF, 254, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 400,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_1
+ );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ status = rtems_region_get_segment(
+ Region_id,
+ 1998,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &Buffer_address_2
+ );
+ directive_failed( status, "rtems_region_get_segment" );
+
+ /* execute Task_2 */
+
+ status = rtems_region_return_segment( Region_id, Buffer_address_2 );
+ directive_failed( status, "rtems_region_return_segment" );
+
+ Timer_initialize();
+ (void) rtems_region_delete( Region_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_DELETE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_initialize( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_initialize",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_INITIALIZE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_open( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_open",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_OPEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_close( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_close",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_CLOSE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_read( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_read",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_READ
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_write( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_write",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_WRITE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_io_control( _STUB_major, 0, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_control",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_IO_CONTROL
+ );
+
+ puts( "*** END OF TEST 20 ***" );
+ exit( 0 );
+}
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment: not available -- caller blocks",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_GET_SEGMENT
+ );
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_1 );
+
+ /* preempt back to Task_1 */
+
+ Timer_initialize();
+ (void) rtems_region_return_segment( Region_id, Buffer_address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment: task readied -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_REGION_RETURN_SEGMENT
+ );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/tmtests/tm20/tm20.doc b/testsuites/tmtests/tm20/tm20.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm20/tm20.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm21/system.h b/testsuites/tmtests/tm21/system.h
new file mode 100644
index 0000000000..f2831954e6
--- /dev/null
+++ b/testsuites/tmtests/tm21/system.h
@@ -0,0 +1,48 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 102
+#define CONFIGURE_MAXIMUM_TIMERS 100
+#define CONFIGURE_MAXIMUM_SEMAPHORES 100
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100
+#define CONFIGURE_MAXIMUM_PARTITIONS 100
+#define CONFIGURE_MAXIMUM_REGIONS 100
+#define CONFIGURE_MAXIMUM_PORTS 100
+#define CONFIGURE_MAXIMUM_PERIODS 100
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm21/task1.c b/testsuites/tmtests/tm21/task1.c
new file mode 100644
index 0000000000..79703ea0d1
--- /dev/null
+++ b/testsuites/tmtests/tm21/task1.c
@@ -0,0 +1,236 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 21 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 250,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TASK1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TASK1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_id id;
+ rtems_status_code status;
+
+ for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create (
+ index,
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_message_queue_create(
+ index,
+ 1, /* only going to ident this queue */
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ status = rtems_semaphore_create(
+ index,
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &id
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ status = rtems_region_create(
+ index,
+ Region_area,
+ 2048,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_region_create" );
+
+ status = rtems_partition_create(
+ index,
+ Partition_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_partition_create" );
+
+ status = rtems_port_create(
+ index,
+ Partition_area,
+ Region_area,
+ 0xff,
+ &id
+ );
+ directive_failed( status, "rtems_port_create" );
+
+ status = rtems_timer_create( index, &id );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_rate_monotonic_create( index, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_SEMAPHORE_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PARTITION_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_region_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_REGION_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_IDENT
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_rate_monotonic_ident( index, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_RATE_MONOTONIC_IDENT
+ );
+
+ puts( "*** END OF TEST 21 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm21/tm21.doc b/testsuites/tmtests/tm21/tm21.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm21/tm21.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm22/system.h b/testsuites/tmtests/tm22/system.h
new file mode 100644
index 0000000000..a7d66a30cc
--- /dev/null
+++ b/testsuites/tmtests/tm22/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 103
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm22/task1.c b/testsuites/tmtests/tm22/task1.c
new file mode 100644
index 0000000000..e0bab9217b
--- /dev/null
+++ b/testsuites/tmtests/tm22/task1.c
@@ -0,0 +1,200 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Queue_id;
+
+long Buffer[4];
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 22 ***" );
+
+ status = rtems_message_queue_create(
+ rtems_build_name( 'M', 'Q', '1', ' '),
+ 100,
+ 16,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Queue_id
+ );
+ directive_failed( status, "rtems_message_queue_create" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ status = rtems_task_create(
+ 1,
+ 11,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create RTEMS_PREEMPT" );
+
+ status = rtems_task_start( id, Preempt_task, 0 );
+ directive_failed( status, "rtems_task_start RTEMS_PREEMPT" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+ rtems_status_code status;
+
+ Timer_initialize();
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: task readied -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ status = rtems_task_suspend(RTEMS_SELF);
+ directive_failed( status, "rtems_task_suspend" );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_unsigned32 count;
+ rtems_unsigned32 size;
+ rtems_status_code status;
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_start HIGH" );
+
+ status = rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "message_queu_receive" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: no waiting tasks",
+ end_time,
+ OPERATION_COUNT,
+ 1,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ (void) rtems_message_queue_receive(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ &size,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+
+ /* should go to Preempt_task here */
+
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast: task readied -- preempts caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
+ );
+
+ puts( "*** END OF TEST 22 ***" );
+ exit( 0 );
+}
+
+rtems_task Preempt_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 count;
+
+ Timer_initialize();
+ (void) rtems_message_queue_broadcast(
+ Queue_id,
+ (long (*)[4]) Buffer,
+ 16,
+ &count
+ );
+
+ /* should be preempted by low task */
+}
diff --git a/testsuites/tmtests/tm22/tm22.doc b/testsuites/tmtests/tm22/tm22.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm22/tm22.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm23/system.h b/testsuites/tmtests/tm23/system.h
new file mode 100644
index 0000000000..877649e397
--- /dev/null
+++ b/testsuites/tmtests/tm23/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm23/task1.c b/testsuites/tmtests/tm23/task1.c
new file mode 100644
index 0000000000..d503244779
--- /dev/null
+++ b/testsuites/tmtests/tm23/task1.c
@@ -0,0 +1,302 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Timer_id[ OPERATION_COUNT+1 ];
+
+rtems_time_of_day time_of_day;
+
+void null_delay(
+ rtems_id ignored_id,
+ void *ignored_address
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+
+ rtems_task_priority priority;
+ rtems_unsigned32 index;
+ rtems_id id;
+ rtems_task_entry task_entry;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 23 ***" );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ priority = 5;
+
+ for( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ if ( index == 1 ) task_entry = High_task;
+ else if ( index == OPERATION_COUNT ) task_entry = Low_task;
+ else task_entry = Middle_tasks;
+
+ status = rtems_task_start( id, task_entry, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+
+ priority++;
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+void null_delay(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_status_code status;
+ int i;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_create( index, &Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_AFTER
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_AFTER
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_cancel( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CANCEL
+ );
+
+ for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_cancel( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_CANCEL
+ );
+
+ for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_RESET
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_RESET
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_reset( Timer_id[ index ] );
+
+ build_time( &time_of_day, 12, 31, 1988, 9, 0, 0, 0 );
+
+ status = rtems_clock_set( &time_of_day );
+ directive_failed( status, "rtems_clock_set" );
+
+ time_of_day.year = 1989;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_when(
+ Timer_id[ index ], &time_of_day, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_WHEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_fire_when(
+ Timer_id[ index ], &time_of_day, null_delay, NULL );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_FIRE_WHEN
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_delete( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete: active",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_DELETE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_timer_create( index, &Timer_id[ index ] );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
+ directive_failed( status, "rtems_timer_fire_after" );
+
+ status = rtems_timer_cancel( Timer_id[ index ] );
+ directive_failed( status, "rtems_timer_cancel" );
+ }
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_timer_delete( Timer_id[ index ] );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete: inactive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TIMER_DELETE
+ );
+
+ Timer_initialize();
+ (void) rtems_task_wake_when( &time_of_day );
+}
+
+rtems_task Middle_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_task_wake_when( &time_of_day );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_when",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ CALLING_OVERHEAD_TASK_WAKE_WHEN
+ );
+
+ puts( "*** END OF TEST 23 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm23/tm23.doc b/testsuites/tmtests/tm23/tm23.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm23/tm23.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm24/system.h b/testsuites/tmtests/tm24/system.h
new file mode 100644
index 0000000000..6b2f2c420b
--- /dev/null
+++ b/testsuites/tmtests/tm24/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm24/task1.c b/testsuites/tmtests/tm24/task1.c
new file mode 100644
index 0000000000..58e6eba6b8
--- /dev/null
+++ b/testsuites/tmtests/tm24/task1.c
@@ -0,0 +1,124 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned32 Task_count;
+
+rtems_task Tasks(
+ rtems_task_argument argument
+);
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 24 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 10,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ status = rtems_task_start( id, High_task, 0 );
+ directive_failed( status, "rtems_task_create HIGH" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'R', 'E', 'S', 'T' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( id, Tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after: yield -- returns to caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_WAKE_AFTER
+ );
+
+ Task_count = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Tasks(
+ rtems_task_argument argument
+)
+{
+ Task_count++;
+
+ if ( Task_count == 1 )
+ Timer_initialize();
+ else if ( Task_count == OPERATION_COUNT ) {
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after: yields -- preempts caller",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_TASK_WAKE_AFTER
+ );
+
+ puts( "*** END OF TEST 24 ***" );
+ exit( 0 );
+ }
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+}
diff --git a/testsuites/tmtests/tm24/tm24.doc b/testsuites/tmtests/tm24/tm24.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm24/tm24.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm25/system.h b/testsuites/tmtests/tm25/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/testsuites/tmtests/tm25/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm25/task1.c b/testsuites/tmtests/tm25/task1.c
new file mode 100644
index 0000000000..fc24318938
--- /dev/null
+++ b/testsuites/tmtests/tm25/task1.c
@@ -0,0 +1,109 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Semaphore_id;
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id task_id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 25 ***" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'M', '1', ' ') ,
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( task_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( task_id, High_tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_tasks(
+ rtems_task_argument argument
+)
+{
+ (void) rtems_semaphore_obtain(
+ Semaphore_id,
+ RTEMS_DEFAULT_OPTIONS,
+ 0xffffffff
+ );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ Timer_initialize();
+ (void) rtems_clock_tick();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_tick",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_CLOCK_TICK
+ );
+
+ puts( "*** END OF TEST 25 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm25/tm25.doc b/testsuites/tmtests/tm25/tm25.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm25/tm25.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm26/fptest.h b/testsuites/tmtests/tm26/fptest.h
new file mode 100644
index 0000000000..39b8438ef9
--- /dev/null
+++ b/testsuites/tmtests/tm26/fptest.h
@@ -0,0 +1,165 @@
+/* fptest.h
+ *
+ * This include file contains the CPU dependent implementation
+ * of the following routines needed to test RTEMS floating
+ * point support:
+ * FP_load( &context )
+ * FP_check( &context )
+ *
+ * FP_load - loads the specified floating point context
+ * FP_check - checks the specified floating point context
+ *
+ * NOTE: These routines are VERY CPU dependent and are thus
+ * located in in the CPU dependent include file
+ * fptest.h. These routines form the core of the
+ * floating point context switch test.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#ifndef __FPTEST_h
+#define __FPTEST_h
+
+#include <stdio.h>
+
+#ifndef CPU_HARDWARE_FP
+#error "This CPU does not have CPU_HARDWARE_FP defined"
+#endif
+
+#if ( CPU_HARDWARE_FP == FALSE )
+
+#define FP_DECLARE
+#define FP_LOAD( _factor )
+#define FP_CHECK( _factor ) 0
+
+#else
+
+#define FP_DECLARE \
+ double fp01 = 1.0; \
+ double fp02 = 2.0; \
+ double fp03 = 3.0; \
+ double fp04 = 4.0; \
+ double fp05 = 5.0; \
+ double fp06 = 6.0; \
+ double fp07 = 7.0; \
+ double fp08 = 8.0; \
+ double fp09 = 9.0; \
+ double fp10 = 10.0; \
+ double fp11 = 11.0; \
+ double fp12 = 12.0; \
+ double fp13 = 13.0; \
+ double fp14 = 14.0; \
+ double fp15 = 15.0; \
+ double fp16 = 16.0; \
+ double fp17 = 17.0; \
+ double fp18 = 18.0; \
+ double fp19 = 19.0; \
+ double fp20 = 20.0; \
+ double fp21 = 21.0; \
+ double fp22 = 22.0; \
+ double fp23 = 23.0; \
+ double fp24 = 24.0; \
+ double fp25 = 25.0; \
+ double fp26 = 26.0; \
+ double fp27 = 27.0; \
+ double fp28 = 28.0; \
+ double fp29 = 29.0; \
+ double fp30 = 30.0; \
+ double fp31 = 31.0; \
+ double fp32 = 32.0
+
+#define FP_LOAD( _factor ) \
+ do { \
+ fp01 += _factor; \
+ fp02 += _factor; \
+ fp03 += _factor; \
+ fp04 += _factor; \
+ fp05 += _factor; \
+ fp06 += _factor; \
+ fp07 += _factor; \
+ fp08 += _factor; \
+ fp09 += _factor; \
+ fp10 += _factor; \
+ fp11 += _factor; \
+ fp12 += _factor; \
+ fp13 += _factor; \
+ fp14 += _factor; \
+ fp15 += _factor; \
+ fp16 += _factor; \
+ fp17 += _factor; \
+ fp18 += _factor; \
+ fp19 += _factor; \
+ fp20 += _factor; \
+ fp21 += _factor; \
+ fp22 += _factor; \
+ fp23 += _factor; \
+ fp24 += _factor; \
+ fp25 += _factor; \
+ fp26 += _factor; \
+ fp27 += _factor; \
+ fp28 += _factor; \
+ fp29 += _factor; \
+ fp30 += _factor; \
+ fp31 += _factor; \
+ fp32 += _factor; \
+ } while (0)
+
+#define EPSILON (0.0005)
+#define FPABS(d) (((d) < 0.0) ? -(d) : (d))
+#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON)
+
+#define FP_CHECK_ONE( _v, _base, _factor ) \
+ if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \
+ printf("%d: " #_v " wrong -- (%g not %g)\n", \
+ task_index, (_v), (_base + _factor)); \
+ }
+
+
+#define FP_CHECK( _factor ) \
+ do { \
+ FP_CHECK_ONE( fp01, 1.0, (_factor) ); \
+ FP_CHECK_ONE( fp02, 2.0, (_factor) ); \
+ FP_CHECK_ONE( fp03, 3.0, (_factor) ); \
+ FP_CHECK_ONE( fp04, 4.0, (_factor) ); \
+ FP_CHECK_ONE( fp05, 5.0, (_factor) ); \
+ FP_CHECK_ONE( fp06, 6.0, (_factor) ); \
+ FP_CHECK_ONE( fp07, 7.0, (_factor) ); \
+ FP_CHECK_ONE( fp08, 8.0, (_factor) ); \
+ FP_CHECK_ONE( fp09, 9.0, (_factor) ); \
+ FP_CHECK_ONE( fp10, 10.0, (_factor) ); \
+ FP_CHECK_ONE( fp11, 11.0, (_factor) ); \
+ FP_CHECK_ONE( fp12, 12.0, (_factor) ); \
+ FP_CHECK_ONE( fp13, 13.0, (_factor) ); \
+ FP_CHECK_ONE( fp14, 14.0, (_factor) ); \
+ FP_CHECK_ONE( fp15, 15.0, (_factor) ); \
+ FP_CHECK_ONE( fp16, 16.0, (_factor) ); \
+ FP_CHECK_ONE( fp17, 17.0, (_factor) ); \
+ FP_CHECK_ONE( fp18, 18.0, (_factor) ); \
+ FP_CHECK_ONE( fp19, 19.0, (_factor) ); \
+ FP_CHECK_ONE( fp20, 20.0, (_factor) ); \
+ FP_CHECK_ONE( fp21, 21.0, (_factor) ); \
+ FP_CHECK_ONE( fp22, 22.0, (_factor) ); \
+ FP_CHECK_ONE( fp23, 23.0, (_factor) ); \
+ FP_CHECK_ONE( fp24, 24.0, (_factor) ); \
+ FP_CHECK_ONE( fp25, 25.0, (_factor) ); \
+ FP_CHECK_ONE( fp26, 26.0, (_factor) ); \
+ FP_CHECK_ONE( fp27, 27.0, (_factor) ); \
+ FP_CHECK_ONE( fp28, 28.0, (_factor) ); \
+ FP_CHECK_ONE( fp29, 29.0, (_factor) ); \
+ FP_CHECK_ONE( fp30, 30.0, (_factor) ); \
+ FP_CHECK_ONE( fp31, 31.0, (_factor) ); \
+ FP_CHECK_ONE( fp32, 32.0, (_factor) ); \
+ } while (0)
+
+#endif
+
+#endif
diff --git a/testsuites/tmtests/tm26/system.h b/testsuites/tmtests/tm26/system.h
new file mode 100644
index 0000000000..74eb108e3e
--- /dev/null
+++ b/testsuites/tmtests/tm26/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
new file mode 100644
index 0000000000..c55c9098ed
--- /dev/null
+++ b/testsuites/tmtests/tm26/task1.c
@@ -0,0 +1,550 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include "system.h"
+#include "fptest.h"
+#include <coverhd.h>
+#include <tmacros.h>
+#include <timesys.h>
+
+
+/* TEST DATA */
+rtems_id Semaphore_id;
+
+Objects_Locations location; /* uses internal RTEMS type */
+
+Thread_Control *Middle_tcb; /* uses internal RTEMS type */
+
+Thread_Control *Low_tcb; /* uses internal RTEMS type */
+
+rtems_task High_task(
+ rtems_task_argument argument
+);
+
+rtems_task Middle_task(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_task Floating_point_task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Floating_point_task_2(
+ rtems_task_argument argument
+);
+
+void complete_test( void );
+
+rtems_task null_task(
+ rtems_task_argument argument
+)
+{
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+ rtems_id task_id;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 26 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'F', 'P', '1', ' ' ),
+ 201,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of FP1" );
+
+ status = rtems_task_start( task_id, Floating_point_task_1, 0 );
+ directive_failed( status, "rtems_task_start of FP1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'F', 'P', '2', ' ' ),
+ 202,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of FP2" );
+
+ status = rtems_task_start( task_id, Floating_point_task_2, 0 );
+ directive_failed( status, "rtems_task_start of FP2" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 200,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of LOW" );
+
+ status = rtems_task_start( task_id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start of LOW" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'M', 'I', 'D', ' ' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of MIDDLE" );
+
+ status = rtems_task_start( task_id, Middle_task, 0 );
+ directive_failed( status, "rtems_task_start of MIDDLE" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'H', 'I', 'G', 'H' ),
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create of HIGH" );
+
+ status = rtems_task_start( task_id, High_task, 0 );
+ directive_failed( status, "rtems_task_start of HIGH" );
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'S', 'E', 'M', '1' ),
+ OPERATION_COUNT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'N', 'U', 'L', 'L' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( task_id, null_task, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task High_task(
+ rtems_task_argument argument
+)
+{
+ rtems_interrupt_level level;
+
+ Timer_initialize();
+ rtems_interrupt_disable( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Disable",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ rtems_interrupt_flash( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Flash",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ rtems_interrupt_enable( level );
+ end_time = Read_timer();
+
+ put_time(
+ "_ISR_Enable",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Disable_dispatch();
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Disable_dispatch",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Enable_dispatch();
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Enable_dispatch",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Set_state",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Context_Switch_necessary = TRUE;
+
+ Timer_initialize();
+ _Thread_Dispatch(); /* dispatches Middle_task */
+}
+
+rtems_task Middle_task(
+ rtems_task_argument argument
+)
+{
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Disptach (NO FP)",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+
+ Middle_tcb = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[200].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers );
+
+ Timer_initialize();
+ _Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: no floating point contexts",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ Low_tcb = executing;
+
+ Timer_initialize();
+ _Context_Switch( &executing->Registers, &executing->Registers );
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: self",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Context_Switch(&executing->Registers, &Middle_tcb->Registers);
+
+ end_time = Read_timer();
+
+ put_time(
+ "context switch: to another task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[201].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+}
+
+rtems_task Floating_point_task_1(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+ FP_DECLARE;
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: restore 1st FP task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[202].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_2 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save idle, restore initialized",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ FP_LOAD( 1.0 );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[202].first;
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_2 */
+}
+
+rtems_task Floating_point_task_2(
+ rtems_task_argument argument
+)
+{
+ Thread_Control *executing;
+ FP_DECLARE;
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save idle, restore idle",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ executing = _Thread_Executing;
+
+ _Thread_Executing =
+ (Thread_Control *) _Thread_Ready_chain[201].first;
+
+ FP_LOAD( 1.0 );
+
+ /* do not force context switch */
+
+ _Context_Switch_necessary = FALSE;
+
+ _Thread_Disable_dispatch();
+
+ Timer_initialize();
+ _Context_Save_fp( &executing->fp_context );
+ _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ /* switch to Floating_point_task_1 */
+
+ end_time = Read_timer();
+
+ put_time(
+ "fp context switch: save initialized, restore initialized",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ complete_test();
+}
+
+void complete_test( void )
+{
+ rtems_unsigned32 index;
+ rtems_id task_id;
+
+ Timer_initialize();
+ _Thread_Resume( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Resume",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
+
+ Timer_initialize();
+ _Thread_Unblock( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Unblock",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
+
+ Timer_initialize();
+ _Thread_Ready( Middle_tcb );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Ready",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ task_id = Middle_tcb->Object.id;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Thread_Get( task_id, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Get",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Semaphore_Get( Semaphore_id, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Semaphore_Get",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) _Thread_Get( 0x3, &location );
+ end_time = Read_timer();
+
+ put_time(
+ "_Thread_Get: invalid id",
+ end_time,
+ OPERATION_COUNT,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TEST 26 ***" );
+ exit( 0 );
+}
+
diff --git a/testsuites/tmtests/tm26/tm26.doc b/testsuites/tmtests/tm26/tm26.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm26/tm26.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm27/system.h b/testsuites/tmtests/tm27/system.h
new file mode 100644
index 0000000000..6b2f2c420b
--- /dev/null
+++ b/testsuites/tmtests/tm27/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
new file mode 100644
index 0000000000..aa346fb29e
--- /dev/null
+++ b/testsuites/tmtests/tm27/task1.c
@@ -0,0 +1,272 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+/*
+ * WARNING!!!!!!!!!
+ *
+ * THIS TEST USES INTERNAL RTEMS VARIABLES!!!
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+#include <bsp.h>
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Task_2(
+ rtems_task_argument argument
+);
+
+volatile rtems_unsigned32 Interrupt_occurred;
+volatile rtems_unsigned32 Interrupt_enter_time, Interrupt_enter_nested_time;
+volatile rtems_unsigned32 Interrupt_return_time, Interrupt_return_nested_time;
+rtems_unsigned32 Interrupt_nest;
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 27 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create Task_1" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start Task_1" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '2', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of Task_2" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of Task_2" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ Install_tm27_vector( Isr_handler );
+
+ /*
+ * No preempt .. no nesting
+ */
+
+ Interrupt_nest = 0;
+
+ _Thread_Dispatch_disable_level = 0;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to Isr_handler */
+
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to interrupted task",
+ Interrupt_enter_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to interrupted task",
+ Interrupt_return_time,
+ 1,
+ 0,
+ 0
+ );
+
+ /*
+ * No preempt .. nested
+ */
+
+ _Thread_Dispatch_disable_level = 1;
+
+ Interrupt_nest = 1;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to Isr_handler */
+
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to nested interrupt",
+ Interrupt_enter_nested_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to nested interrupt",
+ Interrupt_return_nested_time,
+ 1,
+ 0,
+ 0
+ );
+
+ /*
+ * Does a preempt .. not nested
+ */
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].last;
+
+ _Context_Switch_necessary = 1;
+
+ Interrupt_occurred = 0;
+ Timer_initialize();
+ Cause_tm27_intr();
+
+ /*
+ * goes to Isr_handler and then returns
+ */
+
+ puts( "*** END OF TEST 27 ***" );
+ exit( 0 );
+}
+
+/*
+ * NOTE: When this task is executing, some of the assumptions made
+ * regarding the placement of the currently executing task's TCB
+ * on the ready chains have been violated. At least the assumption
+ * that this task is at the head of the chain for its priority
+ * has been violated.
+ */
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ end_time = Read_timer();
+
+ put_time(
+ "interrupt entry overhead: returns to preempting task",
+ Interrupt_enter_time,
+ 1,
+ 0,
+ 0
+ );
+
+ put_time(
+ "interrupt exit overhead: returns to preempting task",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ fflush( stdout );
+
+ /*
+ * Switch back to the other task to exit the test.
+ */
+
+ _Thread_Dispatch_disable_level = 0;
+
+ _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].first;
+
+ _Context_Switch_necessary = 1;
+
+ _Thread_Dispatch();
+
+}
+
+/* The Isr_handler() and Isr_handler_inner() routines are structured
+ * so that there will be as little entry overhead as possible included
+ * in the interrupt entry time.
+ */
+
+void Isr_handler_inner( void );
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+)
+{
+ end_time = Read_timer();
+
+ Interrupt_occurred = 1;
+ Isr_handler_inner();
+}
+
+void Isr_handler_inner( void )
+{
+
+ /*enable_tracing();*/
+ Clear_tm27_intr();
+ switch ( Interrupt_nest ) {
+ case 0:
+ Interrupt_enter_time = end_time;
+ break;
+ case 1:
+ Interrupt_enter_time = end_time;
+ Interrupt_nest = 2;
+ Interrupt_occurred = 0;
+ Lower_tm27_intr();
+ Timer_initialize();
+ Cause_tm27_intr();
+ /* goes to a nested copy of Isr_handler */
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_nested_time = Read_timer();
+ break;
+ case 2:
+ Interrupt_enter_nested_time = end_time;
+ break;
+ }
+
+ Timer_initialize();
+}
diff --git a/testsuites/tmtests/tm27/tm27.doc b/testsuites/tmtests/tm27/tm27.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm27/tm27.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm28/system.h b/testsuites/tmtests/tm28/system.h
new file mode 100644
index 0000000000..4fa010796f
--- /dev/null
+++ b/testsuites/tmtests/tm28/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_PORTS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm28/task1.c b/testsuites/tmtests/tm28/task1.c
new file mode 100644
index 0000000000..26728953fa
--- /dev/null
+++ b/testsuites/tmtests/tm28/task1.c
@@ -0,0 +1,134 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_id Port_id;
+
+rtems_unsigned8 Internal_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
+rtems_unsigned8 External_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 28 ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'I', 'M', 'E' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
+ directive_failed( status, "rtems_task_start" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Test_task (
+ rtems_task_argument argument
+)
+{
+ rtems_name name;
+ rtems_unsigned32 index;
+ void *converted;
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ name = rtems_build_name( 'P', 'O', 'R', 'T' ),
+
+ Timer_initialize();
+ rtems_port_create(
+ name,
+ Internal_area,
+ External_area,
+ 0xff,
+ &Port_id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PORT_CREATE
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_external_to_internal(
+ Port_id,
+ &External_area[ 0xf ],
+ &converted
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_external_to_internal",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL
+ );
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_port_internal_to_external(
+ Port_id,
+ &Internal_area[ 0xf ],
+ &converted
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_internal_to_external",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL
+ );
+
+ Timer_initialize();
+ rtems_port_delete( Port_id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_delete",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_PORT_DELETE
+ );
+
+ puts( "*** END OF TEST 28 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm28/tm28.doc b/testsuites/tmtests/tm28/tm28.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm28/tm28.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tm29/system.h b/testsuites/tmtests/tm29/system.h
new file mode 100644
index 0000000000..d2fa07c5f4
--- /dev/null
+++ b/testsuites/tmtests/tm29/system.h
@@ -0,0 +1,41 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_PERIODS 111
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tm29/task1.c b/testsuites/tmtests/tm29/task1.c
new file mode 100644
index 0000000000..9600942b6d
--- /dev/null
+++ b/testsuites/tmtests/tm29/task1.c
@@ -0,0 +1,207 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_name Period_name;
+
+rtems_task Tasks(
+ rtems_task_argument argument
+);
+
+rtems_task Low_task(
+ rtems_task_argument argument
+);
+
+rtems_unsigned32 Task_count;
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST 29 ***" );
+
+ Period_name = rtems_build_name( 'P', 'R', 'D', ' ' );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_create( Period_name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_create",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_CREATE
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_period( id, 10 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: initiate period -- returns to caller",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_period( id, RTEMS_PERIOD_STATUS );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: obtain status",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_cancel",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL
+ );
+
+ Timer_initialize();
+ (void) rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete: inactive",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
+ );
+
+ status = rtems_rate_monotonic_create( Period_name, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+
+ status = rtems_rate_monotonic_period( id, 10 );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+
+ Timer_initialize();
+ rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete: active",
+ end_time,
+ 1,
+ 0,
+ CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
+ );
+
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 128,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOOP" );
+
+ status = rtems_task_start( id, Tasks, 0 );
+ directive_failed( status, "rtems_task_start LOOP" );
+ }
+
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'O', 'W', ' ' ),
+ 200,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create LOW" );
+
+ status = rtems_task_start( id, Low_task, 0 );
+ directive_failed( status, "rtems_task_start LOW" );
+
+ Task_count = 0;
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Tasks(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ status = rtems_rate_monotonic_create( 1, &id );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+
+ status = rtems_rate_monotonic_period( id, 100 );
+ directive_failed( status, "rtems_rate_monotonic_period" );
+
+ /*
+ * Give up the processor to allow all tasks to actually
+ * create and start their period timer before the benchmark
+ * timer is initialized.
+ */
+
+ (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+ Task_count++;
+
+ if ( Task_count == 1 )
+ Timer_initialize();
+
+ (void) rtems_rate_monotonic_period( id, 100 );
+}
+
+rtems_task Low_task(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ end_time = Read_timer();
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) Empty_function();
+ overhead = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period: conclude periods -- caller blocks",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
+ );
+
+ puts( "*** END OF TEST 29 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tm29/tm29.doc b/testsuites/tmtests/tm29/tm29.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tm29/tm29.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/testsuites/tmtests/tmck/system.h b/testsuites/tmtests/tmck/system.h
new file mode 100644
index 0000000000..ddbfd9ca0a
--- /dev/null
+++ b/testsuites/tmtests/tmck/system.h
@@ -0,0 +1,40 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tmck/task1.c b/testsuites/tmtests/tmck/task1.c
new file mode 100644
index 0000000000..80a64f5326
--- /dev/null
+++ b/testsuites/tmtests/tmck/task1.c
@@ -0,0 +1,180 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#define TEST_INIT
+#include "system.h"
+
+#define MAXIMUM_DISTRIBUTION 10000
+
+#undef OPERATION_COUNT
+#define OPERATION_COUNT 100000
+
+int Distribution[ MAXIMUM_DISTRIBUTION + 1 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+void check_read_timer( void );
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_id id;
+ rtems_status_code status;
+
+ /*
+ * Tell the Timer Driver what we are doing
+ */
+
+ Set_find_average_overhead( 1 );
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME CHECKER ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ),
+
+ status = rtems_task_create(
+ 1,
+ 5,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_unsigned32 index;
+
+ check_read_timer();
+rtems_test_pause();
+
+ Timer_initialize();
+ end_time = Read_timer();
+
+ put_time(
+ "NULL timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 1000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (1000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 10000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (10000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 50000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (50000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ Timer_initialize();
+ for ( index = 1 ; index <= 100000 ; index++ )
+ (void) Empty_function();
+ end_time = Read_timer();
+
+ put_time(
+ "LOOP (100000) timer stopped at",
+ end_time,
+ 1,
+ 0,
+ 0
+ );
+
+ puts( "*** END OF TIME CHECKER ***" );
+ exit( 0 );
+}
+
+void check_read_timer()
+{
+ rtems_unsigned32 index;
+ rtems_unsigned32 time;
+
+ for ( index = 1 ; index <= MAXIMUM_DISTRIBUTION ; index++ )
+ Distribution[ index ] = 0;
+
+ for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
+ Timer_initialize();
+ end_time = Read_timer();
+ if ( end_time > MAXIMUM_DISTRIBUTION ) {
+ /*
+ * Under UNIX a simple process swap takes longer than we
+ * consider valid for our testing purposes.
+ */
+ printf( "TOO LONG (%d) at index %d!!!\n", end_time, index );
+#if defined(unix) || defined(go32)
+ index--;
+ continue;
+#else
+ exit( 1 );
+#endif
+ }
+ else
+ Distribution[ end_time ]++;
+ }
+
+ printf( "Units may not be in microseconds for this test!!!\n" );
+ time = 0;
+ for ( index = 0 ; index <= MAXIMUM_DISTRIBUTION ; index++ ) {
+ time += (Distribution[ index ] * index);
+ if ( Distribution[ index ] != 0 )
+ printf( "%d %d\n", index, Distribution[ index ] );
+ }
+ printf( "Total time = %d\n", time );
+ printf( "Average time = %d\n", time / OPERATION_COUNT );
+}
diff --git a/testsuites/tmtests/tmck/tmck.doc b/testsuites/tmtests/tmck/tmck.doc
new file mode 100644
index 0000000000..9ef6a57d99
--- /dev/null
+++ b/testsuites/tmtests/tmck/tmck.doc
@@ -0,0 +1,20 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives timed by this test.
+
+benchmark name: timecheck
+
+This becnchmark is used to calibrate the timer. It is only used to
+when initial timing begins on a particular processor board.
+
diff --git a/testsuites/tmtests/tmoverhd/dumrtems.h b/testsuites/tmtests/tmoverhd/dumrtems.h
new file mode 100644
index 0000000000..161ab1c7fa
--- /dev/null
+++ b/testsuites/tmtests/tmoverhd/dumrtems.h
@@ -0,0 +1,255 @@
+/* dumrtems.h
+ *
+ * This include file contains phony macros to map
+ * executive calls to Empty_directive().
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __DUMRTEMS_h
+#define __DUMRTEMS_h
+
+/* RTEMS call redefinition macros */
+
+#undef rtems_signal_catch
+#undef rtems_signal_send
+#undef rtems_io_close
+#undef rtems_io_control
+#undef rtems_io_initialize
+#undef rtems_io_open
+#undef rtems_io_read
+#undef rtems_io_write
+#undef rtems_port_internal_to_external
+#undef rtems_port_external_to_internal
+#undef rtems_port_create
+#undef rtems_port_delete
+#undef rtems_port_ident
+#undef rtems_event_receive
+#undef rtems_event_send
+#undef rtems_initialize_executive
+#undef rtems_shutdown_executive
+#undef rtems_interrupt_catch
+#undef rtems_partition_create
+#undef rtems_partition_delete
+#undef rtems_partition_get_buffer
+#undef rtems_partition_ident
+#undef rtems_partition_return_buffer
+#undef rtems_message_queue_broadcast
+#undef rtems_message_queue_create
+#undef rtems_message_queue_delete
+#undef rtems_message_queue_flush
+#undef rtems_message_queue_ident
+#undef rtems_message_queue_receive
+#undef rtems_message_queue_send
+#undef rtems_message_queue_urgent
+#undef rtems_region_create
+#undef rtems_region_delete
+#undef rtems_region_get_segment
+#undef rtems_region_ident
+#undef rtems_region_return_segment
+#undef rtems_semaphore_create
+#undef rtems_semaphore_delete
+#undef rtems_semaphore_ident
+#undef rtems_semaphore_obtain
+#undef rtems_semaphore_release
+#undef rtems_task_create
+#undef rtems_task_delete
+#undef rtems_task_get_note
+#undef rtems_task_ident
+#undef rtems_task_mode
+#undef rtems_task_restart
+#undef rtems_task_resume
+#undef rtems_task_set_note
+#undef rtems_task_set_priority
+#undef rtems_task_start
+#undef rtems_task_suspend
+#undef rtems_clock_get
+#undef rtems_clock_set
+#undef rtems_clock_tick
+#undef rtems_task_wake_after
+#undef rtems_task_wake_when
+#undef rtems_fatal_error_occurred
+#undef rtems_rate_monotonic_create
+#undef rtems_rate_monotonic_ident
+#undef rtems_rate_monotonic_delete
+#undef rtems_rate_monotonic_cancel
+#undef rtems_rate_monotonic_period
+#undef rtems_multiprocessing_announce
+#undef rtems_timer_create
+#undef rtems_timer_ident
+#undef rtems_timer_delete
+#undef rtems_timer_cancel
+#undef rtems_timer_fire_after
+#undef rtems_timer_fire_when
+#undef rtems_timer_reset
+
+#define rtems_signal_catch( asraddr, mode ) \
+ Empty_directive( asraddr, mode )
+#define rtems_signal_send( tid, signal ) \
+ Empty_directive( tid, signal )
+
+#define rtems_io_close( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_control( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_initialize( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_open( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_read( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+#define rtems_io_write( major, minor, argp, rval ) \
+ Empty_directive( major, minor, argp, rval )
+
+#define rtems_port_internal_to_external( dpid, internal, external ) \
+ Empty_directive( dpid, internal, external )
+#define rtems_port_external_to_internal( dpid, external, internal ) \
+ Empty_directive( dpid, external, internal )
+#define rtems_port_create( name, intaddr, extaddr, length, dpid ) \
+ Empty_directive( name, intaddr, extaddr, length, dpid )
+#define rtems_port_delete( dpid ) \
+ Empty_directive( dpid )
+#define rtems_port_ident( name, dpid ) \
+ Empty_directive( name, dpid )
+
+#define rtems_event_receive( eventin, options, timeout, eventout ) \
+ Empty_directive( eventin, options, timeout, eventout )
+#define rtems_event_send( tid, event ) \
+ Empty_directive( tid, event )
+
+#define rtems_initialize_executive( conftbl, cputbl ) \
+ Empty_directive( conftbl, cputbl )
+#define rtems_shutdown_executive( the_error ) \
+ Empty_directive( the_error )
+
+#define rtems_interrupt_catch( israddr, vector, oldisr ) \
+ Empty_directive( israddr, vector, oldisr )
+
+#define rtems_partition_create( name, paddr, length, bsize, attr, ptid ) \
+ Empty_directive( name, paddr, length, bsize, attr, ptid )
+#define rtems_partition_delete( ptid ) \
+ Empty_directive( ptid )
+#define rtems_partition_get_buffer( ptid, bufaddr ) \
+ Empty_directive( ptid, bufaddr )
+#define rtems_partition_ident( name, node, ptid ) \
+ Empty_directive( name, node, ptid )
+#define rtems_partition_return_buffer( ptid, bufaddr ) \
+ Empty_directive( ptid, bufaddr )
+
+#define rtems_message_queue_broadcast( qid, buffer, count ) \
+ Empty_directive( qid, buffer, count )
+#define rtems_message_queue_create( name, count, attr, qid ) \
+ Empty_directive( name, count, attr, qid )
+#define rtems_message_queue_delete( qid ) \
+ Empty_directive( qid )
+#define rtems_message_queue_flush( qid, count ) \
+ Empty_directive( qid, count )
+#define rtems_message_queue_ident( name, node, qid ) \
+ Empty_directive( name, node, qid )
+#define rtems_message_queue_receive( qid, buffer, options, timeout ) \
+ Empty_directive( qid, buffer, options, timeout )
+#define rtems_message_queue_send( qid, buffer ) \
+ Empty_directive( qid, buffer )
+#define rtems_message_queue_urgent( qid, buffer ) \
+ Empty_directive( qid, buffer )
+
+#define rtems_region_create( name, paddr, length, pagesize, attr, rnid ) \
+ Empty_directive( name, paddr, length, pagesize, attr, rnid )
+#define rtems_region_delete( rnid ) \
+ Empty_directive( rnid )
+#define rtems_region_get_segment( rnid, size, options, timeout, segaddr ) \
+ Empty_directive( rnid, size, options, timeout, segaddr )
+#define rtems_region_ident( name, rnid ) \
+ Empty_directive( name, rnid )
+#define rtems_region_return_segment( rnid, segaddr ) \
+ Empty_directive( rnid, segaddr )
+
+#define rtems_semaphore_create( name, count, attr, priceil, smid ) \
+ Empty_directive( name, count, attr, priceil, smid )
+#define rtems_semaphore_delete( smid ) \
+ Empty_directive( smid )
+#define rtems_semaphore_ident( name, node, smid ) \
+ Empty_directive( name, node, smid )
+#define rtems_semaphore_obtain( smid, options, timeout ) \
+ Empty_directive( smid, options, timeout )
+#define rtems_semaphore_release( smid ) \
+ Empty_directive( smid )
+
+#define rtems_task_create( name, priority, stack_size, mode, attr, tid ) \
+ Empty_directive( name, priority, stack_size, mode, attr, tid )
+#define rtems_task_delete( tid ) \
+ Empty_directive( tid )
+#define rtems_task_get_note( tid, notepad, note ) \
+ Empty_directive( tid, notepad, note )
+#define rtems_task_ident( name, node, tid ) \
+ Empty_directive( name, node, tid )
+#define rtems_task_mode( mode, mask, pmode ) \
+ Empty_directive( mode, mask, pmode )
+#define rtems_task_restart( tid, arg ) \
+ Empty_directive( tid, arg )
+#define rtems_task_resume( tid ) \
+ Empty_directive( tid )
+#define rtems_task_set_note( tid, notepad, note ) \
+ Empty_directive( tid, notepad, note )
+#define rtems_task_set_priority( tid, priority, ppriority ) \
+ Empty_directive( tid, priority, ppriority )
+#define rtems_task_start( tid, saddr, arg ) \
+ Empty_directive( tid, saddr, arg )
+#define rtems_task_suspend( tid ) \
+ Empty_directive( tid )
+
+#define rtems_clock_get( options, time ) \
+ Empty_directive( options, time )
+#define rtems_clock_set( time ) \
+ Empty_directive( time )
+#define rtems_clock_tick() \
+ Empty_directive()
+#define rtems_task_wake_after( ticks ) \
+ Empty_directive( ticks )
+#define rtems_task_wake_when( time ) \
+ Empty_directive( time )
+
+#define rtems_fatal_error_occurred( errcode ) \
+ Empty_directive( errcode )
+
+#define rtems_rate_monotonic_create( name, id ) \
+ Empty_directive( name, id )
+#define rtems_rate_monotonic_ident( name, id ) \
+ Empty_directive( name, id )
+#define rtems_rate_monotonic_delete( id ) \
+ Empty_directive( id )
+#define rtems_rate_monotonic_cancel( id ) \
+ Empty_directive( id )
+#define rtems_rate_monotonic_period( id, period ) \
+ Empty_directive( id, period )
+
+#define rtems_multiprocessing_announce() \
+ Empty_directive()
+
+#define rtems_timer_create( name, tmid ) \
+ Empty_directive( name, tmid )
+#define rtems_timer_delete( tmid ) \
+ Empty_directive( tmid )
+#define rtems_timer_cancel( tmid ) \
+ Empty_directive( tmid )
+#define rtems_timer_ident( name, tmid ) \
+ Empty_directive( name, tmid )
+#define rtems_timer_fire_after( tmid, ticks, routine, user_data ) \
+ Empty_directive( tmid, ticks, routine, user_data )
+#define rtems_timer_fire_when( tmid, time, routine, user_data ) \
+ Empty_directive( tmid, time, routine, user_data )
+#define rtems_timer_reset( tmid ) \
+ Empty_directive( tmid )
+
+rtems_status_code Empty_directive();
+
+#endif
+/* end of include file */
diff --git a/testsuites/tmtests/tmoverhd/empty.c b/testsuites/tmtests/tmoverhd/empty.c
new file mode 100644
index 0000000000..dcfa33d1ed
--- /dev/null
+++ b/testsuites/tmtests/tmoverhd/empty.c
@@ -0,0 +1,41 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Timer_handler(
+ rtems_id argument
+)
+{
+}
+
+rtems_asr Isr_handler(
+ rtems_signal_set signals
+)
+{
+}
+
+rtems_asr Asr_handler(
+ rtems_signal_set signals
+)
+{
+}
+
+rtems_task task_func() {}
+
+void null_func() {}
+
+rtems_status_code Empty_directive()
+{
+ return( RTEMS_SUCCESSFUL );
+}
diff --git a/testsuites/tmtests/tmoverhd/system.h b/testsuites/tmtests/tmoverhd/system.h
new file mode 100644
index 0000000000..9fbbf116dd
--- /dev/null
+++ b/testsuites/tmtests/tmoverhd/system.h
@@ -0,0 +1,58 @@
+/* system.h
+ *
+ * This include file is used by all tests in the Time Suite.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include <coverhd.h>
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_timer_service_routine Timer_handler(
+ rtems_id argument
+);
+
+rtems_asr Isr_handler(
+ rtems_signal_set signals
+);
+
+rtems_asr Asr_handler(
+ rtems_signal_set signals
+);
+
+rtems_task task_func();
+
+void null_func();
+
+rtems_status_code Empty_directive();
+
+#include <timesys.h>
+
+/* configuration information */
+
+#define CONFIGURE_TMTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/tmtests/tmoverhd/testtask.c b/testsuites/tmtests/tmoverhd/testtask.c
new file mode 100644
index 0000000000..e8710c45bc
--- /dev/null
+++ b/testsuites/tmtests/tmoverhd/testtask.c
@@ -0,0 +1,1279 @@
+/*
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_unsigned8 Memory_area[ 2048 ];
+rtems_unsigned8 Internal_port_area[ 256 ];
+rtems_unsigned8 External_port_area[ 256 ];
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{ rtems_id id;
+ rtems_status_code status;
+
+ Set_find_average_overhead( TRUE );
+
+ Print_Warning();
+
+ puts( "\n\n*** TIME TEST OVERHEAD ***" );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 254,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_start( id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+/* comment out the following include to verify type are correct */
+#include "dumrtems.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_name name;
+ rtems_unsigned32 index;
+ rtems_cpu_table cpu_table;
+ rtems_id id;
+ rtems_task_priority in_priority;
+ rtems_task_priority out_priority;
+ rtems_mode in_mode;
+ rtems_mode mask;
+ rtems_mode out_mode;
+ rtems_unsigned32 note;
+ rtems_time_of_day time;
+ rtems_interval timeout;
+ rtems_signal_set signals;
+ void *address_1;
+ rtems_event_set events;
+ long buffer[ 4 ];
+ rtems_unsigned32 count;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+ rtems_unsigned32 io_result;
+ rtems_unsigned32 error;
+ rtems_clock_get_options options;
+
+ name = rtems_build_name( 'N', 'A', 'M', 'E' );
+ in_priority = 250;
+ in_mode = RTEMS_NO_PREEMPT;
+ mask = RTEMS_PREEMPT_MASK;
+ note = 8;
+ timeout = 100;
+ signals = RTEMS_SIGNAL_1 | RTEMS_SIGNAL_3;
+ major = 10;
+ minor = 0;
+ error = 100;
+ options = 0;
+
+/* rtems_initialize_executive */
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_initialize_executive( &BSP_Configuration, &cpu_table );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_initialize_executive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_shutdown_executive */
+
+ Timer_initialize();
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+ (void) rtems_shutdown_executive( error );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_shutdown_executive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_create(
+ name,
+ in_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_start */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_start( id, Task_1, 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_start",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_restart */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_restart( id, 0 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_restart",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_suspend */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_suspend( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_suspend",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_resume */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_resume( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_resume",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_set_priority */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_set_priority( id, in_priority, &out_priority );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_priority",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_mode */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_mode( in_mode, mask, &out_mode );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_mode",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_get_note */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_get_note( id, 1, note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_get_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_set_note */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_set_note( id, 1, note );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_set_note",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_wake_when */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_wake_when( time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_when",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_task_wake_after */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_task_wake_after( timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_task_wake_after",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_interrupt_catch */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_interrupt_catch( Isr_handler, 5, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_interrupt_catch",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_get */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_get( options, time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_get",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_set */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_set( time );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_set",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_clock_tick */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_clock_tick();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_clock_tick",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_timer_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_create( name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_fire_after */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_fire_after(
+ id,
+ timeout,
+ Timer_handler,
+ NULL
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_after",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_fire_when */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_fire_when(
+ id,
+ time,
+ Timer_handler,
+ NULL
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_fire_when",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_reset */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_reset( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_reset",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_timer_cancel */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_timer_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_timer_cancel",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_create(
+ name,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_obtain */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_obtain",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_semaphore_release */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_semaphore_release( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_semaphore_release",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_create(
+ name,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_ident(
+ name,
+ RTEMS_SEARCH_ALL_NODES,
+ id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_send( id, (long (*)[4])buffer );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_urgent */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_urgent( id, (long (*)[4])buffer );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_urgent",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_broadcast */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_broadcast(
+ id,
+ (long (*)[4])buffer,
+ &count
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_broadcast",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_receive */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_receive(
+ id,
+ (long (*)[4])buffer,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_receive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_message_queue_flush */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_message_queue_flush( id, &count );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_message_queue_flush",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_event_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_event_send( id, events );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_event_receive */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &events
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_event_receive",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_signal_catch */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_signal_catch( Asr_handler, RTEMS_DEFAULT_MODES );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_catch",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_signal_send */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_signal_send( id, signals );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_signal_send",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_create(
+ name,
+ Memory_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_ident( name, RTEMS_SEARCH_ALL_NODES, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_get_buffer */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_get_buffer( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_get_buffer",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_partition_return_buffer */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_partition_return_buffer( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_partition_return_buffer",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_create(
+ name,
+ Memory_area,
+ 2048,
+ 128,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_get_segment */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_get_segment(
+ id,
+ 243,
+ RTEMS_DEFAULT_OPTIONS,
+ timeout,
+ &address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_get_segment",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_region_return_segment */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_region_return_segment( id, address_1 );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_region_return_segment",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_create(
+ name,
+ Internal_port_area,
+ External_port_area,
+ 0xff,
+ &id
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_external_to_internal */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_external_to_internal(
+ id,
+ &External_port_area[ 7 ],
+ address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_external_to_internal",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_port_internal_to_external */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_port_internal_to_external(
+ id,
+ &Internal_port_area[ 7 ],
+ address_1
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_port_internal_to_external",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+rtems_test_pause();
+
+/* rtems_io_initialize */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_initialize(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_initialize",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_open */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_open(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_open",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_close */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_close(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_close",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_read */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_read(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_read",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_write */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_write(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_write",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_io_control */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_io_control(
+ major,
+ minor,
+ address_1,
+ &io_result
+ );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_io_control",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_fatal_error_occurred */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_fatal_error_occurred( error );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_fatal_error_occurred",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_create */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_create( name, &id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_create",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_ident */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_ident( name, id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_ident",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_delete */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_delete( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_delete",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_cancel */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_cancel( id );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_cancel",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_rate_monotonic_period */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_rate_monotonic_period( id, timeout );
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_rate_monotonic_period",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+/* rtems_multiprocessing_announce */
+
+ Timer_initialize();
+ for ( index = 1 ; index <= OPERATION_COUNT ; index ++ )
+ (void) rtems_multiprocessing_announce();
+ end_time = Read_timer();
+
+ put_time(
+ "rtems_multiprocessing_announce",
+ end_time,
+ OPERATION_COUNT,
+ overhead,
+ 0
+ );
+
+ puts( "*** END OF TIME OVERHEAD ***" );
+
+ exit( 0 );
+}
diff --git a/testsuites/tmtests/tmoverhd/tmoverhd.doc b/testsuites/tmtests/tmoverhd/tmoverhd.doc
new file mode 100644
index 0000000000..0de40191c6
--- /dev/null
+++ b/testsuites/tmtests/tmoverhd/tmoverhd.doc
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
diff --git a/tools/build/README b/tools/build/README
new file mode 100644
index 0000000000..0436fc958d
--- /dev/null
+++ b/tools/build/README
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+Misc. support tools for RTEMS workspaces.
+More will be added later as they are converted from Teamware
+to CVS.
+
+install-if-change
+ Smart install script that also can append suffixes as it
+ installs (suffixes used for debug and profile variants).
+ Requires bash or ksh.
+
+rcs-clean
+ deletes all files from the current directory that can be
+ re-created from RCS. Careful to not delete locked files.
+ May be used by 'gmake clobber'
+
+lock-directory
+unlock-directory
+ traverse a directory structure making it unwritable.
+ Useful to keep people from accidentally overwriting
+ "released" trees if they get confused about which
+ module they have loaded.
+
+rtems-glom
+ glom together all the rtems libraries in order to simplify
+ the link line used by applications.
+ Produces rtems.rel.
+ Not used by the RTEMS src tree at all.
+ Strictly optional.
+
diff --git a/tools/build/cklength.c b/tools/build/cklength.c
new file mode 100644
index 0000000000..6059cacb1f
--- /dev/null
+++ b/tools/build/cklength.c
@@ -0,0 +1,364 @@
+/*
+ * cklength - check the length of lines in a file
+ *
+ * This program check to see if the files passed to it on the command line
+ * contain a line which exceeds the maximum allowable length. The default
+ * maximum line length is 80.
+ *
+ * usage: cklength [ -v ] [ arg ... ] files...
+ * -l length -- maximum line length
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "l:nNv"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -l length -- maximum line length\n\
+ -n -- report line numbers for offending lines\n\
+ -N -- report line numbers and length for offending lines\n\
+ -v -- verbose\n\
+\n\
+Print the name of files which have at least 1 line which exceeds the\n\
+maximum line length. The default maximum line length is 80.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 512
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int report_line_numbers = FALSE; /* report line numbers of offenders */
+int report_line_length = FALSE; /* report line length of offenders */
+
+int line_length = 80; /* maximum allowable line length */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 'l': /* line length */
+ line_length = atoi( optarg );
+ if ( line_length < 0 || line_length > BUFFER_SIZE )
+ error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
+ break;
+
+ case 'n': /* toggle report_line_numbers */
+ report_line_numbers = ! report_line_numbers;
+ break;
+
+ case 'N': /* toggle both reports */
+ report_line_numbers = ! report_line_numbers;
+ report_line_length = ! report_line_length;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int line_number;
+ int length;
+ int count;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ count = 0;
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( length <= line_length )
+ continue;
+
+ if ( count == 0 ) {
+ fprintf( stderr, "%s\n", arg );
+ if ( !report_line_numbers )
+ break;
+ }
+
+ if ( verbose )
+ fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
+
+ if ( report_line_numbers ) {
+ if ( report_line_length )
+ fprintf( stderr, "%d: %d\n" , line_number, length );
+ else
+ fprintf( stderr, "%d\n" , line_number );
+ }
+
+ count++;
+
+ }
+
+ fclose( in );
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/tools/build/eolstrip.c b/tools/build/eolstrip.c
new file mode 100644
index 0000000000..b4e0d5d165
--- /dev/null
+++ b/tools/build/eolstrip.c
@@ -0,0 +1,351 @@
+/*
+ * eolstrip - strip white space from end of lines
+ *
+ * This program strips the white space from the end of every line in the
+ * specified program.
+ *
+ * usage: eolstrip [ -v ] [ arg ... ] files...
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "vt"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -v -- verbose\n\
+ -t -- test only .. DO NOT OVERWRITE FILE!!!\n\
+\n\
+Strip the white space from the end of every line on the list of files.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 2048
+#define MAX_PATH 2048
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int test_only = FALSE; /* test only */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 't': /* toggle test only mode */
+ test_only = ! test_only;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ FILE *out = (FILE *) 0;
+ char outname[ MAX_PATH ];
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int length;
+ int line_number;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ if ( !test_only ) {
+ sprintf( outname, "%s.eoltmp", arg );
+
+ out = fopen( outname, "w" );
+ if (!out)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+ }
+
+ if ( verbose )
+ fprintf( stderr, "Processing %s\n", arg );
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( buffer[ length ] != '\n' )
+ error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
+
+ while ( isspace( buffer[ length ] ) )
+ buffer[ length-- ] = '\0';
+
+ if ( test_only ) {
+ fprintf( stderr, "%s\n", arg );
+ break;
+ }
+
+ fprintf( out, "%s\n", buffer );
+ }
+
+ fclose( in );
+ if ( !test_only ) {
+ fclose( out );
+ rename( outname, arg );
+ }
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/tools/build/os/msdos/README b/tools/build/os/msdos/README
new file mode 100644
index 0000000000..af3b0dfb31
--- /dev/null
+++ b/tools/build/os/msdos/README
@@ -0,0 +1,12 @@
+#
+# $Id$
+#
+
+ifc is an MS-DOS executable which is equivalent to the program
+install-if-change. It was compiled using Borland C 2.00.
+
+cklength is a precompiled version of the program cklength.c from
+the main source tree.
+
+fixtimer is a program to restore the clock if the program does not
+exit cleanly.
diff --git a/tools/build/os/msdos/cklength.uue b/tools/build/os/msdos/cklength.uue
new file mode 100644
index 0000000000..fd8052cd9a
--- /dev/null
+++ b/tools/build/os/msdos/cklength.uue
@@ -0,0 +1,286 @@
+#
+# $Id$
+#
+begin 664 cklength
+M?T5,1@$" 0 " ( ! $,% #0 "T8 T "
+M!0 H !H %P 8 T $ - "@ H 4 P
+M -0 !$ ! ! ! 7
+M2P %TL % $ $ !=, (73 &\ %? < 0
+M @ %U A=0 (@ !P O=7-R+VQI8B]L9"YS
+M;RXQ $, !6 20 #P
+M #@ $4 /0 !P !# &@
+M A 30 #\ *0 $X !" D
+M $@ W $8 )@ "
+M ! %( 4P Z *@ 00
+M $H 'P $L !5 3P L .P %0 H
+M-@ #$ P 40
+M
+M
+M G
+M '0 C ; N
+M "( -0 E #D R - !X
+M "T ,P !$ *P
+M ^ "\ 3 % !'
+M 0#4 , $ $ Z # "
+M ! U0 P P 0BT , 0 $*W #
+M % !"S P !@ 0P4 , < $32
+M # ( !$^ P "0 1/L , H $3
+M] # + !% P # A=, , T
+M (74 # . "%]@ P #P ACP , !
+M (9" # 1 P $@ ,
+M !, # 4 P %0
+M , !8 # 7 P &
+M , !D ! (8. 2 " !$_0 $0 "P !8
+M 0P4 =!( < = (8U 2 (@ "&$0 $@
+M "< 1/L !$ H U (8O 2 / "&0@ $$0
+M$0 $4 AB8 !( !. (9# 01 1 5P "',@
+M$0#_\0 %P 1+ 2!( < !B $2> $@2 ' 9P !$8@
+M "H$@ !P &\ AD8 !0"$ !$ !T (73 1 /_Q B@ "
+M&*0 $@ ) A@( !( "7 (8% 2
+MG !$T@ $@ " *( ACT !!$ ! "J (9$ 01 1
+M M "&E@ )@$0 $0 , AB !( #' (8\ 01
+M 0 S0 "%U $0#_\0 -8 0[H !0!( < #> (9&
+M 4 1 1 Y "&E@ )@$0 $0 /$ AC@ !( #W (8
+M+ 2 _P "&" $@ 04 AD, !"$ !$ $-
+M (<N 01 1 !$P "&+ $@ 1H 1 H !8!( <
+M $@ (8_ 01 0 !,P "'+P $$0 $0 3H AC( !(
+M $_ (<P 01 1 !1@ "&&@ $@ 4P AS$
+M!!$ !$ %3 (8^ 01 0 !9P "&0@ $0#_\0 6X A?8
+M !$ __$ &( (87 2 !C@ "&1 $$0 $0 9<
+M 1,( /!( < &I $3\ 1 * !M@ !%TL $0#_\0
+M ;T 10 !!$ P '* $2, $@2 ' !SP "&(P $@
+M =8 0R( !( < 'H $3^ 1 + !]0 !#10 '4
+M$@ !P ?H AD !!$ ! (& (8= 2 "#0 !$^
+M $@ "0 A, AA0 !( 9V5T;W!T %]?1%1/4E],25-47U\
+M7W-T87)T ')E860 871O:0!?7T-43U)?3$E35%]? '-T<G1O; !P<F]G;F%M
+M90!V9G!R:6YT9@!?96YV:7)O;@!?96YD %=R:71E %)E860 9V5T<&%R;0!?
+M:6]B %]'3$]"04Q?3T9&4T547U1!0DQ%7P!A8F]R= !A=&5X:70 97AI= !?
+M:6YI= !V97)B;W-E %]S>7-?;F5R<@!S>7-?97)R;&ES= !F8VQO<V4 55-!
+M1T4 7T193D%-24, <')O8V5S<P!?7VEO8@!?<WES7V5R<FQI<W0 =W)I=&4
+M<W1R<F-H<@!?97AI= !E;G9I<F]N &5R<FYO '-T<F-H<@!E<G)O<@!R97!O
+M<G1?;&EN95]L96YG=&@ ;W!T:6YD &]P96X ;W!T87)G &9G971S &]P=&5R
+M<@!R97!O<G1?;&EN95]N=6UB97)S %]E9&%T80!?4%)/0T5$55)%7TQ)3DM!
+M1T5?5$%"3$5? &9O<&5N '-Y<U]N97)R %]?9&]?9VQO8F%L7V1T;W)S %]?
+M0U1/4E]%3D1?7P!?971E>'0 7VQI8E]V97)S:6]N $]P96X 9F9L=7-H %]?
+M9&]?9VQO8F%L7V-T;W)S %]?1%1/4E]%3D1?7P!M86EN &QI;F5?;&5N9W1H
+M '-T<FQE;@!?9FEN:0!F<')I;G1F &QI8F,N<V\N,0 AD, C$P
+M AS$ !#$P AS !!$P AR\ _$P AD8 U
+M$P " AD0 !($P AI8 P$P A@( K%0 A@4
+M L%0 A@@ Y%0 A@L X%0 A@X :%0
+M AA$ >%0 AA0 !5%0 AA< !'%0 AAH !"%0
+M AAT !3%0 AB Q%0 AB, !.%0 AB8 B
+M%0 ABD J%0 ABP \%0 AB\ @%0 AC(
+M ! %0 AC4 =%0 AC@ W%0 "\$" X .@0*(#H$2<
+M(Z @@) 0* 20$ !0 !"]@$ 1 !$D!(CX$ 0O(! 0 !P $
+M "0$ 0DA $94L( *4 J $E 1 "A< (:6$N$,U"+ $ "D! 0 !"
+MYP$ ! $+H 0 ('#X @! $0 1-0"(^R HK__$H #9(2(^S0 F $
+M@*(@ * F4$" E@)@!)(0( "2 F $T ) "X"B( 2O__]E *@ 9*2@ "
+M@ ,$0 1!$ $2B$B/LH2I@ M $ !&?P@ 0 *"$/_PRO__]T 0 $1$
+M $1 $+!D!(C"(''X B!Z G>._F*@0 !BB$" L! @ - &0 ! $+!DA @
+M+Q, (: HB $H !- B80@0@ $T 9 - "80B0 B !T")A"!$ (;0 B$(
+MT"9 !$ (? (B#$(0 AB< (8E "&%0 19 0 !22$ 90 !"KI02H:"
+MHC__ H ,X"B(&PB@ 1$0 AQ2 F HB!N@*(@/P* "J HB!. H '- $
+M(/@0O__P%0 10* !. HB!V H 'M $H/00O__J%0 14 0IO0 B# E!
+M"!$ (: HJ( "+__XM0B(0 3 !%$0@ $ (N2$F&H$+__W14 $70!"#X
+M@* ")!@/_\0O__7T"0@^("@ B08#__T"0@^- $X/R H (D& __Q"__\_0
+M).#\@* ")!@/_\0O__+T"2@]!"__\FB$" !@*1@ "* L1 "'%0 AA$
+M (:0$B$X$P 19(28<A $)VU *@\$ 0F60$" !DA "- "(+R1*B "T 9
+M"("B( "@ 1(0 A] "8+R1*B "0 #] &0 B HC__(H K 0/__0!""\
+MD (@ = D(+R1*B "T 9 "("B( 2O__SDA $(''X B!Z G>.]F) 0 !@3
+M !%0 !"6I(28="JD@ $H !Z80( 1& $P 19(28=A !%E! &* 0
+M( &H![WX)0 ABT (:0$ 4DA B $ 0DV4$ 5@*(@ * #4! 0 !"
+M2Y 0 !2B C__$0 AM "(0" I$ (!( *X"DX 2@ +$0 AA, $60%*$X
+MDA)A^$ 0C64$ 8T 6@^("B( "@ B$0 AM "(/2 HB H !Q, $60
+M%*$XDA)B )00 !! $(HE@>]^- %H/B HB H $A$ (;0 B#\@*(@ *
+M D3 !%D!2A.)(28AB4$ 00 !"&Y80 !$0@ (I@3@ 1, $60%*$XDA)B
+M($ 0A24$ 0I@3@ 1"__\B@!" !0 !"&Y 0 !6P$" @<?@"('H "=X[^0
+M\B>@2/0GH$SV)Z!0^">@5/HGH%@1 "&0 !"$I 2(2@1' LBX "!$0 "
+MC@ ( H !*('H$P1 "'\@(@N. 'H$@5 "&-0 AI 6H3@3 !%DA)B*$
+M0?/4 J$(D!:A.)(0 !! $(!E! $8"F8 "@ :$0 A@2 !*0$B$X$0
+MAM "(1" ID (-H #!$ (85 "&E!*B6)<N8 *0%J$X$P 19(28C! $'=
+MU + "A" X1 "&D!(A.!, $62$F(X0 !!UI00 !D0@ '$0 AI 2(3@3
+M !%0 !!T)(28E 1 "&0 !!W) 2(3@1# @(X " * !41" @(X " *
+M R IF H !1$ $41 !%$( Y(2(EB2$B)P?___M) 0( ! $&MD!
+M&9 0( 3 !%?___KI(28GA $'+ 0 (''X B!Z G>._F* 0 !@1 !%
+MD!(BD$ 0<;23 @*(@ !* F0$ 0$0@ !, $62$F*@?___G)00 ! 0
+M@ :L! &9(0( ! $&\E! @ + 0 B I@ 9!H !("F !H$@ 1 0 ("F
+M0!H2@ ($0@ !, $62$F*XE! $'___XF6$ :,( !Q, $62$F+0E!
+M&Y80 !E___^"F! &H''X B!Z G>._F* 0 !B0$ 0DA &4 0:*4$ :
+ML! "("F/_\2@ ($1@ !, $62$F+PE! $)80 !E___]PF! &H''X B!
+MZ G>._F* 0 !B0$ 0DA &4 09.4$ :L! "("F/_\2@ ($1@ !,
+M $62$F,0E! $)80 !E___]>F! &H''X B!Z G>._F* 0 !B0$ 0DA
+M&4 0824$ :L! "("F/_\2@ ($1@ !, $62$F,PE! $)80 !E___],
+MF! &H''X B!Z G>._F!$ $32 B/X@*)@ * F@$B/XT 0 )_" "@
+M!" $T 0 ("B( 2O__[ 0 (''X B!Z G>._F)WCOZ"!Z G>._F!$
+M $34 B/L@**__Q* V2$B/LT )@!("B( "@ )E! @ )8"8 22$" D@)@
+M!- "0 N HB $K___90"H &2DH H #!$ $01 !$HA(C[*$J8 +0! 1
+MG\( $ "@A#_\,K___= $ !$1 !$0 !!$) 2(PB!Q^ (@>@ (''X B!
+MZ G>._H(''X B!Z _____P #_____ ! '5S
+M86=E.B @8VML96YG=&@@(%L@+78@72!;(&%R9R N+BX@72!F:6QE<RXN+B *
+M(" @(" @(" @(" @+6P@;&5N9W1H(" @+2T@;6%X:6UU;2!L:6YE(&QE;F=T
+M: H@(" @(" @(" @(" M;B @(" @(" @(" M+2!R97!O<G0@;&EN92!N=6UB
+M97)S(&9O<B!O9F9E;F1I;F<@;&EN97,*(" @(" @(" @(" @+4X@(" @(" @
+M(" @+2T@<F5P;W)T(&QI;F4@;G5M8F5R<R!A;F0@;&5N9W1H(&9O<B!O9F9E
+M;F1I;F<@;&EN97,*(" @(" @(" @(" @+78@(" @(" @(" @+2T@=F5R8F]S
+M90H*4')I;G0@=&AE(&YA;64@;V8@9FEL97,@=VAI8V@@:&%V92!A="!L96%S
+M=" Q(&QI;F4@=VAI8V@@97AC965D<R!T:&4*;6%X:6UU;2!L:6YE(&QE;F=T
+M:"X@(%1H92!D969A=6QT(&UA>&EM=6T@;&EN92!L96YG=&@@:7,@.# N"@
+M &PZ;DYV *"5D*2!I<R!I;&QE9V%L(&QI;F4@;&5N9W1H"@ E<P
+M '( 56YA8FQE('1O(&]P96X@9FEL92 H)7,I"@ E
+M<PH %1/3R!,3TY'.B5D.B E<PH "5D.B E9 H )60*
+M E<SH@ " H)7,I"@ ("AU;FMN;W=N(&5R<FYO/25D*0H "@
+M !F871A;"!E<G)O<BP@97AI=&EN9P !E>&ET:6YG &9A=&%L(&5R
+M<F]R+"!A8F]R=&EN9P # Q,C,T-38W.#DM G)7,G(&ES(&YO="!A
+M(&YU;6)E<@ E<R!C86X@;VYL>2!B92 E;&0 E<R!M=7-T(&)E
+M(&)E='=E96X@)6QD(&%N9" E;&0 &]P96XH)R5S)RP@,'@E>"P@,"5O*2!F
+M86EL960 <F5A9"@E9"P@,'@E>"P@)60I(&9A:6QE9 !W<FET
+M92@E9"P@,'@E>"P@)60I(&9A:6QE9 (74 $ (; # !$T@
+M - $3X 0 0#H !0 !"+0 * ")0 8 0-4 "P
+M ! 5 , A?8 @ .0 4 !P !< 0LP
+M!P !"MP ( !. D ,
+M # P,+__\P$ #
+M \,+__\ $ # !(,+__[0$ # !4,+__Z@$ # !@,+__YP$
+M # !L,+__Y $ # !X,+__X0$ # "$,+__W@$ # "0,+__
+MVP$ # "<,+__V $ # "H,+__U0$ # "T,+__T@$ # #
+M,+__SP$ # #,,+__S $ # #8,+__R0$ # #D,+__Q@$ #
+M #P,+__PP$ # #\,+__P $ # $(,+__O0$ ! $4"
+M % $
+M 0 __$ $ U # ! ! .@ P @ 0-4
+M , , $(M # $ !"MP P !0
+M 0LP , 8 $,% # ' !$T@ P "
+M 1/@ , D $3[ # * !$_0 P
+M"P 10 , P (73 # - "%U
+M P #@ A?8 , \ (8\ # 0 "&0@
+M P $0 , !( # 3
+M P % , !4 # 6
+M P %P , !@ # 9
+M #P ! #_\0 !8 0 __$ B $
+M /_Q +0 !$U @ " $, 0R( < !2 (8\
+M ! 0 8 ! #_\0 &L 0T4 < !Z
+M $ /_Q A ! #_\0 (\ 1-$ ( < "E
+M $31 ' M "&00 0 $ ,( 0 __$
+M #) (8. 2 T !$_0 $0 "P -X 0P4 =!(
+M < #E (8U 2 Z@ "&$0 $@ .\ 1/L
+M !$ H #] (8O 2 !! "&0@ $$0 $0 0T AB8
+M !( $6 (9# 01 1 !'P "',@ $0#_\0 20
+M 1+ 2!( < $J $2> $@2 ' !+P !$8@ "H$@ !P
+M 3< AD8 !0"$ !$ $\ (73 1 /_Q !4@ "&*0 $@
+M 5@ A@( !( %? (8% 2 !9 !$T@
+M$@ " 6H ACT !!$ ! %R (9$ 01 1 !? "&E@
+M )@$0 $0 8@ AB !( &/ (8\ 01 0 !E0 "
+M%U $0#_\0 9X 0[H !0!( < &F (9& 4 1 1 !
+MK "&E@ )@$0 $0 ;D AC@ !( &_ (8+ 2
+M !QP "&" $@ <T AD, !"$ !$ '5 (<N 01
+M 1 !VP "&+ $@ >( 1 H !8!( < 'H (8_
+M 01 0 !^P "'+P $$0 $0 @( AC( !( (' (<
+MP 01 1 "#@ "&&@ $@ A0 AS$ !!$ !$ (;
+M (8^ 01 0 "+P "&0@ $0#_\0 C8 A?8 !$ __$
+M )0 (87 2 "5@ "&1 $$0 $0 E\ 1,( /!(
+M < )Q $3\ 1 * "?@ !%TL $0#_\0 H4 10
+M!!$ P *2 $2, $@2 ' "EP "&(P $@ IX 0R(
+M !( < *P $3^ 1 + "O0 !#10 '4$@ !P L(
+M AD !!$ ! +. (8= 2 "U0 !$^ $@ "0
+M ML AA0 !( 9V\S,B]C:VQE;F=T: !C<G1I+G, =F%L=65S+5AA
+M+F, 8W)T<W1U9F8N8P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@ 9V-C,E]C;VUP
+M:6QE9"X 9F]R8V5?=&]?9&%T80!C:VQE;F=T:"YC &=C8S)?8V]M<&EL960N
+M &QI8F=C8S(N8P!C<G1S='5F9BYC %]?9&]?9VQO8F%L7V-T;W)S7V%U> !G
+M8V,R7V-O;7!I;&5D+@!F;W)C95]T;U]D871A &-R=&XN<P!G971O<'0 7U]$
+M5$]27TQ)4U1?7P!?<W1A<G0 <F5A9 !A=&]I %]?0U1/4E],25-47U\ <W1R
+M=&]L '!R;V=N86UE '9F<')I;G1F %]E;G9I<F]N %]E;F0 5W)I=&4 4F5A
+M9 !G971P87)M %]I;V( 7T=,3T)!3%]/1D93151?5$%"3$5? &%B;W)T &%T
+M97AI= !E>&ET %]I;FET '9E<F)O<V4 7W-Y<U]N97)R '-Y<U]E<G)L:7-T
+M &9C;&]S90!54T%'10!?1%E.04U)0P!P<F]C97-S %]?:6]B %]S>7-?97)R
+M;&ES= !W<FET90!S=')R8VAR %]E>&ET &5N=FER;VX 97)R;F\ <W1R8VAR
+M &5R<F]R ')E<&]R=%]L:6YE7VQE;F=T: !O<'1I;F0 ;W!E;@!O<'1A<F<
+M9F=E=', ;W!T97)R ')E<&]R=%]L:6YE7VYU;6)E<G, 7V5D871A %]04D]#
+M14154D5?3$E.2T%'15]404),15\ 9F]P96X <WES7VYE<G( 7U]D;U]G;&]B
+M86Q?9'1O<G, 7U]#5$]27T5.1%]? %]E=&5X= !?;&EB7W9E<G-I;VX 3W!E
+M;@!F9FQU<V@ 7U]D;U]G;&]B86Q?8W1O<G, 7U]$5$]27T5.1%]? &UA:6X
+M;&EN95]L96YG=&@ <W1R;&5N %]F:6YI &9P<FEN=&8 $ %
+MFP UD "]D # %$X ((X
+M $8\ ! *",I4W5N3U,@-2XS($=E;F5R:6,@4V5P=&5M
+M8F5R(#$Y.3, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,*
+M $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@
+M4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A
+M8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N
+M,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C,
+M;&0Z("A31U4I(%-U;D]3+T5,1B H3$LM,2XS*0 0 "D 8?
+M"V0 1,( (60 1,( +3P /(
+M 7H <( EX L(
+M SH !$H !5H !=(
+M !EH !LX !SX !
+MX8 !]( "#( ".8
+M "5( "<( "D8 "G8
+M "R( #&8 $GH %+(
+M & %.8 ) %0X -< %3H #0 %
+M6H #4 %9( #8 %;X #< %>8 #@
+M %A( #D %CX #H %FH $8 %IX
+M %T( &T %]( "X &"20 !\L 1,( "YI;G1E
+M<G +FAA<V@ +F1Y;G-Y;0 N9'EN<W1R "YR96QA+F)S<P N<F5L82YP;'0
+M+G1E>'0 +FEN:70 +F9I;FD +F-T;W)S "YD=&]R<P N<F]D871A "YG;W0
+M+F1Y;F%M:6, +G!L= N9&%T80 N8G-S "YS>6UT86( +G-T<G1A8@ N<W1A
+M8BYI;F1E> N8V]M;65N= N<W1A8@ N<VAS=')T86( +G-T86(N:6YD97AS
+M='( +G-T86)S='( '9A;'5E<RU882YC "\Q,#DS+V]N,3 Y,U]W<R]U<W(O
+M<W)C+VQI8B]L:6)C+P!P;W)T+V=E;B]V86QU97,M6&$N8P %AT(#L@5CTR
+M+C +VYE="]M;W)G86YA+W5S<C$O<G1E;7,M,RXU+C P+V,O8G5I;&0M=&]O
+M;',O<W)C "]U<W(O8V-S+VQI8B]V86QU97,M6&$N;P ;&EB9V-C,BYC "]U
+M<W(T+T=.050O9V-C+3(N-BXS+P N+VQI8F=C8S(N8P!G8V,R7V-O;7!I;&5D
+M+@!I;G0Z=#$]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T-SL 8VAA<CIT,CUR
+M,CLP.S$R-SL ;&]N9R!I;G0Z=#,]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T
+M-SL =6YS:6=N960@:6YT.G0T/7(Q.S [+3$[ &QO;F<@=6YS:6=N960@:6YT
+M.G0U/7(Q.S [+3$[ &QO;F<@;&]N9R!I;G0Z=#8]<C$[,#$P,# P,# P,# P
+M,# P,# P,# P,# [,#<W-S<W-S<W-S<W-S<W-S<W-S<W-SL ;&]N9R!L;VYG
+M('5N<VEG;F5D(&EN=#IT-SUR,3LP,# P,# P,# P,# P.S Q-S<W-S<W-S<W
+M-S<W-S<W-S<W-S<W.P!S:&]R="!I;G0Z=#@]<C$[+3,R-S8X.S,R-S8W.P!S
+M:&]R="!U;G-I9VYE9"!I;G0Z=#D]<C$[,#LV-34S-3L <VEG;F5D(&-H87(Z
+M=#$P/7(Q.RTQ,C@[,3(W.P!U;G-I9VYE9"!C:&%R.G0Q,3UR,3LP.S(U-3L
+M9FQO870Z=#$R/7(Q.S0[,#L 9&]U8FQE.G0Q,SUR,3LX.S [ &QO;F<@9&]U
+M8FQE.G0Q-#UR,3LX.S [ &-O;7!L97@@:6YT.G0Q-3US.')E86PZ,2PP+#,R
+M.VEM86<Z,2PS,BPS,CL[ &-O;7!L97@@9FQO870Z=#$V/7(Q-CLT.S [ &-O
+M;7!L97@@9&]U8FQE.G0Q-SUR,3<[.#LP.P!C;VUP;&5X(&QO;F<@9&]U8FQE
+M.G0Q.#UR,3@[.#LP.P!V;VED.G0Q.3TQ.0!A<F-H7W1Y<&4Z5#(P/65!4D-(
+M7S,R0DE4.C L05)#2%\V-$))5#HQ+#L <F5G7V-L87-S.E0R,3UE3D]?4D5'
+M4SHP+$=%3D5204Q?4D5'4SHQ+$907U)%1U,Z,BQ!3$Q?4D5'4SHS+$Q)35]2
+M14=?0TQ!4U-%4SHT+#L ;6%C:&EN95]M;V1E.E0R,CUE5D])1&UO9&4Z,"Q1
+M26UO9&4Z,2Q(26UO9&4Z,BQ04TEM;V1E.C,L4TEM;V1E.C0L4$1);6]D93HU
+M+$1);6]D93HV+%1);6]D93HW+$]);6]D93HX+%%&;6]D93HY+$A&;6]D93HQ
+M,"Q4449M;V1E.C$Q+%-&;6]D93HQ,BQ$1FUO9&4Z,3,L6$9M;V1E.C$T+%1&
+M;6]D93HQ-2Q30VUO9&4Z,38L1$-M;V1E.C$W+%A#;6]D93HQ."Q40VUO9&4Z
+M,3DL0U%);6]D93HR,"Q#2$EM;V1E.C(Q+$-326UO9&4Z,C(L0T1);6]D93HR
+M,RQ#5$EM;V1E.C(T+$-/26UO9&4Z,C4L0DQ+;6]D93HR-BQ#0VUO9&4Z,C<L
+M0T-8;6]D93HR."Q#0U].3T]6;6]D93HR.2Q#0UA?3D]/5FUO9&4Z,S L0T-&
+M4&UO9&4Z,S$L0T-&4$5M;V1E.C,R+$U!6%]-04-(24Y%7TU/1$4Z,S,L.P!M
+M;V1E7V-L87-S.E0R,SUE34]$15]204Y$3TTZ,"Q-3T1%7TE.5#HQ+$U/1$5?
+M1DQ/050Z,BQ-3T1%7U!!4E1)04Q?24Y4.C,L34]$15]#0SHT+$U/1$5?0T]-
+M4$Q%6%])3E0Z-2Q-3T1%7T-/35!,15A?1DQ/050Z-BQ-05A?34]$15]#3$%3
+M4SHW+#L <'1R9&EF9E]T.G0Q '-I>F5?=#IT- !W8VAA<E]T.G0S %51271Y
+M<&4Z=#$Q %-)='EP93IT,0!54TET>7!E.G0T $1)='EP93IT-@!51$ET>7!E
+M.G0W %-&='EP93IT,3( 1$9T>7!E.G0Q,P!W;W)D7W1Y<&4Z=#$ 1$ES=')U
+M8W0Z5#(T/7,X:&EG:#HQ+# L,S([;&]W.C$L,S(L,S([.P!$275N:6]N.G0R
+M-3UU.',Z,C0L,"PV-#ML;#HV+# L-C0[.P!F=6YC7W!T<CIT,C8]*C(W/68Q
+M.0!?7V1O7V=L;V)A;%]D=&]R<SI&,3D
+M $ ! @ ! -0 #4 $0
+M 0 ) !0 ( 0#H Z FP #
+M 0 $ #P L " $#5 U0 5@ ! !H $
+M $ !< # @ !"+0 BT ")0 0
+M ? ! ( 0K< *W %0 # $0 0 , *0
+M 0 " $+, "S #D P \ $ # #, !
+M!@ !#!0 P4 '- ! Y 0 8 1-(
+M 32 )@ 0 /P $ & $3X $^
+M , $ $4 ! !@ !$^P !/L "
+M ! !, 0 8 1/T 3] @
+M 0 4P $ " $4 % -+ (
+M %L ! P "%TP !=, ! ! 0
+M !@ !@ , A=0 74 (@ $ 0 ( :0
+M $ ' (7V %]@ $8 $ # &X !
+M P "&/ !CP % ! !T " , AD(
+M 9" \ @ >0 ( &0@
+M 90 $P "D $ $ ($ # !]8 "XP
+M 0 ") 0 B/ $@
+M 0 , E0 $ (H0 $; !
+M )X ! ".@ !^ ! P
+M "D P EF ,8 $ K@
+M , )EX "; ! +T #
+= ";Y &'P 0 !
+
+end
diff --git a/tools/build/os/msdos/fixtimer.c b/tools/build/os/msdos/fixtimer.c
new file mode 100644
index 0000000000..3b71032550
--- /dev/null
+++ b/tools/build/os/msdos/fixtimer.c
@@ -0,0 +1,111 @@
+/*
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <dos.h>
+
+#define IO_RTC 0x70 /* RTC */
+
+#define RTC_SEC 0x00 /* seconds */
+#define RTC_MIN 0x02 /* minutes */
+#define RTC_HRS 0x04 /* hours */
+#define RTC_WDAY 0x06 /* week day */
+#define RTC_DAY 0x07 /* day of month */
+#define RTC_MONTH 0x08 /* month of year */
+#define RTC_YEAR 0x09 /* month of year */
+#define RTC_STATUSA 0x0a /* status register A */
+#define RTCSA_TUP 0x80 /* time update, don't look now */
+
+#define RTC_STATUSB 0x0b /* status register B */
+
+#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
+#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
+
+
+
+/* convert 2 digit BCD number */
+static int bcd( unsigned int i )
+{
+ return ((i/16)*10 + (i%16));
+}
+
+static unsigned int rtcin( unsigned int what )
+{
+ outportb( IO_RTC, what );
+ return inportb( IO_RTC+1 );
+}
+
+
+void fix_date( void )
+{
+ int s;
+ struct date date;
+ struct time time;
+
+ /* initialize brain-dead battery powered clock */
+ outportb( IO_RTC, RTC_STATUSA );
+ outportb( IO_RTC+1, 0x26 );
+ outportb( IO_RTC, RTC_STATUSB );
+ outportb( IO_RTC+1, 2 );
+
+ outportb( IO_RTC, RTC_DIAG );
+ s = inportb( IO_RTC+1 );
+ if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
+
+ /* check for presence of clock */
+ s = rtcin(RTC_STATUSA);
+ if ( s == 0xff || s == 0 ) {
+ printf( "Real-time clock not found\n" );
+ return;
+ }
+
+ /* ready for a read? */
+ while ((s & RTCSA_TUP) == RTCSA_TUP)
+ s = rtcin(RTC_STATUSA);
+
+ date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
+ if ( date.da_year < 1970) date.da_year += 100;
+ date.da_year -= 1980;
+ date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
+ date.da_day = bcd(rtcin(RTC_DAY)); /* day */
+
+ (void)bcd(rtcin(RTC_WDAY)); /* weekday */
+
+ time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
+ time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
+ time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
+ time.ti_hund = 0;
+
+ setdate( & date );
+ settime( & time );
+}
+
+
+
+
+void fix_timer( void )
+{
+#define PIT_PORT 0x40
+#define TIMER_CNTR0 (PIT_PORT + 0) /* timer 0 counter port */
+#define TIMER_MODE (PIT_PORT + 3) /* timer mode port */
+#define TIMER_SEL0 0x00 /* select counter 0 */
+#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
+#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
+
+ /* set timer 0 to generate interrupts every period */
+ outportb( TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT );
+ outportb( TIMER_CNTR0, 0 ); /* counter low */
+ outportb( TIMER_CNTR0, 0 ); /* counter high */
+}
+
+int main(void)
+{
+ /* Make timer count at correct pace */
+ fix_timer();
+
+ /* Fix the date */
+ fix_date();
+
+ return 0;
+}
diff --git a/tools/build/os/msdos/fixtimer.uue b/tools/build/os/msdos/fixtimer.uue
new file mode 100644
index 0000000000..bc4b10fc72
--- /dev/null
+++ b/tools/build/os/msdos/fixtimer.uue
@@ -0,0 +1,162 @@
+#
+# $Id$
+#
+begin 664 fixtimer.exe
+M35IF 0X 0 @ T __^; 8 (@ $ ^R!R:@$
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M "Z3 $NB1;X ;0PS2&++@( BQXL ([:HY( C :0
+M (D>C ")+JP QP:6 /__Z#0!Q#Z* (O'B]BY_W\F@3TX-W49)HM5 H#Z/740
+M@.;?_P:6 (#^674$_P:6 /*NXV%#)C@%==: S8#WV8D.B@"Y 0#3XX/#"(/C
+M^(D>C@",VBOJBSY\ H'_ )S![\ HD^? *!Q^P$<B@#/GH"<B*Q!-/O1SOO
+M<AF#/GP" '0'@SYZ @!U#K\ $#OO=P>+_>L#Z2$!B]\#VHD>I ")'J@ H9
+M*]B.P+1*5\TA7]/G^H[2B^?[,\ NC@;X ;^F!+GL!"O/\ZH._Q:8!.BU NB=
+M [0 S1J)%I@ B0Z: /\6G 3_-H@ _S:& /\VA #H%P)0Z%H"+HX>^ 'H? .
+M_Q::!#/ B_"Y+P"0_ ($@-0 1N+X+3<-D'0*N1D D+HO .B+ (OLM$R*1@+-
+M(;D. )"Z2 #IAP >N US2&)'G0 C 9V +@$-<TAB1YX (P&>@"X!37-(8D>
+M? ",!GX N 8US2&)'H C :" +@ )8S*CMJZ6 '-(1_#'K@ )<46= #-(1\>
+MN 0EQ19X ,TA'QZX!27%%GP S2$?'K@&)<46@ #-(1_#QP:6 R\.T0+L"
+M ,TAP[D> )"Z5@ NCA[X >CI_[@# %#H*?\ %6+[(M&!+$$T^BZ"@#WXHM6
+M!('B#P #PNL 7<-5B^R*1@3F<.1QM #K %W#58OL@^P(5K *YG"P)N9QL OF
+M<+ "YG&P#N9PY'&T (OP"_9T#[BR 5!6N)0!4.B<"8/$!K@* %#HM?]9B_"!
+M_O\ = 0+]G4+N/P!4.A^"5GIJ0#K"K@* %#HE/]9B_"+QB6 #V '3LN D
+M4.B _UE0Z%__605L!XE&^(%^^+('?02#1OAD@6[XO >X" !0Z%W_65#H//]9
+MB$;[N < 4.A-_UE0Z"S_68A&^K@& %#H/?]94.@<_UFX! !0Z##_65#H#_]9
+MB$;]N ( 4.@@_UE0Z/_^68A&_#/ 4.@1_UE0Z/#^68A&_\9&_@"-1OA0Z'H1
+M68U&_%#HA1%97HOE7<.P-.9#L #F0+ YD##Z/#_Z.S^,\#K ,-5B^Q6BW8$
+M"_9\%(/^6'8#OE< B388 HJ$&@*8ENL-]]Z#_B-WZL<&& +__XO&HY0 N/__
+MZP!>7<(" ,-5B^SK"HL>?@+1X_^7I@2A?@+_#GX""\!UZ_\6= +_%G8"_Q9X
+M O]V!.AZ_5E=PP "Z/!JH#+HP>K /\C@:0 +Z #+D)JQ C,6'UI.+
+M-HH @\8"N0$ @#Z2 -R$8X&C "+_K%_,L#RKN-V@/%_@^P"N $ \,#P27^
+M_XO\*_AR8(OGC,".V(S0CL!12?.D,L"JCMV'\H?9B\.+T$/H&0!W!W) Z!(
+M=_D\('0(/ UT!#P)=>@RP.OD"\!T!T*J"L!U 4.&X#+ ^>,5K$DL(G0/!"(\
+M7'4'@#PB=0*L20OVP^E^_5D#RBZ.'JP#B1Z$ $,#VXOTB^PKZW+FB^6)+H8
+MXPZ)=@"#Q0(VK K X/IT\#/ B48 +O\FJ@.+#HH 4>A' 5F+^ O ="0>'@>.
+M'HP ,_;\\Z0?B_@&_S:. .@I 8/$ HO8!Z.( O =0/I$?TSP+G__XD_@\,"
+M\JXF. 5U](D'PU6+[(,^?@(@=06X 0#K%8M&!(L>?@+1XXF'I@3_!GX",\#K
+M %W#58OL5E>+?@2+10:CZ 0[QW4(QP;H! ZQ"+=02+'N@$B7<$H>@$B40&
+M7UY=PU6+[%97BWX$BT8&*06+-0/WBT8&0(D$B7P"H>8$.\=U!HDVY@3K"(O^
+M WX&B74"B\8%! #K %]>7<-5B^Q6BT8$,](E__^!X@ 4E#H] !968OP@_[_
+M=00SP.L8H>8$B40"BT8$0(D$B3;F!*'F! 4$ .L 7EW#58OL5HM&!#/2)?__
+M@>( %)0Z+< 65F+\(/^_W4$,\#K%8DVZ@2)-N8$BT8$0(D$B\8%! #K %Y=
+MPU6+[%97BWX$"_]U!#/ ZUJ+QP4+ "7X_XOX@S[J! !U!U?HH?]9ZT*+-N@$
+MB\8+P'0QBP2+UX/"*#O"<@E75N@-_UE9ZR2+!#O'<@Y6Z-'^6?\$B\8%! #K
+M$(MT!CLVZ 1USU?H(O]9ZP!?7EW#58OLBT8$B]2!Z@ !.\)S!Z.> #/ ZPO'
+M!I0 " "X___K %W#58OLBT8$BU8& P:> (/2 (O(@<$ 8/2 O2=0H[S',&
+MAP:> .L+QP:4 @ N/__ZP!=PU6+[/]V!.B?_UGK %W#58OLBT8$F5)0Z++_
+MB^7K %W#58OL@^P"5E>+7@2+-XO&B4;^BUX$]T<"0 !T!(O&ZQ^+7@2+?PKK
+M"XO?1X _"G4#_T;^B\9."\!U[HM&_NL 7UZ+Y5W" @!5B^Q6BW8$5NA3!%D+
+MP'0%N/__ZTR#?@H!=1"#/ !^"U;HE?^9*48&&58(@60"7_['! BT0(B40*
+M_W8*_W8(_W8&BD0$F%#HW *#Q B#^O]U"CW__W4%N/__ZP(SP.L 7EW#58OL
+M@^P$5HMV!%;H[ -9"\!T"+K__[C__^L_N $ 4#/ 4%"*1 284.B8 H/$"(E6
+M_HE&_(,\ 'X9BU;^BT;\4E!6Z!#_F8O8B\I86BO#&]'K!HM6_HM&_.L 7HOE
+M7<-5B^RX $2+7@3-(;@ '($T>+1T.L 7<-5B^Q65XM^"HMV!(M$#CO&=0R#
+M?@@"?P:!__]_=@:X___IJ@"#/NH# '4/N) ".\9U",<&Z@,! .L4@S[H P!U
+M#;B CO&=0;'!N@# 0"#/ !T#[@! % SP%!05NC&_H/$"/=$ @0 = ?_= CH
+M"PQ9@60"\__'1 8 (O&!04 B40(B40*@WX( G0_"_]V.\<&= +$"(-^!@!U
+M&%?H6?U9B48&"\!T!X%, @0 ZP6X___K&XM&!HE$"HE$"(E\!H-^" %U!8%,
+M @@ ,\#K %]>7<-65[\$ +Z NL0]T0" P!T!5;HG )93X/&$ O_=>Q?7L-5
+MB^R![(H 5E>+1@A /0( <P4SP.GV (M>!-'C]X? P" =!+_=@C_=@;_=@3H
+MXP"#Q ;IUP"+7@31XX&GP /__8M&!HF&?/^+1@B)AGC_C;9^_^MM_XYX_XN>
+M?/__AGS_B@>(AGO_/ IU!,8$#4:*AGO_B 1&C89^_XO6*]"!^H ?#Z-AG[_
+MB_XK^%>-AG[_4/]V!.A[ (/$!HF&=O\[QW0;@[YV_P!S!;C__^L-BT8(*X9X
+M_P.&=O\KQ^M/C;9^_X.^>/\ = /IB?^-AG[_B_XK^(O'"\!V+E>-AG[_4/]V
+M!.@M (/$!HF&=O\[QW07@[YV_P!S!;C__^L)BT8( X9V_RO'ZP6+1@CK %]>
+MB^5=PU6+[(M>!-'C]X? P (=!"X @!0,\!04/]V!.@H (OEM$"+7@2+3@B+
+M5@;-(7(/4(M>!-'C@8_ P 06.L&4.@%^>L 7<-5B^R+7@31XX&GP /__;1"
+MBD8*BUX$BTX(BU8&S2%R NL'4.C;^)GK %W#58OL@^PB5E<&BWX*'@>+7@B#
+M^R1W6(#[ G)3BT8,BTX."\E]$8!^!@!T"\8%+4?WV??8@]D C7;>XP^1*]+W
+M\Y'W\X@41N,)Z_$KTO?SB!1&"\!U]8U.WO?9 \[\3HH$+ IS! 0ZZP,"1@2J
+MXN^P *H'BT8*ZP!?7HOE7<(, %6+[(-^" IU!HM&!)GK!8M&!#/24E#_=@;_
+M=@BP 5"P85#H7/_K %W#58OL_W8&_W8$_W8(_W8*L !0L&%0Z$#_ZP!=PU6+
+M[/]V!O]V!/]V"/]V"H-^"@IU!;@! .L",\!0L&%0Z!G_ZP!=P[KL ^L#NO$#
+MN04 D+1 NP( S2&Y)P"0NO8#M$#-(>EM]E6+[%97BW8$BT0..\9T!;C__^MF
+M@SP ?"WW1 (( '4,BT0*B]:#P@4[PG46QP0 (M$"HO6@\(%.\)U!HM$"(E$
+M"C/ ZS2+? 8#/$<I/%>+1 B)1 I0BD0$F%#H$OV#Q 8[QW01]T0" )U"H%,
+M A N/__ZP0SP.L 7UY=PU6+[+AK#5"XD )0_W8$C48&4.A, NL 7<-5B^R+
+M7@;_#_]V!HI&!)A0Z 8 B^7K %W#58OL@^P"5HMV!HI&!(A&__\$?3:*1O__
+M1 J+7 J(1__W1 (( '0;@'[_"G0&@'[_#74/5N@9_UD+P'0&N/__Z>D BD;_
+MM #IX0#_#/=$ I =0?W1 (" '4+@4P"$ "X___IQ@"!3 ( 8-\!@!T)H,\
+M '015NC7_ED+P'0&N/__Z:< ZPJX__^+5 8KPHD$Z7W_Z94 @S[J P!U.;B0
+M CO&=3**1 284.@)^UD+P'4%@60"__VX )0]T0" )T!;@" .L",\!0,\!0
+M5NC]^H/$".F/_X!^_PIU'_=$ D =1BX 0!0N!X$4(I$!)A0Z.#\@\0&/0$
+M=1BX 0!0C48$4(I$!)A0Z,C\@\0&/0$ =!'W1 ( G4*@4P"$ "X___K!XI&
+M_[0 ZP!>B^5=PU6+[%:+=@2XD )05NC!_EE9ZP!>7<-5B^R#[ )65XMV!(M^
+M!D?W1 (( '0CZP+K $^+QPO =!56BUX(_T8(B@>84.B+_EE9/?__=>+I=0#W
+M1 ) '0W@WP& '0QBT0&.\=S*H,\ '0-5NBT_5D+P'0$,\#K4T]7_W8(BD0$
+MF%#H(?R#Q :)1OXK?O[K-^L"ZP!/B\<+P'0L_P1]%8M>"/]&"(H'_T0*BUP*
+MB$?_M #K#E:+7@C_1@C_-^CZ_5E9/?__=<N+Q^L 7UZ+Y5W"!@#_)IX$58OL
+MBU8$N00/NR<$_(K&TNC7JHK&(L77JHK"TNC7JHK"(L77JNL 7<(" %6+[('L
+ME@!65\=&J@ QD:M4.LX5[G__S+ \J[WT4E?PX@%1_Y.K7XB4U%2!HU&KBOX
+MC4:N4%?_=@C_5@K&1JU0 7ZJC7ZN!UI96\,&_(U^KHF^;/^+OFS_BW8&K K
+M=!$\)700B 5'_DZM?^_HN?_KZNEU!(FV>/^L/"5TYXF^;/\SR8F.=O^)CFK_
+MB(YU_\>&</___\>&<O___^L!K#+DB]"+V(#K((#[8'-'BI\W!(O#/1< =@/I
+M'02+V-'C+O^G& ]C#TL/I ]7#\D/TP\5$!\0+Q"*#V00/Q!#$$<0Z1";$3P1
+M7!'_$BP3+!,L$W8/@ _IX0. _0!W^(..:O\!ZYN _0!W[(..:O\"ZX^ _0!W
+MX("^=?\K= 2(EG7_Z7S_@Z9J_]^U!>ER_X..:O\@M07I:/^ _0!W1/>&:O\"
+M '4A@XYJ_PBU >E1_^F( XM^!(L%@T8$ H#] G,)B89P_[4#Z3?_@/T$=>&)
+MAG+__L7I*?^ _01ST[4$Z1__DBPPF(#] G<;M0*'AG#_"\!\TM'@B]#1X-'@
+M \(!AG#_Z?O^@/T$=:6'AG+_"\!\M-'@B]#1X-'@ \(!AG+_Z=W^@XYJ_Q"U
+M!>G3_H&.:O\ 8.F:O_OM07IP_Z#IFK_[X&.:O^ +4%Z;/^MPCK"K<*ZPNW
+M$+/I MK&AG7_ ,:&;_\ B)9N_XM^!(L%,]+K$;<*QH9O_P&(EF[_BWX$BP69
+M1T>)=@;WAFK_$ !T!(L51T>)?@2-OGO_"\!U,PO2=2^#OG+_ '4MB[YL_XN.
+M</_C&X/Y_W06BX9J_R4( '0$LC#K K(@BL+HMOWB^>GI_8..:O\$4E!7BL>8
+M4(J&;_]04^B0^18'BY9R_PO2?P/I% 'I(0&(EF[_B78&C;YZ_XM>!/\W0T.)
+M7@3WAFK_( !T#_\W0T.)7@06!^@7_; ZJA8'Z _]Q@4 QH9O_P"#IFK_^XV.
+M>O\K^8?/BY9R_SO1?P*+T>F^ (EV!HB6;O^+?@2+!8-&! (6!XV^>_\RY(D%
+MN0$ Z=@ B78&B)9N_XM^!/>&:O\@ '4,BSV#1@0"'@<+_^L*Q#V#1@0$C, +
+MQW4%'@>_( 3HVOP[CG+_=@2+CG+_Z9D B78&B)9N_XM^!(N.<O\+R7T#N08
+M5U&-GGO_4U*X 0 CAFK_4(N&:O^I@ !T"K@" ,=&_@0 ZQ>I %T"K@( ,=&
+M_@H ZPC'1OX( +@& %#H-_R+1OX!1@06!XV^>__WAFK_" !T$XN6</\+TGX+
+MZ%O\*]%^!(F6=O^*AG7_"L!T%": /2UT#H.N=O\!@Y9V_P!/)H@%Z#3\B_>+
+MOFS_BYYP_[@% ".&:O\]!0!U%HJF;O^ _&]U$(.^=O\ ?P;'AG;_ 0#K'Y"
+M_'AT!8#\6'44@XYJ_T!+2X.N=O\"?0;'AG;_ #CG;_]X9J_P( =0SK!K @
+MZ.'[2SO9?_;WAFK_0 !T#+ PZ,_[BH9N_^C(^XN6=O\+TGXG*\HKVB:*!#PM
+M= @\('0$/"MU!R:LZ*C[24N'RN,'L##HG?OB^8?*XQ$KV2:LB 5'_DZM?P/H
+MD/OB\0O;?@F+R[ @Z'O[XOGIKON)=@:+?@3WAFK_( !U"HL]@T8$ AX'ZP;$
+M/8-&! 2X4 J1JT#1JHFB07I??N+MGC_B[YL_[ EZ#S[K K =?B ?JU0?0/H
+M-OL'BT:JZP!?7HOE7<(( %6+[%97BW8$@S[H! !T'(L>Z 2+?P:+'N@$B7<&
+MB74$B7P&H>@$B40$ZPJ)-N@$B70$B70&7UY=PU6+[(/L E97BW8&BWX$BP0!
+M!:'F!#O&=0:)/N8$ZPV+! /&B4;^BU[^B7\"5NA-\5E?7HOE7<-6H>H$.P;F
+M!'42_S;J!.C:\EDSP*/F!*/J!.L[BQ[F!(MW O<$ 0!U(E;H&?%9.S;J!'4*
+M,\"CY@2CZ@3K!HM$ J/F!%;HH_)9ZPS_-N8$Z)GR68DVY@1>PU6+[(/L E97
+MBW8$_PR+! /&B4;^BWP"]P4! '44.S;J!'0.BP0!!8M>_HE_ HOWZP56Z +_
+M68M>_O<' 0!U"?]V_E;H*O]965]>B^5=PU6+[%:+=@0+]G4"ZQ>+Q@7\_XOP
+M.S;F!'4%Z#S_ZP56Z(__65Y=PU6+[%:T*XMV!(L,BU0"S2%>7<-5B^Q6M"V+
+M=@2+#(M4 LTA7EW# !4=7)B;RU#("T@0V]P>7)I9VAT("AC
+M*2 Q.3@X($)O<FQA;F0@26YT;"X 3G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-
+M"D1I=FED92!E<G)O<@T*06)N;W)M86P@<')O9W)A;2!T97)M:6YA=&EO;@T*
+M .P$[ 3L
+M!
+M
+M
+M
+M
+M 4E1#($))3U,@9&EA9VYO<W1I8R!E<G)O<B E
+M8@H $ AC;&]C:U]B871T97)Y!U)/35]C:W-U;09C;VYF:6=?=6YI= 5M96UO
+M<GE?<VEZ901F:7AE9%]D:7-K VEN=F%L:61?=&EM90!296%L+71I;64@8VQO
+M8VL@;F]T(&9O=6YD"@ $P("! 4&" @(%!4%$_\6!1$"____________
+M_____P4%_____________________P__(P+_#_____\3__\" @4/ O___Q/_
+M_________R/_____(_\3_P!Z WH#>@, 0 D" ( "
+M * @$ "0 @ @(" H ( $," P
+M + " !" @0 # @ #_ T ( _P
+M . " /\ #P @ #_ , _P
+M ! # /\ @ P #_ , ,
+M_P $ # /\ !0 P #_ 8 ,
+M _P ' # /\ " P #_
+MD , _P * # /\ "P P$@ B "( 2@ J#_
+M______________________________________\ <')I;G0@<V-A;F8@
+M.B!F;&]A=&EN9R!P;VEN="!F;W)M871S(&YO="!L:6YK960-"@ - "AN=6QL
+M*0 P,3(S-#4V-S@Y04)#1$5& !04 105%!04% ( % ,$% D%!04%!04%!044
+M%!04%!04%!04% \7#P@4%!0'%!84%!04%!04%!0-%!04%!04%!04%! *#P\/
+G" H4% 84$@L.%!01% P4% T4%!04%!04 -(!T@'9 50+60M9"UD+
+
+end
diff --git a/tools/build/os/msdos/ifc.c b/tools/build/os/msdos/ifc.c
new file mode 100644
index 0000000000..091e2dd0ef
--- /dev/null
+++ b/tools/build/os/msdos/ifc.c
@@ -0,0 +1,331 @@
+/*
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <process.h>
+
+#include <io.h>
+
+void * xmalloc( int size )
+{
+ void * p = (void *)malloc( size );
+ if ( !p ) {
+ fprintf( stderr, "out of memory\n" );
+ exit( 1 );
+ }
+ return p;
+}
+void * xrealloc( void * old, int size )
+{
+ void * p = (void *)realloc( old, size );
+ if ( !p ) {
+ fprintf( stderr, "out of memory\n" );
+ exit( 1 );
+ }
+ return p;
+}
+
+char ** argv_fix( int * argc, char ** argv )
+{
+ char ** new = NULL;
+ int max = 20;
+ int cnt = 0;
+ int j;
+
+ for ( j = 1; argv[j]; ++j )
+ if ( argv[j][0] == '@' && access(argv[j]+1,0)==0 )
+ break;
+ if ( argv[j] == NULL )
+ return argv;
+
+ new = (char **)xmalloc( max * sizeof *new );
+ new[cnt++] = *argv++;
+ for ( ; *argv; ++argv ) {
+ if ( cnt >= max )
+ new = (char **)realloc( new, (max*=2) * sizeof *new );
+
+ if ( argv[0][0] != '@' || access(argv[0]+1,0) ) {
+ new[cnt++] = *argv;
+ } else {
+ char line[ 1000 ];
+ FILE * f = fopen( argv[0]+1, "r" );
+ if ( !f ) {
+ perror( argv[0]+1 );
+ exit( 2 );
+ }
+ while ( fgets( line, sizeof line, f ) ) {
+ int len = strlen( line );
+ /* delete trailing newlines */
+ while ( line[len-1] == '\n' || line[len-1] == '\r' )
+ line[--len] = '\0';
+ if ( cnt >= max )
+ new = (char **)xrealloc( new, (max*=2) * sizeof *new );
+ new[cnt] = (char *)xmalloc( len+1 );
+ strcpy( new[cnt], line );
+ ++cnt;
+ }
+ fclose( f );
+ }
+ }
+ if ( cnt >= max )
+ new = (char **)xrealloc( new, (max+1) * sizeof *new );
+ new[cnt] = NULL;
+ *argc = cnt;
+ return new;
+}
+
+
+const char * USAGE =
+"usage: $progname [ -cNvmV ] file [ file ... ] dest-directory-or-file\n"
+" -v -- verbose\n"
+" -V suffix -- suffix to append to targets (before any . suffix)\n"
+" eg: -V _g would change 'foo' to 'foo_g' and\n"
+" 'libfoo.a' to 'libfoo_g.a'\n"
+" -m mode -- mode for new file(s)\n"
+" -c -- copy instead of move (always on)\n"
+" -N -- copy only if source is newer than target\n"
+;
+
+void fatal( char * msg )
+{
+ if ( msg )
+ fprintf( stderr, "%s\n", msg );
+ fprintf( stderr, "%s", USAGE );
+ exit( 1 );
+}
+
+char * basename( char * f )
+{
+ char * b = strrchr( f, '/' );
+ if ( b ) ++b;
+ else b = f;
+ return b;
+}
+
+#include <sys/stat.h>
+int is_dir( char * path )
+{
+ struct stat buf;
+ if ( stat( path, &buf ) )
+ return 0;
+ return buf.st_mode & S_IFDIR;
+}
+int is_file( char * path )
+{
+ struct stat buf;
+ if ( stat( path, &buf ) )
+ return 0;
+ return buf.st_mode & S_IFREG;
+}
+int newer( char * p1, char * p2 )
+{
+ struct stat buf1;
+ struct stat buf2;
+ if ( stat( p1, &buf1 ) )
+ return 0;
+ if ( stat( p2, &buf2 ) )
+ return 0;
+ return buf1.st_mtime > buf2.st_mtime;
+}
+
+int filecopy( char * d, char * s, int preserve_time )
+{
+#if 0
+ int status;
+ char * argv[ 5 ];
+ argv[0] = "cp";
+ argv[1] = "-p";
+ argv[2] = s;
+ argv[3] = d;
+ argv[4] = NULL;
+ status = spawnvp( P_WAIT, argv[0], argv );
+ if ( status )
+ perror( "cp" );
+ return status;
+#else
+ FILE * fs;
+ FILE * fd;
+ char buffer[ 8192 ];
+ int n;
+ struct ftime When;
+ struct stat Stat;
+
+ fs = fopen( s, "rb" );
+ if ( fs == NULL ) {
+ perror( s );
+ return 1;
+ }
+ fd = fopen( d, "wb" );
+ if ( fd == NULL ) {
+ perror( d );
+ fclose( fs );
+ return 2;
+ }
+
+ if ( preserve_time )
+ if ( getftime( fileno(fs), &When ) ) {
+ perror( s );
+ preserve_time = 0;
+ }
+
+ do {
+ n = fread( buffer, 1, sizeof buffer, fs );
+ if ( n > 0 )
+ if ( fwrite( buffer, 1, n, fd ) < 0 ) {
+ perror( d );
+ return 3;
+ }
+ } while ( n > 0 );
+
+ fclose( fs );
+
+ /* Fix time stamp */
+ if ( preserve_time )
+ if ( setftime( fileno(fd), &When ) ) {
+ perror( s );
+ preserve_time = 0;
+ }
+ fclose( fd );
+
+ /* Fix access rights */
+ if ( stat( s, &Stat ) )
+ perror( s );
+ else if ( chmod( d, Stat.st_mode ) )
+ perror( d );
+
+ return 0;
+#endif
+}
+
+
+
+
+
+int main( int argc, char * argv[] )
+{
+ char * progname;
+ int verbose = 0;
+ int only_if_newer= 0;
+ char * suffix = NULL;
+ char * mode = NULL;
+ char * dest;
+ char ** pp;
+
+ argv = argv_fix( &argc, argv );
+
+ progname = basename( *argv++ );
+
+ /* process the options */
+ while ( argv[0] && argv[0][0] == '-' ) {
+ switch ( argv[0][1] ) {
+ case 'N':
+ ++argv;
+ only_if_newer = 1;
+ break;
+ case 'c':
+ ++argv;
+ /* We always copy, regardless */
+ break;
+ case 'v':
+ ++argv;
+ verbose = 1;
+ break;
+ case 'V':
+ ++argv;
+ suffix = *argv;
+ ++argv;
+ break;
+ case 'm':
+ ++argv;
+ mode = *argv;
+ ++argv;
+ break;
+ default:
+ fatal( NULL );
+ }
+ }
+
+ /* Separate source file(s) from dest directory or file */
+#if 0
+ if ( !argv[0] || !argv[1] )
+ fatal( "missing files or invalid destination" );
+#else
+ /* We used to require at least one file; not any more */
+ if ( !argv[0] )
+ fatal( "missing files or invalid destination" );
+ if ( !argv[1] )
+ return 0;
+#endif
+ for ( pp = argv; *pp; ++pp )
+ continue;
+ --pp;
+ dest = *pp;
+ *pp = NULL;
+
+ /* Process the arguments */
+ for (; *argv; ++argv ) {
+ char * f = *argv;
+ char * leaf = basename( f );
+ char target[ 128 ];
+
+ strcpy( target, dest );
+
+ if ( is_dir( target ) ) {
+ strcat( target, "/" );
+ /* if we were given a suffix, then add it as appropriate */
+ if ( suffix ) {
+ char * dot = strchr( leaf, '.' );
+ if ( dot ) {
+ strncat( target, leaf, dot-leaf );
+ strcat( target, suffix );
+ strcat( target, dot );
+ if ( verbose )
+ printf( "%s: %s will be installed as %s",
+ progname, f, strrchr(target,'/')+1 );
+ } else {
+ strcat( target, leaf );
+ strcat( target, suffix );
+ }
+ } else {
+ strcat( target, leaf );
+ }
+ }
+
+ if ( access( f, 0 ) ) {
+ char buf[200];
+ sprintf( buf, "cannot read %s", f );
+ fatal( buf );
+ }
+
+ if ( only_if_newer && is_file( target ) && !newer( f, target ) ) {
+ if ( verbose )
+ printf( "'%s' not newer than '%s'\n", f, target );
+ continue;
+ }
+
+ if ( verbose )
+ printf( "rm -f %s\n", target );
+ if ( chmod( target, 0777 ) )
+ if ( verbose )
+ perror( target );
+ if ( unlink( target ) )
+ if ( verbose )
+ perror( target );
+ if ( verbose )
+ printf( "cp -p %s %s\n", f, target );
+ if ( filecopy( target, f, 1 ) )
+ return 1;
+ if ( mode ) {
+ char buf[ 255 ];
+ sprintf( buf, "chmod %s %s\n", mode, target );
+ if ( verbose )
+ printf( "%s\n", buf );
+ system( buf );
+ }
+ }
+
+ return 0;
+}
+
diff --git a/tools/build/os/msdos/ifc_exe.uue b/tools/build/os/msdos/ifc_exe.uue
new file mode 100644
index 0000000000..cd9f52b8f0
--- /dev/null
+++ b/tools/build/os/msdos/ifc_exe.uue
@@ -0,0 +1,163 @@
+#
+# $Id$
+#
+
+begin 664 ifc.exe
+M(VEN8VQU9&4@/'-T9&EO+F@^#0HC:6YC;'5D92 \<W1R:6YG+F@^#0HC:6YC
+M;'5D92 \<')O8V5S<RYH/@T*#0HC:6YC;'5D92 \:6\N:#X-"@T*=F]I9" J
+M('AM86QL;V,H(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
+M("HI;6%L;&]C*"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)9G!R:6YT
+M9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H(#$@*3L-
+M"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0IV;VED("H@>')E86QL;V,H('9O
+M:60@*B!O;&0L(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
+M("HI<F5A;&QO8R@@;VQD+"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)
+M9G!R:6YT9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H
+M(#$@*3L-"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0H-"F-H87(@*BH@87)G
+M=E]F:7@H(&EN=" J(&%R9V,L(&-H87(@*BH@87)G=B I#0I[#0H@(" @8VAA
+M<B J*B!N97<@/2!.54Q,.PT*(" @(&EN=" @(" @;6%X(#T@,C [#0H@(" @
+M:6YT"2 @("!C;G0@/2 P.PT*(" @(&EN= D@(" @:CL-"@T*(" @(&9O<B H
+M(&H@/2 Q.R!A<F=V6VI=.R K*VH@*0T*"6EF("@@87)G=EMJ75LP72 ]/2 G
+M0"<@)B8@86-C97-S*&%R9W9;:ETK,2PP*3T]," I#0H)(" @(&)R96%K.PT*
+M(" @(&EF("@@87)G=EMJ72 ]/2!.54Q,("D-"@ER971U<FX@87)G=CL-"@T*
+M(" @(&YE=R ]("AC:&%R("HJ*7AM86QL;V,H(&UA>" J('-I>F5O9B J;F5W
+M("D[#0H@(" @;F5W6V-N="LK72 ]("IA<F=V*RL[#0H@(" @9F]R("@@.R J
+M87)G=CL@*RMA<F=V("D@('L-"@EI9B H(&-N=" ^/2!M87@@*0T*"2 @("!N
+M97<@/2 H8VAA<B J*BER96%L;&]C*"!N97<L("AM87@J/3(I("H@<VEZ96]F
+M("IN97<@*3L-"@D@(" @#0H):68@*"!A<F=V6S!=6S!=("$]("= )R!\?"!A
+M8V-E<W,H87)G=ELP72LQ+# I("D@('L-"@D@(" @;F5W6V-N="LK72 ]("IA
+M<F=V.PT*"7T@96QS92![#0H)(" @(&-H87(@;&EN95L@,3 P,"!=.PT*"2 @
+M("!&24Q%("H@9B ](&9O<&5N*"!A<F=V6S!=*S$L(")R(B I.PT*"2 @("!I
+M9B H("%F("D@('L-"@D)<&5R<F]R*"!A<F=V6S!=*S$@*3L-"@D)97AI="@@
+M,B I.PT*"2 @("!]#0H)(" @('=H:6QE("@@9F=E=',H(&QI;F4L('-I>F5O
+M9B!L:6YE+"!F("D@*2 @>PT*"0EI;G0@;&5N(#T@<W1R;&5N*"!L:6YE("D[
+M#0H)"2\J(&1E;&5T92!T<F%I;&EN9R!N97=L:6YE<R J+PT*"0EW:&EL92 H
+M(&QI;F5;;&5N+3%=(#T]("=<;B<@?'P@;&EN95ML96XM,5T@/3T@)UQR)R I
+M#0H)"2 @("!L:6YE6RTM;&5N72 ]("=<,"<[#0H)"6EF("@@8VYT(#X](&UA
+M>" I#0H)"2 @("!N97<@/2 H8VAA<B J*BEX<F5A;&QO8R@@;F5W+" H;6%X
+M*CTR*2 J('-I>F5O9B J;F5W("D[#0H)"6YE=UMC;G1=(#T@*&-H87(@*BEX
+M;6%L;&]C*"!L96XK,2 I.PT*"0ES=')C<'DH(&YE=UMC;G1=+"!L:6YE("D[
+M#0H)"2LK8VYT.PT*"2 @("!]#0H)(" @(&9C;&]S92@@9B I.PT*"7T)#0H@
+M(" @?0T*(" @(&EF("@@8VYT(#X](&UA>" I#0H);F5W(#T@*&-H87(@*BHI
+M>')E86QL;V,H(&YE=RP@*&UA>"LQ*2 J('-I>F5O9B J;F5W("D[#0H@(" @
+M;F5W6V-N=%T@/2!.54Q,.PT*(" @("IA<F=C(#T@8VYT.PT*(" @(')E='5R
+M;B!N97<[#0I]#0H-"@T*8V]N<W0@8VAA<B J(%5304=%(#T@#0HB=7-A9V4Z
+M("1P<F]G;F%M92!;("UC3G9M5B!=(&9I;&4@6R!F:6QE("XN+B!=(&1E<W0M
+M9&ER96-T;W)Y+6]R+69I;&5<;B(-"B(@(" @(" @("UV(" @(" @(" @("TM
+M('9E<F)O<V5<;B(-"B(@(" @(" @("U6('-U9F9I>" @("TM('-U9F9I>"!T
+M;R!A<'!E;F0@=&\@=&%R9V5T<R H8F5F;W)E(&%N>2 N('-U9F9I>"E<;B(-
+M"B(@(" @(" @(" @(" @(" @(" @(" @("!E9SH@+58@7V<@=V]U;&0@8VAA
+M;F=E("=F;V\G('1O("=F;V]?9R<@86YD7&XB#0HB(" @(" @(" @(" @(" @
+M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" G;&EB9F]O+F$G('1O
+M("=L:6)F;V]?9RYA)UQN(@T*(B @(" @(" @+6T@;6]D92 @(" @+2T@;6]D
+M92!F;W(@;F5W(&9I;&4H<RE<;B(-"B(@(" @(" @("UC(" @(" @(" @("TM
+M(&-O<'D@:6YS=&5A9"!O9B!M;W9E("AA;'=A>7,@;VXI7&XB#0HB(" @(" @
+M(" M3B @(" @(" @(" M+2!C;W!Y(&]N;'D@:68@<V]U<F-E(&ES(&YE=V5R
+M('1H86X@=&%R9V5T7&XB#0H[#0H-"G9O:60@9F%T86PH(&-H87(@*B!M<V<@
+M*0T*>PT*(" @(&EF("@@;7-G("D-"@EF<')I;G1F*"!S=&1E<G(L("(E<UQN
+M(BP@;7-G("D[#0H@(" @9G!R:6YT9B@@<W1D97)R+" B)7,B+"!54T%'12 I
+M.PT*(" @(&5X:70H(#$@*3L-"GT-"@T*8VAA<B J(&)A<V5N86UE*"!C:&%R
+M("H@9B I#0I[#0H@(" @8VAA<B J(&(@/2!S=')R8VAR*"!F+" G+R<@*3L-
+M"B @("!I9B H(&(@*0DK*V([#0H@(" @96QS90EB(#T@9CL-"B @("!R971U
+M<FX@8CL-"GT-"@T*(VEN8VQU9&4@/'-Y<R]S=&%T+F@^#0II;G0@:7-?9&ER
+M*"!C:&%R("H@<&%T:" I#0I[#0H@(" @<W1R=6-T('-T870@8G5F.PT*(" @
+M(&EF("@@<W1A="@@<&%T:"P@)F)U9B I("D-"@ER971U<FX@,#L-"B @("!R
+M971U<FX@8G5F+G-T7VUO9&4@)B!37TE&1$E2.PT*?0T*:6YT(&ES7V9I;&4H
+M(&-H87(@*B!P871H("D-"GL-"B @("!S=')U8W0@<W1A="!B=68[#0H@(" @
+M:68@*"!S=&%T*"!P871H+" F8G5F("D@*0T*"7)E='5R;B P.PT*(" @(')E
+M='5R;B!B=68N<W1?;6]D92 F(%-?249214<[#0I]#0II;G0@;F5W97(H(&-H
+M87(@*B!P,2P@8VAA<B J(' R("D-"GL-"B @("!S=')U8W0@<W1A="!B=68Q
+M.PT*(" @('-T<G5C="!S=&%T(&)U9C([#0H@(" @:68@*"!S=&%T*"!P,2P@
+M)F)U9C$@*2 I#0H)<F5T=7)N(# [#0H@(" @:68@*"!S=&%T*"!P,BP@)F)U
+M9C(@*2 I#0H)<F5T=7)N(# [#0H@(" @<F5T=7)N(&)U9C$N<W1?;71I;64@
+M/B!B=68R+G-T7VUT:6UE.PT*?0T*#0II;G0@9FEL96-O<'DH(&-H87(@*B!D
+M+"!C:&%R("H@<RP@:6YT('!R97-E<G9E7W1I;64@*0T*>PT*(VEF(# -"B @
+M("!I;G0)"7-T871U<SL-"B @("!C:&%R(" @(" @*B!A<F=V6R U(%T[#0H@
+M(" @87)G=ELP72 ](")C<"([#0H@(" @87)G=ELQ72 ]("(M<"([#0H@(" @
+M87)G=ELR72 ](',[#0H@(" @87)G=ELS72 ](&0[#0H@(" @87)G=ELT72 ]
+M($Y53$P[#0H@(" @<W1A='5S(#T@<W!A=VYV<"@@4%]704E4+"!A<F=V6S!=
+M+"!A<F=V("D[#0H@(" @:68@*"!S=&%T=7,@*0T*"7!E<G)O<B@@(F-P(B I
+M.PT*(" @(')E='5R;B!S=&%T=7,[#0HC96QS90T*(" @($9)3$4@(" @(" J
+M(&9S.PT*(" @($9)3$4@(" @(" J(&9D.PT*(" @(&-H87()8G5F9F5R6R X
+M,3DR(%T[#0H@(" @:6YT"0EN.PT*(" @('-T<G5C="!F=&EM90E7:&5N.PT*
+M(" @('-T<G5C="!S=&%T"0E3=&%T.PT*#0H@(" @9G,@/2!F;W!E;B@@<RP@
+M(G)B(B I.PT*(" @(&EF("@@9G,@/3T@3E5,3" I("![#0H)<&5R<F]R*"!S
+M("D[#0H)<F5T=7)N(#$[#0H@(" @?0T*(" @(&9D(#T@9F]P96XH(&0L(")W
+M8B(@*3L-"B @("!I9B H(&9D(#T]($Y53$P@*2 @>PT*"7!E<G)O<B@@9" I
+M.PT*"69C;&]S92@@9G,@*3L-"@ER971U<FX@,CL-"B @("!]#0H-"B @("!I
+M9B H('!R97-E<G9E7W1I;64@*0T*"6EF("@@9V5T9G1I;64H(&9I;&5N;RAF
+M<RDL("97:&5N("D@*2 @>PT*"2 @("!P97)R;W(H(',@*3L-"@D@(" @<')E
+M<V5R=F5?=&EM92 ](# [#0H)?0T*#0H@(" @9&\@>PT*"6X@/2!F<F5A9"@@
+M8G5F9F5R+" Q+"!S:7IE;V8@8G5F9F5R+"!F<R I.PT*"6EF("@@;B ^(# @
+M*0T*"2 @("!I9B H(&9W<FET92@@8G5F9F5R+" Q+"!N+"!F9" I(#P@," I
+M("![#0H)"7!E<G)O<B@@9" I.PT*"0ER971U<FX@,SL-"@D@(" @?0T*(" @
+M('T@=VAI;&4@*"!N(#X@," I.R @(" -"@T*(" @(&9C;&]S92@@9G,@*3L-
+M"@T*(" @("\J($9I>"!T:6UE('-T86UP("HO#0H@(" @:68@*"!P<F5S97)V
+M95]T:6UE("D-"@EI9B H('-E=&9T:6UE*"!F:6QE;F\H9F0I+" F5VAE;B I
+M("D@('L-"@D@(" @<&5R<F]R*"!S("D[#0H)(" @('!R97-E<G9E7W1I;64@
+M/2 P.PT*"7T-"B @("!F8VQO<V4H(&9D("D[#0H-"B @(" O*B!&:7@@86-C
+M97-S(')I9VAT<R J+PT*(" @(&EF("@@<W1A="@@<RP@)E-T870@*2 I#0H)
+M<&5R<F]R*"!S("D[#0H@(" @96QS92!I9B H(&-H;6]D*"!D+"!3=&%T+G-T
+M7VUO9&4@*2 I#0H)<&5R<F]R*"!D("D[#0H-"B @("!R971U<FX@,#L-"B-E
+M;F1I9@T*?0T*#0H-"@T*#0H-"FEN="!M86EN*"!I;G0@87)G8RP@8VAA<B J
+M(&%R9W9;72 I#0I[#0H@(" @8VAA<B J"7!R;V=N86UE.PT*(" @(&EN= D)
+M=F5R8F]S92 ](# [#0H@(" @:6YT"0EO;FQY7VEF7VYE=V5R/2 P.PT*(" @
+M(&-H87(@*@ES=69F:7@@(#T@3E5,3#L-"B @("!C:&%R("H);6]D90D]($Y5
+M3$P[#0H@(" @8VAA<B J( ED97-T.PT*(" @(&-H87(@*BH)<' [#0H-"B @
+M("!A<F=V(#T@87)G=E]F:7@H("9A<F=C+"!A<F=V("D[#0H-"B @("!P<F]G
+M;F%M92 ](&)A<V5N86UE*" J87)G=BLK("D[#0H-"B @(" O*B!P<F]C97-S
+M('1H92!O<'1I;VYS("HO#0H@(" @=VAI;&4@*"!A<F=V6S!=(" F)B @87)G
+M=ELP75LP72 ]/2 G+2<@*2 @>PT*"7-W:71C:" H(&%R9W9;,%U;,5T@*2 @
+M>PT*"2 @("!C87-E("=.)SH-"@D@(" @(" @("LK87)G=CL-"@D);VYL>5]I
+M9E]N97=E<B ](#$[#0H)"6)R96%K.PT*"2 @("!C87-E("=C)SH-"@D@(" @
+M(" @("LK87)G=CL-"@D)+RH@5V4@86QW87ES(&-O<'DL(')E9V%R9&QE<W,@
+M*B\-"@D)8G)E86L[#0H)(" @(&-A<V4@)W8G.@T*"0DK*V%R9W8[#0H)"79E
+M<F)O<V4@/2 Q.PT*"0EB<F5A:SL-"@D@(" @8V%S92 G5B<Z#0H)"2LK87)G
+M=CL-"@D)<W5F9FEX(#T@*F%R9W8[#0H)"2LK87)G=CL-"@D)8G)E86L[#0H)
+M(" @(&-A<V4@)VTG.@T*"0DK*V%R9W8[#0H)"6UO9&4@/2 J87)G=CL-"@D)
+M*RMA<F=V.PT*"0EB<F5A:SL-"@D@(" @9&5F875L=#H-"@D)9F%T86PH($Y5
+M3$P@*3L-"@E]#0H@(" @?0T*#0H@(" @+RH@4V5P87)A=&4@<V]U<F-E(&9I
+M;&4H<RD@9G)O;2!D97-T(&1I<F5C=&]R>2!O<B!F:6QE("HO#0HC:68@, T*
+M(" @(&EF("@@(6%R9W9;,%T@?'P@(6%R9W9;,5T@*0T*"69A=&%L*" B;6ES
+M<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*(V5L<V4-
+M"B @(" O*B!792!U<V5D('1O(')E<75I<F4@870@;&5A<W0@;VYE(&9I;&4[
+M(&YO="!A;GD@;6]R92 J+PT*(" @(&EF("@@(6%R9W9;,%T@*0T*"69A=&%L
+M*" B;6ES<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*
+M(" @(&EF("@@(6%R9W9;,5T@*0T*"7)E='5R;B P.PT*(V5N9&EF#0H@(" @
+M9F]R("@@<' @/2!A<F=V.R J<' [("LK<' @*0T*"6-O;G1I;G5E.PT*(" @
+M("TM<' [#0H@(" @9&5S=" ]("IP<#L-"B @(" J<' @/2!.54Q,.PT*#0H@
+M(" @+RH@4')O8V5S<R!T:&4@87)G=6UE;G1S("HO#0H@(" @9F]R("@[("IA
+M<F=V.R K*V%R9W8@*2 @>PT*"6-H87(@*B!F(#T@*F%R9W8[#0H)8VAA<B J
+M(&QE868@/2!B87-E;F%M92@@9B I.PT*"6-H87(@=&%R9V5T6R Q,C@@73L-
+M"@T*"7-T<F-P>2@@=&%R9V5T+"!D97-T("D[#0H-"@EI9B H(&ES7V1I<B@@
+M=&%R9V5T("D@*2 @>PT*"2 @("!S=')C870H('1A<F=E="P@(B\B("D[#0H)
+M(" @("\J(&EF('=E('=E<F4@9VEV96X@82!S=69F:7@L('1H96X@861D(&ET
+M(&%S(&%P<')O<')I871E("HO#0H)(" @(&EF("@@<W5F9FEX("D@('L-"@D)
+M8VAA<B J(&1O=" ]('-T<F-H<B@@;&5A9BP@)RXG("D[#0H)"6EF("@@9&]T
+M("D@('L-"@D)(" @('-T<FYC870H('1A<F=E="P@;&5A9BP@9&]T+6QE868@
+M*3L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!S=69F:7@@*3L-"@D)(" @('-T
+M<F-A="@@=&%R9V5T+"!D;W0@*3L-"@D)(" @(&EF("@@=F5R8F]S92 I#0H)
+M"0EP<FEN=&8H("(E<SH@)7,@=VEL;"!B92!I;G-T86QL960@87,@)7,B+ T*
+M"0D)(" @(" @('!R;V=N86UE+"!F+"!S=')R8VAR*'1A<F=E="PG+R<I*S$@
+M*3L-"@D)?2!E;'-E('L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!L96%F("D[
+M#0H)"2 @("!S=')C870H('1A<F=E="P@<W5F9FEX("D[#0H)"7T-"@D@(" @
+M?2!E;'-E('L-"@D)<W1R8V%T*"!T87)G970L(&QE868@*3L-"@D@(" @?0T*
+M"7T-"@T*"6EF("@@86-C97-S*"!F+" P("D@*2 @>PT*"2 @("!C:&%R(&)U
+M9ELR,#!=.PT*"2 @("!S<')I;G1F*"!B=68L(")C86YN;W0@<F5A9" E<R(L
+M(&8@*3L-"@D@(" @9F%T86PH(&)U9B I.PT*"7T-"@T*"6EF("@@;VYL>5]I
+M9E]N97=E<B F)B!I<U]F:6QE*"!T87)G970@*2 F)B A;F5W97(H(&8L('1A
+M<F=E=" I("D@('L-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<')I;G1F*" B
+M)R5S)R!N;W0@;F5W97(@=&AA;B G)7,G7&XB+"!F+"!T87)G970@*3L-"@D@
+M(" @8V]N=&EN=64[#0H)?0T*#0H):68@*"!V97)B;W-E("D-"@D@(" @<')I
+M;G1F*" B<FT@+68@)7-<;B(L('1A<F=E=" I.PT*"6EF("@@8VAM;V0H('1A
+M<F=E="P@,#<W-R I("D-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<&5R<F]R
+M*"!T87)G970@*3L-"@EI9B H('5N;&EN:R@@=&%R9V5T("D@*0T*"2 @("!I
+M9B H('9E<F)O<V4@*0T*"0EP97)R;W(H('1A<F=E=" I.PT*"6EF("@@=F5R
+M8F]S92 I#0H)(" @('!R:6YT9B@@(F-P("UP("5S("5S7&XB+"!F+"!T87)G
+M970@*3L-"@EI9B H(&9I;&5C;W!Y*"!T87)G970L(&8L(#$@*2 I#0H)(" @
+M(')E='5R;B Q.PT*"6EF("@@;6]D92 I("![#0H)(" @(&-H87(@8G5F6R R
+M-34@73L-"@D@(" @<W!R:6YT9B@@8G5F+" B8VAM;V0@)7,@)7-<;B(L(&UO
+M9&4L('1A<F=E=" I.PT*"2 @("!I9B H('9E<F)O<V4@*0T*"0EP<FEN=&8H
+M("(E<UQN(BP@8G5F("D[#0H)(" @('-Y<W1E;2@@8G5F("D[#0H)?0T*(" @
+:('T-"@T*(" @(')E='5R;B P.PT*?0T*#0IE
+
+end
diff --git a/tools/build/packhex.c b/tools/build/packhex.c
new file mode 100644
index 0000000000..ddd010c4a9
--- /dev/null
+++ b/tools/build/packhex.c
@@ -0,0 +1,513 @@
+
+/***** P A C K H E X . C ************************************************
+ *
+ * Packhex is a hex-file compaction utility. It attempts to concatenate
+ * hex records to produce more size-efficient packaging.
+ *
+ * Limitations: Input files must be correctly formatted. This utility
+ * is not robust enough to detect hex-record formatting
+ * errors.
+ *
+ * Published: 5/93 Embedded Systems magazine
+ *
+ * Compiler: Microsoft C 6.0
+ * cl /F 1000 packhex.c
+ *
+ *
+ * $Id$
+ *
+ **************************************************************************/
+
+
+/* #define SMALLER_RECORDS */
+#ifdef SMALLER_RECORDS
+#define MAX_LEN_S1_RECS 128
+#define MAX_LEN_S2_RECS 128
+#define MAX_LEN_S3_RECS 128
+#else
+#define MAX_LEN_S1_RECS 252
+#define MAX_LEN_S2_RECS 251
+#define MAX_LEN_S3_RECS 250
+#endif
+
+
+/*--------------------------------- includes ---------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__unix__) && !defined(EXIT_FAILURE)
+#define EXIT_FAILURE -1
+#define EXIT_SUCCESS 0
+#endif
+
+/*--------------------------------- defines ----------------------------------*/
+
+#define YES 1
+#define MAX_LINE_SIZE 600
+#define EOS '\0'
+
+
+/*---------------------------------- macros ----------------------------------*/
+
+/* Convert ASCII hexadecimal digit to value. */
+
+#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
+
+
+/*--------------------------------- typedefs ---------------------------------*/
+
+typedef unsigned char Boolean;
+typedef unsigned char Uchar;
+typedef unsigned int Uint;
+typedef unsigned long Ulong;
+
+typedef struct /* Functions and constant returning Hex-record vital stats. */
+{
+ Boolean ( *is_data_record )( char * );
+ Ulong ( *get_address )( char * );
+ Uint ( *get_data_count )( char * );
+ const Uint max_data_count;
+ char *( *get_data_start )( char * );
+ void ( *put_data_record )( Uint, Ulong, char * );
+} Rec_vitals;
+
+
+/*--------------------------- function prototypes ----------------------------*/
+
+Rec_vitals * identify_first_data_record( char * );
+Ulong get_ndigit_hex( char *, int );
+
+
+/*----------------------------- Intel Hex format -----------------------------*/
+
+/*
+ * Intel Hex data-record layout
+ *
+ * :aabbbbccd...dee
+ *
+ * : - header character
+ * aa - record data byte count, a 2-digit hex value
+ * bbbb - record address, a 4-digit hex value
+ * cc - record type, a 2-digit hex value:
+ * "00" is a data record
+ * "01" is an end-of-data record
+ * "02" is an extended-address record
+ * "03" is a start record
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 2's complement
+ * [ (sum of bytes: aabbbbccd...d) modulo 256 ]
+ */
+
+
+Boolean is_intel_data_rec( char * rec_str )
+{
+ return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
+}
+
+Uint get_intel_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
+}
+
+Ulong get_intel_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 3, 4 ) );
+}
+
+char * get_intel_rec_data_start( char * rec_str )
+{
+ return( rec_str + 9 );
+}
+
+void put_intel_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ ":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
+ );
+}
+
+
+Rec_vitals intel_hex =
+{
+ is_intel_data_rec,
+ get_intel_rec_address,
+ get_intel_rec_data_count,
+ 255, /* Maximum data bytes in a record. */
+ get_intel_rec_data_start,
+ put_intel_data_rec
+};
+
+
+/*------------------------- Motorola S1-record format ------------------------*/
+
+/*
+ * Motorola S-record data-record layout
+ *
+ * Sabbc...cd...dee
+ *
+ * S - header character
+ * a - record type, a 1-digit value:
+ * "0" is a header record
+ * "1" is a 2-byte-address data record
+ * "2" is a 3-byte-address data record
+ * "3" is a 4-byte-address data record
+ * "7" is a 4-byte-address end-of-data record
+ * "8" is a 3-byte-address end-of-data record
+ * "9" is a 2-byte-address end-of-data record
+ * bb - record length in bytes, a 2-digit hex value
+ * (record length doesn't count the header/type
+ * chars and checksum byte)
+ * c...c - record address, a 4-, 6-, or 8-digit value,
+ * depending on record type
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 1's complement
+ * [ (sum of all bytes: bbc..cd...d) modulo 256 ]
+ */
+
+#define S1_COUNT_OFFSET 3
+
+
+Boolean is_moto_s1_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
+}
+
+Uint get_moto_s1_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
+}
+
+Ulong get_moto_s1_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 4 ) );
+}
+
+char * get_moto_s1_rec_data_start( char * rec_str )
+{
+ return( rec_str + 8 );
+}
+
+void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S1_COUNT_OFFSET + count +
+ ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S1%02X%04lX%s%02X\n",
+ count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s1_rec =
+{
+ is_moto_s1_data_rec,
+ get_moto_s1_rec_address,
+ get_moto_s1_rec_data_count,
+ MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
+ get_moto_s1_rec_data_start,
+ put_moto_s1_data_rec
+};
+
+
+/*------------------------- Motorola S2-record format ------------------------*/
+
+#define S2_COUNT_OFFSET 4
+
+Boolean is_moto_s2_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
+}
+
+Uint get_moto_s2_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
+}
+
+Ulong get_moto_s2_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 6 ) );
+}
+
+char * get_moto_s2_rec_data_start( char * rec_str )
+{
+ return( rec_str + 10 );
+}
+
+void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S2%02X%06lX%s%02X\n",
+ count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s2_rec =
+{
+ is_moto_s2_data_rec,
+ get_moto_s2_rec_address,
+ get_moto_s2_rec_data_count,
+ MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
+ get_moto_s2_rec_data_start,
+ put_moto_s2_data_rec
+};
+
+
+/*------------------------- Motorola S3-record format ------------------------*/
+
+#define S3_COUNT_OFFSET 5
+
+Boolean is_moto_s3_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
+}
+
+Uint get_moto_s3_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
+}
+
+Ulong get_moto_s3_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 8 ) );
+}
+
+char * get_moto_s3_rec_data_start( char * rec_str )
+{
+ return( rec_str + 12 );
+}
+
+void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
+ ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S3%02X%08lX%s%02X\n",
+ count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s3_rec =
+{
+ is_moto_s3_data_rec,
+ get_moto_s3_rec_address,
+ get_moto_s3_rec_data_count,
+ MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
+ get_moto_s3_rec_data_start,
+ put_moto_s3_data_rec
+};
+
+
+/*-------------------- Put your favorite hex format here ---------------------*/
+
+/*
+ * * * * The following is a template for an additional hex format: * * *
+ *
+ *
+ * Boolean is_X_data_rec( char * rec_str ) {}
+ *
+ * Uint get_X_rec_data_count( char * rec_str ) {}
+ *
+ * Ulong get_X_rec_address( char * rec_str ) {}
+ *
+ * char * get_X_rec_data_start( char * rec_str ) {}
+ *
+ * void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
+ *
+ * Rec_vitals X_rec =
+ * {
+ * is_X_data_rec,
+ * get_X_rec_address,
+ * get_X_rec_data_count,
+ * MAXIMUM DATA BYTES IN A RECORD,
+ * get_X_rec_data_start,
+ * put_X_data_rec
+ * };
+ *
+ */
+
+/*----------------------------------------------------------------------------*/
+
+
+/*
+ * Put address of additional Rec_vitals structures
+ * in this array, before the NULL entry.
+ */
+
+Rec_vitals *formats[] =
+{
+ &intel_hex,
+ &motorola_s1_rec,
+ &motorola_s2_rec,
+ &motorola_s3_rec,
+ ( Rec_vitals * ) NULL
+};
+
+
+/**** main *****************************************************************
+*
+*
+* Expects: Nothing (no command-line parameters).
+*
+* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
+*
+* Reads hex records on the standard input and attempts to
+* splice adjacent data fields together. Results appear on
+* the standard output.
+*
+*******************************************************************************/
+
+void main( void )
+{
+
+ char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
+ char *in_dptr, *out_dptr;
+ int d_total, d_count, d_excess, n;
+ Ulong in_rec_addr, out_rec_addr = 0;
+ Rec_vitals *rptr;
+
+
+ /* Sift through file until first hex record is identified. */
+ if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
+ {
+ fputs( "No hex records found.\n", stderr );
+ exit( EXIT_FAILURE );
+ }
+
+
+ /* Attempt data-record splicing until end-of-file is reached. */
+ d_total = 0;
+ do
+ {
+ if ( rptr->is_data_record( inbuff ) == YES )
+ { /* Input record is a data record. */
+ d_count = rptr->get_data_count( inbuff );
+ in_rec_addr = rptr->get_address( inbuff );
+ in_dptr = rptr->get_data_start( inbuff );
+
+ if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
+ { /* Begin a new output record. */
+ if ( d_total != 0 )
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ out_dptr = outbuff;
+ n = d_total = d_count;
+ out_rec_addr = in_rec_addr;
+ }
+ else if
+ ( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
+ { /* Output a maximum-length record, then start a new record. */
+ strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
+ rptr->put_data_record(
+ rptr->max_data_count, out_rec_addr, outbuff
+ );
+ in_dptr += 2 * ( d_count - d_excess );
+ out_dptr = outbuff;
+ n = d_total = d_excess;
+ out_rec_addr += rptr->max_data_count;
+ }
+ else
+ { /* Append input record's data field with accumulated data. */
+ out_dptr = outbuff + ( 2 * d_total );
+ d_total += n = d_count;
+ }
+ strncpy( out_dptr, in_dptr, 2 * n );
+ out_dptr[ 2 * n ] = EOS;
+ }
+ else
+ { /* Not a data record;
+ * flush accumulated data then echo non-data record.
+ */
+ if ( d_total != 0 )
+ {
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ d_total = 0;
+ }
+ puts( inbuff );
+ }
+ } while ( gets( inbuff ) != NULL );
+
+
+ exit( EXIT_SUCCESS );
+
+}
+
+
+/**** identify_first_data_record *******************************************
+*
+* Expects: Pointer to hex-record line buffer.
+*
+* Returns: Pointer to hex-record structure (NULL if no match found).
+*
+* Reads the standard input, line by line, searching for a valid
+* record header character. If a valid header is found, a pointer
+* to the hex-record's type structure is returned, otherwise NULL.
+*
+* The input-stream pointer is left pointing to the first valid hex record.
+*
+*******************************************************************************/
+
+Rec_vitals * identify_first_data_record( char * buff_ptr )
+{
+ Rec_vitals ** ptr;
+
+ while ( gets( buff_ptr ) != NULL )
+ {
+ for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
+ if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
+ return( *ptr ); /* Successful return. */
+
+ puts( buff_ptr ); /* Echo non-hex-record line. */
+ }
+
+ return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
+}
+
+
+/**** get_ndigit_hex *******************************************************
+*
+* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
+*
+* Returns: Value of hexadecimal string as an unsigned long.
+*
+*******************************************************************************/
+
+Ulong get_ndigit_hex( char * cptr, int digits )
+{
+ Ulong value;
+
+ for ( value = 0 ; --digits >= 0 ; cptr++ )
+ value = ( value * 16L ) + HEX_DIGIT( *cptr );
+
+ return( value );
+}
diff --git a/tools/build/scripts/README b/tools/build/scripts/README
new file mode 100644
index 0000000000..0436fc958d
--- /dev/null
+++ b/tools/build/scripts/README
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+Misc. support tools for RTEMS workspaces.
+More will be added later as they are converted from Teamware
+to CVS.
+
+install-if-change
+ Smart install script that also can append suffixes as it
+ installs (suffixes used for debug and profile variants).
+ Requires bash or ksh.
+
+rcs-clean
+ deletes all files from the current directory that can be
+ re-created from RCS. Careful to not delete locked files.
+ May be used by 'gmake clobber'
+
+lock-directory
+unlock-directory
+ traverse a directory structure making it unwritable.
+ Useful to keep people from accidentally overwriting
+ "released" trees if they get confused about which
+ module they have loaded.
+
+rtems-glom
+ glom together all the rtems libraries in order to simplify
+ the link line used by applications.
+ Produces rtems.rel.
+ Not used by the RTEMS src tree at all.
+ Strictly optional.
+
diff --git a/tools/build/src/cklength.c b/tools/build/src/cklength.c
new file mode 100644
index 0000000000..6059cacb1f
--- /dev/null
+++ b/tools/build/src/cklength.c
@@ -0,0 +1,364 @@
+/*
+ * cklength - check the length of lines in a file
+ *
+ * This program check to see if the files passed to it on the command line
+ * contain a line which exceeds the maximum allowable length. The default
+ * maximum line length is 80.
+ *
+ * usage: cklength [ -v ] [ arg ... ] files...
+ * -l length -- maximum line length
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "l:nNv"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -l length -- maximum line length\n\
+ -n -- report line numbers for offending lines\n\
+ -N -- report line numbers and length for offending lines\n\
+ -v -- verbose\n\
+\n\
+Print the name of files which have at least 1 line which exceeds the\n\
+maximum line length. The default maximum line length is 80.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 512
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int report_line_numbers = FALSE; /* report line numbers of offenders */
+int report_line_length = FALSE; /* report line length of offenders */
+
+int line_length = 80; /* maximum allowable line length */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 'l': /* line length */
+ line_length = atoi( optarg );
+ if ( line_length < 0 || line_length > BUFFER_SIZE )
+ error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
+ break;
+
+ case 'n': /* toggle report_line_numbers */
+ report_line_numbers = ! report_line_numbers;
+ break;
+
+ case 'N': /* toggle both reports */
+ report_line_numbers = ! report_line_numbers;
+ report_line_length = ! report_line_length;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int line_number;
+ int length;
+ int count;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ count = 0;
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( length <= line_length )
+ continue;
+
+ if ( count == 0 ) {
+ fprintf( stderr, "%s\n", arg );
+ if ( !report_line_numbers )
+ break;
+ }
+
+ if ( verbose )
+ fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
+
+ if ( report_line_numbers ) {
+ if ( report_line_length )
+ fprintf( stderr, "%d: %d\n" , line_number, length );
+ else
+ fprintf( stderr, "%d\n" , line_number );
+ }
+
+ count++;
+
+ }
+
+ fclose( in );
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/tools/build/src/eolstrip.c b/tools/build/src/eolstrip.c
new file mode 100644
index 0000000000..b4e0d5d165
--- /dev/null
+++ b/tools/build/src/eolstrip.c
@@ -0,0 +1,351 @@
+/*
+ * eolstrip - strip white space from end of lines
+ *
+ * This program strips the white space from the end of every line in the
+ * specified program.
+ *
+ * usage: eolstrip [ -v ] [ arg ... ] files...
+ * -v -- verbose
+ *
+ * $Id$
+ */
+
+#define GETOPTARGS "vt"
+
+char *USAGE = "\
+usage: cklength [ -v ] [ arg ... ] files... \n\
+ -v -- verbose\n\
+ -t -- test only .. DO NOT OVERWRITE FILE!!!\n\
+\n\
+Strip the white space from the end of every line on the list of files.\n\
+";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#define BUFFER_SIZE 2048
+#define MAX_PATH 2048
+
+#define SUCCESS 0
+#define FAILURE -1
+#define Failed(x) (((int) (x)) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+#define STREQ(a,b) (strcmp(a,b) == 0)
+#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
+
+/*
+ * Definitions for unsigned "ints"; especially for use in data structures
+ * that will be shared among (potentially) different cpu's (we punt on
+ * byte ordering problems tho)
+ */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * vars controlled by command line options
+ */
+
+int verbose = FALSE; /* be verbose */
+int test_only = FALSE; /* test only */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind, opterr;
+extern int errno;
+
+char *progname; /* for error() */
+
+int process(char *arg);
+void error(int errn, ...);
+long getparm(char *s, long min, long max, char *msg);
+
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtol(p, (char **) NULL, 0)
+int Open(), Read(), Write();
+
+int
+main(int argc, char **argv, char **env)
+{
+ register int c;
+ int showusage = FALSE; /* usage error? */
+ int rc = 0;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ opterr = 0; /* we'll report all errors */
+ while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
+ switch (c)
+ {
+ case 't': /* toggle test only mode */
+ test_only = ! test_only;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ /*
+ * traverse and process the arguments
+ */
+
+ for ( ; argv[optind]; optind++)
+ if (Failed(process(argv[optind])))
+ rc = FAILURE;
+
+ return rc;
+}
+
+
+/*
+ * process(arg)
+ */
+
+int
+process(char *arg)
+{
+ FILE *in;
+ FILE *out = (FILE *) 0;
+ char outname[ MAX_PATH ];
+ char *bptr;
+ char buffer[ BUFFER_SIZE ];
+ int length;
+ int line_number;
+ int rc = SUCCESS; /* succeed by default */
+
+ in = fopen( arg, "r" );
+ if (!in)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+
+ if ( !test_only ) {
+ sprintf( outname, "%s.eoltmp", arg );
+
+ out = fopen( outname, "w" );
+ if (!out)
+ error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
+ }
+
+ if ( verbose )
+ fprintf( stderr, "Processing %s\n", arg );
+
+ for ( line_number=1 ; ; line_number++ ) {
+ bptr = fgets( buffer, BUFFER_SIZE, in );
+ if (!bptr)
+ break;
+
+ /*
+ * Don't count the carriage return.
+ */
+
+ length = strlen( buffer ) - 1;
+
+ if ( buffer[ length ] != '\n' )
+ error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
+
+ while ( isspace( buffer[ length ] ) )
+ buffer[ length-- ] = '\0';
+
+ if ( test_only ) {
+ fprintf( stderr, "%s\n", arg );
+ break;
+ }
+
+ fprintf( out, "%s\n", buffer );
+ }
+
+ fclose( in );
+ if ( !test_only ) {
+ fclose( out );
+ rename( outname, arg );
+ }
+ return rc;
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_FATAL bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
+long
+getparm(char *s,
+ long min,
+ long max,
+ char *msg)
+{
+ long val;
+
+ if ( ! strchr("0123456789-", *s))
+ {
+ error(ERR_FATAL, "'%s' is not a number", s);
+ return min;
+ }
+
+ val = strtol(s, (char **) NULL, 0);
+ if ((val < min) || (val > max))
+ {
+ if (min == max)
+ error(ERR_FATAL, "%s can only be %ld", s, min);
+ else
+ error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
+ }
+
+ return val;
+}
+
+
+/*
+ * Open()
+ * Perform open(2), returning the file descriptor. Prints
+ * error message if open fails.
+ */
+
+int
+Open(char *file,
+ int oflag,
+ int mode)
+{
+ int O_fd;
+
+ if (Failed(O_fd = open(file, oflag, mode)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "open('%s', 0x%x, 0%o) failed", file, oflag, mode
+ );
+
+ return O_fd;
+}
+
+/*
+ * Read()
+ * Perform read(2); prints error message if fails.
+ */
+
+int
+Read(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = read(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "read(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
+
+/*
+ * Write()
+ * Perform write(2); prints error message if fails.
+ */
+
+int
+Write(int file,
+ char *buffer,
+ unsigned int count)
+{
+ int nbytes;
+
+ if (Failed(nbytes = write(file, buffer, count)))
+ error(
+ ERR_ERRNO | ERR_FATAL,
+ "write(%d, 0x%x, %d) failed", file, buffer, count
+ );
+
+ return nbytes;
+}
diff --git a/tools/build/src/packhex.c b/tools/build/src/packhex.c
new file mode 100644
index 0000000000..ddd010c4a9
--- /dev/null
+++ b/tools/build/src/packhex.c
@@ -0,0 +1,513 @@
+
+/***** P A C K H E X . C ************************************************
+ *
+ * Packhex is a hex-file compaction utility. It attempts to concatenate
+ * hex records to produce more size-efficient packaging.
+ *
+ * Limitations: Input files must be correctly formatted. This utility
+ * is not robust enough to detect hex-record formatting
+ * errors.
+ *
+ * Published: 5/93 Embedded Systems magazine
+ *
+ * Compiler: Microsoft C 6.0
+ * cl /F 1000 packhex.c
+ *
+ *
+ * $Id$
+ *
+ **************************************************************************/
+
+
+/* #define SMALLER_RECORDS */
+#ifdef SMALLER_RECORDS
+#define MAX_LEN_S1_RECS 128
+#define MAX_LEN_S2_RECS 128
+#define MAX_LEN_S3_RECS 128
+#else
+#define MAX_LEN_S1_RECS 252
+#define MAX_LEN_S2_RECS 251
+#define MAX_LEN_S3_RECS 250
+#endif
+
+
+/*--------------------------------- includes ---------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__unix__) && !defined(EXIT_FAILURE)
+#define EXIT_FAILURE -1
+#define EXIT_SUCCESS 0
+#endif
+
+/*--------------------------------- defines ----------------------------------*/
+
+#define YES 1
+#define MAX_LINE_SIZE 600
+#define EOS '\0'
+
+
+/*---------------------------------- macros ----------------------------------*/
+
+/* Convert ASCII hexadecimal digit to value. */
+
+#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
+
+
+/*--------------------------------- typedefs ---------------------------------*/
+
+typedef unsigned char Boolean;
+typedef unsigned char Uchar;
+typedef unsigned int Uint;
+typedef unsigned long Ulong;
+
+typedef struct /* Functions and constant returning Hex-record vital stats. */
+{
+ Boolean ( *is_data_record )( char * );
+ Ulong ( *get_address )( char * );
+ Uint ( *get_data_count )( char * );
+ const Uint max_data_count;
+ char *( *get_data_start )( char * );
+ void ( *put_data_record )( Uint, Ulong, char * );
+} Rec_vitals;
+
+
+/*--------------------------- function prototypes ----------------------------*/
+
+Rec_vitals * identify_first_data_record( char * );
+Ulong get_ndigit_hex( char *, int );
+
+
+/*----------------------------- Intel Hex format -----------------------------*/
+
+/*
+ * Intel Hex data-record layout
+ *
+ * :aabbbbccd...dee
+ *
+ * : - header character
+ * aa - record data byte count, a 2-digit hex value
+ * bbbb - record address, a 4-digit hex value
+ * cc - record type, a 2-digit hex value:
+ * "00" is a data record
+ * "01" is an end-of-data record
+ * "02" is an extended-address record
+ * "03" is a start record
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 2's complement
+ * [ (sum of bytes: aabbbbccd...d) modulo 256 ]
+ */
+
+
+Boolean is_intel_data_rec( char * rec_str )
+{
+ return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
+}
+
+Uint get_intel_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
+}
+
+Ulong get_intel_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 3, 4 ) );
+}
+
+char * get_intel_rec_data_start( char * rec_str )
+{
+ return( rec_str + 9 );
+}
+
+void put_intel_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ ":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
+ );
+}
+
+
+Rec_vitals intel_hex =
+{
+ is_intel_data_rec,
+ get_intel_rec_address,
+ get_intel_rec_data_count,
+ 255, /* Maximum data bytes in a record. */
+ get_intel_rec_data_start,
+ put_intel_data_rec
+};
+
+
+/*------------------------- Motorola S1-record format ------------------------*/
+
+/*
+ * Motorola S-record data-record layout
+ *
+ * Sabbc...cd...dee
+ *
+ * S - header character
+ * a - record type, a 1-digit value:
+ * "0" is a header record
+ * "1" is a 2-byte-address data record
+ * "2" is a 3-byte-address data record
+ * "3" is a 4-byte-address data record
+ * "7" is a 4-byte-address end-of-data record
+ * "8" is a 3-byte-address end-of-data record
+ * "9" is a 2-byte-address end-of-data record
+ * bb - record length in bytes, a 2-digit hex value
+ * (record length doesn't count the header/type
+ * chars and checksum byte)
+ * c...c - record address, a 4-, 6-, or 8-digit value,
+ * depending on record type
+ * d...d - data (always an even number of chars)
+ * ee - record checksum, a 2-digit hex value
+ * checksum = 1's complement
+ * [ (sum of all bytes: bbc..cd...d) modulo 256 ]
+ */
+
+#define S1_COUNT_OFFSET 3
+
+
+Boolean is_moto_s1_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
+}
+
+Uint get_moto_s1_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
+}
+
+Ulong get_moto_s1_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 4 ) );
+}
+
+char * get_moto_s1_rec_data_start( char * rec_str )
+{
+ return( rec_str + 8 );
+}
+
+void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S1_COUNT_OFFSET + count +
+ ( address >> 8 & 0xff ) + ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S1%02X%04lX%s%02X\n",
+ count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s1_rec =
+{
+ is_moto_s1_data_rec,
+ get_moto_s1_rec_address,
+ get_moto_s1_rec_data_count,
+ MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
+ get_moto_s1_rec_data_start,
+ put_moto_s1_data_rec
+};
+
+
+/*------------------------- Motorola S2-record format ------------------------*/
+
+#define S2_COUNT_OFFSET 4
+
+Boolean is_moto_s2_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
+}
+
+Uint get_moto_s2_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
+}
+
+Ulong get_moto_s2_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 6 ) );
+}
+
+char * get_moto_s2_rec_data_start( char * rec_str )
+{
+ return( rec_str + 10 );
+}
+
+void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S2%02X%06lX%s%02X\n",
+ count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s2_rec =
+{
+ is_moto_s2_data_rec,
+ get_moto_s2_rec_address,
+ get_moto_s2_rec_data_count,
+ MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
+ get_moto_s2_rec_data_start,
+ put_moto_s2_data_rec
+};
+
+
+/*------------------------- Motorola S3-record format ------------------------*/
+
+#define S3_COUNT_OFFSET 5
+
+Boolean is_moto_s3_data_rec( char * rec_str )
+{
+ return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
+}
+
+Uint get_moto_s3_rec_data_count( char * rec_str )
+{
+ return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
+}
+
+Ulong get_moto_s3_rec_address( char * rec_str )
+{
+ return( get_ndigit_hex( rec_str + 4, 8 ) );
+}
+
+char * get_moto_s3_rec_data_start( char * rec_str )
+{
+ return( rec_str + 12 );
+}
+
+void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
+{
+ char *ptr;
+ Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
+ ( address >> 16 & 0xff ) +
+ ( address >> 8 & 0xff ) +
+ ( address & 0xff );
+
+ for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
+ sum += ( Uint ) get_ndigit_hex( ptr, 2 );
+
+ printf(
+ "S3%02X%08lX%s%02X\n",
+ count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
+ );
+}
+
+
+Rec_vitals motorola_s3_rec =
+{
+ is_moto_s3_data_rec,
+ get_moto_s3_rec_address,
+ get_moto_s3_rec_data_count,
+ MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
+ get_moto_s3_rec_data_start,
+ put_moto_s3_data_rec
+};
+
+
+/*-------------------- Put your favorite hex format here ---------------------*/
+
+/*
+ * * * * The following is a template for an additional hex format: * * *
+ *
+ *
+ * Boolean is_X_data_rec( char * rec_str ) {}
+ *
+ * Uint get_X_rec_data_count( char * rec_str ) {}
+ *
+ * Ulong get_X_rec_address( char * rec_str ) {}
+ *
+ * char * get_X_rec_data_start( char * rec_str ) {}
+ *
+ * void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
+ *
+ * Rec_vitals X_rec =
+ * {
+ * is_X_data_rec,
+ * get_X_rec_address,
+ * get_X_rec_data_count,
+ * MAXIMUM DATA BYTES IN A RECORD,
+ * get_X_rec_data_start,
+ * put_X_data_rec
+ * };
+ *
+ */
+
+/*----------------------------------------------------------------------------*/
+
+
+/*
+ * Put address of additional Rec_vitals structures
+ * in this array, before the NULL entry.
+ */
+
+Rec_vitals *formats[] =
+{
+ &intel_hex,
+ &motorola_s1_rec,
+ &motorola_s2_rec,
+ &motorola_s3_rec,
+ ( Rec_vitals * ) NULL
+};
+
+
+/**** main *****************************************************************
+*
+*
+* Expects: Nothing (no command-line parameters).
+*
+* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
+*
+* Reads hex records on the standard input and attempts to
+* splice adjacent data fields together. Results appear on
+* the standard output.
+*
+*******************************************************************************/
+
+void main( void )
+{
+
+ char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
+ char *in_dptr, *out_dptr;
+ int d_total, d_count, d_excess, n;
+ Ulong in_rec_addr, out_rec_addr = 0;
+ Rec_vitals *rptr;
+
+
+ /* Sift through file until first hex record is identified. */
+ if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
+ {
+ fputs( "No hex records found.\n", stderr );
+ exit( EXIT_FAILURE );
+ }
+
+
+ /* Attempt data-record splicing until end-of-file is reached. */
+ d_total = 0;
+ do
+ {
+ if ( rptr->is_data_record( inbuff ) == YES )
+ { /* Input record is a data record. */
+ d_count = rptr->get_data_count( inbuff );
+ in_rec_addr = rptr->get_address( inbuff );
+ in_dptr = rptr->get_data_start( inbuff );
+
+ if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
+ { /* Begin a new output record. */
+ if ( d_total != 0 )
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ out_dptr = outbuff;
+ n = d_total = d_count;
+ out_rec_addr = in_rec_addr;
+ }
+ else if
+ ( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
+ { /* Output a maximum-length record, then start a new record. */
+ strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
+ rptr->put_data_record(
+ rptr->max_data_count, out_rec_addr, outbuff
+ );
+ in_dptr += 2 * ( d_count - d_excess );
+ out_dptr = outbuff;
+ n = d_total = d_excess;
+ out_rec_addr += rptr->max_data_count;
+ }
+ else
+ { /* Append input record's data field with accumulated data. */
+ out_dptr = outbuff + ( 2 * d_total );
+ d_total += n = d_count;
+ }
+ strncpy( out_dptr, in_dptr, 2 * n );
+ out_dptr[ 2 * n ] = EOS;
+ }
+ else
+ { /* Not a data record;
+ * flush accumulated data then echo non-data record.
+ */
+ if ( d_total != 0 )
+ {
+ rptr->put_data_record( d_total, out_rec_addr, outbuff );
+ d_total = 0;
+ }
+ puts( inbuff );
+ }
+ } while ( gets( inbuff ) != NULL );
+
+
+ exit( EXIT_SUCCESS );
+
+}
+
+
+/**** identify_first_data_record *******************************************
+*
+* Expects: Pointer to hex-record line buffer.
+*
+* Returns: Pointer to hex-record structure (NULL if no match found).
+*
+* Reads the standard input, line by line, searching for a valid
+* record header character. If a valid header is found, a pointer
+* to the hex-record's type structure is returned, otherwise NULL.
+*
+* The input-stream pointer is left pointing to the first valid hex record.
+*
+*******************************************************************************/
+
+Rec_vitals * identify_first_data_record( char * buff_ptr )
+{
+ Rec_vitals ** ptr;
+
+ while ( gets( buff_ptr ) != NULL )
+ {
+ for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
+ if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
+ return( *ptr ); /* Successful return. */
+
+ puts( buff_ptr ); /* Echo non-hex-record line. */
+ }
+
+ return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
+}
+
+
+/**** get_ndigit_hex *******************************************************
+*
+* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
+*
+* Returns: Value of hexadecimal string as an unsigned long.
+*
+*******************************************************************************/
+
+Ulong get_ndigit_hex( char * cptr, int digits )
+{
+ Ulong value;
+
+ for ( value = 0 ; --digits >= 0 ; cptr++ )
+ value = ( value * 16L ) + HEX_DIGIT( *cptr );
+
+ return( value );
+}
diff --git a/tools/build/src/unhex.c b/tools/build/src/unhex.c
new file mode 100644
index 0000000000..ba099c4772
--- /dev/null
+++ b/tools/build/src/unhex.c
@@ -0,0 +1,721 @@
+/*
+ * unhex
+ * convert a hex file to binary equivalent. If more than one file name
+ * is given, then the output will be logically concatenated together.
+ * stdin and stdout are defaults. Verbose will enable checksum output.
+ *
+ * Supported input formats are Intel hex, Motorola S records, and TI 'B'
+ * records.
+ *
+ * Intel hex input format is
+ * Byte
+ * 1 Colon :
+ * 2..3 Record length, eg: "20"
+ * 4..7 load address nibbles
+ * 8..9 record type: "00" (data) or "02" base addr
+ * 10..x data bytes in ascii-hex
+ * x+1..x+2 cksum (2's compl of (len+addr+data))
+ * x+3 \n -- newline
+ *
+ * $Id$
+ */
+
+char *USAGE = "\
+usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
+ -v -- verbose\n\
+ -a base -- 1st byte of output corresponds to this address\n\
+ -l -- linear, just writes data out\n\
+ -o file -- output file; must not be input file\n\
+ -F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
+ up to \"k_bits\" * 1024 bits\n\
+";
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define OK 0
+#define FAILURE (-1)
+#define Failed(x) ((x) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+typedef char bool;
+#define STREQ(a,b) (strcmp(a,b) == 0)
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * Pick out designated bytes
+ */
+
+#define B0(x) ((x) & 0xff)
+#define B1(x) B0((x) >> 8)
+#define B2(x) B0((x) >> 16)
+#define B3(x) B0((x) >> 24)
+
+typedef struct buffer_rec {
+ u32 dl_destaddr;
+ u32 dl_jumpaddr;
+ int dl_count;
+ u8 dl_buf[512];
+} buffer_rec;
+
+/*
+ * vars controlled by command line options
+ */
+
+bool verbose = FALSE; /* be verbose */
+bool linear = FALSE; /* just write out linear data */
+char *outfilename = "-"; /* default output is stdout */
+u32 base = 0L; /* base address */
+u32 FFfill = 0L; /* how far to fill w 0xFF's */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind;
+extern int errno;
+
+char *progname; /* for error() */
+
+void error(int errn, ...);
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtoul(p, (char **) NULL, 0)
+
+int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+void write_record(buffer_rec *tb, FILE *fp);
+int getnibble(char **p);
+int getbyte(char **p);
+long getNbytes(char **p, int n);
+void badformat(char *s, char *fname, char *msg);
+
+#define get1bytes(p) ((int) getbyte(p))
+#define get2bytes(p) ((int) getNbytes(p, 2))
+#define get3bytes(p) getNbytes(p, 3)
+#define get4bytes(p) getNbytes(p, 4)
+
+char *BADADDR = "Invalid record address";
+char *BADLEN = "Invalid record length";
+char *BADBASE = "Bad base or starting address";
+char *BADFMT = "Unrecognized record type";
+char *BADDATA = "Invalid data byte";
+char *BADCSUM = "Invalid checksum";
+char *MISCSUM = "Checksum mismatch";
+char *BADTYPE = "Unrecognized record type";
+char *MISTYPE = "Incompatible record types";
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ register int c;
+ bool showusage = FALSE; /* usage error? */
+ int rc = 0;
+ FILE *outfp, *infp;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ progname = argv[0];
+ while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
+ switch (c)
+ {
+ case 'a': /* base address */
+ base = stol(optarg);
+ break;
+
+ case 'l': /* linear output */
+ linear = TRUE;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case 'o': /* output file */
+ outfilename = optarg;
+ break;
+
+ case 'F': /* 0xFF fill amount (bytes) */
+ FFfill = stol(optarg) * 1024L / 8L;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ if (linear && (base != 0))
+ {
+ error(0, "-l and -a may not be specified in combination");
+ exit(1);
+ }
+
+ if (STREQ(outfilename, "-"))
+ {
+ outfp = stdout;
+ outfilename = "stdout";
+ }
+ else
+ if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for output", outfilename);
+ exit(1);
+ }
+
+ /*
+ * Now process the input files (or stdin, if none specified)
+ */
+
+ if (argv[optind] == (char *) NULL) /* just stdin */
+ exit(unhex(stdin, "stdin", outfp, outfilename));
+ else
+ for (; (optarg = argv[optind]); optind++)
+ {
+ if (STREQ(optarg, "-"))
+ rc += unhex(stdin, "stdin", outfp, outfilename);
+ else
+ {
+ if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for input", optarg);
+ exit(1);
+ }
+ rc += unhex(infp, optarg, outfp, outfilename);
+ }
+ }
+
+ return(rc);
+}
+
+u16 filesum;
+
+int
+unhex(FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ int c;
+
+ filesum = 0;
+
+ /*
+ * Make sure holes will be filled with 0xFF's if requested. We
+ * do this the easy way by just filling the file with FF's before
+ * getting started. To do it more optimally would be quite a bit
+ * more difficult since the user can skip around as much as he/she
+ * likes in the input hex file addressing.
+ *
+ * We'll clean this up later (after this program has run) with
+ * 'stripffs'
+ */
+
+ if (FFfill)
+ {
+ (void) fseek(ofp, 0, 0);
+ for (c = FFfill; c > 0; c--)
+ (void) fputc(0xFF, ofp);
+ }
+
+ /*
+ * Read the first char from file and determine record types
+ */
+
+ if ((c = getc(ifp)) != EOF)
+ {
+ ungetc(c, ifp);
+ switch(c)
+ {
+ case 'S':
+ convert_S_records(ifp, inm, ofp, onm);
+ break;
+
+ case ':':
+ convert_Intel_records(ifp, inm, ofp, onm);
+ break;
+
+ case '9':
+ case 'B':
+ convert_TI_records(ifp, inm, ofp, onm);
+ break;
+
+ default:
+ {
+ char tmp[2];
+ tmp[0] = c; tmp[1] = 0;
+ badformat(tmp, inm, BADFMT);
+ }
+ }
+ }
+
+ if (verbose)
+ fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
+
+ return 0;
+}
+
+int
+convert_Intel_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int rectype; /* record type */
+ int len; /* data length of current line */
+ u32 addr;
+ u32 base_address = 0;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != ':')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+
+ if ((addr = get2bytes(&p)) == -1L) /* record addr */
+ badformat(buff, inm, BADADDR);
+
+ rectype = getbyte(&p);
+
+ cksum = len + B0(addr) + B1(addr) + rectype;
+
+ switch (rectype)
+ {
+ case 0x00: /* normal data record */
+ tb.dl_destaddr = base_address + addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x01: /* execution start address */
+ base_address = addr;
+ endrecord = TRUE;
+ break;
+
+ case 0x02: /* new base */
+ if ((base_address = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADBASE);
+ cksum += B0(base_address) + B1(base_address);
+ base_address <<= 4;
+ break;
+
+ case 0x03: /* seg/off execution start address */
+ {
+ u32 seg, off;
+
+ seg = get2bytes(&p);
+ off = get2bytes(&p);
+ if ((seg == -1L) || (off == -1L))
+ badformat(buff, inm, BADADDR);
+
+ cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
+
+ tb.dl_jumpaddr = (seg << 4) + off;
+ break;
+ }
+
+ default:
+ error(0, "unknown Intel-hex record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (-cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_S_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int len; /* data length of current line */
+ int rectype; /* record type */
+ u32 addr;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != 'S')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((rectype = getnibble(&p)) == -1) /* record type */
+ badformat(buff, inm, BADTYPE);
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+ cksum = len;
+
+ switch (rectype)
+ {
+ case 0x00: /* comment field, ignored */
+ goto write_it;
+
+ case 0x01: /* data record, 16 bit addr */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 3;
+ goto doit;
+
+ case 0x02: /* ... 24 bit addr */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 4;
+ goto doit;
+
+ case 0x03: /* ... 32 bit addr */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 5;
+ doit:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+
+ tb.dl_destaddr = addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x07: /* 32 bit end record */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x08: /* 24 bit end record */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x09: /* 16 bit end record */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+
+end_rec:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+ tb.dl_jumpaddr = addr;
+ break;
+
+ default:
+ error(0, "unknown Motorola-S record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ break;
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (~cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+write_it:
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_TI_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ int c;
+ bool endrecord = FALSE;
+ bool eol;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ p = &buff[0];
+ eol = FALSE;
+ while ( ! eol && ! endrecord)
+ {
+ switch (*p++)
+ {
+ case '9':
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ tb.dl_destaddr = get2bytes(&p);
+ break;
+
+ case 'B':
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ break;
+
+ case 'F':
+ eol = TRUE;
+ break;
+
+ case ':':
+ endrecord = TRUE;
+ break;
+
+ default:
+ badformat(p, inm, BADFMT);
+ }
+ }
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+void
+write_record(buffer_rec *tb,
+ FILE *fp)
+{
+ if ( ! linear)
+ {
+ if (tb->dl_destaddr < base)
+ error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
+ tb->dl_destaddr, base);
+ (void) fseek(fp, tb->dl_destaddr - base, 0);
+ }
+
+ (void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
+ tb->dl_destaddr += tb->dl_count;
+ tb->dl_count = 0;
+}
+
+int
+getnibble(char **p)
+{
+ register int val;
+
+ **p = toupper(**p);
+ switch (**p)
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ val = **p - '0';
+ break;
+
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ val = 10 + (**p - 'A');
+ break;
+
+ default:
+ return(-1);
+ }
+ *p += 1;
+
+ return(val & 0x0f);
+}
+
+int
+getbyte(char **p)
+{
+ int n0, n1;
+
+ if ((n0 = getnibble(p)) == -1)
+ return(-1);
+ if ((n1 = getnibble(p)) == -1)
+ return(-1);
+
+ return(((n0 << 4) + n1) & 0xff);
+}
+
+long
+getNbytes(char **p,
+ int n)
+{
+ int t;
+ u32 val = 0;
+
+ while (n--)
+ {
+ if ((t = getbyte(p)) == -1)
+ return(-1L);
+ val <<= 8;
+ val += t;
+ }
+
+ return(val);
+}
+
+void
+badformat(char *s,
+ char *fname,
+ char *msg)
+{
+ if (s[strlen(s)-1] == '\n') /* get rid of newline */
+ s[strlen(s)-1] = '\0';
+ error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
+ exit(1);
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_EXIT bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
diff --git a/tools/build/unhex.c b/tools/build/unhex.c
new file mode 100644
index 0000000000..ba099c4772
--- /dev/null
+++ b/tools/build/unhex.c
@@ -0,0 +1,721 @@
+/*
+ * unhex
+ * convert a hex file to binary equivalent. If more than one file name
+ * is given, then the output will be logically concatenated together.
+ * stdin and stdout are defaults. Verbose will enable checksum output.
+ *
+ * Supported input formats are Intel hex, Motorola S records, and TI 'B'
+ * records.
+ *
+ * Intel hex input format is
+ * Byte
+ * 1 Colon :
+ * 2..3 Record length, eg: "20"
+ * 4..7 load address nibbles
+ * 8..9 record type: "00" (data) or "02" base addr
+ * 10..x data bytes in ascii-hex
+ * x+1..x+2 cksum (2's compl of (len+addr+data))
+ * x+3 \n -- newline
+ *
+ * $Id$
+ */
+
+char *USAGE = "\
+usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
+ -v -- verbose\n\
+ -a base -- 1st byte of output corresponds to this address\n\
+ -l -- linear, just writes data out\n\
+ -o file -- output file; must not be input file\n\
+ -F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
+ up to \"k_bits\" * 1024 bits\n\
+";
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define OK 0
+#define FAILURE (-1)
+#define Failed(x) ((x) == FAILURE)
+#define TRUE 1
+#define FALSE 0
+typedef char bool;
+#define STREQ(a,b) (strcmp(a,b) == 0)
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+/*
+ * Pick out designated bytes
+ */
+
+#define B0(x) ((x) & 0xff)
+#define B1(x) B0((x) >> 8)
+#define B2(x) B0((x) >> 16)
+#define B3(x) B0((x) >> 24)
+
+typedef struct buffer_rec {
+ u32 dl_destaddr;
+ u32 dl_jumpaddr;
+ int dl_count;
+ u8 dl_buf[512];
+} buffer_rec;
+
+/*
+ * vars controlled by command line options
+ */
+
+bool verbose = FALSE; /* be verbose */
+bool linear = FALSE; /* just write out linear data */
+char *outfilename = "-"; /* default output is stdout */
+u32 base = 0L; /* base address */
+u32 FFfill = 0L; /* how far to fill w 0xFF's */
+
+extern char *optarg; /* getopt(3) control vars */
+extern int optind;
+extern int errno;
+
+char *progname; /* for error() */
+
+void error(int errn, ...);
+#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
+#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
+#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
+#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
+
+#define stol(p) strtoul(p, (char **) NULL, 0)
+
+int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
+void write_record(buffer_rec *tb, FILE *fp);
+int getnibble(char **p);
+int getbyte(char **p);
+long getNbytes(char **p, int n);
+void badformat(char *s, char *fname, char *msg);
+
+#define get1bytes(p) ((int) getbyte(p))
+#define get2bytes(p) ((int) getNbytes(p, 2))
+#define get3bytes(p) getNbytes(p, 3)
+#define get4bytes(p) getNbytes(p, 4)
+
+char *BADADDR = "Invalid record address";
+char *BADLEN = "Invalid record length";
+char *BADBASE = "Bad base or starting address";
+char *BADFMT = "Unrecognized record type";
+char *BADDATA = "Invalid data byte";
+char *BADCSUM = "Invalid checksum";
+char *MISCSUM = "Checksum mismatch";
+char *BADTYPE = "Unrecognized record type";
+char *MISTYPE = "Incompatible record types";
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ register int c;
+ bool showusage = FALSE; /* usage error? */
+ int rc = 0;
+ FILE *outfp, *infp;
+
+ /*
+ * figure out invocation leaf-name
+ */
+
+ if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ argv[0] = progname; /* for getopt err reporting */
+
+ /*
+ * Check options and arguments.
+ */
+
+ progname = argv[0];
+ while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
+ switch (c)
+ {
+ case 'a': /* base address */
+ base = stol(optarg);
+ break;
+
+ case 'l': /* linear output */
+ linear = TRUE;
+ break;
+
+ case 'v': /* toggle verbose */
+ verbose = ! verbose;
+ break;
+
+ case 'o': /* output file */
+ outfilename = optarg;
+ break;
+
+ case 'F': /* 0xFF fill amount (bytes) */
+ FFfill = stol(optarg) * 1024L / 8L;
+ break;
+
+ case '?':
+ showusage = TRUE;
+ }
+
+ if (showusage)
+ {
+ (void) fprintf(stderr, "%s", USAGE);
+ exit(1);
+ }
+
+ if (linear && (base != 0))
+ {
+ error(0, "-l and -a may not be specified in combination");
+ exit(1);
+ }
+
+ if (STREQ(outfilename, "-"))
+ {
+ outfp = stdout;
+ outfilename = "stdout";
+ }
+ else
+ if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for output", outfilename);
+ exit(1);
+ }
+
+ /*
+ * Now process the input files (or stdin, if none specified)
+ */
+
+ if (argv[optind] == (char *) NULL) /* just stdin */
+ exit(unhex(stdin, "stdin", outfp, outfilename));
+ else
+ for (; (optarg = argv[optind]); optind++)
+ {
+ if (STREQ(optarg, "-"))
+ rc += unhex(stdin, "stdin", outfp, outfilename);
+ else
+ {
+ if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
+ {
+ error(-1, "couldn't open '%s' for input", optarg);
+ exit(1);
+ }
+ rc += unhex(infp, optarg, outfp, outfilename);
+ }
+ }
+
+ return(rc);
+}
+
+u16 filesum;
+
+int
+unhex(FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ int c;
+
+ filesum = 0;
+
+ /*
+ * Make sure holes will be filled with 0xFF's if requested. We
+ * do this the easy way by just filling the file with FF's before
+ * getting started. To do it more optimally would be quite a bit
+ * more difficult since the user can skip around as much as he/she
+ * likes in the input hex file addressing.
+ *
+ * We'll clean this up later (after this program has run) with
+ * 'stripffs'
+ */
+
+ if (FFfill)
+ {
+ (void) fseek(ofp, 0, 0);
+ for (c = FFfill; c > 0; c--)
+ (void) fputc(0xFF, ofp);
+ }
+
+ /*
+ * Read the first char from file and determine record types
+ */
+
+ if ((c = getc(ifp)) != EOF)
+ {
+ ungetc(c, ifp);
+ switch(c)
+ {
+ case 'S':
+ convert_S_records(ifp, inm, ofp, onm);
+ break;
+
+ case ':':
+ convert_Intel_records(ifp, inm, ofp, onm);
+ break;
+
+ case '9':
+ case 'B':
+ convert_TI_records(ifp, inm, ofp, onm);
+ break;
+
+ default:
+ {
+ char tmp[2];
+ tmp[0] = c; tmp[1] = 0;
+ badformat(tmp, inm, BADFMT);
+ }
+ }
+ }
+
+ if (verbose)
+ fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
+
+ return 0;
+}
+
+int
+convert_Intel_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int rectype; /* record type */
+ int len; /* data length of current line */
+ u32 addr;
+ u32 base_address = 0;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != ':')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+
+ if ((addr = get2bytes(&p)) == -1L) /* record addr */
+ badformat(buff, inm, BADADDR);
+
+ rectype = getbyte(&p);
+
+ cksum = len + B0(addr) + B1(addr) + rectype;
+
+ switch (rectype)
+ {
+ case 0x00: /* normal data record */
+ tb.dl_destaddr = base_address + addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x01: /* execution start address */
+ base_address = addr;
+ endrecord = TRUE;
+ break;
+
+ case 0x02: /* new base */
+ if ((base_address = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADBASE);
+ cksum += B0(base_address) + B1(base_address);
+ base_address <<= 4;
+ break;
+
+ case 0x03: /* seg/off execution start address */
+ {
+ u32 seg, off;
+
+ seg = get2bytes(&p);
+ off = get2bytes(&p);
+ if ((seg == -1L) || (off == -1L))
+ badformat(buff, inm, BADADDR);
+
+ cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
+
+ tb.dl_jumpaddr = (seg << 4) + off;
+ break;
+ }
+
+ default:
+ error(0, "unknown Intel-hex record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (-cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_S_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ u8 cksum;
+ int incksum;
+ int c;
+ int len; /* data length of current line */
+ int rectype; /* record type */
+ u32 addr;
+ bool endrecord = FALSE;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ p = &buff[0];
+
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ if (*p != 'S')
+ badformat(p, inm, BADFMT);
+ p++;
+
+ if ((rectype = getnibble(&p)) == -1) /* record type */
+ badformat(buff, inm, BADTYPE);
+
+ if ((len = getbyte(&p)) == -1) /* record len */
+ badformat(buff, inm, BADLEN);
+ cksum = len;
+
+ switch (rectype)
+ {
+ case 0x00: /* comment field, ignored */
+ goto write_it;
+
+ case 0x01: /* data record, 16 bit addr */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 3;
+ goto doit;
+
+ case 0x02: /* ... 24 bit addr */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 4;
+ goto doit;
+
+ case 0x03: /* ... 32 bit addr */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ len -= 5;
+ doit:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+
+ tb.dl_destaddr = addr;
+ while (len--)
+ {
+ if ((c = getbyte(&p)) == -1)
+ badformat(buff, inm, BADDATA);
+ cksum += c;
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ }
+ break;
+
+ case 0x07: /* 32 bit end record */
+ if ((addr = get4bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x08: /* 24 bit end record */
+ if ((addr = get3bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+ goto end_rec;
+
+ case 0x09: /* 16 bit end record */
+ if ((addr = get2bytes(&p)) == -1L)
+ badformat(buff, inm, BADADDR);
+
+end_rec:
+ cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
+ tb.dl_jumpaddr = addr;
+ break;
+
+ default:
+ error(0, "unknown Motorola-S record type: 0x%02x", rectype);
+ badformat(buff, inm, BADTYPE);
+ break;
+ }
+
+ /*
+ * Verify checksums are correct in file.
+ */
+
+ cksum = (~cksum) & 0xff;
+ if ((incksum = getbyte(&p)) == -1)
+ badformat(buff, inm, BADCSUM);
+ if (((u8) incksum) != cksum)
+ badformat(buff, inm, MISCSUM);
+
+write_it:
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+int
+convert_TI_records(
+ FILE *ifp,
+ char *inm,
+ FILE *ofp,
+ char *onm)
+{
+ char buff[512];
+ char *p;
+ int c;
+ bool endrecord = FALSE;
+ bool eol;
+ buffer_rec tb;
+
+ while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
+ {
+ if (p[strlen(p)-1] == '\n') /* get rid of newline */
+ p[strlen(p)-1] = '\0';
+
+ if (p[strlen(p)-1] == '\r') /* get rid of any CR */
+ p[strlen(p)-1] = '\0';
+
+ tb.dl_count = 0;
+
+ p = &buff[0];
+ eol = FALSE;
+ while ( ! eol && ! endrecord)
+ {
+ switch (*p++)
+ {
+ case '9':
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ tb.dl_destaddr = get2bytes(&p);
+ break;
+
+ case 'B':
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ c = getbyte(&p);
+ filesum += c;
+ tb.dl_buf[tb.dl_count++] = c;
+ break;
+
+ case 'F':
+ eol = TRUE;
+ break;
+
+ case ':':
+ endrecord = TRUE;
+ break;
+
+ default:
+ badformat(p, inm, BADFMT);
+ }
+ }
+ if (tb.dl_count)
+ write_record(&tb, ofp);
+ }
+ return 0;
+}
+
+void
+write_record(buffer_rec *tb,
+ FILE *fp)
+{
+ if ( ! linear)
+ {
+ if (tb->dl_destaddr < base)
+ error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
+ tb->dl_destaddr, base);
+ (void) fseek(fp, tb->dl_destaddr - base, 0);
+ }
+
+ (void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
+ tb->dl_destaddr += tb->dl_count;
+ tb->dl_count = 0;
+}
+
+int
+getnibble(char **p)
+{
+ register int val;
+
+ **p = toupper(**p);
+ switch (**p)
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ val = **p - '0';
+ break;
+
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ val = 10 + (**p - 'A');
+ break;
+
+ default:
+ return(-1);
+ }
+ *p += 1;
+
+ return(val & 0x0f);
+}
+
+int
+getbyte(char **p)
+{
+ int n0, n1;
+
+ if ((n0 = getnibble(p)) == -1)
+ return(-1);
+ if ((n1 = getnibble(p)) == -1)
+ return(-1);
+
+ return(((n0 << 4) + n1) & 0xff);
+}
+
+long
+getNbytes(char **p,
+ int n)
+{
+ int t;
+ u32 val = 0;
+
+ while (n--)
+ {
+ if ((t = getbyte(p)) == -1)
+ return(-1L);
+ val <<= 8;
+ val += t;
+ }
+
+ return(val);
+}
+
+void
+badformat(char *s,
+ char *fname,
+ char *msg)
+{
+ if (s[strlen(s)-1] == '\n') /* get rid of newline */
+ s[strlen(s)-1] = '\0';
+ error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
+ exit(1);
+}
+
+/*
+ * error(errn, arglist)
+ * report an error to stderr using printf(3) conventions.
+ * Any output is preceded by '<progname>: '
+ *
+ * Uses ERR_EXIT bit to request exit(errn)
+ * ERR_ABORT to request abort()
+ * ERR_ERRNO to indicate use of errno instead of argument.
+ *
+ * If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
+ * associated error message is appended to the output.
+ */
+
+/*VARARGS*/
+
+void
+error(int error_flag, ...)
+{
+ va_list arglist;
+ register char *format;
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ int local_errno;
+
+ extern int errno;
+
+ (void) fflush(stdout); /* in case stdout/stderr same */
+
+ local_errno = error_flag & ~ERR_MASK;
+ if (error_flag & ERR_ERRNO) /* use errno? */
+ local_errno = errno;
+
+ va_start(arglist, error_flag);
+ format = va_arg(arglist, char *);
+ (void) fprintf(stderr, "%s: ", progname);
+ (void) vfprintf(stderr, format, arglist);
+ va_end(arglist);
+
+ if (local_errno)
+ if ((local_errno > 0) && (local_errno < sys_nerr))
+ (void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
+ else
+ (void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
+ else
+ (void) fprintf(stderr, "\n");
+
+ (void) fflush(stderr);
+
+ if (error_flag & (ERR_FATAL | ERR_ABORT))
+ {
+ if (error_flag & ERR_FATAL)
+ {
+ error(0, "fatal error, exiting");
+ exit(local_errno ? local_errno : 1);
+ }
+ else
+ {
+ error(0, "fatal error, aborting");
+ abort();
+ }
+ }
+}
+
diff --git a/tools/cpu/hppa1.1/genoffsets.c b/tools/cpu/hppa1.1/genoffsets.c
new file mode 100644
index 0000000000..39f900b48a
--- /dev/null
+++ b/tools/cpu/hppa1.1/genoffsets.c
@@ -0,0 +1,346 @@
+/*
+ * genoffsets.c
+ *
+ * This file generates the offsets.h for the HP PA-RISC port of RTEMS.
+ *
+ * NOTE: It only prints the offset for structures actually used
+ * by the assembly code.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+
+#if defined(__hpux__) && defined(__hppa__)
+#include <rtems/system.h>
+#endif
+
+void print_information( void );
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ unsigned int size = 0;
+
+ /*
+ * Print the file header
+ */
+
+printf(
+ "/* offsets.h\n"
+ " *\n"
+ " * This include file contains the offsets of elements in the\n"
+ " * C data structures used by the assembly language code for the\n"
+ " * HP PA-RISC 1.1 port of RTEMS.\n"
+ " *\n"
+ " * NOTE: THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
+ " * DO NOT EDIT THIS BY HAND!!!!\n"
+ " *\n"
+ " * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
+ " * On-Line Applications Research Corporation (OAR).\n"
+ " * All rights assigned to U.S. Government, 1994.\n"
+ " *\n"
+ " * This material may be reproduced by or for the U.S. Government pursuant\n"
+ " * to the copyright license under the clause at DFARS 252.227-7013. This\n"
+ " * notice must appear in all copies of this file and its derivatives.\n"
+ " */\n"
+ "\n"
+ "#ifndef __OFFSETS_h\n"
+ "#define __OFFSETS_h\n"
+ "\n"
+);
+
+#define PRINT_IT( STRING, TYPE, FIELD ) \
+ printf( "#define\t%s\t0x%p\t\t/* %d */\n", \
+ STRING, \
+ &((TYPE)0)->FIELD, \
+ (int) &((TYPE)0)->FIELD );
+
+#define PRINT_SIZE( STRING, item ) \
+ printf( "#ifdef ASM\n#define\t%s\t%d\t\t/* 0x%x */\n#endif\n", \
+ STRING, \
+ sizeof(item), \
+ sizeof(item) );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+#if defined(__hpux__) && defined(__hppa__)
+
+/*
+ * Offsets of elements in the Context_control structure.
+ */
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_IT( "FLAGS_OFFSET", Context_Control *, flags );
+ PRINT_IT( "R1_OFFSET", Context_Control *, gr1 );
+ PRINT_IT( "R2_OFFSET", Context_Control *, gr2 );
+ PRINT_IT( "R3_OFFSET", Context_Control *, gr3 );
+ PRINT_IT( "R4_OFFSET", Context_Control *, gr4 );
+ PRINT_IT( "R5_OFFSET", Context_Control *, gr5 );
+ PRINT_IT( "R6_OFFSET", Context_Control *, gr6 );
+ PRINT_IT( "R7_OFFSET", Context_Control *, gr7 );
+ PRINT_IT( "R8_OFFSET", Context_Control *, gr8 );
+ PRINT_IT( "R9_OFFSET", Context_Control *, gr9 );
+ PRINT_IT( "R10_OFFSET", Context_Control *, gr10 );
+ PRINT_IT( "R11_OFFSET", Context_Control *, gr11 );
+ PRINT_IT( "R12_OFFSET", Context_Control *, gr12 );
+ PRINT_IT( "R13_OFFSET", Context_Control *, gr13 );
+ PRINT_IT( "R14_OFFSET", Context_Control *, gr14 );
+ PRINT_IT( "R15_OFFSET", Context_Control *, gr15 );
+ PRINT_IT( "R16_OFFSET", Context_Control *, gr16 );
+ PRINT_IT( "R17_OFFSET", Context_Control *, gr17 );
+ PRINT_IT( "R18_OFFSET", Context_Control *, gr18 );
+ PRINT_IT( "R19_OFFSET", Context_Control *, gr19 );
+ PRINT_IT( "R20_OFFSET", Context_Control *, gr20 );
+ PRINT_IT( "R21_OFFSET", Context_Control *, gr21 );
+ PRINT_IT( "R22_OFFSET", Context_Control *, gr22 );
+ PRINT_IT( "R23_OFFSET", Context_Control *, gr23 );
+ PRINT_IT( "R24_OFFSET", Context_Control *, gr24 );
+ PRINT_IT( "R25_OFFSET", Context_Control *, gr25 );
+ PRINT_IT( "R26_OFFSET", Context_Control *, gr26 );
+ PRINT_IT( "R27_OFFSET", Context_Control *, gr27 );
+ PRINT_IT( "R28_OFFSET", Context_Control *, gr28 );
+ PRINT_IT( "R29_OFFSET", Context_Control *, gr29 );
+ PRINT_IT( "R30_OFFSET", Context_Control *, sp );
+ PRINT_IT( "R31_OFFSET", Context_Control *, gr31 );
+
+ /*
+ * And common aliases for the above
+ */
+
+ PRINT_COMMENT("Common aliases for above");
+
+ PRINT_IT( "RP_OFFSET", Context_Control *, gr2 );
+ PRINT_IT( "ARG3_OFFSET", Context_Control *, gr23 );
+ PRINT_IT( "ARG2_OFFSET", Context_Control *, gr24 );
+ PRINT_IT( "ARG1_OFFSET", Context_Control *, gr25 );
+ PRINT_IT( "ARG0_OFFSET", Context_Control *, gr26 );
+ PRINT_IT( "SP_OFFSET", Context_Control *, sp );
+ PRINT_IT( "DP_OFFSET", Context_Control *, gr27 );
+ PRINT_IT( "RET0_OFFSET", Context_Control *, gr28 );
+ PRINT_IT( "RET1_OFFSET", Context_Control *, gr29 );
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE", Context_Control);
+
+ PRINT_COMMENT("Context_Control_fp information");
+
+ PRINT_IT( "FR0_OFFSET", Context_Control_fp *, fr0 );
+ PRINT_IT( "FR1_OFFSET", Context_Control_fp *, fr1 );
+ PRINT_IT( "FR2_OFFSET", Context_Control_fp *, fr2 );
+ PRINT_IT( "FR3_OFFSET", Context_Control_fp *, fr3 );
+ PRINT_IT( "FR4_OFFSET", Context_Control_fp *, fr4 );
+ PRINT_IT( "FR5_OFFSET", Context_Control_fp *, fr5 );
+ PRINT_IT( "FR6_OFFSET", Context_Control_fp *, fr6 );
+ PRINT_IT( "FR7_OFFSET", Context_Control_fp *, fr7 );
+ PRINT_IT( "FR8_OFFSET", Context_Control_fp *, fr8 );
+ PRINT_IT( "FR9_OFFSET", Context_Control_fp *, fr9 );
+ PRINT_IT( "FR10_OFFSET", Context_Control_fp *, fr10 );
+ PRINT_IT( "FR11_OFFSET", Context_Control_fp *, fr11 );
+ PRINT_IT( "FR12_OFFSET", Context_Control_fp *, fr12 );
+ PRINT_IT( "FR13_OFFSET", Context_Control_fp *, fr13 );
+ PRINT_IT( "FR14_OFFSET", Context_Control_fp *, fr14 );
+ PRINT_IT( "FR15_OFFSET", Context_Control_fp *, fr15 );
+ PRINT_IT( "FR16_OFFSET", Context_Control_fp *, fr16 );
+ PRINT_IT( "FR17_OFFSET", Context_Control_fp *, fr17 );
+ PRINT_IT( "FR18_OFFSET", Context_Control_fp *, fr18 );
+ PRINT_IT( "FR19_OFFSET", Context_Control_fp *, fr19 );
+ PRINT_IT( "FR20_OFFSET", Context_Control_fp *, fr20 );
+ PRINT_IT( "FR21_OFFSET", Context_Control_fp *, fr21 );
+ PRINT_IT( "FR22_OFFSET", Context_Control_fp *, fr22 );
+ PRINT_IT( "FR23_OFFSET", Context_Control_fp *, fr23 );
+ PRINT_IT( "FR24_OFFSET", Context_Control_fp *, fr24 );
+ PRINT_IT( "FR25_OFFSET", Context_Control_fp *, fr25 );
+ PRINT_IT( "FR26_OFFSET", Context_Control_fp *, fr26 );
+ PRINT_IT( "FR27_OFFSET", Context_Control_fp *, fr27 );
+ PRINT_IT( "FR28_OFFSET", Context_Control_fp *, fr28 );
+ PRINT_IT( "FR29_OFFSET", Context_Control_fp *, fr29 );
+ PRINT_IT( "FR30_OFFSET", Context_Control_fp *, fr30 );
+ PRINT_IT( "FR31_OFFSET", Context_Control_fp *, fr31 );
+
+ PRINT_SIZE("CPU_CONTEXT_FP_SIZE", Context_Control_fp);
+
+ /*
+ * And the control registers
+ */
+
+ PRINT_COMMENT("Control register portion of context");
+
+ PRINT_IT( "SAR_OFFSET", Context_Control *, sar );
+ PRINT_IT( "IPSW_OFFSET", Context_Control *, ipsw );
+ PRINT_IT( "IIR_OFFSET", Context_Control *, iir );
+ PRINT_IT( "IOR_OFFSET", Context_Control *, ior );
+ PRINT_IT( "ISR_OFFSET", Context_Control *, isr );
+ PRINT_IT( "PCOQFRONT_OFFSET", Context_Control *, pcoqfront );
+ PRINT_IT( "PCOQBACK_OFFSET", Context_Control *, pcoqback );
+ PRINT_IT( "PCSQFRONT_OFFSET", Context_Control *, pcsqfront );
+ PRINT_IT( "PCSQBACK_OFFSET", Context_Control *, pcsqback );
+ PRINT_IT( "ITIMER_OFFSET", Context_Control *, itimer );
+
+ /*
+ * Full interrupt frame (integer + float)
+ */
+ PRINT_COMMENT("Interrupt frame information");
+
+ PRINT_IT( "INTEGER_CONTEXT_OFFSET", CPU_Interrupt_frame *, Integer );
+ PRINT_IT( "FP_CONTEXT_OFFSET", CPU_Interrupt_frame *, Floating_Point );
+ size = sizeof( CPU_Interrupt_frame );
+
+ if ( size % CPU_STACK_ALIGNMENT )
+ size += CPU_STACK_ALIGNMENT - (size % CPU_STACK_ALIGNMENT);
+
+ printf( "#define\tCPU_INTERRUPT_FRAME_SIZE\t%d\t\t/* 0x%x */\n", size, size );
+
+#else
+
+ print_information();
+
+#endif
+
+#undef PRINT_IT
+#undef PRINT_SIZE
+#undef PRINT_COMMENT
+
+ /*
+ * Print the end of file stuff
+ */
+
+ printf(
+ "\n"
+ "#endif /* __OFFSETS_h */\n"
+ "\n"
+ "/* end of include file */\n"
+ );
+
+ return 0;
+}
+
+void print_information( void )
+{
+
+#define PRINT_IT( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_SIZE( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+/*
+ * Offsets of elements in the Context_control structure.
+ */
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_IT( "FLAGS_OFFSET", 0x00 );
+ PRINT_IT( "R1_OFFSET", 0x04 );
+ PRINT_IT( "R2_OFFSET", 0x08 );
+ PRINT_IT( "R3_OFFSET", 0x0c );
+ PRINT_IT( "R4_OFFSET", 0x00 );
+ PRINT_IT( "R5_OFFSET", 0x14 );
+ PRINT_IT( "R6_OFFSET", 0x18 );
+ PRINT_IT( "R7_OFFSET", 0x1c );
+ PRINT_IT( "R8_OFFSET", 0x20 );
+ PRINT_IT( "R9_OFFSET", 0x24 );
+ PRINT_IT( "R10_OFFSET", 0x28 );
+ PRINT_IT( "R11_OFFSET", 0x2c );
+ PRINT_IT( "R12_OFFSET", 0x30 );
+ PRINT_IT( "R13_OFFSET", 0x34 );
+ PRINT_IT( "R14_OFFSET", 0x38 );
+ PRINT_IT( "R15_OFFSET", 0x3c );
+ PRINT_IT( "R16_OFFSET", 0x40 );
+ PRINT_IT( "R17_OFFSET", 0x44 );
+ PRINT_IT( "R18_OFFSET", 0x48 );
+ PRINT_IT( "R19_OFFSET", 0x4c );
+ PRINT_IT( "R20_OFFSET", 0x50 );
+ PRINT_IT( "R21_OFFSET", 0x54 );
+ PRINT_IT( "R22_OFFSET", 0x58 );
+ PRINT_IT( "R23_OFFSET", 0x5c );
+ PRINT_IT( "R24_OFFSET", 0x60 );
+ PRINT_IT( "R25_OFFSET", 0x64 );
+ PRINT_IT( "R26_OFFSET", 0x68 );
+ PRINT_IT( "R27_OFFSET", 0x6c );
+ PRINT_IT( "R28_OFFSET", 0x70 );
+ PRINT_IT( "R29_OFFSET", 0x74 );
+ PRINT_IT( "R30_OFFSET", 0x78 );
+ PRINT_IT( "R31_OFFSET", 0x7c );
+
+ /*
+ * And common aliases for the above
+ */
+
+ PRINT_COMMENT("Common aliases for above");
+
+ PRINT_IT( "RP_OFFSET", 0x08 );
+ PRINT_IT( "ARG3_OFFSET", 0x5c );
+ PRINT_IT( "ARG2_OFFSET", 0x60 );
+ PRINT_IT( "ARG1_OFFSET", 0x64 );
+ PRINT_IT( "ARG0_OFFSET", 0x68 );
+ PRINT_IT( "SP_OFFSET", 0x78 );
+ PRINT_IT( "DP_OFFSET", 0x6c );
+ PRINT_IT( "RET0_OFFSET", 0x74 );
+ PRINT_IT( "RET1_OFFSET", 0x74 );
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE", 168 );
+
+ PRINT_COMMENT("Context_Control_fp information");
+
+ PRINT_SIZE("CPU_CONTEXT_FP_SIZE", 256);
+
+ /*
+ * And the control registers
+ */
+
+ PRINT_COMMENT("Control register portion of context");
+
+ PRINT_IT( "SAR_OFFSET", 0x80 );
+ PRINT_IT( "IPSW_OFFSET", 0x84 );
+ PRINT_IT( "IIR_OFFSET", 0x88 );
+ PRINT_IT( "IOR_OFFSET", 0x8c );
+ PRINT_IT( "ISR_OFFSET", 0x90 );
+ PRINT_IT( "PCOQFRONT_OFFSET", 0x94 );
+ PRINT_IT( "PCOQBACK_OFFSET", 0x98 );
+ PRINT_IT( "PCSQFRONT_OFFSET", 0x9c );
+ PRINT_IT( "PCSQBACK_OFFSET", 0xa0 );
+ PRINT_IT( "ITIMER_OFFSET", 0xa4 );
+
+ /*
+ * Full interrupt frame (integer + float)
+ */
+
+ PRINT_COMMENT("Interrupt frame information");
+
+ PRINT_IT( "INTEGER_CONTEXT_OFFSET", 0x00 );
+ PRINT_IT( "FP_CONTEXT_OFFSET", 0xa8 );
+ PRINT_SIZE( "CPU_INTERRUPT_FRAME_SIZE", 448 );
+
+}
diff --git a/tools/cpu/unix/gensize.c b/tools/cpu/unix/gensize.c
new file mode 100644
index 0000000000..0466d67b09
--- /dev/null
+++ b/tools/cpu/unix/gensize.c
@@ -0,0 +1,116 @@
+/*
+ * gensize.c
+ *
+ * This file generates the file unixsize.h
+ *
+ * NOTE: It only prints the minimal information required.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+/*
+ * This feels like a very crude way to determine if we are on a Solaris
+ * host but it does work.
+ */
+
+#if defined(__sun__) && defined(__sparc__) && \
+ defined(__unix__) && defined(__svr4__)
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+#include <setjmp.h>
+#include <signal.h>
+
+typedef struct {
+ jmp_buf regs;
+ sigset_t isr_level;
+} Context_Control;
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ Context_Control *cc = 0;
+
+ /*
+ * Print the file header
+ */
+
+printf(
+ "/* unixsize.h\n"
+ " *\n"
+ " * This include file contans the size of the context control block\n"
+ " * C data structure. This structure must be defined in such a way\n"
+ " * that files NOT including the native header files can work.\n"
+ " *\n"
+ " * NOTE: THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
+ " * DO NOT EDIT THIS BY HAND!!!!\n"
+ " *\n"
+ " * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
+ " * On-Line Applications Research Corporation (OAR).\n"
+ " * All rights assigned to U.S. Government, 1994.\n"
+ " *\n"
+ " * This material may be reproduced by or for the U.S. Government pursuant\n"
+ " * to the copyright license under the clause at DFARS 252.227-7013. This\n"
+ " * notice must appear in all copies of this file and its derivatives.\n"
+ " */\n"
+ "\n"
+ "#ifndef __UNIXSIZE_h\n"
+ "#define __UNIXSIZE_h\n"
+ "\n"
+);
+
+#define PRINT_IT( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_SIZE( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE_IN_BYTES", sizeof( Context_Control ) );
+ PRINT_SIZE("CPU_CONTEXT_REGISTERS_OFFSET_IN_BYTES", (int) &cc->regs );
+ PRINT_SIZE("CPU_CONTEXT_SIGNALS_OFFSET_IN_BYTES", (int) &cc->isr_level );
+
+ /*
+ * Print the end of file stuff
+ */
+
+ printf(
+ "\n"
+ "#endif /* __UNIXSIZE_h */\n"
+ "\n"
+ "/* end of include file */\n"
+ );
+
+ return 0;
+}
+
diff --git a/tools/update/310_to_320_list b/tools/update/310_to_320_list
new file mode 100644
index 0000000000..b4add28685
--- /dev/null
+++ b/tools/update/310_to_320_list
@@ -0,0 +1,543 @@
+#
+# External API name
+#
+initialize_executive rtems_initialize_executive
+initialize_executive_early rtems_initialize_executive_early
+initialize_executive_late rtems_initialize_executive_late
+shutdown_executive rtems_shutdown_executive
+task_create rtems_task_create
+task_ident rtems_task_ident
+task_start rtems_task_start
+task_restart rtems_task_restart
+task_delete rtems_task_delete
+task_suspend rtems_task_suspend
+task_resume rtems_task_resume
+task_set_priority rtems_task_set_priority
+task_mode rtems_task_mode
+task_get_note rtems_task_get_note
+task_set_note rtems_task_set_note
+task_wake_after rtems_task_wake_after
+task_wake_when rtems_task_wake_when
+interrupt_catch rtems_interrupt_catch
+clock_set rtems_clock_set
+clock_get rtems_clock_get
+clock_tick rtems_clock_tick
+extension_create rtems_extension_create
+extension_ident rtems_extension_ident
+extension_delete rtems_extension_delete
+timer_create rtems_timer_create
+timer_ident rtems_timer_ident
+timer_cancel rtems_timer_cancel
+timer_delete rtems_timer_delete
+timer_fire_after rtems_timer_fire_after
+timer_fire_when rtems_timer_fire_when
+timer_reset rtems_timer_reset
+semaphore_create rtems_semaphore_create
+semaphore_ident rtems_semaphore_ident
+semaphore_delete rtems_semaphore_delete
+semaphore_obtain rtems_semaphore_obtain
+semaphore_release rtems_semaphore_release
+message_queue_create rtems_message_queue_create
+message_queue_ident rtems_message_queue_ident
+message_queue_delete rtems_message_queue_delete
+message_queue_send rtems_message_queue_send
+message_queue_urgent rtems_message_queue_urgent
+message_queue_broadcast rtems_message_queue_broadcast
+message_queue_receive rtems_message_queue_receive
+message_queue_flush rtems_message_queue_flush
+event_send rtems_event_send
+event_receive rtems_event_receive
+signal_catch rtems_signal_catch
+signal_send rtems_signal_send
+partition_create rtems_partition_create
+partition_ident rtems_partition_ident
+partition_delete rtems_partition_delete
+partition_get_buffer rtems_partition_get_buffer
+partition_return_buffer rtems_partition_return_buffer
+region_create rtems_region_create
+region_extend rtems_region_extend
+region_ident rtems_region_ident
+region_delete rtems_region_delete
+region_get_segment rtems_region_get_segment
+region_get_segment_size rtems_region_get_segment_size
+region_return_segment rtems_region_return_segment
+port_create rtems_port_create
+port_ident rtems_port_ident
+port_delete rtems_port_delete
+port_external_to_internal rtems_port_external_to_internal
+port_internal_to_external rtems_port_internal_to_external
+io_initialize rtems_io_initialize
+io_open rtems_io_open
+io_close rtems_io_close
+io_read rtems_io_read
+io_write rtems_io_write
+io_control rtems_io_control
+fatal_error_occurred rtems_fatal_error_occurred
+rate_monotonic_create rtems_rate_monotonic_create
+rate_monotonic_ident rtems_rate_monotonic_ident
+rate_monotonic_delete rtems_rate_monotonic_delete
+rate_monotonic_cancel rtems_rate_monotonic_cancel
+rate_monotonic_period rtems_rate_monotonic_period
+multiprocessing_announce rtems_multiprocessing_announce
+#
+# Internal Names for API
+#
+_Initialize_Executive rtems_initialize_executive
+_Initialize_Executive_early rtems_initialize_executive_early
+_Initialize_Executive_late rtems_initialize_executive_late
+_Shutdown_Executive rtems_shutdown_executive
+_RTEMS_tasks_Create rtems_task_create
+_RTEMS_tasks_Name_to_id rtems_task_ident
+_RTEMS_tasks_Start rtems_task_start
+_RTEMS_tasks_Restart rtems_task_restart
+_RTEMS_tasks_Delete rtems_task_delete
+_RTEMS_tasks_Suspend rtems_task_suspend
+_RTEMS_tasks_Resume rtems_task_resume
+_RTEMS_tasks_Set_priority rtems_task_set_priority
+_RTEMS_tasks_Mode rtems_task_mode
+_RTEMS_tasks_Get_note rtems_task_get_note
+_RTEMS_tasks_Set_note rtems_task_set_note
+_RTEMS_tasks_Wake_after rtems_task_wake_after
+_RTEMS_tasks_Wake_when rtems_task_wake_when
+_Interrupt_Catch rtems_interrupt_catch
+_Clock_Set rtems_clock_set
+_Clock_Get rtems_clock_get
+_Clock_Tick rtems_clock_tick
+_Extension_Create rtems_extension_create
+_Extension_Name_to_id rtems_extension_ident
+_Extension_Delete rtems_extension_delete
+_Timer_Create rtems_timer_create
+_Timer_Name_to_id rtems_timer_ident
+_Timer_Cancel rtems_timer_cancel
+_Timer_Delete rtems_timer_delete
+_Timer_Fire_after rtems_timer_fire_after
+_Timer_Fire_when rtems_timer_fire_when
+_Timer_Reset rtems_timer_reset
+_Semaphore_Create rtems_semaphore_create
+_Semaphore_Name_to_id rtems_semaphore_ident
+_Semaphore_Delete rtems_semaphore_delete
+_Semaphore_Obtain rtems_semaphore_obtain
+_Semaphore_Release rtems_semaphore_release
+_Message_queue_Create rtems_message_queue_create
+_Message_queue_Name_to_id rtems_message_queue_ident
+_Message_queue_Delete rtems_message_queue_delete
+_Message_queue_Send rtems_message_queue_send
+_Message_queue_Urgent rtems_message_queue_urgent
+_Message_queue_Broadcast rtems_message_queue_broadcast
+_Message_queue_Receive rtems_message_queue_receive
+_Message_queue_Flush rtems_message_queue_flush
+_Event_Send rtems_event_send
+_Event_Receive rtems_event_receive
+_Signal_Catch rtems_signal_catch
+_Signal_Send rtems_signal_send
+_Partition_Create rtems_partition_create
+_Partition_Name_to_id rtems_partition_ident
+_Partition_Delete rtems_partition_delete
+_Partition_Get_buffer rtems_partition_get_buffer
+_Partition_Return_buffer rtems_partition_return_buffer
+_Region_Create rtems_region_create
+_Region_Extend rtems_region_extend
+_Region_Name_to_id rtems_region_ident
+_Region_Delete rtems_region_delete
+_Region_Get_segment rtems_region_get_segment
+_Region_Get_segment_size rtems_region_get_segment_size
+_Region_Return_segment rtems_region_return_segment
+_Dual_ported_memory_Create rtems_port_create
+_Dual_ported_memory_Name_to_id rtems_port_ident
+_Dual_ported_memory_Delete rtems_port_delete
+_Dual_ported_memory_External_to_internal rtems_port_external_to_internal
+_Dual_ported_memory_Internal_to_external rtems_port_internal_to_external
+_IO_Initialize rtems_io_initialize
+_IO_Open rtems_io_open
+_IO_Close rtems_io_close
+_IO_Read rtems_io_read
+_IO_Write rtems_io_write
+_IO_Control rtems_io_control
+_Fatal_Error_occurred rtems_fatal_error_occurred
+_Rate_monotonic_Create rtems_rate_monotonic_create
+_Rate_monotonic_Name_to_id rtems_rate_monotonic_ident
+_Rate_monotonic_Delete rtems_rate_monotonic_delete
+_Rate_monotonic_Cancel rtems_rate_monotonic_cancel
+_Rate_monotonic_Period rtems_rate_monotonic_period
+_Multiprocessing_Announce rtems_multiprocessing_announce
+#
+# Status (API names)
+#
+SUCCESSFUL RTEMS_SUCCESSFUL
+TASK_EXITTED RTEMS_TASK_EXITTED
+MP_NOT_CONFIGURED RTEMS_MP_NOT_CONFIGURED
+INVALID_NAME RTEMS_INVALID_NAME
+INVALID_ID RTEMS_INVALID_ID
+TOO_MANY RTEMS_TOO_MANY
+TIMEOUT RTEMS_TIMEOUT
+OBJECT_WAS_DELETED RTEMS_OBJECT_WAS_DELETED
+INVALID_SIZE RTEMS_INVALID_SIZE
+INVALID_ADDRESS RTEMS_INVALID_ADDRESS
+INVALID_NUMBER RTEMS_INVALID_NUMBER
+NOT_DEFINED RTEMS_NOT_DEFINED
+RESOURCE_IN_USE RTEMS_RESOURCE_IN_USE
+UNSATISFIED RTEMS_UNSATISFIED
+INCORRECT_STATE RTEMS_INCORRECT_STATE
+ALREADY_SUSPENDED RTEMS_ALREADY_SUSPENDED
+ILLEGAL_ON_SELF RTEMS_ILLEGAL_ON_SELF
+ILLEGAL_ON_REMOTE_OBJECT RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+CALLED_FROM_ISR RTEMS_CALLED_FROM_ISR
+INVALID_PRIORITY RTEMS_INVALID_PRIORITY
+INVALID_CLOCK RTEMS_INVALID_CLOCK
+INVALID_NODE RTEMS_INVALID_NODE
+NOT_CONFIGURED RTEMS_NOT_CONFIGURED
+NOT_OWNER_OF_RESOURCE RTEMS_NOT_OWNER_OF_RESOURCE
+NOT_IMPLEMENTED RTEMS_NOT_IMPLEMENTED
+INTERNAL_ERROR RTEMS_INTERNAL_ERROR
+PROXY_BLOCKING RTEMS_PROXY_BLOCKING
+NO_MEMORY RTEMS_NO_MEMORY
+STATUS_CODES_FIRST RTEMS_STATUS_CODES_FIRST
+STATUS_CODES_LAST RTEMS_STATUS_CODES_LAST
+#
+# Status (Internal names)
+#
+STATUS_SUCCESSFUL RTEMS_SUCCESSFUL
+STATUS_TASK_EXITTED RTEMS_TASK_EXITTED
+STATUS_MP_NOT_CONFIGURED RTEMS_MP_NOT_CONFIGURED
+STATUS_INVALID_NAME RTEMS_INVALID_NAME
+STATUS_INVALID_ID RTEMS_INVALID_ID
+STATUS_TOO_MANY RTEMS_TOO_MANY
+STATUS_TIMEOUT RTEMS_TIMEOUT
+STATUS_OBJECT_WAS_DELETED RTEMS_OBJECT_WAS_DELETED
+STATUS_INVALID_SIZE RTEMS_INVALID_SIZE
+STATUS_INVALID_ADDRESS RTEMS_INVALID_ADDRESS
+STATUS_INVALID_NUMBER RTEMS_INVALID_NUMBER
+STATUS_NOT_DEFINED RTEMS_NOT_DEFINED
+STATUS_RESOURCE_IN_USE RTEMS_RESOURCE_IN_USE
+STATUS_UNSATISFIED RTEMS_UNSATISFIED
+STATUS_INCORRECT_STATE RTEMS_INCORRECT_STATE
+STATUS_ALREADY_SUSPENDED RTEMS_ALREADY_SUSPENDED
+STATUS_ILLEGAL_ON_SELF RTEMS_ILLEGAL_ON_SELF
+STATUS_ILLEGAL_ON_REMOTE_OBJECT RTEMS_ILLEGAL_ON_REMOTE_OBJECT
+STATUS_CALLED_FROM_ISR RTEMS_CALLED_FROM_ISR
+STATUS_INVALID_PRIORITY RTEMS_INVALID_PRIORITY
+STATUS_INVALID_CLOCK RTEMS_INVALID_CLOCK
+STATUS_INVALID_NODE RTEMS_INVALID_NODE
+STATUS_NOT_CONFIGURED RTEMS_NOT_CONFIGURED
+STATUS_NOT_OWNER_OF_RESOURCE RTEMS_NOT_OWNER_OF_RESOURCE
+STATUS_NOT_IMPLEMENTED RTEMS_NOT_IMPLEMENTED
+STATUS_INTERNAL_ERROR RTEMS_INTERNAL_ERROR
+STATUS_PROXY_BLOCKING RTEMS_PROXY_BLOCKING
+STATUS_NO_MEMORY RTEMS_NO_MEMORY
+#
+# Attributes (External)
+#
+DEFAULT_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+NO_FLOATING_POINT RTEMS_NO_FLOATING_POINT
+FLOATING_POINT RTEMS_FLOATING_POINT
+LOCAL RTEMS_LOCAL
+GLOBAL RTEMS_GLOBAL
+FIFO RTEMS_FIFO
+PRIORITY RTEMS_PRIORITY
+NO_LIMIT RTEMS_NO_LIMIT
+LIMIT RTEMS_LIMIT
+COUNTING_SEMAPHORE RTEMS_COUNTING_SEMAPHORE
+BINARY_SEMAPHORE RTEMS_BINARY_SEMAPHORE
+NO_INHERIT_PRIORITY RTEMS_NO_INHERIT_PRIORITY
+INHERIT_PRIORITY RTEMS_INHERIT_PRIORITY
+#
+# Attributes (Internal)
+#
+ATTRIBUTES_DEFAULTS RTEMS_DEFAULT_ATTRIBUTES
+ATTRIBUTES_NO_FLOATING_POINT RTEMS_NO_FLOATING_POINT
+ATTRIBUTES_FLOATING_POINT RTEMS_FLOATING_POINT
+ATTRIBUTES_LOCAL RTEMS_LOCAL
+ATTRIBUTES_GLOBAL RTEMS_GLOBAL
+ATTRIBUTES_FIFO RTEMS_FIFO
+ATTRIBUTES_PRIORITY RTEMS_PRIORITY
+ATTRIBUTES_NO_LIMIT RTEMS_NO_LIMIT
+ATTRIBUTES_LIMIT RTEMS_LIMIT
+ATTRIBUTES_COUNTING_SEMAPHORE RTEMS_COUNTING_SEMAPHORE
+ATTRIBUTES_BINARY_SEMAPHORE RTEMS_BINARY_SEMAPHORE
+ATTRIBUTES_NO_INHERIT_PRIORITY RTEMS_NO_INHERIT_PRIORITY
+ATTRIBUTES_INHERIT_PRIORITY RTEMS_INHERIT_PRIORITY
+#
+# Options (External)
+#
+DEFAULT_OPTIONS RTEMS_DEFAULT_OPTIONS
+WAIT RTEMS_WAIT
+NO_WAIT RTEMS_NO_WAIT
+EVENT_ALL RTEMS_EVENT_ALL
+EVENT_ANY RTEMS_EVENT_ANY
+#
+# Options (Internal)
+#
+OPTIONS_DEFAULT RTEMS_DEFAULT_OPTIONS
+OPTIONS_WAIT RTEMS_WAIT
+OPTIONS_NO_WAIT RTEMS_NO_WAIT
+OPTIONS_EVENT_ALL RTEMS_EVENT_ALL
+OPTIONS_EVENT_ANY RTEMS_EVENT_ANY
+#
+# Masks (External)
+#
+ALL_MODE_MASKS RTEMS_ALL_MODE_MASKS
+PREEMPT_MASK RTEMS_PREEMPT_MASK
+TIMESLICE_MASK RTEMS_TIMESLICE_MASK
+ASR_MASK RTEMS_ASR_MASK
+INTERRUPT_MASK RTEMS_INTERRUPT_MASK
+#
+# Masks (Internal)
+#
+MODES_ALL_MASK RTEMS_ALL_MODE_MASKS
+MODES_PREEMPT_MASK RTEMS_PREEMPT_MASK
+MODES_TIMESLICE_MASK RTEMS_TIMESLICE_MASK
+MODES_ASR_MASK RTEMS_ASR_MASK
+MODES_INTERRUPT_MASK RTEMS_INTERRUPT_MASK
+#
+# Modes (Internal)
+#
+MODES_DEFAULTS RTEMS_DEFAULT_MODES
+MODES_PREEMPT RTEMS_PREEMPT
+MODES_NO_PREEMPT RTEMS_NO_PREEMPT
+MODES_NO_TIMESLICE RTEMS_NO_TIMESLICE
+MODES_TIMESLICE RTEMS_TIMESLICE
+MODES_ASR RTEMS_ASR
+MODES_NO_ASR RTEMS_NO_ASR
+_Modes_Interrupt_level RTEMS_INTERRUPT_LEVEL
+#
+# Modes (External)
+#
+DEFAULT_MODES RTEMS_DEFAULT_MODES
+PREEMPT RTEMS_PREEMPT
+NO_PREEMPT RTEMS_NO_PREEMPT
+NO_TIMESLICE RTEMS_NO_TIMESLICE
+TIMESLICE RTEMS_TIMESLICE
+ASR RTEMS_ASR
+NO_ASR RTEMS_NO_ASR
+INTERRUPT_LEVEL RTEMS_INTERRUPT_LEVEL
+#
+# Identification (External)
+#
+SEARCH_ALL_NODES RTEMS_SEARCH_ALL_NODES
+SEARCH_OTHER_NODES RTEMS_SEARCH_OTHER_NODES
+SEARCH_LOCAL_NODE RTEMS_SEARCH_LOCAL_NODE
+WHO_AM_I RTEMS_WHO_AM_I
+#
+# Identification (Internal)
+#
+OBJECTS_SEARCH_ALL_NODES RTEMS_SEARCH_ALL_NODES
+OBJECTS_SEARCH_OTHER_NODES RTEMS_SEARCH_OTHER_NODES
+OBJECTS_SEARCH_LOCAL_NODE RTEMS_SEARCH_LOCAL_NODE
+OBJECTS_WHO_AM_I RTEMS_WHO_AM_I
+#
+# Miscellaneous (External API)
+#
+CURRENT_MODE RTEMS_CURRENT_MODE
+CURRENT_PRIORITY RTEMS_CURRENT_PRIORITY
+PENDING_EVENTS RTEMS_PENDING_EVENTS
+NO_TIMEOUT RTEMS_NO_TIMEOUT
+SELF RTEMS_SELF
+PERIOD_STATUS RTEMS_PERIOD_STATUS
+YIELD_PROCESSOR RTEMS_YIELD_PROCESSOR
+MINIMUM_PRIORITY RTEMS_MINIMUM_PRIORITY
+MAXIMUM_PRIORITY RTEMS_MAXIMUM_PRIORITY
+MINIMUM_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE
+#
+# Miscellaneous (External API)
+#
+MODES_CURRENT RTEMS_CURRENT_MODE
+PRIORITY_CURRENT RTEMS_CURRENT_PRIORITY
+#
+# Events
+#
+ALL_EVENTS RTEMS_ALL_EVENTS
+EVENT_0 RTEMS_EVENT_0
+EVENT_1 RTEMS_EVENT_1
+EVENT_2 RTEMS_EVENT_2
+EVENT_3 RTEMS_EVENT_3
+EVENT_4 RTEMS_EVENT_4
+EVENT_5 RTEMS_EVENT_5
+EVENT_6 RTEMS_EVENT_6
+EVENT_7 RTEMS_EVENT_7
+EVENT_8 RTEMS_EVENT_8
+EVENT_9 RTEMS_EVENT_9
+EVENT_10 RTEMS_EVENT_10
+EVENT_11 RTEMS_EVENT_11
+EVENT_12 RTEMS_EVENT_12
+EVENT_13 RTEMS_EVENT_13
+EVENT_14 RTEMS_EVENT_14
+EVENT_15 RTEMS_EVENT_15
+EVENT_16 RTEMS_EVENT_16
+EVENT_17 RTEMS_EVENT_17
+EVENT_18 RTEMS_EVENT_18
+EVENT_19 RTEMS_EVENT_19
+EVENT_20 RTEMS_EVENT_20
+EVENT_21 RTEMS_EVENT_21
+EVENT_22 RTEMS_EVENT_22
+EVENT_23 RTEMS_EVENT_23
+EVENT_24 RTEMS_EVENT_24
+EVENT_25 RTEMS_EVENT_25
+EVENT_26 RTEMS_EVENT_26
+EVENT_27 RTEMS_EVENT_27
+EVENT_28 RTEMS_EVENT_28
+EVENT_29 RTEMS_EVENT_29
+EVENT_30 RTEMS_EVENT_30
+EVENT_31 RTEMS_EVENT_31
+#
+# Signals
+#
+SIGNAL_0 RTEMS_SIGNAL_0
+SIGNAL_1 RTEMS_SIGNAL_1
+SIGNAL_2 RTEMS_SIGNAL_2
+SIGNAL_3 RTEMS_SIGNAL_3
+SIGNAL_4 RTEMS_SIGNAL_4
+SIGNAL_5 RTEMS_SIGNAL_5
+SIGNAL_6 RTEMS_SIGNAL_6
+SIGNAL_7 RTEMS_SIGNAL_7
+SIGNAL_8 RTEMS_SIGNAL_8
+SIGNAL_9 RTEMS_SIGNAL_9
+SIGNAL_10 RTEMS_SIGNAL_10
+SIGNAL_11 RTEMS_SIGNAL_11
+SIGNAL_12 RTEMS_SIGNAL_12
+SIGNAL_13 RTEMS_SIGNAL_13
+SIGNAL_14 RTEMS_SIGNAL_14
+SIGNAL_15 RTEMS_SIGNAL_15
+SIGNAL_16 RTEMS_SIGNAL_16
+SIGNAL_17 RTEMS_SIGNAL_17
+SIGNAL_18 RTEMS_SIGNAL_18
+SIGNAL_19 RTEMS_SIGNAL_19
+SIGNAL_20 RTEMS_SIGNAL_20
+SIGNAL_21 RTEMS_SIGNAL_21
+SIGNAL_22 RTEMS_SIGNAL_22
+SIGNAL_23 RTEMS_SIGNAL_23
+SIGNAL_24 RTEMS_SIGNAL_24
+SIGNAL_25 RTEMS_SIGNAL_25
+SIGNAL_26 RTEMS_SIGNAL_26
+SIGNAL_27 RTEMS_SIGNAL_27
+SIGNAL_28 RTEMS_SIGNAL_28
+SIGNAL_29 RTEMS_SIGNAL_29
+SIGNAL_30 RTEMS_SIGNAL_30
+SIGNAL_31 RTEMS_SIGNAL_31
+#
+# Notepads
+#
+NOTEPAD_FIRST RTEMS_NOTEPAD_FIRST
+NOTEPAD_0 RTEMS_NOTEPAD_0
+NOTEPAD_1 RTEMS_NOTEPAD_1
+NOTEPAD_2 RTEMS_NOTEPAD_2
+NOTEPAD_3 RTEMS_NOTEPAD_3
+NOTEPAD_4 RTEMS_NOTEPAD_4
+NOTEPAD_5 RTEMS_NOTEPAD_5
+NOTEPAD_6 RTEMS_NOTEPAD_6
+NOTEPAD_7 RTEMS_NOTEPAD_7
+NOTEPAD_8 RTEMS_NOTEPAD_8
+NOTEPAD_9 RTEMS_NOTEPAD_9
+NOTEPAD_10 RTEMS_NOTEPAD_10
+NOTEPAD_11 RTEMS_NOTEPAD_11
+NOTEPAD_12 RTEMS_NOTEPAD_12
+NOTEPAD_13 RTEMS_NOTEPAD_13
+NOTEPAD_14 RTEMS_NOTEPAD_14
+NOTEPAD_15 RTEMS_NOTEPAD_15
+NOTEPAD_LAST RTEMS_NOTEPAD_LAST
+#
+# Multiprocessing
+#
+MIN_PKTSIZE RTEMS_MINIMUM_PACKET_SIZE
+MIN_HETERO_CONV RTEMS_MINIMUN_HETERO_CONVERSION
+#
+# Name and ID External
+#
+get_node rtems_get_node
+get_index rtems_get_index
+build_name rtems_build_name
+name_to_characters rtems_name_to_characters
+#
+# Name and ID Internal
+#
+_Objects_Get_node rtems_get_node
+_Objects_Get_index rtems_get_index
+_Objects_Build_name rtems_build_name
+_Objects_Name_to_characters rtems_name_to_characters
+#
+# clock_get
+#
+CLOCK_GET_TOD RTEMS_CLOCK_GET_TOD
+CLOCK_GET_SECONDS_SINCE_EPOCH RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH
+CLOCK_GET_TICKS_SINCE_BOOT RTEMS_CLOCK_GET_TICKS_SINCE_BOOT
+CLOCK_GET_TICKS_PER_SECOND RTEMS_CLOCK_GET_TICKS_PER_SECOND
+CLOCK_GET_TIME_VALUE RTEMS_CLOCK_GET_TIME_VALUE
+#
+# Status Code Support Routines (External) -- NO CHANGES
+#
+#
+# Status Code Support Routines (Internal)
+#
+_Status_Is_successful rtems_is_status_successful
+_Status_Is_equal rtems_are_statuses_equal
+#
+# Time Conversion Support Routines (External) -- NO CHANGES
+#
+#
+# Time Conversion Support Routines (Internal)
+#
+_TOD_Milliseconds_to_microseconds RTEMS_MILLISECONDS_TO_MICROSECONDS
+_TOD_Milliseconds_to_ticks RTEMS_MILLISECONDS_TO_MICROSECONDS
+#
+# MP packet
+#
+MP_PACKET_INTERNAL_THREADS RTEMS_MP_PACKET_INTERNAL_THREADS
+MP_PACKET_RTEMS_TASKS RTEMS_MP_PACKET_TASKS
+MP_PACKET_MESSAGE_QUEUE RTEMS_MP_PACKET_MESSAGE_QUEUE
+MP_PACKET_SEMAPHORE RTEMS_MP_PACKET_SEMAPHORE
+MP_PACKET_PARTITION RTEMS_MP_PACKET_PARTITION
+MP_PACKET_REGION RTEMS_MP_PACKET_REGION
+MP_PACKET_EVENT RTEMS_MP_PACKET_EVENT
+MP_PACKET_SIGNAL RTEMS_MP_PACKET_SIGNAL
+#
+#
+#
+IO_Major_control rtems_device_major_number
+IO_Minor_control rtems_device_minor_number
+#
+# Configuration Info
+#
+Configuration_Table rtems_configuration_table
+Configuration_Initialization_tasks_table rtems_initialization_tasks_table
+Configuration_Driver_address_table rtems_driver_address_table
+Configuration_Extension_table rtems_extensions_table
+rtems_tasks_create_extension rtems_task_create_extension
+rtems_tasks_start_extension rtems_task_start_extension
+rtems_tasks_restart_extension rtems_task_restart_extension
+rtems_tasks_delete_extension rtems_task_delete_extension
+rtems_tasks_switch_extension rtems_task_switch_extension
+rtems_tasks_begin_extension rtems_task_begin_extension
+rtems_tasks_exitted_extension rtems_task_exitted_extension
+rtems_fatal_extension rtems_fatal_extension
+Configuration_MPCI_table rtems_mpci_table
+Configuration_Multiprocessing_table rtems_multiprocessing_table
+CPU_Table rtems_cpu_table
+#
+Clock_Get_options rtems_clock_get_options
+Clock_Time_value rtems_clock_time_value
+MP_packet_Prefix rtems_packet_prefix
+MP_packet_Classes rtems_mp_packet_classes
+TOD_Control rtems_time_of_day
+ISR_Vector rtems_vector_number
+Watchdog_Interval rtems_interval
+Watchdog_Service rtems_timer_service_routine_entry
+Attributes_Control rtems_attribute
+Modes_Control rtems_mode
+Options_Control rtems_option
+Priority_Control rtems_task_priority
+PRIORITY_MINIMUM RTEMS_MINIMUM_PRIORITY
+PRIORITY_MAXIMUM RTEMS_MAXIMUM_PRIORITY
+Event_sets_Control rtems_event_set
+ASR_Signal_set_control rtems_signal_set
+Status_Codes rtems_status_code
+RTEMS_TASKS_YIELD_PROCESSOR RTEMS_YIELD_PROCESSOR
+RATE_MONOTONIC_PERIOD_STATUS RTEMS_PERIOD_STATUS
+WATCHDOG_FOREVER RTEMS_NO_TIMEOUT
+STACK_MINIMUM_SIZE RTEMS_MINIMUM_STACK_SIZE
+#
+ASR_Handler rtems_asr_entry
+Thread_Entry rtems_task_entry
+#
+disable_intr rtems_interrupt_disable
+enable_intr rtems_interrupt_enable
+flash_intr rtems_interrupt_flash
+
diff --git a/tools/update/README b/tools/update/README
new file mode 100644
index 0000000000..bbf99cb71d
--- /dev/null
+++ b/tools/update/README
@@ -0,0 +1,7 @@
+#
+# $Id$
+#
+
+This directory contains tools which aid in upgrading from RTEMS 3.1.0
+to RTEMS 3.2.0.
+